You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ug...@apache.org on 2005/08/03 13:33:18 UTC

svn commit: r227199 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ExceptionGenerator.java

Author: ugo
Date: Wed Aug  3 04:33:15 2005
New Revision: 227199

URL: http://svn.apache.org/viewcvs?rev=227199&view=rev
Log:
Sanity null check

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ExceptionGenerator.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ExceptionGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ExceptionGenerator.java?rev=227199&r1=227198&r2=227199&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ExceptionGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ExceptionGenerator.java Wed Aug  3 04:33:15 2005
@@ -77,21 +77,22 @@
         Throwable current = thr;
         while (current != null) {
             if (current instanceof MultiLocatable) {
-                // Get raw message for LocatableExceptions, message otherwise
-                String message = current instanceof LocatableException ?
-                        ((LocatableException)current).getRawMessage() :
-                        current.getMessage();
-
-                attr.clear();
-                handler.startElement(EXCEPTION_NS, "location-list", "ex:location-list", attr);
-                simpleElement("description", attr, message, handler);
                 List locations = ((MultiLocatable)current).getLocations();
-                for (int i = 0; i < locations.size(); i++) {
+                if (locations != null) {
+                    // Get raw message for LocatableExceptions, message otherwise
+                    String message = current instanceof LocatableException ?
+                            ((LocatableException)current).getRawMessage() :
+                            current.getMessage();
+    
                     attr.clear();
-                    dumpLocation((Location)locations.get(i), attr, null, handler);
+                    handler.startElement(EXCEPTION_NS, "location-list", "ex:location-list", attr);
+                    simpleElement("description", attr, message, handler);
+                    for (int i = 0; i < locations.size(); i++) {
+                        attr.clear();
+                        dumpLocation((Location)locations.get(i), attr, null, handler);
+                    }
+                    handler.endElement(EXCEPTION_NS, "location-list", "ex:location-list");
                 }
-                handler.endElement(EXCEPTION_NS, "location-list", "ex:location-list");
-
             } else {
                 // Not a MultiLocatable
                 loc = ExceptionUtils.getLocation(current);