cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject svn commit: r227199 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/ExceptionGenerator.java
Date Wed, 03 Aug 2005 11:33:18 GMT
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);



Mime
View raw message