@Override public void onReadError(Exception ex) throws Exception { BatchListenerRecorder.batchListenersCountDownLatch.countDown(); System.out.println("MyItemReadListener.onReadError: " + ex.getLocalizedMessage()); } }
@Override public void onProcessError(Object item, Exception ex) throws Exception { BatchListenerRecorder.batchListenersCountDownLatch.countDown(); System.out.println("MyItemProcessorListener.onProcessError: " + item + ", " + ex.getLocalizedMessage()); } }
@Override public void onWriteError(List items, Exception ex) throws Exception { BatchListenerRecorder.batchListenersCountDownLatch.countDown(); System.out.println("MyItemWriteListener.onError: " + items + ", " + ex.getLocalizedMessage()); } }
@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() ); } }
/** * 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; }
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; }
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; } }
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; }
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 ) ); }
@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; } }
@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; } }
@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); } }
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()); }
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 ); } }
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 ); } } }
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() ) ); } } } }
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()); } }
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);
@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(); } }
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$ } }