List of usage examples for java.lang RuntimeException getMessage
public String getMessage()
From source file:de.xirp.chart.ChartManager.java
/** * Returns a list of bar charts. The charts are generated using * the given record->interval map and the key array. One chart is * generated for each record in the map. The records are evaluated * for the mapped interval.//from w ww.j a v a 2 s. c om * * @param recordIntervalMap * The records with the data and the interval. * @param keys * The keys to use. * @return A list of bar charts. * @see org.jfree.chart.JFreeChart * @see de.xirp.db.Record * @see de.xirp.ui.widgets.dialogs.ChartConfigDialog.Interval */ public static List<JFreeChart> createBarChart(Map<Record, Interval> recordIntervalMap, String[] keys) { List<JFreeChart> charts = new ArrayList<JFreeChart>(); Interval i; for (Record record : recordIntervalMap.keySet()) { i = recordIntervalMap.get(record); try { charts.add(createBarChart(record, keys, i.start.getTime(), i.stop.getTime(), false)); } catch (RuntimeException e) { logClass.error("Error: " + e.getMessage() //$NON-NLS-1$ + Constants.LINE_SEPARATOR, e); } } return charts; }
From source file:com.auditbucket.helper.DeadlockRetry.java
public static Command execute(Command command, String block, int maxRetry) throws DatagioException { // Deadlock re-try fun int retryCount = 0; while (retryCount < maxRetry) { try {//from w ww . ja v a2s. c o m return command.execute(); } catch (RuntimeException re) { // ToDo: Exceptions getting wrapped in a JedisException. Can't directly catch the DDE hence the instanceof check if (re.getCause() instanceof NotFoundException || re.getCause() instanceof DeadlockDetectedException || re.getCause() instanceof InvalidDataAccessResourceUsageException || re.getCause() instanceof DataRetrievalFailureException) { logger.debug("Deadlock Detected. Entering retry [{}]", block); Thread.yield(); retryCount++; if (retryCount == maxRetry) { // http://www.slideshare.net/neo4j/zephyr-neo4jgraphconnect-2013short logger.error("Deadlock retries exceeded in [{}]", block); throw (re); } } else { logger.error("DeadlockRetry error could not be handled {}", re.getMessage()); throw (re); } } } return null; }
From source file:br.ime.usp.aztec.AZTECMain.java
private void handleIOError(RuntimeException e) { System.err.println(e.getMessage()); System.exit(2); }
From source file:at.christophwurst.orm.consoleclient.CommandExecutorImpl.java
@Override public void execute(Command cmd, ConsoleInterface consoleInterface) { try {//from w ww . j a v a2s. c o m cmd.execute(consoleInterface); } catch (RuntimeException ex) { System.err.println("Exception caught: " + ex.getMessage()); } }
From source file:com.dell.asm.asmcore.asmmanager.util.discovery.DeviceTypeCheckUtil.java
public static int httpGet(String urlToRead) throws IOException { URL url;/*from w ww . j a v a2 s . c o m*/ HttpURLConnection conn; BufferedReader rd = null; StringBuffer result = new StringBuffer(); int responseCode = 400; try { url = new URL(urlToRead); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(10); responseCode = conn.getResponseCode(); } catch (RuntimeException e) { throw new IOException("Could not connect to the url: " + e.getMessage()); } catch (Exception e) { throw new IOException("Could not connect to the url: " + urlToRead); } finally { if (rd != null) rd.close(); } return responseCode; }
From source file:com.dell.asm.asmcore.asmmanager.util.discovery.DeviceTypeCheckUtil.java
/** * HTTP request extractor//ww w .ja v a 2 s. c om * * @param urlToRead device URL * @return device type string * @throws IOException */ public static String getHTML(String urlToRead) throws IOException { URL url; HttpURLConnection conn; BufferedReader rd = null; String line; StringBuffer result = new StringBuffer(); try { url = new URL(urlToRead); conn = (HttpURLConnection) url.openConnection(); if (conn instanceof HttpsURLConnection) { HttpsURLConnection sslConn = (HttpsURLConnection) conn; sslConn.setHostnameVerifier(hv); SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, new TrustManager[] { tmNoCheck }, new SecureRandom()); sslConn.setSSLSocketFactory(sslContext.getSocketFactory()); } conn.setRequestMethod("GET"); conn.setConnectTimeout(AsmManagerApp.CONNECT_TIMEOUT); // timeout value conn.setReadTimeout(AsmManagerApp.CONNECT_TIMEOUT); rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); while ((line = rd.readLine()) != null) { result.append(line); } } catch (RuntimeException e) { throw new IOException("Could not connect to the url: " + e.getMessage()); } catch (Exception e) { throw new IOException("Could not connect to the url: " + urlToRead); } finally { if (rd != null) rd.close(); } return result.toString(); }
From source file:com.hybris.integration.controller.base.ApiExceptionHandler.java
private TmallAppResponse parseErrorMessage(RuntimeException ex) { return CommonUtils.getGsonByBuilder(false).fromJson(ex.getMessage(), TmallAppResponse.class); }
From source file:com.dell.asm.asmcore.asmmanager.util.discovery.DeviceTypeCheckUtil.java
/** * HTTP POST with basic auth//from w w w. java2 s . c o m * * @param urlToRead device URL * @return http response message * @throws IOException */ public static String httpPost(String urlToRead, String username, String password) throws IOException { URL url; HttpURLConnection conn; BufferedReader rd = null; String line; StringBuffer result = new StringBuffer(); try { url = new URL(urlToRead); conn = (HttpURLConnection) url.openConnection(); if (conn instanceof HttpsURLConnection) { HttpsURLConnection sslConn = (HttpsURLConnection) conn; sslConn.setHostnameVerifier(hv); SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, new TrustManager[] { tmNoCheck }, new SecureRandom()); sslConn.setSSLSocketFactory(sslContext.getSocketFactory()); } conn.setDoOutput(true); conn.setConnectTimeout(AsmManagerApp.CONNECT_TIMEOUT); // timeout value conn.setReadTimeout(AsmManagerApp.CONNECT_TIMEOUT); conn.setRequestMethod("POST"); conn.setRequestProperty("x-dell-api-version", "2.0"); conn.setRequestProperty("Authorization", encodeCredentials(username, password)); conn.setRequestProperty("Content-Type", "application/json"); conn.setFixedLengthStreamingMode("{}".length()); conn.getOutputStream().write("{}".getBytes(Charset.forName("UTF-8"))); rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); while ((line = rd.readLine()) != null) { result.append(line); } } catch (RuntimeException e) { throw new IOException("Could not connect to the url: " + e.getMessage()); } catch (Exception e) { throw new IOException("Could not connect to the url: " + urlToRead); } finally { if (rd != null) rd.close(); } return result.toString(); }
From source file:com.espertech.esper.core.start.EPStatementDestroyCallbackList.java
public void destroy() { if (callbacks == null) { return;/*from ww w. j a v a2 s. co m*/ } for (DestroyCallback destroyCallback : callbacks) { try { destroyCallback.destroy(); } catch (RuntimeException ex) { log.error("Failed to destroy resource: " + ex.getMessage(), ex); } } }
From source file:de.langmi.spring.batch.examples.complex.file.split.GetLineCountTaskletTest.java
@Test public void testExecuteWithNull() throws Exception { // setup/*from ww w . j a v a 2 s . com*/ tasklet = new GetLineCountTasklet(); tasklet.setResource(null); // execute try { tasklet.execute(null, null); } catch (RuntimeException e) { assertTrue(e.getMessage().contains("Resource was null")); } }