List of usage examples for java.lang Exception getCause
public synchronized Throwable getCause()
From source file:com.flipzu.flipzu.FlipInterface.java
/** * Trust every server - dont check for any certificate *///from w w w. j a v a2s. c o m private static void trustAllHosts() { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[] {}; } public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } } }; // Install the all-trusting trust manager try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { Log.e(TAG, "trustAllHosts ERROR", e.getCause()); } }
From source file:org.eclipse.winery.repository.Utils.java
public static Response getResponseForException(Exception e) { String msg;//from w ww .j av a 2 s .co m if (e.getCause() != null) { msg = e.getCause().getMessage(); } else { msg = e.getMessage(); } return Response.status(Status.INTERNAL_SERVER_ERROR).entity(msg).build(); }
From source file:com.mirth.connect.server.util.javascript.JavaScriptUtil.java
/** * Executes global level deploy scripts. * /*from w w w . jav a 2 s.co m*/ * @param scriptId * @throws InterruptedException * @throws JavaScriptExecutorException */ public static void executeGlobalDeployScript(final String scriptId) throws InterruptedException, JavaScriptExecutorException { try { execute(new JavaScriptTask<Object>(getGlobalScriptContextFactory(), "Global Deploy") { @Override public Object doCall() throws Exception { Logger scriptLogger = Logger.getLogger(scriptId.toLowerCase()); try { Scriptable scope = JavaScriptScopeUtil.getDeployScope(getContextFactory(), scriptLogger); JavaScriptUtil.executeScript(this, scriptId, scope, null, null); return null; } finally { Context.exit(); } } }); } catch (Exception e) { if (!(e instanceof JavaScriptExecutorException)) { e = new JavaScriptExecutorException(e); } logScriptError(scriptId, null, e.getCause()); throw (JavaScriptExecutorException) e; } }
From source file:com.mirth.connect.server.util.javascript.JavaScriptUtil.java
/** * Executes global level undeploy scripts. * // w ww. ja va 2 s . co m * @param scriptId * @throws InterruptedException * @throws JavaScriptExecutorException */ public static void executeGlobalUndeployScript(final String scriptId) throws InterruptedException, JavaScriptExecutorException { try { execute(new JavaScriptTask<Object>(getGlobalScriptContextFactory(), "Global Undeploy") { @Override public Object doCall() throws Exception { Logger scriptLogger = Logger.getLogger(scriptId.toLowerCase()); try { Scriptable scope = JavaScriptScopeUtil.getUndeployScope(getContextFactory(), scriptLogger); JavaScriptUtil.executeScript(this, scriptId, scope, null, null); return null; } finally { Context.exit(); } } }); } catch (Exception e) { if (!(e instanceof JavaScriptExecutorException)) { e = new JavaScriptExecutorException(e); } logScriptError(scriptId, null, e.getCause()); throw (JavaScriptExecutorException) e; } }
From source file:com.bitranger.parknshop.util.ObjUtils.java
public static Object fromBytes(byte[] plainObj) { Object var = null; ByteArrayInputStream baIS = new ByteArrayInputStream(plainObj); ObjectInputStream objIS = null; try {/* ww w . ja v a 2 s. c om*/ objIS = new ObjectInputStream(baIS); var = objIS.readObject(); } catch (Exception e) { throw new RuntimeException(e.getMessage() + "\n\tCAUSE: " + e.getCause(), e); } finally { try { baIS.close(); if (objIS != null) { objIS.close(); } } catch (IOException e) { throw new RuntimeException(e.getMessage() + "\n\tCAUSE: " + e.getCause(), e); } } return var; }
From source file:net.mypapit.mobile.myrepeater.RepeaterListActivity.java
public static ArrayList<String> loadStringData(InputStream stream) { ArrayList<String> mlist = new ArrayList<String>(150); int line = 0; try {/*from ww w .j a v a2 s. c o m*/ InputStreamReader is = new InputStreamReader(stream); BufferedReader in = new BufferedReader(is); CSVReader csv = new CSVReader(in, ';', '\"', 0); String data[]; while ((data = csv.readNext()) != null) { line++; mlist.add(data[1]); } in.close(); } catch (IOException ioe) { Log.e("Read CSV Error mypapit", "Some CSV Error: ", ioe.getCause()); } catch (NumberFormatException nfe) { Log.e("Number error", "parse number error - line: " + line + " " + nfe.getMessage(), nfe.getCause()); } catch (Exception ex) { Log.e("Some Exception", "some exception at line :" + line + " \n " + ex.getCause()); ex.printStackTrace(System.err); } // Collections.sort(mlist); return mlist; }
From source file:net.mypapit.mobile.myrepeater.RepeaterListActivity.java
public static RepeaterList loadData(int resource, Activity activity) { RepeaterList mlist = new RepeaterList(150); int line = 0; try {/*from www. j a v a2 s .co m*/ InputStreamReader is = new InputStreamReader(activity.getResources().openRawResource(resource)); BufferedReader in = new BufferedReader(is); CSVReader csv = new CSVReader(in, ';', '\"', 0); String data[]; while ((data = csv.readNext()) != null) { line++; mlist.add(new Repeater("", data[1], data[2], data[3], data[9], Double.parseDouble(data[4]), Double.parseDouble(data[5]), Double.parseDouble(data[6]), Double.parseDouble(data[7]), Double.parseDouble(data[8]))); } in.close(); } catch (IOException ioe) { Log.e("Read CSV Error mypapit", "Some CSV Error: ", ioe.getCause()); } catch (NumberFormatException nfe) { Log.e("Number error", "parse number error - line: " + line + " " + nfe.getMessage(), nfe.getCause()); } catch (Exception ex) { Log.e("Some Exception", "some exception at line :" + line + " \n " + ex.getCause()); ex.printStackTrace(System.err); } return mlist; }
From source file:org.zoumbox.mh_dla_notifier.sp.PublicScriptsProxy.java
@Deprecated protected static void saveUpdateResult(Context context, PublicScript script, long date, Exception exception) { if (PublicScript.Profil2.equals(script)) { SharedPreferences preferences = context.getSharedPreferences(ProfileProxyV1.PREFS_NAME, 0); boolean success = false; String result;// ww w. j a v a 2 s . c o m if (exception == null) { result = "SUCCESS"; success = true; } else { result = exception.getClass().getName(); if (exception instanceof NetworkUnavailableException || (exception instanceof PublicScriptException && exception.getCause() != null)) { result = "NETWORK ERROR: " + result; } } SharedPreferences.Editor editor = preferences.edit(); editor.putLong("LAST_UPDATE_ATTEMPT", date); editor.putString("LAST_UPDATE_RESULT", result); if (success) { editor.putLong("LAST_UPDATE_SUCCESS", date); } editor.commit(); } }
From source file:org.messic.server.facade.controllers.rest.exceptions.CaptchaNotValidMessicRESTException.java
public CaptchaNotValidMessicRESTException(Exception e) { super(e.getMessage(), e.getCause()); }
From source file:org.messic.server.facade.controllers.rest.exceptions.DuplicatedMessicRESTException.java
public DuplicatedMessicRESTException(Exception e) { super(e.getMessage(), e.getCause()); }