private void makeActionOverflowMenuShown() { //devices with hardware menu button (e.g. Samsung Note) don't show action overflow menu try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception e) { Log.d(TAG, e.getLocalizedMessage()); } }
@Override public void stop(StopContext context) { if (this.stopper != null) { try { this.stopper.accept(context); } catch (RuntimeException | Error e) { LOGGER.warn(e.getLocalizedMessage(), e); } } }
@Override public void stop(StopContext context) { try { this.destroyer.accept(this.value); } catch (RuntimeException | Error e) { LOGGER.warn(e.getLocalizedMessage(), e); } finally { this.value = null; } } }
@Override public void stop(StopContext context) { if (this.destroyer != null) { try { this.destroyer.accept(context, this.value); } catch (RuntimeException | Error e) { LOGGER.warn(e.getLocalizedMessage(), e); } finally { this.value = null; } } } }
@Override public String toString() { String msg = getLocalizedMessage(); String name = getClass().getName(); if (msg == null) { return name; } return name + ": " + msg; }
@Override public String getLocalizedMessage() { StringBuilder sb = new StringBuilder(); for (Throwable e : list) sb.append(e.getLocalizedMessage()).append('\n'); return sb.toString(); }
/** * Called when a pattern cannot be compiled or some other error occurs; resets gui to valid state. * Thread safe. * * @param txt Error message text (friendly text appropriate for users) * @param e The exception that caused the problem */ public void doError(final String txt, final Throwable e) { SwingUtilities.invokeLater(() -> { String extraData = e.getLocalizedMessage() != null ? e.getLocalizedMessage(): (e.getClass() != null) ? e.getClass().toString(): ""; JOptionPane.showMessageDialog(InputPanel.this, txt + '\n' + extraData, "Tregex Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); // send to stderr for debugging useProgressBar(false); updateFoundStats(null, 0, 0); }); }
private Camera openFrontFacingCameraGingerbread() { int cameraCount = 0; Camera cam = null; Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); cameraCount = Camera.getNumberOfCameras(); for (int camIdx = 0; camIdx < cameraCount; camIdx++) { Camera.getCameraInfo(camIdx, cameraInfo); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { try { cam = Camera.open(camIdx); } catch (RuntimeException e) { Log.e(TAG, "Camera failed to open: " + e.getLocalizedMessage()); } } } return cam; }
@Override public void handle(Event event, Throwable cause) throws EventDeliveryException { LOG.error("Event delivery failed: " + cause.getLocalizedMessage()); LOG.debug("Exception follows.", cause); throw new EventDeliveryException(cause); }
public static ExecuteResult createError(Throwable throwable) { Preconditions.checkArgument(throwable != null, "throwable cannot be null"); return new ExecuteResult(State.ERROR, throwable.getLocalizedMessage(), throwable); }
public void onError( Throwable t ) { SpoonFactory.getInstance().messageBox( t.getLocalizedMessage(), resourceBundle.getString( "RepositoryConfigDialog.InitializationFailed" ), false, Const.ERROR ); //$NON-NLS-1$ log.error( resourceBundle.getString( "RepositoryConfigDialog.ErrorStartingXulApplication" ), t );//$NON-NLS-1$ }
static OperationFailedException createOperationFailure(final Throwable cause) { final String msg = cause.getLocalizedMessage(); // OperationFailedException's don't log the cause, for debug purposes logging the failure could be useful BatchLogger.LOGGER.debugf(cause, "Failed to process batch operation: %s", msg); return new OperationFailedException(msg, cause); }
@Override public void run() { try { this.listener.membershipChanged(this.oldMembership, this.membership, this.merged); } catch (Throwable e) { ClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } } }
public void onError( XulComponent sender, Throwable t ) { log.logDetailed( BaseMessages.getString( PKG, "RepositoryLogin.UnableToDeleteRepository", t .getLocalizedMessage() ) ); new ErrorDialog( shell, BaseMessages.getString( PKG, "Dialog.Error" ), BaseMessages.getString( PKG, "RepositoryLogin.UnableToDeleteRepository", t.getLocalizedMessage() ), t ); } } );
@Override public TryResult call() throws Exception { TryResult r; try { r = javaEvaluator.executeTask(new JavaCodeRunner(javaEvaluator, j.outputObject, j), j.getExecutionOptions()); } catch (Throwable e) { e.printStackTrace(); r = TryResult.createError(e.getLocalizedMessage()); } return r; } }
@Override public TryResult call() { TryResult r; try { j.outputObject.started(); r = clojureEvaluator.executeTask(new ClojureCodeRunner(clojureEvaluator, j.codeToBeExecuted, j.outputObject), j.getExecutionOptions()); } catch (Throwable e) { logger.error(e.getMessage()); r = TryResult.createError(e.getLocalizedMessage()); } return r; }
@Override public void accept(Collection<T> services, Throwable exception) { if (services != null) { try (Batch batch = CacheServiceProviderRegistry.this.batcher.createBatch()) { for (T service : services) { CacheServiceProviderRegistry.this.register(joinedMember, service); } } } else if (exception != null) { ClusteringServerLogger.ROOT_LOGGER.warn(exception.getLocalizedMessage(), exception); } } };
public void onError( XulComponent sender, Throwable t ) { if ( mainController == null || !mainController.handleLostRepository( t ) ) { messageBox.setTitle( BaseMessages.getString( PKG, "Dialog.Error" ) );//$NON-NLS-1$ messageBox.setAcceptLabel( BaseMessages.getString( PKG, "Dialog.Ok" ) );//$NON-NLS-1$ messageBox .setMessage( BaseMessages.getString( PKG, "RemoveRole.UnableToRemoveRole", t.getLocalizedMessage() ) );//$NON-NLS-1$ messageBox.open(); } } } );
public void onError( XulComponent sender, Throwable t ) { if ( mainController == null || !mainController.handleLostRepository( t ) ) { messageBox.setTitle( BaseMessages.getString( PKG, "Dialog.Error" ) ); messageBox.setAcceptLabel( BaseMessages.getString( PKG, "Dialog.Ok" ) ); messageBox.setMessage( BaseMessages.getString( PKG, "RemoveUser.UnableToRemoveUser", t .getLocalizedMessage() ) ); messageBox.open(); } } } );
private void onLoginError( Throwable t ) { if ( t instanceof KettleAuthException ) { ShowMessageDialog dialog = new ShowMessageDialog( loginDialog.getShell(), SWT.OK | SWT.ICON_ERROR, BaseMessages.getString( PKG, "Spoon.Dialog.LoginFailed.Title" ), t.getLocalizedMessage() ); dialog.open(); } else { new ErrorDialog( loginDialog.getShell(), BaseMessages.getString( PKG, "Spoon.Dialog.LoginFailed.Title" ), BaseMessages .getString( PKG, "Spoon.Dialog.LoginFailed.Message", t ), t ); } }