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:19:01 UTC

svn commit: r1624382 - in /pivot/branches/2.0.x: ./ wtk/src/org/apache/pivot/wtk/ApplicationContext.java

Author: rwhitcomb
Date: Thu Sep 11 20:19:01 2014
New Revision: 1624382

URL: http://svn.apache.org/r1624382
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.

This is a merge of revision 1624381 from trunk to branches/2.0.x.

Modified:
    pivot/branches/2.0.x/   (props changed)
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java

Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
  Merged /pivot/trunk:r1624381

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=1624382&r1=1624381&r2=1624382&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Thu Sep 11 20:19:01 2014
@@ -2055,6 +2055,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) {
@@ -2067,25 +2089,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);
         }
     }