Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2004-09-02 18:07:45 -0400
committerPascal Rapicault2004-09-02 18:07:45 -0400
commitfed3bcd2aa96e5c18153cfce92c3504eaff98b2b (patch)
tree4cfd819545e0ff363a69406335b4050b9f3342f1
parentde0591c6fbcad3f0c99341f3f76821a2ffa5da99 (diff)
downloadrt.equinox.framework-R3_0_maintenance.tar.gz
rt.equinox.framework-R3_0_maintenance.tar.xz
rt.equinox.framework-R3_0_maintenance.zip
[osgi] Review the EclipseAdaptor#handleRuntimeException behavior so it filters exceptions
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java20
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMessages.properties3
2 files changed, 18 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java
index ae179313f..e57bc7db4 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java
@@ -551,25 +551,37 @@ public class EclipseAdaptor extends DefaultAdaptor {
stopper.stopBundles();
}
+ private boolean isFatalException(Throwable error) {
+ if (error instanceof VirtualMachineError) {
+ return true;
+ }
+ if (error instanceof ThreadDeath) {
+ return true;
+ }
+ return false;
+ }
+
public void handleRuntimeError(Throwable error) {
try {
// check the prop each time this happens (should NEVER happen!)
exitOnError = Boolean.valueOf(System.getProperty(PROP_EXITONERROR, "true")).booleanValue(); //$NON-NLS-1$
String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_ADAPTOR_RUNTIME_ERROR"); //$NON-NLS-1$
+ if (exitOnError && isFatalException(error))
+ message += ' ' + EclipseAdaptorMsg.formatter.getString("ECLIPSE_ADAPTOR_EXITING"); //$NON-NLS-1$
FrameworkLogEntry logEntry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, message, 0, error, null);
frameworkLog.log(logEntry);
} catch (Throwable t) {
- // we may be in a currupted state and must be able to handle any errors (ie OutOfMemoryError)
+ // we may be in a corrupted state and must be able to handle any errors (ie OutOfMemoryError)
// that may occur when handling the first error; this is REALLY the last resort.
try {
- error.printStackTrace();
- t.printStackTrace();
+ error.printStackTrace(System.err);
+ t.printStackTrace(System.err);
} catch (Throwable t1) {
// if we fail that then we are beyond help.
}
} finally {
// do the exit outside the try block just incase another runtime error was thrown while logging
- if (exitOnError)
+ if (exitOnError && isFatalException(error))
System.exit(13);
}
}
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMessages.properties b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMessages.properties
index c61aeabb3..1767afc6e 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMessages.properties
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMessages.properties
@@ -14,7 +14,8 @@
#EclipseAdaptor messages
ECLIPSE_ADAPTOR_ERROR_RM_CACHE=Cannot clean the cache directory {0}.
ECLIPSE_ADAPTOR_ERROR_XML_SERVICE=Error registering XML parser services.
-ECLIPSE_ADAPTOR_RUNTIME_ERROR=An unexpected runtime error has occurred. The application will terminate.
+ECLIPSE_ADAPTOR_RUNTIME_ERROR=An unexpected runtime error has occurred.
+ECLIPSE_ADAPTOR_EXITING=The application will terminate.
#EclipseStarter messages
ECLIPSE_STARTUP_BUNDLE_NOT_FOUND=Bundle {0} not found.

Back to the top