Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 45300 invoked from network); 7 Nov 2008 14:49:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Nov 2008 14:49:15 -0000 Received: (qmail 70872 invoked by uid 500); 7 Nov 2008 14:49:20 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 70804 invoked by uid 500); 7 Nov 2008 14:49:19 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 70795 invoked by uid 99); 7 Nov 2008 14:49:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Nov 2008 06:49:19 -0800 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, 07 Nov 2008 14:48:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E2FEE238895D; Fri, 7 Nov 2008 06:48:49 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r712142 - in /commons/proper/math/branches/MATH_2_0/src: java/org/apache/commons/math/ java/org/apache/commons/math/geometry/ java/org/apache/commons/math/linear/ java/org/apache/commons/math/random/ test/org/apache/commons/math/ test/org/a... Date: Fri, 07 Nov 2008 14:48:28 -0000 To: commits@commons.apache.org From: luc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081107144849.E2FEE238895D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: luc Date: Fri Nov 7 06:48:13 2008 New Revision: 712142 URL: http://svn.apache.org/viewvc?rev=712142&view=rev Log: leverage null pointer handling, exception classes can be built using null arguments arrays which are automatically converted to zero-sized arrays to prevent null pointer exceptions Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ConvergenceException.java commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RankDeficientMatrixException.java commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/SingularMatrixException.java commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/NotPositiveDefiniteMatrixException.java commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathExceptionTest.java commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ConvergenceException.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ConvergenceException.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ConvergenceException.java (original) +++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ConvergenceException.java Fri Nov 7 06:48:13 2008 @@ -31,7 +31,7 @@ * Default constructor. */ public ConvergenceException() { - super("Convergence failed", new Object[0]); + super("Convergence failed", null); } /** Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java (original) +++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java Fri Nov 7 06:48:13 2008 @@ -35,7 +35,7 @@ * if false it is related to EulerAngles */ public CardanEulerSingularityException(boolean isCardan) { - super(isCardan ? "Cardan angles singularity" : "Euler angles singularity", new Object[0]); + super(isCardan ? "Cardan angles singularity" : "Euler angles singularity", null); } /** Serializable version identifier */ Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RankDeficientMatrixException.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RankDeficientMatrixException.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RankDeficientMatrixException.java (original) +++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RankDeficientMatrixException.java Fri Nov 7 06:48:13 2008 @@ -31,7 +31,7 @@ * Construct an exception with a default message. */ public RankDeficientMatrixException() { - super("matrix is rank-deficient", new Object[0]); + super("matrix is rank-deficient", null); } } Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/SingularMatrixException.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/SingularMatrixException.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/SingularMatrixException.java (original) +++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/SingularMatrixException.java Fri Nov 7 06:48:13 2008 @@ -31,7 +31,7 @@ * Construct an exception with a default message. */ public SingularMatrixException() { - super("matrix is singular", new Object[0]); + super("matrix is singular", null); } } Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/NotPositiveDefiniteMatrixException.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/NotPositiveDefiniteMatrixException.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/NotPositiveDefiniteMatrixException.java (original) +++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/NotPositiveDefiniteMatrixException.java Fri Nov 7 06:48:13 2008 @@ -36,7 +36,7 @@ * build an exception with a default message. */ public NotPositiveDefiniteMatrixException() { - super("not positive definite matrix", new Object[0]); + super("not positive definite matrix", null); } } Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java (original) +++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java Fri Nov 7 06:48:13 2008 @@ -30,7 +30,7 @@ MathConfigurationException ex = new MathConfigurationException(); assertNull(ex.getCause()); assertNull(ex.getMessage()); - assertNull(ex.getMessage(Locale.FRENCH)); + assertEquals(0, ex.getMessage(Locale.FRENCH).length()); } public void testConstructorPatternArguments(){ Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathExceptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathExceptionTest.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathExceptionTest.java (original) +++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/MathExceptionTest.java Fri Nov 7 06:48:13 2008 @@ -33,7 +33,7 @@ MathException ex = new MathException(); assertNull(ex.getCause()); assertNull(ex.getMessage()); - assertNull(ex.getMessage(Locale.FRENCH)); + assertEquals(0, ex.getMessage(Locale.FRENCH).length()); } public void testConstructorPatternArguments(){ @@ -79,8 +79,8 @@ public void testPrintStackTrace() { String outMsg = "outer message"; String inMsg = "inner message"; - MathException cause = new MathConfigurationException(inMsg, new Object[0]); - MathException ex = new MathException(outMsg, new Object[0], cause); + MathException cause = new MathConfigurationException(inMsg, null); + MathException ex = new MathException(outMsg, null, cause); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); ex.printStackTrace(ps); @@ -104,8 +104,8 @@ public void testSerialization() { String outMsg = "outer message"; String inMsg = "inner message"; - MathException cause = new MathConfigurationException(inMsg, new Object[0]); - MathException ex = new MathException(outMsg, new Object[0], cause); + MathException cause = new MathConfigurationException(inMsg, null); + MathException ex = new MathException(outMsg, null, cause); MathException image = (MathException) TestUtils.serializeAndRecover(ex); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java (original) +++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java Fri Nov 7 06:48:13 2008 @@ -29,7 +29,7 @@ */ public void testConstructorMessage(){ String msg = "message"; - InvalidMatrixException ex = new InvalidMatrixException(msg, new Object[0]); + InvalidMatrixException ex = new InvalidMatrixException(msg, null); assertEquals(msg, ex.getMessage()); } } Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java (original) +++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java Fri Nov 7 06:48:13 2008 @@ -29,7 +29,7 @@ */ public void testConstructorMessage(){ String msg = "message"; - MatrixIndexException ex = new MatrixIndexException(msg, new Object[0]); + MatrixIndexException ex = new MatrixIndexException(msg, null); assertEquals(msg, ex.getMessage()); } } Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java?rev=712142&r1=712141&r2=712142&view=diff ============================================================================== --- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java (original) +++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java Fri Nov 7 06:48:13 2008 @@ -659,7 +659,7 @@ if (!lu.isSquare() || lowerData.length != lowerData[0].length || upperData.length != upperData[0].length || lowerData.length != upperData.length || lowerData.length != lu.getRowDimension()) { - throw new InvalidMatrixException("incorrect dimensions", new Object[0]); + throw new InvalidMatrixException("incorrect dimensions", null); } int n = lu.getRowDimension(); for (int i = 0; i < n; i++) {