commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
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 GMT
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++) {



Mime
View raw message