Source:
<code>public AskSecretManager(final RStudioAPIServerOperations server, EventBus eventBus, final GlobalDisplay globalDisplay, final Satellite satellite, final SatelliteManager satelliteManager, final DependencyManager dependencyManager) { eventBus.addHandler(AskSecretEvent.TYPE, new AskSecretEvent.Handler() { private boolean handleAskSecret(String targetWindow) { String window = StringUtil.notNull(satellite.getSatelliteName()); if (window.equals(targetWindow)) return true; if (!Satellite.isCurrentWindowSatellite() && !satelliteManager.satelliteWindowExists(targetWindow)) return true; else return false; } @Override public void onAskSecret(final AskSecretEvent e) { if (!handleAskSecret(e.getWindow())) return; asksecretPending_ = true; AskSecretDialog dialog = new AskSecretDialog( e.getTitle(), e.getPrompt(), e.getCanRemember(), e.getHasSecret(), dependencyManager, new ProgressOperationWithInput<AskSecretDialogResult>() { @Override public void execute(final AskSecretDialogResult result, final ProgressIndicator indicator) { asksecretPending_ = false; RSAEncrypt.encrypt_ServerOnly( server, result.getSecret(), new RSAEncrypt.ResponseCallback() { @Override public void onSuccess(String encryptedData) { server.askSecretCompleted( encryptedData, result.getRemember(), result.getHasChanged(), new VoidServerRequestCallback(indicator)); } @Override public void onFailure(ServerError error) { <START> Debug.logError(error); <END> } }); } }, new Operation() { @Override public void execute() { asksecretPending_ = false; server.askSecretCompleted( null, false, false, new SimpleRequestCallback<Void>()); } } ); dialog.showModal(); } }); Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent event) { if (asksecretPending_) { asksecretPending_ = false; server.askSecretCompleted( null, false, false, new SimpleRequestCallback<Void>()); } } }); }</code><technical_language>this is a waitformethod, I need invoke askSecretCompleted if error method complete server side</technical_language>

Target:
public AskSecretManager(final RStudioAPIServerOperations server, EventBus eventBus, final GlobalDisplay globalDisplay, final Satellite satellite, final SatelliteManager satelliteManager, final DependencyManager dependencyManager) { eventBus.addHandler(AskSecretEvent.TYPE, new AskSecretEvent.Handler() { private boolean handleAskSecret(String targetWindow) { String window = StringUtil.notNull(satellite.getSatelliteName()); if (window.equals(targetWindow)) return true; if (!Satellite.isCurrentWindowSatellite() && !satelliteManager.satelliteWindowExists(targetWindow)) return true; else return false; } @Override public void onAskSecret(final AskSecretEvent e) { if (!handleAskSecret(e.getWindow())) return; asksecretPending_ = true; AskSecretDialog dialog = new AskSecretDialog( e.getTitle(), e.getPrompt(), e.getCanRemember(), e.getHasSecret(), dependencyManager, new ProgressOperationWithInput<AskSecretDialogResult>() { @Override public void execute(final AskSecretDialogResult result, final ProgressIndicator indicator) { asksecretPending_ = false; RSAEncrypt.encrypt_ServerOnly( server, result.getSecret(), new RSAEncrypt.ResponseCallback() { @Override public void onSuccess(String encryptedData) { server.askSecretCompleted( encryptedData, result.getRemember(), result.getHasChanged(), new VoidServerRequestCallback(indicator)); } @Override public void onFailure(ServerError error) { Debug.logError(error); server.askSecretCompleted( null, false, false, new SimpleRequestCallback<Void>()); } }); } }, new Operation() { @Override public void execute() { asksecretPending_ = false; server.askSecretCompleted( null, false, false, new SimpleRequestCallback<Void>()); } } ); dialog.showModal(); } }); Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent event) { if (asksecretPending_) { asksecretPending_ = false; server.askSecretCompleted( null, false, false, new SimpleRequestCallback<Void>()); } } }); }