List of usage examples for java.lang Exception getLocalizedMessage
public String getLocalizedMessage()
From source file:org.craftercms.social.util.web.RestMappingExceptionResolver.java
@Override protected ModelAndView getModelAndView(String viewName, Exception ex) { ModelAndView mv = new ModelAndView(viewName); HashMap<String, Object> map = new HashMap<>(); map.put("message", ex.getMessage()); map.put("localizedMessage", ex.getLocalizedMessage()); mv.addAllObjects(map);/*from ww w . j a v a2 s. c o m*/ return mv; }
From source file:com.amazonaws.mturk.cmd.RejectQualificationRequests.java
private void rejectQualRequests(String[] qualReqs, String[] comments) { // If we're not given anything, just no-op if (qualReqs == null) { return;// www .ja v a 2 s .c om } checkIsUserCertain( "You are about to reject " + qualReqs.length + " qualification request(s). Are you sure?"); String comment = null; if (comments == null) { comment = getComment(); } for (int i = 0; qualReqs != null && i < qualReqs.length; i++) { try { if (comments != null) comment = comments[i]; service.rejectQualificationRequest(qualReqs[i], comment); log.info("[" + qualReqs[i] + "] Qualification request successfully rejected " + (comment != null ? " with comment (" + comment + ")" : "")); } catch (Exception e) { log.error("Error rejecting qualification request " + qualReqs[i] + " with comment [" + comment + "]: " + e.getLocalizedMessage(), e); } } }
From source file:fr.sanofi.fcl4transmart.controllers.listeners.geneExpression.SetStudyTreeListener.java
@Override public void handleEvent(Event event) { // TODO Auto-generated method stub File file = new File(this.dataType.getPath().toString() + File.separator + this.dataType.getStudy().toString() + ".subject_mapping.tmp"); File stsmf = ((GeneExpressionData) this.dataType).getStsmf(); if (stsmf == null) { this.setStudyTreeUI.displayMessage("Error: no subject to sample mapping file"); }/*ww w . j a va 2s.c o m*/ String category = ""; TreeNode node = this.setStudyTreeUI.getRoot(); if (!node.hasChildren()) { this.setStudyTreeUI.displayMessage("You have to set a category code"); return; } node = node.getChildren().get(0); while (node != null) { if (category.compareTo("") == 0) { category += node.toString().replace(' ', '_'); } else { category += "+" + node.toString().replace(' ', '_'); } if (node.hasChildren()) { node = node.getChildren().get(0); } else { node = null; } } try { FileWriter fw = new FileWriter(file); BufferedWriter out = new BufferedWriter(fw); out.write( "study_id\tsite_id\tsubject_id\tSAMPLE_ID\tPLATFORM\tTISSUETYPE\tATTR1\tATTR2\tcategory_cd\n"); try { BufferedReader br = new BufferedReader(new FileReader(stsmf)); String line = br.readLine(); while ((line = br.readLine()) != null) { String[] fields = line.split("\t", -1); out.write(fields[0] + "\t" + fields[1] + "\t" + fields[2] + "\t" + fields[3] + "\t" + fields[4] + "\t" + fields[5] + "\t" + fields[6] + "\t" + fields[7] + "\t" + category + "\n"); } br.close(); } catch (Exception e) { this.setStudyTreeUI.displayMessage("File error: " + e.getLocalizedMessage()); out.close(); e.printStackTrace(); } out.close(); try { File fileDest; if (stsmf != null) { String fileName = stsmf.getName(); stsmf.delete(); fileDest = new File(this.dataType.getPath() + File.separator + fileName); } else { fileDest = new File(this.dataType.getPath() + File.separator + this.dataType.getStudy().toString() + ".subject_mapping"); } FileUtils.moveFile(file, fileDest); ((GeneExpressionData) this.dataType).setSTSMF(fileDest); } catch (IOException ioe) { this.setStudyTreeUI.displayMessage("File error: " + ioe.getLocalizedMessage()); return; } } catch (Exception e) { this.setStudyTreeUI.displayMessage("Eerror: " + e.getLocalizedMessage()); e.printStackTrace(); } this.setStudyTreeUI.displayMessage("Subject to sample mapping file updated"); WorkPart.updateSteps(); WorkPart.updateFiles(); }
From source file:com.flagleader.builder.FlagLeader.java
public void checkUpdate() { if (BuilderConfig.getInstance().getUpdateUrl().length() > 0) try {//from w ww . j av a 2 s. c o m StringBuffer localStringBuffer = new StringBuffer(); JspUtil.readUrl(BuilderConfig.getInstance().getUpdateUrl(), localStringBuffer); } catch (Exception localException) { Logger.getLogger("flagleader").log(Level.WARNING, localException.getLocalizedMessage()); } }
From source file:com.netease.hearttouch.hthotfix.patch.PatchSoHelper.java
private void makePatchDir(File dexFile, String patchDirPath, ArrayList<File> soFiles) { try {//from w w w . jav a 2 s .c o m File dirFile = new File(patchDirPath + "libs"); if (!dirFile.exists()) { dirFile.mkdirs(); } //copy classes.dex to ../hotfix/patch/ if (dexFile.exists()) { InputStream in = new FileInputStream(dexFile); OutputStream out = new FileOutputStream(patchDirPath + Constants.HOTFIX_PATCH_DEX_NAME); FileUtil.copyFile(in, out); in.close(); out.close(); } //copy .so for (File file : soFiles) { InputStream soIn = new FileInputStream(file); OutputStream soOut = new FileOutputStream(new File(dirFile.getAbsoluteFile(), file.getName())); FileUtil.copyFile(soIn, soOut); soIn.close(); soOut.close(); } } catch (Exception e) { project.getLogger().error(e.getLocalizedMessage()); e.printStackTrace(); } }
From source file:it.geosolutions.figis.ws.test.CheckChangeUserTest.java
/** * Create or modified test file/* www . j a v a2s . c o m*/ * * @param useracProptestFile * @param userRoleAdminPwd * @throws IOException */ public void modifyUseracTestFile(String useracProptestFile, String userRoleAdminPwd) throws IOException { FileWriter fstream = null; BufferedWriter out = null; try { // Create file java.net.URL url = this.getClass().getClassLoader().getResource(useracProptestFile); fstream = new FileWriter(url.toURI().toURL().getPath()); out = new BufferedWriter(fstream); out.write(TO_TEST_PROPERTIES_FILE + "\n"); out.write(TO_TEST_PERIOD + "\n"); out.write(userRoleAdminPwd + "\n"); out.write(TO_TEST_USERS_ROLE_USER + "\n"); out.flush(); } catch (Exception e) // Catch exception if any { LOGGER.error(e.getLocalizedMessage(), e); } finally { // Close the output stream if (fstream != null) { IOUtils.closeQuietly(fstream); } if (out != null) { IOUtils.closeQuietly(out); } } }
From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.FetchReservationsToDate.java
/** * Clears adapter of current data and fills it with fetched reservations. * In process it clears details fragment, so it could not display information about no longer existing reservation. * * @param resultList fetched reservations *//*from www.j av a2 s . c o m*/ @Override protected void onPostExecute(List<Reservation> resultList) { reservationAdapter.clear(); if (resultList != null && !resultList.isEmpty()) { for (Reservation reservation : resultList) { try { reservationAdapter.add(reservation); } catch (Exception e) { setState(ERROR, e); Log.e(TAG, e.getLocalizedMessage(), e); } } } FragmentManager fm = activity.getFragmentManager(); ReservationDetailsFragment details = new ReservationDetailsFragment(); ReservationDetailsFragment frag = (ReservationDetailsFragment) fm .findFragmentByTag(ReservationDetailsFragment.TAG); if (frag != null) { FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.details, details, ReservationDetailsFragment.TAG); ft.commit(); } }
From source file:edu.isi.misd.scanner.network.registry.web.controller.BaseController.java
@ExceptionHandler({ ConflictException.class, DataIntegrityViolationException.class }) @ResponseBody//ww w . ja v a 2s .co m @ResponseStatus(value = HttpStatus.CONFLICT) public ErrorMessage handleConflictException(Exception e) { return new ErrorMessage(HttpStatus.CONFLICT.value(), HttpStatus.CONFLICT.getReasonPhrase(), e.getLocalizedMessage()); }
From source file:jahirfiquitiva.iconshowcase.services.MuzeiArtSourceService.java
@Override protected void onTryUpdate(int reason) throws RetryException { if (mPrefs.areFeaturesEnabled()) { try {// ww w . ja va2 s . c o m new DownloadJSONAndSetWall(getApplicationContext()).execute(); } catch (Exception e) { Utils.showLog("Error updating Muzei: " + e.getLocalizedMessage()); throw new RetryException(); } } }
From source file:com.kylinolap.job.hadoop.cube.StorageCleanupJob.java
@Override public int run(String[] args) throws Exception { Options options = new Options(); try {// ww w . j a v a2 s.c om options.addOption(OPTION_DELETE); parseOptions(options, args); delete = Boolean.parseBoolean(getOptionValue(OPTION_DELETE)); Configuration conf = HBaseConfiguration.create(getConf()); cleanUnusedHdfsFiles(conf); cleanUnusedHBaseTables(conf); cleanUnusedIntermediateHiveTable(conf); return 0; } catch (Exception e) { e.printStackTrace(System.err); log.error(e.getLocalizedMessage(), e); return 2; } }