From commits-return-2979-apmail-openjpa-commits-archive=openjpa.apache.org@openjpa.apache.org Fri May 16 17:46:13 2008 Return-Path: Delivered-To: apmail-openjpa-commits-archive@www.apache.org Received: (qmail 26254 invoked from network); 16 May 2008 17:46:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 May 2008 17:46:13 -0000 Received: (qmail 36523 invoked by uid 500); 16 May 2008 17:46:14 -0000 Delivered-To: apmail-openjpa-commits-archive@openjpa.apache.org Received: (qmail 36508 invoked by uid 500); 16 May 2008 17:46:14 -0000 Mailing-List: contact commits-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list commits@openjpa.apache.org Received: (qmail 36499 invoked by uid 99); 16 May 2008 17:46:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2008 10:46:14 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2008 17:45:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B6D6E2388A00; Fri, 16 May 2008 10:45:48 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@openjpa.apache.org From: dezzio@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080516174548.B6D6E2388A00@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }