From 06ab9692d54c04d83f7da4e940bed16be3c70783 Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Wed, 11 Jun 2008 23:59:44 +0000 Subject: [PATCH] Merge from ../branches/1.1.x. svn merge -c 657148 ../branches/1.1.x git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@666920 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/openjpa/util/Exceptions.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java index d67ceb649..2d6bfe5dc 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java @@ -171,7 +171,9 @@ public class Exceptions { 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 @@ public class Exceptions { 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 @@ public class Exceptions { 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; }