java.lang.Exception.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(414)

本文整理了Java中java.lang.Exception.getLocalizedMessage()方法的一些代码示例,展示了Exception.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Exception.getLocalizedMessage()方法的具体详情如下:
包路径:java.lang.Exception
类名称:Exception
方法名:getLocalizedMessage

Exception.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: javaee-samples/javaee7-samples

@Override
  public void onReadError(Exception ex) throws Exception {
    BatchListenerRecorder.batchListenersCountDownLatch.countDown();
    System.out.println("MyItemReadListener.onReadError: " + ex.getLocalizedMessage());
  }
}

代码示例来源:origin: javaee-samples/javaee7-samples

@Override
  public void onProcessError(Object item, Exception ex) throws Exception {
    BatchListenerRecorder.batchListenersCountDownLatch.countDown();
    System.out.println("MyItemProcessorListener.onProcessError: " + item + ", " + ex.getLocalizedMessage());
  }
}

代码示例来源:origin: javaee-samples/javaee7-samples

@Override
  public void onWriteError(List items, Exception ex) throws Exception {
    BatchListenerRecorder.batchListenersCountDownLatch.countDown();
    System.out.println("MyItemWriteListener.onError: " + items + ", " + ex.getLocalizedMessage());
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void update( ChangedFlagInterface o, Object arg ) {
 try {
  Method m = getClass().getMethod( arg.toString() );
  if ( m != null ) {
   m.invoke( this );
  }
 } catch ( Exception e ) {
  // ignore... let the other notifiers try to do something
  System.out.println( "Unable to update: " + e.getLocalizedMessage() );
 }
}

代码示例来源:origin: redisson/redisson

/**
 * This method should be overridden for TypeDescription implementations that are supposed to implement
 * instantiation logic that is different from default one as implemented in YAML constructors.
 * Note that even if you override this method, default filling of fields with
 * variables from parsed YAML will still occur later.
 * @param node - node to construct the instance from
 * @return new instance
 */
public Object newInstance(Node node) {
  if (impl != null) {
    try {
      java.lang.reflect.Constructor<?> c = impl.getDeclaredConstructor();
      c.setAccessible(true);
      return c.newInstance();
    } catch (Exception e) {
      log.fine(e.getLocalizedMessage());
      impl = null;
    }
  }
  return null;
}

代码示例来源:origin: pentaho/pentaho-kettle

public static KeyPair generateKeyPair() {
 KeyPair pair = null;
 try {
  KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance( PUBLIC_KEY_ALGORITHM );
  keyPairGen.initialize( KEY_SIZE );
  pair = keyPairGen.generateKeyPair();
 } catch ( Exception ex ) {
  log.logError( ex.getLocalizedMessage(), ex );
 }
 return pair;
}

代码示例来源:origin: pentaho/pentaho-kettle

public static byte[] decryptUsingKey( byte[] data, Key key ) {
  byte[] result = null;
  try {
   Cipher cipher = Cipher.getInstance( PUBLIC_KEY_ALGORITHM );
   cipher.init( Cipher.DECRYPT_MODE, key );
   result = cipher.doFinal( data );
  } catch ( Exception ex ) {
   log.logError( ex.getLocalizedMessage(), ex );
  }
  return result;
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public static byte[] encryptUsingKey( byte[] data, Key key ) {
 byte[] result = null;
 try {
  Cipher cipher = Cipher.getInstance( PUBLIC_KEY_ALGORITHM );
  cipher.init( Cipher.ENCRYPT_MODE, key );
  result = cipher.doFinal( data );
 } catch ( Exception ex ) {
  log.logError( ex.getLocalizedMessage(), ex );
 }
 return result;
}

代码示例来源:origin: pentaho/pentaho-kettle

public static void addExceptionRemark( CheckResultSourceInterface source, String propertyName,
 String validatorName, List<CheckResultInterface> remarks, Exception e ) {
 String key = "messages.failed.unableToValidate";
 remarks.add( new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, ValidatorMessages.getString(
  key, propertyName, e.getClass().getSimpleName() + ": " + e.getLocalizedMessage() ), source ) );
}

代码示例来源:origin: jersey/jersey

@SuppressWarnings("unchecked")
@Override
public T next() {
  final Class<T> nextClass = (Class<T>) it.next();
  try {
    return nextClass.newInstance();
  } catch (final Exception ex) {
    final ServiceConfigurationError sce = new ServiceConfigurationError(serviceName + ": "
        + LocalizationMessages.PROVIDER_COULD_NOT_BE_CREATED(
        nextClass.getName(), serviceClass, ex.getLocalizedMessage()));
    sce.initCause(ex);
    throw sce;
  }
}

代码示例来源:origin: jersey/jersey

@SuppressWarnings("unchecked")
@Override
public T next() {
  final Class<T> nextClass = (Class<T>) it.next();
  try {
    return nextClass.newInstance();
  } catch (final Exception ex) {
    final ServiceConfigurationError sce = new ServiceConfigurationError(serviceName + ": "
        + LocalizationMessages.PROVIDER_COULD_NOT_BE_CREATED(
        nextClass.getName(), serviceClass, ex.getLocalizedMessage()));
    sce.initCause(ex);
    throw sce;
  }
}

代码示例来源:origin: apache/kylin

@RequestMapping(value = "/{projectName}", method = { RequestMethod.DELETE }, produces = { "application/json" })
@ResponseBody
public void deleteProject(@PathVariable String projectName) {
  try {
    ProjectInstance project = projectService.getProjectManager().getProject(projectName);
    projectService.deleteProject(projectName, project);
  } catch (Exception e) {
    logger.error(e.getLocalizedMessage(), e);
    throw new InternalErrorException("Failed to delete project. " + " Caused by: " + e.getMessage(), e);
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

public static void invokeCallbackWithException(
  FacebookCallback<Sharer.Result> callback,
  final Exception exception) {
  if (exception instanceof FacebookException) {
    invokeOnErrorCallback(callback, (FacebookException) exception);
    return;
  }
  invokeCallbackWithError(
    callback,
    "Error preparing share content: " + exception.getLocalizedMessage());
}

代码示例来源:origin: pentaho/pentaho-kettle

public void dispose( StepMetaInterface smi, StepDataInterface sdi ) {
  meta = (ElasticSearchBulkMeta) smi;
  data = (ElasticSearchBulkData) sdi;
  try {
   disposeClient();
  } catch ( Exception e ) {
   logError( e.getLocalizedMessage(), e );
  }
  super.dispose( smi, sdi );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private void writeData() {
  try {
   input.writeData();
  } catch ( Exception e ) {
   log.logDetailed( BaseMessages.getString( PKG, "RepositoryLogin.ErrorSavingRepositoryDefinition", e
    .getLocalizedMessage() ) );
   new ErrorDialog( shell, BaseMessages.getString( PKG, "Dialog.Error" ), BaseMessages.getString(
    PKG, "RepositoryLogin.ErrorSavingRepositoryDefinition", e.getLocalizedMessage() ), e );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void onClose( XulComponent sender, Status returnCode, Object retVal ) {
 if ( returnCode == Status.ACCEPT ) {
  try {
   ( (UIEERepositoryDirectory) repoObject ).delete( true );
  } catch ( Exception e ) {
   if ( mainController == null || !mainController.handleLostRepository( e ) ) {
    displayExceptionMessage( BaseMessages.getString( PKG, e.getLocalizedMessage() ) );
   }
  }
 }
}

代码示例来源:origin: wildfly/wildfly

private void logException(String msg, Exception e) {
  if (log.isDebugEnabled()) {
    log.debug(msg, e);
  } else if (log.isWarnEnabled()) {
    log.warn("%s. Error is %s", msg, e.getLocalizedMessage());
  }
}

代码示例来源:origin: wildfly/wildfly

public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    final String attributeName = operation.require(NAME).asString();
    final ServiceController<?> managementRepoService = context.getServiceRegistry(false).getService(
        ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE);
    if (managementRepoService != null) {
      try {
        setModelValue(context.getResult(), attributeName);
      } catch (Exception e) {
        throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToGetMetrics(e.getLocalizedMessage()));
      }
    }
  }
}, OperationContext.Stage.RUNTIME);

代码示例来源:origin: wildfly/wildfly

@Override
  public void accept(JChannel channel) {
    channel.disconnect();

    if (this.server != null) {
      try {
        JmxConfigurator.unregisterChannel(channel, this.server.get(), this.name);
      } catch (Exception e) {
        JGroupsLogger.ROOT_LOGGER.debug(e.getLocalizedMessage(), e);
      }
    }

    channel.close();
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void deleteUsers( List<IUser> users ) throws KettleException {
 ensureHasPermissions();
 try {
  userRoleWebService.deleteUsers( UserRoleHelper.convertToPentahoProxyUsers( users ) );
  lookupCache.removeUsersFromLookupSet( users );
  fireUserRoleListChange();
 } catch ( Exception e ) {
  throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,
    "UserRoleDelegate.ERROR_0003_UNABLE_TO_DELETE_USERS", e.getLocalizedMessage() ), e ); //$NON-NLS-1$
 }
}

相关文章