List of usage examples for java.lang Throwable printStackTrace
public void printStackTrace()
From source file:Main.java
private static void handlePluginException(Throwable throwable) { System.err.println((new StringBuilder()).append("RxJavaErrorHandler threw an Exception. It shouldn't. => ") .append(throwable.getMessage()).toString()); throwable.printStackTrace(); }
From source file:Main.java
public static String getMetaData(Context app, String name) { Bundle bundle = app.getApplicationInfo().metaData; if (bundle != null) { return bundle.getString(name); } else {//from w w w . j a v a 2s .c om XmlResourceParser parser = null; AssetManager assmgr = null; try { assmgr = (AssetManager) AssetManager.class.newInstance(); Method e = AssetManager.class.getDeclaredMethod("addAssetPath", new Class[] { String.class }); e.setAccessible(true); int cookie = ((Integer) e.invoke(assmgr, new Object[] { app.getApplicationInfo().sourceDir })) .intValue(); if (cookie != 0) { String ANDROID_RESOURCES = "http://schemas.android.com/apk/res/android"; parser = assmgr.openXmlResourceParser(cookie, "AndroidManifest.xml"); boolean findAppMetadata = false; int event = parser.getEventType(); while (event != 1) { switch (event) { case 2: String nodeName = parser.getName(); String metadataName; if ("meta-data".equals(nodeName)) { findAppMetadata = true; metadataName = parser.getAttributeValue(ANDROID_RESOURCES, "name"); if (metadataName.equals(name)) { String var12 = parser.getAttributeValue(ANDROID_RESOURCES, "value"); return var12; } } else if (findAppMetadata) { metadataName = null; return metadataName; } default: event = parser.next(); } } } } catch (Throwable var16) { var16.printStackTrace(); } finally { if (parser != null) { parser.close(); } if (assmgr != null) { assmgr.close(); } } return null; } }
From source file:fr.ens.biologie.genomique.eoulsan.actions.ClusterTaskAction.java
/** * Execute the task.//from w ww . j a v a2 s . c o m * @param taskContextFile context file */ private static void run(final DataFile taskContextFile) { checkNotNull(taskContextFile, "contextFile is null"); // Get Eoulsan runtime final LocalEoulsanRuntime localRuntime = (LocalEoulsanRuntime) EoulsanRuntime.getRuntime(); // Set the cluster task mode localRuntime.setMode(EoulsanExecMode.CLUSTER_TASK); try { // Execute the task TaskSerializationUtils.execute(taskContextFile); } catch (FileNotFoundException e) { Common.errorExit(e, "File not found: " + e.getMessage()); } catch (IOException e) { Common.errorExit(e, "IOException: " + e.getMessage()); } catch (EoulsanRuntimeException e) { Common.errorExit(e, "Error while executing " + Globals.APP_NAME_LOWER_CASE + ": " + e.getMessage()); } catch (Throwable t) { t.printStackTrace(); } }
From source file:com.aw.support.reflection.AttributeAccessor.java
/** * @param target//from w w w. j a va 2s. com * @param attrName * @return */ public static Object get(Object target, String attrName) { Object objectToReturn = null; try { Class cls = target.getClass(); Field field = getField(cls, attrName); objectToReturn = field.get(target); } catch (Throwable e) { logger.error("Exception getting attribute value:" + attrName, e); e.printStackTrace(); } return objectToReturn; }
From source file:com.stratuscom.harvester.liaison.VirtualFileSystemConfiguration.java
private static void setManagerClassLoader() { try {/*from www . jav a 2 s . co m*/ Object mgr = VFS.getManager(); Method setter = mgr.getClass().getMethod("setClassLoader", new Class[] { ClassLoader.class }); setter.invoke(mgr, new Object[] { mgr.getClass().getClassLoader() }); } catch (Throwable t) { t.printStackTrace(); } }
From source file:de.renew.workflow.connector.internal.cases.ScenarioCompatibilityHelper.java
public static boolean ensureBackwardsCompatibility(final ScenarioHandlingProjectNature nature) { // FIXME: this is dirty fix only for this release 2.3 // should be implemented in other way, we just do not have any time now try {//from w w w. j av a2 s . com if (nature == null || !nature.getProject().hasNature("org.kalypso.kalypso1d2d.pjt.Kalypso1D2DProjectNature")) //$NON-NLS-1$ return true; // FIXME: the whole code here does not belong to this place -> this is a hidden dependency to 1d2d: bad! // TODO: instead implement an extension point mechanism final ProjectTemplate[] lTemplate = EclipsePlatformContributionsExtensions .getProjectTemplates("org.kalypso.kalypso1d2d.pjt.projectTemplate"); //$NON-NLS-1$ try { // FIXME: this very probably does not work correctly or any more at all! /* Unpack project from template */ final File destinationDir = nature.getProject().getLocation().toFile(); final URL data = lTemplate[0].getData(); final String location = data.toString(); final String extension = FilenameUtils.getExtension(location); if ("zip".equalsIgnoreCase(extension)) //$NON-NLS-1$ { // TODO: this completely overwrite the old project content, is this intended? ZipUtilities.unzip(data.openStream(), destinationDir, false); } else { final URL fileURL = FileLocator.toFileURL(data); final File dataDir = FileUtils.toFile(fileURL); if (dataDir == null) { return false; } // FIXME: this only fixes the basic scenario, is this intended? final IOFileFilter lFileFilter = new WildcardFileFilter(new String[] { "wind.gml" }); //$NON-NLS-1$ final IOFileFilter lDirFilter = TrueFileFilter.INSTANCE; final Collection<?> windFiles = FileUtils.listFiles(destinationDir, lFileFilter, lDirFilter); if (dataDir.isDirectory() && (windFiles == null || windFiles.size() == 0)) { final WildcardFileFilter lCopyFilter = new WildcardFileFilter( new String[] { "*asis", "models", "wind.gml" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ FileUtils.copyDirectory(dataDir, destinationDir, lCopyFilter); } else { return true; } } } catch (final Throwable t) { t.printStackTrace(); return false; } nature.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); } catch (final CoreException e) { // FIXME: this is no error handling; the users are not informed and will stumble over following errors caued by // this problem WorkflowConnectorPlugin.getDefault().getLog().log(e.getStatus()); e.printStackTrace(); return false; } return true; }
From source file:org.lilyproject.process.test.AbstractRestTest.java
@AfterClass public static void tearDownAfterClass() throws Exception { try {//from w w w . j a v a 2 s .c om if (lilyProxy != null) { lilyProxy.stop(); } } catch (Throwable t) { t.printStackTrace(); } }
From source file:com.onesignal.NotificationOpenedProcessor.java
static void processIntent(Context incContext, Intent inIntent) { context = incContext;/*from w w w . j ava 2 s. c om*/ intent = inIntent; String summaryGroup = intent.getStringExtra("summary"); boolean dismissed = intent.getBooleanExtra("dismissed", false); OneSignalDbHelper dbHelper = new OneSignalDbHelper(context); SQLiteDatabase writableDb = dbHelper.getWritableDatabase(); JSONArray dataArray = null; if (!dismissed) { try { dataArray = NotificationBundleProcessor .newJsonArray(new JSONObject(intent.getStringExtra("onesignal_data"))); } catch (Throwable t) { t.printStackTrace(); } } // We just opened a summary notification. if (!dismissed && summaryGroup != null) addChildNotifications(dataArray, summaryGroup, writableDb); markNotificationsConsumed(writableDb); // Notification is not a summary type and is a single notification part of a group. if (summaryGroup == null && intent.getStringExtra("grp") != null) updateSummaryNotification(writableDb); writableDb.close(); if (!dismissed) OneSignal.handleNotificationOpened(context, dataArray, inIntent.getBooleanExtra("from_alert", false)); }
From source file:cn.com.loopj.android.http.MySSLSocketFactory.java
/** * Gets a Default KeyStore//from w w w.j av a 2 s. c o m * * @return KeyStore */ public static KeyStore getKeystore() { KeyStore trustStore = null; try { trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null, null); } catch (Throwable t) { t.printStackTrace(); } return trustStore; }
From source file:cn.com.loopj.android.http.MySSLSocketFactory.java
/** * Returns a SSlSocketFactory which trusts all certificates * * @return SSLSocketFactory// w w w . j a v a 2 s . c o m */ public static SSLSocketFactory getFixedSocketFactory() { SSLSocketFactory socketFactory; try { socketFactory = new MySSLSocketFactory(getKeystore()); socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); } catch (Throwable t) { t.printStackTrace(); socketFactory = SSLSocketFactory.getSocketFactory(); } return socketFactory; }