List of usage examples for java.lang Exception getLocalizedMessage
public String getLocalizedMessage()
From source file:com.mc.printer.model.layout.ws.WebSender.java
public <T extends Object> T postForObject(String url, Object request, Class<T> responseType) throws RestClientException { try {// ww w . j ava 2 s . c o m T obj = super.postForObject(url, request, responseType); ; return obj; } catch (Exception e) { throw new RestClientException("" + e.getLocalizedMessage()); } }
From source file:org.openmrs.module.providermanagement.fragment.controller.ProviderSuggestionFormFragmentController.java
public FragmentActionResult deleteProviderSuggestion( @RequestParam(value = "providerSuggestion", required = true) ProviderSuggestion providerSuggestion) { try {/*from w ww . ja va 2 s .c o m*/ Context.getService(ProviderSuggestionService.class).purgeProviderSuggestion(providerSuggestion); return new SuccessResult(); } catch (Exception e) { return new FailureResult(e.getLocalizedMessage()); } }
From source file:org.openmrs.module.providermanagement.fragment.controller.ProviderSuggestionFormFragmentController.java
public FragmentActionResult retireProviderSuggestion( @RequestParam(value = "providerSuggestion", required = true) ProviderSuggestion providerSuggestion) { try {//from w w w .j a va 2 s . co m Context.getService(ProviderSuggestionService.class).retireProviderSuggestion(providerSuggestion, "retired via provider management ui"); return new SuccessResult(); } catch (Exception e) { return new FailureResult(e.getLocalizedMessage()); } }
From source file:com.kylinolap.job.cmd.JavaHadoopCmd.java
@Override public ICommandOutput execute() throws JobException { output.appendOutput("Start to execute command: \n" + this.executeCommand); String[] args = executeCommand.trim().split("\\s+"); try {/*from w w w . j a v a 2s .com*/ output.setStatus(JobStepStatusEnum.RUNNING); int exitCode = ToolRunner.run(job, args); output.setExitCode(exitCode); } catch (Exception e) { output.appendOutput(e.getLocalizedMessage()); output.setExitCode(-1); } final String errorLog = job.getErrorLog(); if (!StringUtils.isEmpty(errorLog)) { output.appendOutput(errorLog); } output.appendOutput("Command execute return code " + output.getExitCode()); if (output.getExitCode() != 0) { output.setStatus(JobStepStatusEnum.ERROR); } return output; }
From source file:org.openmrs.module.providermanagement.fragment.controller.ProviderSuggestionFormFragmentController.java
public FragmentActionResult saveProviderSuggestion(@BindParams() ProviderSuggestion suggestion) { // TODO: (PROV-12) add validation to check to make sure criteria is valid Groovy code // hard code the evaluator to the groovy evaluator since this is the only type we currently support suggestion.setEvaluator("org.openmrs.module.providermanagement.suggestion.GroovySuggestionEvaluator"); try {//from w w w .ja v a2 s .c o m Context.getService(ProviderSuggestionService.class).saveProviderSuggestion(suggestion); return new SuccessResult(); } catch (Exception e) { return new FailureResult(e.getLocalizedMessage()); } }
From source file:de.chaosdorf.meteroid.longrunningio.LongRunningIOGet.java
@Override protected String doInBackground(Void... params) { HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpGet httpGet = new HttpGet(url); try {// w w w.j a v a2 s . c o m HttpResponse response = httpClient.execute(httpGet, localContext); int code = response.getStatusLine().getStatusCode(); if (code >= 400 && code <= 599) { callback.displayErrorMessage(id, response.getStatusLine().getReasonPhrase()); return null; } HttpEntity entity = response.getEntity(); return EntityUtils.toString(entity, HTTP.UTF_8); } catch (Exception e) { callback.displayErrorMessage(id, e.getLocalizedMessage()); return null; } }
From source file:com.facebook.share.internal.ShareInternalUtility.java
public static void invokeCallbackWithException(FacebookCallback<Sharer.Result> callback, final Exception exception) { if (exception instanceof FacebookException) { invokeOnErrorCallback(callback, (FacebookException) exception); return;//from w ww. j ava 2 s . com } invokeCallbackWithError(callback, "Error preparing share content: " + exception.getLocalizedMessage()); }
From source file:org.openmrs.module.providermanagement.fragment.controller.SupervisionSuggestionFormFragmentController.java
public FragmentActionResult deleteSupervisionSuggestion( @RequestParam(value = "supervisionSuggestion", required = true) SupervisionSuggestion supervisionSuggestion) { try {// w ww .j a va 2 s . c o m Context.getService(ProviderSuggestionService.class).purgeSupervisionSuggestion(supervisionSuggestion); return new SuccessResult(); } catch (Exception e) { return new FailureResult(e.getLocalizedMessage()); } }
From source file:org.neo4j.ogm.drivers.http.transaction.HttpTransaction.java
@Override public void commit() { try {/* w w w . j a v a 2 s. c o m*/ if (transactionManager.canCommit()) { HttpPost request = new HttpPost(url + "/commit"); request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8")); request.setHeader(new BasicHeader("X-WRITE", driver.readOnly() ? "0" : "1")); driver.executeHttpRequest(request); } } catch (Exception e) { throw new TransactionException(e.getLocalizedMessage(), e); } finally { super.commit(); // must always be done to keep extension depth correct } }
From source file:com.kylinolap.job.hadoop.dict.CreateDictionaryJob.java
@Override public int run(String[] args) throws Exception { Options options = new Options(); try {//from www . j a v a2s . co m options.addOption(OPTION_CUBE_NAME); options.addOption(OPTION_SEGMENT_NAME); options.addOption(OPTION_INPUT_PATH); parseOptions(options, args); String cubeName = getOptionValue(OPTION_CUBE_NAME); String segmentName = getOptionValue(OPTION_SEGMENT_NAME); String factColumnsInputPath = getOptionValue(OPTION_INPUT_PATH); KylinConfig config = KylinConfig.getInstanceFromEnv(); DictionaryGeneratorCLI.processSegment(config, cubeName, segmentName, factColumnsInputPath); } catch (Exception e) { printUsage(options); e.printStackTrace(System.err); log.error(e.getLocalizedMessage(), e); returnCode = 2; } return returnCode; }