List of usage examples for java.lang Throwable getLocalizedMessage
public String getLocalizedMessage()
From source file:org.jtrfp.trcl.flow.GameShell.java
private void throwable2StringBuilder(Throwable e, StringBuilder sb) { assert e != null; assert sb != null; sb.append(e.getClass().getName() + " " + e.getLocalizedMessage() + "\n"); final StackTraceElement[] stackTraceElements = e.getStackTrace(); for (StackTraceElement ste : stackTraceElements) sb.append("\tat " + ste.getClassName() + "." + ste.getMethodName() + "(" + ste.getFileName() + ":" + ste.getLineNumber() + ")\n"); }
From source file:com.harsh.androidclientphpbackend.fragment.ProfileFragment.java
private void changePasswordProcess(String email, String old_password, String new_password) { Retrofit retrofit = new Retrofit.Builder().baseUrl(Util.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); ApiInterface apiInterface = retrofit.create(ApiInterface.class); User user = new User(); user.setEmail(email);//from www . j a va 2 s .c o m user.setOld_password(old_password); user.setNew_password(new_password); ApiRequest request = new ApiRequest(); request.setOperation(Util.CHANGE_PASSWORD_OPERATION); request.setUser(user); Call<ApiResponse> response = apiInterface.operation(request); response.enqueue(new Callback<ApiResponse>() { @Override public void onResponse(Call<ApiResponse> call, retrofit2.Response<ApiResponse> response) { ApiResponse resp = response.body(); if (resp.getResult().equals(Util.SUCCESS)) { progress.setVisibility(View.GONE); tv_message.setVisibility(View.GONE); dialog.dismiss(); Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show(); Util.hideSoftKeyboard(getActivity()); } else { progress.setVisibility(View.GONE); tv_message.setVisibility(View.VISIBLE); tv_message.setText(resp.getMessage()); Util.hideSoftKeyboard(getActivity()); } } @SuppressLint("LongLogTag") @Override public void onFailure(Call<ApiResponse> call, Throwable t) { Log.d(Util.TAG, "failed"); progress.setVisibility(View.GONE); tv_message.setVisibility(View.VISIBLE); tv_message.setText(t.getLocalizedMessage()); Util.hideSoftKeyboard(getActivity()); } }); }
From source file:com.chessix.vas.web.AccountController.java
@RequestMapping(value = "/{clasId}/range/from/{start}/count/{count}", method = RequestMethod.POST) public DeferredResult<Object> createAccounts(@PathVariable final String clasId, @PathVariable final String start, @PathVariable final String count) { log.info("createAccounts({},{},{})", clasId, start, count); final ActorRef clas = clasService.getClas(clasId); final DeferredResult<Object> deferredResult = new DeferredResult<Object>(); final int countValue = Integer.parseInt(count); if (countValue > MAX_ACCOUNTS_IN_BATCH) { deferredResult// w ww. j a va2s . c o m .setErrorResult(String.format("count %s is to large (> %d)", count, MAX_ACCOUNTS_IN_BATCH)); return deferredResult; } if (clas != null) { final List<AccountCreated> results = Collections.synchronizedList(new LinkedList<AccountCreated>()); final AtomicInteger resultsCounter = new AtomicInteger(0); for (int i = Integer.parseInt(start); i < Integer.parseInt(start) + countValue; i++) { final String accountId = Integer.toString(i); log.debug("createAccounts() : create {}", accountId); final Future<Object> future = Patterns.ask(clas, new CreateAccount.RequestBuilder(clasId).accountId(accountId).build(), timeout * countValue); future.onSuccess(new OnSuccess<Object>() { @Override public void onSuccess(final Object result) { log.info("createAccount({}) : result: {}", clasId, result); final CreateAccount.Response response = (CreateAccount.Response) result; results.add(new AccountCreated(clasId, response.getAccountId(), true, String.format("Account %s created", accountId))); // check if all values are received if (resultsCounter.incrementAndGet() >= countValue) { deferredResult.setResult(results); } } }, system.dispatcher()); future.onFailure(new OnFailure() { @Override public void onFailure(final Throwable arg) throws Throwable { log.error("onFailure", arg); deferredResult .setErrorResult(new AccountCreated(clasId, null, false, arg.getLocalizedMessage())); } }, system.dispatcher()); } } else { deferredResult.setErrorResult(new AccountCreated(clasId, null, false, "CLAS does not exist")); } return deferredResult; }
From source file:com.kii.sample.hellothingif.CommandFragment.java
@OnClick(R.id.buttonRefresh) void onRefreshState() { ProgressDialogFragment.show(getActivity(), getFragmentManager(), R.string.progress_receive_state); PromiseAPIWrapper api = new PromiseAPIWrapper(mAdm, mApi); mAdm.when(api.getTargetState()).then(new DoneCallback<LEDState>() { @SuppressLint("SetTextI18n") @Override//from ww w .j a v a 2s. c om public void onDone(LEDState state) { if (getActivity() == null) { return; } ProgressDialogFragment.close(getFragmentManager()); if (state.power) { mTextViewStatePower.setText("Power: ON"); } else { mTextViewStatePower.setText("Power: OFF"); } mTextViewStateBrightness.setText("Brightness: " + state.brightness); mTextViewStateMotion.setText("Motion: " + state.motion); showToast("The state has been refreshed."); } }).fail(new FailCallback<Throwable>() { @Override public void onFail(final Throwable tr) { ProgressDialogFragment.close(getFragmentManager()); showToast("Failed to receive the state: " + tr.getLocalizedMessage()); } }); }
From source file:org.geoserver.config.hibernate.HibGeoServerLoader.java
protected void initialize() { LOGGER.warning("Initializing " + this.getClass().getSimpleName()); GeoServerInfo global = geoserver.getGlobal(); if (global == null) { global = HibDefaultsFactoryImpl.createDefaultGeoServer(geoserver); HibDefaultsFactoryImpl.createDefaultServices(geoserver, global); HibDefaultsFactoryImpl.createDefaultXXXXspace(geoserver); initializeStyles(catalog);/* w w w . ja va2s. c o m*/ } else { JAIInfo jai = global.getJAI(); // we are missing the JAI info. This can be due by the fact that previous // run was made by a unit test if (jai == null) { LOGGER.warning("Global is missing JAI info. Setting default ones..."); global.setJAI(geoserver.getFactory().createJAI()); geoserver.setGlobal(global); } WMSInfo wms = geoserver.getService(WMSInfo.class); if (wms == null) { LOGGER.warning("Missing WMS service. Creating default one."); HibDefaultsFactoryImpl.createWMS(global, geoserver); } WCSInfo wcs = geoserver.getService(WCSInfo.class); if (wcs == null) { LOGGER.warning("Missing WCS service. Creating default one."); HibDefaultsFactoryImpl.createWCS(global, geoserver); } WFSInfo wfs = geoserver.getService(WFSInfo.class); if (wfs == null) { LOGGER.warning("Missing WFS service. Creating default one."); HibDefaultsFactoryImpl.createWFS(global, geoserver); } } // LOGGING LoggingInfo loggingInfo = geoserver.getLogging(); if (loggingInfo == null) { LOGGER.warning("Missing logging info. Creating default."); loggingInfo = this.geoserver.getFactory().createLogging(); geoserver.setLogging(loggingInfo); } Catalog catalog = geoserver.getCatalog(); catalog.setResourceLoader(resourceLoader); if (catalog instanceof Wrapper && ((Wrapper) catalog).isWrapperFor(Catalog.class)) { catalog = ((Wrapper) catalog).unwrap(Catalog.class); } if (geoserver.getGlobal().getMetadata() != null) { for (String key : geoserver.getGlobal().getMetadata().keySet()) { System.out.println("--- METADATA KEY: " + key); } } // load initializer extensions List<GeoServerInitializer> initializers = GeoServerExtensions.extensions(GeoServerInitializer.class); for (GeoServerInitializer initer : initializers) { try { initer.initialize(geoserver); } catch (Throwable t) { LOGGER.log(Level.WARNING, t.getLocalizedMessage(), t); } } // load listeners // List<CatalogListener> catalogListeners = GeoServerExtensions.extensions( // CatalogListener.class ); // for ( CatalogListener l : catalogListeners ) { // catalog.addListener( l ); // } // List<ConfigurationListener> configListeners = GeoServerExtensions.extensions( // ConfigurationListener.class ); // for ( ConfigurationListener l : configListeners ) { // geoserver.addListener( l ); // } }
From source file:org.opencms.i18n.CmsVfsBundleManager.java
/** * @see org.opencms.main.I_CmsEventListener#cmsEvent(org.opencms.main.CmsEvent) *///from w w w. ja va 2 s . com public void cmsEvent(CmsEvent event) { // wrap in try-catch so that errors don't affect other handlers try { handleEvent(event); } catch (Throwable t) { LOG.error(t.getLocalizedMessage(), t); } }
From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java
/** * Clears the offline caches.<p>/*from w w w .ja v a 2 s. co m*/ */ protected void offlineCacheClear() { for (CachePair cachePair : m_caches) { try { cachePair.getOfflineCache().clear(); } catch (Throwable t) { LOG.error(t.getLocalizedMessage(), t); } } }
From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java
/** * Removes a resource from the offline caches.<p> * * @param resource the resource to remove *//* w ww.j a v a2 s. c o m*/ protected void offlineCacheRemove(CmsPublishedResource resource) { for (CachePair cachePair : m_caches) { try { cachePair.getOfflineCache().remove(resource); } catch (Throwable e) { LOG.error(e.getLocalizedMessage()); } } }
From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java
/** * Removes a resource from the offline caches.<p> * * @param resource the resource to remove *//*from www. j a va 2s .co m*/ protected void offlineCacheRemove(CmsResource resource) { for (CachePair cachePair : m_caches) { try { cachePair.getOfflineCache().remove(resource); } catch (Throwable e) { LOG.error(e.getLocalizedMessage()); } } }
From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java
/** * Clears the online caches.<p>/*w w w.ja va2 s . c o m*/ */ protected void onlineCacheClear() { for (CachePair cachePair : m_caches) { try { cachePair.getOnlineCache().clear(); } catch (Throwable e) { LOG.error(e.getLocalizedMessage(), e); } } }