openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dez...@apache.org
Subject svn commit: r657148 - /openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java
Date Fri, 16 May 2008 17:45:48 GMT
Author: dezzio
Date: Fri May 16 10:45:48 2008
New Revision: 657148

URL: http://svn.apache.org/viewvc?rev=657148&view=rev
Log:
In some cases, nested exception arrays can contain a null entry.  Ignore these rather than
throw a NullPointerException in the exception handling.

Modified:
    openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java

Modified: openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java?rev=657148&r1=657147&r2=657148&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java
(original)
+++ openjpa/branches/1.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java
Fri May 16 10:45:48 2008
@@ -171,7 +171,9 @@
         if (i < nested.length) {
             out.println("NestedThrowables:");
             for (; i < nested.length; i++)
-                nested[i].printStackTrace(out);
+                // guard against a nasty null in the array
+                if (nested[i] != null)
+                    nested[i].printStackTrace(out);
         }
     }
 
@@ -188,7 +190,9 @@
         if (i < nested.length) {
             out.println("NestedThrowables:");
             for (; i < nested.length; i++)
-                nested[i].printStackTrace(out);
+                // guard against a nasty null in the array
+                if (nested[i] != null)
+                    nested[i].printStackTrace(out);
         }
     }
 
@@ -239,7 +243,10 @@
             if (isSerializable(nested[i]))
                 newNested[i] = nested[i];
             else
-                newNested[i] = new Exception(nested[i].toString());
+                // guard against a nasty null in the array by using valueOf
+                // instead of toString to prevent throwing yet another 
+                // exception
+                newNested[i] = new Exception(String.valueOf(nested[i]));
         }
         return newNested;
     }



Mime
View raw message