List of usage examples for java.lang Exception getLocalizedMessage
public String getLocalizedMessage()
From source file:fr.sanofi.fcl4transmart.controllers.listeners.geneExpression.SetPlatformsListener.java
@Override public void handleEvent(Event event) { // TODO Auto-generated method stub Vector<String> values = this.setPlatformsUI.getValues(); Vector<String> samples = this.setPlatformsUI.getSamples(); 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.setPlatformsUI.displayMessage("Error: no subject to sample mapping file"); }//w w w . j a v a 2 s .com 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); String sample = fields[3]; String platform; if (samples.contains(sample)) { platform = values.get(samples.indexOf(sample)); } else { br.close(); return; } out.write(fields[0] + "\t" + fields[1] + "\t" + fields[2] + "\t" + sample + "\t" + platform + "\t" + fields[5] + "\t" + fields[6] + "\t" + fields[7] + "\t" + fields[8] + "\n"); } br.close(); } catch (Exception e) { this.setPlatformsUI.displayMessage("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.setPlatformsUI.displayMessage("File error: " + ioe.getLocalizedMessage()); return; } } catch (Exception e) { this.setPlatformsUI.displayMessage("Error: " + e.getLocalizedMessage()); e.printStackTrace(); } this.setPlatformsUI.displayMessage("Subject to sample mapping file updated"); WorkPart.updateSteps(); WorkPart.updateFiles(); }
From source file:com.qperior.GSAOneBoxProvider.QPOneBoxProviderServletTest.java
/** * //from w w w. ja va2s. c o m */ @Test public void testDoPostHttpServletRequestHttpServletResponse() { String uri = URI_SERVLET + URI_APIMAJ + URI_AMP + URI_APIMIN + URI_AMP + URI_AUTHTYPE + URI_AMP + URI_LANG + URI_AMP + URI_ONEBOXNAME + URI_AMP + URI_QUERY; try { String actual = this.callHttpPost(uri); assertEquals(null, "Method 'doPost' is not supported!", actual); } catch (Exception exc) { fail("Exception in DoPost: " + exc.getLocalizedMessage()); } }
From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.FetchReservationsToDate.java
/** * Method, where all reservations to specified date are read from server. * All heavy lifting is made here.//from www.j a va 2 s.c o m * * @param params only one TimeContainer parameter is allowed here - specifies day, month and year * @return list of fetched reservations */ @Override protected List<Reservation> doInBackground(TimeContainer... params) { SharedPreferences credentials = getCredentials(); String username = credentials.getString("username", null); String password = credentials.getString("password", null); String url = credentials.getString("url", null) + Values.SERVICE_RESERVATION; if (params.length == 1) { TimeContainer time = params[0]; url = url + time.getDay() + "-" + time.getMonth() + "-" + time.getYear(); } else { Log.e(TAG, "Invalid params count! There must be one TimeContainer instance"); setState(ERROR, "Invalid params count! There must be one TimeContainer instance"); return Collections.emptyList(); } setState(RUNNING, R.string.working_ws_msg); // Populate the HTTP Basic Authentication header with the username and // password HttpAuthentication authHeader = new HttpBasicAuthentication(username, password); HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setAuthorization(authHeader); requestHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_XML)); SSLSimpleClientHttpRequestFactory factory = new SSLSimpleClientHttpRequestFactory(); // Create a new RestTemplate instance RestTemplate restTemplate = new RestTemplate(factory); restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter()); try { // Make the network request Log.d(TAG, url); ResponseEntity<ReservationList> response = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<Object>(requestHeaders), ReservationList.class); ReservationList body = response.getBody(); if (body != null) { return body.getReservations(); } } catch (Exception e) { Log.e(TAG, e.getLocalizedMessage(), e); setState(ERROR, e); } finally { setState(DONE); } return Collections.emptyList(); }
From source file:com.adito.clientcerts.ClientCertsPlugin.java
public void activatePlugin() throws ExtensionException { super.activatePlugin(); try {// w w w .j a v a 2 s. com initTableItemActions(); // CoreUtil.updateEventsTable(TunnelPlugin.MESSAGE_RESOURCES_KEY, TunnelsEventConstants.class); } catch (Exception e) { throw new ExtensionException(ExtensionException.INTERNAL_ERROR, e, e.getLocalizedMessage()); } LOG.info("ClientCert plugin activated"); }
From source file:com.atolcd.alfresco.audit.web.scripts.UserConnectionsGet.java
/** * PRINCIPAL METHOD// w w w . ja v a 2s .c om * */ @Override protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) { try { Map<String, Object> model = new HashMap<String, Object>(); String period = req.getParameter("period"); int paramDate = 0; if (req.getParameter("date") != null) paramDate = Integer.parseInt(req.getParameter("date")); GregorianCalendar calendar = DateInterval.setInterval(new Date(), period, paramDate); Calendar[] calendars = DateInterval.startEndPeriod(calendar, period); model.put("userConnections", auditQueriesService.countConnections(calendars, period).entrySet()); return model; } catch (Exception e) { throw new WebScriptException("[UserConnectionsGet] Error in execute function " + e.getMessage() + " " + e.getLocalizedMessage()); } }
From source file:fr.sanofi.fcl4transmart.controllers.listeners.geneExpression.SetAttribute2Listener.java
@Override public void handleEvent(Event event) { // TODO Auto-generated method stub Vector<String> values = this.setAttribute2UI.getValues(); Vector<String> samples = this.setAttribute2UI.getSamples(); 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.setAttribute2UI.displayMessage("Error: no subject to sample mapping file"); }/*from w ww. j a va 2s . c o m*/ 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); String sample = fields[3]; String attribute; if (samples.contains(sample)) { attribute = values.get(samples.indexOf(sample)); } else { br.close(); return; } out.write(fields[0] + "\t" + fields[1] + "\t" + fields[2] + "\t" + sample + "\t" + fields[4] + "\t" + fields[5] + "\t" + fields[6] + "\t" + attribute + "\t" + fields[8] + "\n"); } br.close(); } catch (Exception e) { this.setAttribute2UI.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.setAttribute2UI.displayMessage("File error: " + ioe.getLocalizedMessage()); return; } } catch (Exception e) { this.setAttribute2UI.displayMessage("Error: " + e.getLocalizedMessage()); e.printStackTrace(); } this.setAttribute2UI.displayMessage("Subject to sample mapping file updated"); WorkPart.updateSteps(); WorkPart.updateFiles(); }
From source file:fr.sanofi.fcl4transmart.controllers.listeners.geneExpression.SetTissueTypeListener.java
@Override public void handleEvent(Event event) { // TODO Auto-generated method stub Vector<String> values = this.setTissueTypeUI.getValues(); Vector<String> samples = this.setTissueTypeUI.getSamples(); 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.setTissueTypeUI.displayMessage("Error: no subject to sample mapping file"); }//w w w .j a v a 2 s .c o m 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); String sample = fields[3]; String tissueType; if (samples.contains(sample)) { tissueType = values.get(samples.indexOf(sample)); } else { br.close(); return; } out.write(fields[0] + "\t" + fields[1] + "\t" + fields[2] + "\t" + sample + "\t" + fields[4] + "\t" + tissueType + "\t" + fields[6] + "\t" + fields[7] + "\t" + fields[8] + "\n"); } br.close(); } catch (Exception e) { this.setTissueTypeUI.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.setTissueTypeUI.displayMessage("File error: " + ioe.getLocalizedMessage()); return; } } catch (Exception e) { this.setTissueTypeUI.displayMessage("Error: " + e.getLocalizedMessage()); e.printStackTrace(); } this.setTissueTypeUI.displayMessage("Subject to sample mapping file updated"); WorkPart.updateSteps(); WorkPart.updateFiles(); }
From source file:org.openxdata.server.engine.OpenXDataLoggingEngineImpl.java
/** * Process the HTML formatted log file./*from w w w . j a v a 2s .c om*/ * * @return HTML Formatted output. */ private Diagnosis processHTMLLogFile(String logFilePath) { try { // Read Log File String logFileOutput = FileUtil.readFile(logFilePath); // Process Contents. return buildDiagnosisFromHTMLFileOutput(logFileOutput); } catch (Exception ex) { log.error("Log Processing Engine: " + this.getClass() + ex.getLocalizedMessage(), ex); } return null; }
From source file:com.almende.eve.test.TestCall.java
/** * Test proxy.// www . j a v a 2 s . c o m * * @throws Exception * the exception */ @Test public void testCall() throws Exception { // Create TestAgent according to TestInterface final AgentHost host = AgentHost.getInstance(); final FileStateFactory stateFactory = new FileStateFactory(".eveagents"); host.setStateFactory(stateFactory); host.setSchedulerFactory(new ClockSchedulerFactory(host, new HashMap<String, Object>())); if (host.hasAgent("TestAgent")) { host.deleteAgent("TestAgent"); } final TestAgent agent = host.createAgent(TestAgent.class, "TestAgent"); final AsyncCallback<JSONResponse> callback = new AsyncCallback<JSONResponse>() { @Override public void onSuccess(JSONResponse result) { LOG.info("received result:" + result); } @Override public void onFailure(Exception exception) { LOG.log(Level.WARNING, "Failure:", exception); fail("Failure:" + exception.getLocalizedMessage()); } }; agent.send( new JSONRequest("helloWorld", (ObjectNode) JOM.getInstance().readTree("{\"msg\":\"hi there!\"}")), URI.create("local:TestAgent"), callback, null); agent.send( new JSONRequest("helloWorld2", (ObjectNode) JOM.getInstance().readTree("{\"msg1\":\"hi there!\",\"msg2\":\"Bye!\"}")), URI.create("local:TestAgent"), callback, null); agent.send(new JSONRequest("scheduler.getTasks", JOM.createObjectNode()), URI.create("local:TestAgent"), callback, null); agent.send(new JSONRequest("testVoid", JOM.createObjectNode()), URI.create("local:TestAgent"), callback, null); try { Thread.sleep(500); } catch (InterruptedException e) { } }
From source file:com.kylinolap.job.hadoop.cube.MergeCuboidJob.java
@Override public int run(String[] args) throws Exception { Options options = new Options(); try {// w w w.j ava2 s .c o m options.addOption(OPTION_JOB_NAME); options.addOption(OPTION_CUBE_NAME); options.addOption(OPTION_SEGMENT_NAME); options.addOption(OPTION_INPUT_PATH); options.addOption(OPTION_OUTPUT_PATH); parseOptions(options, args); String cubeName = getOptionValue(OPTION_CUBE_NAME).toUpperCase(); String segmentName = getOptionValue(OPTION_SEGMENT_NAME).toUpperCase(); KylinConfig config = KylinConfig.getInstanceFromEnv(); CubeManager cubeMgr = CubeManager.getInstance(config); CubeInstance cube = cubeMgr.getCube(cubeName); // CubeSegment cubeSeg = cubeMgr.findSegment(cube, segmentName); // start job String jobName = getOptionValue(OPTION_JOB_NAME); System.out.println("Starting: " + jobName); job = Job.getInstance(getConf(), jobName); // set job configuration - basic File JarFile = new File(config.getKylinJobJarPath()); if (JarFile.exists()) { job.setJar(config.getKylinJobJarPath()); } else { job.setJarByClass(this.getClass()); } // setJobJar(job); addInputDirs(getOptionValue(OPTION_INPUT_PATH), job); Path output = new Path(getOptionValue(OPTION_OUTPUT_PATH)); FileOutputFormat.setOutputPath(job, output); // Mapper job.setInputFormatClass(SequenceFileInputFormat.class); job.setMapperClass(MergeCuboidMapper.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Text.class); // Reducer - only one job.setReducerClass(CuboidReducer.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); // set job configuration job.getConfiguration().set(BatchConstants.CFG_CUBE_NAME, cubeName); job.getConfiguration().set(BatchConstants.CFG_CUBE_SEGMENT_NAME, segmentName); // add metadata to distributed cache attachKylinPropsAndMetadata(cube, job.getConfiguration()); setReduceTaskNum(job, config, cubeName, 0); this.deletePath(job.getConfiguration(), output); return waitForCompletion(job); } catch (Exception e) { printUsage(options); log.error(e.getLocalizedMessage(), e); return 2; } }