You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2014/09/11 22:16:50 UTC
svn commit: r1624381 -
/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
Author: rwhitcomb
Date: Thu Sep 11 20:16:50 2014
New Revision: 1624381
URL: http://svn.apache.org/r1624381
Log:
PIVOT-916: Make the default uncaught exception handler available as a
separate method in ApplicationContext so that user applications that
implement the Application.UncaughtExceptionHandler interface can have
access to the default implementation if they need it.
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=1624381&r1=1624380&r2=1624381&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Thu Sep 11 20:16:50 2014
@@ -2040,6 +2040,28 @@ public abstract class ApplicationContext
return cursor;
}
+ public static void defaultUncaughtExceptionHandler(Exception exception) {
+ exception.printStackTrace();
+
+ Display display = (displays.getLength() > 0) ? displays.get(0) : null;
+ if (display == null) {
+ return;
+ }
+
+ String message = exception.getClass().getName();
+
+ TextArea body = null;
+ String bodyText = exception.getMessage();
+ if (bodyText != null && bodyText.length() > 0) {
+ body = new TextArea();
+ body.setText(bodyText);
+ body.setEditable(false);
+ }
+
+ Alert alert = new Alert(MessageType.ERROR, message, null, body, false);
+ alert.open(display);
+ }
+
public static void handleUncaughtException(Exception exception) {
int n = 0;
for (Application application : applications) {
@@ -2051,25 +2073,7 @@ public abstract class ApplicationContext
}
if (n == 0) {
- exception.printStackTrace();
-
- Display display = (displays.getLength() > 0) ? displays.get(0) : null;
- if (display == null) {
- return;
- }
-
- String message = exception.getClass().getName();
-
- TextArea body = null;
- String bodyText = exception.getMessage();
- if (bodyText != null && bodyText.length() > 0) {
- body = new TextArea();
- body.setText(bodyText);
- body.setEditable(false);
- }
-
- Alert alert = new Alert(MessageType.ERROR, message, null, body, false);
- alert.open(display);
+ defaultUncaughtExceptionHandler(exception);
}
}