commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r712430 - in /commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math: ./ analysis/ linear/ random/ stat/descriptive/ stat/descriptive/moment/
Date Sat, 08 Nov 2008 20:42:56 GMT
Author: luc
Date: Sat Nov  8 12:42:55 2008
New Revision: 712430

URL: http://svn.apache.org/viewvc?rev=712430&view=rev
Log:
improved error messages

Modified:
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/MessagesResources_fr.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealIntegratorImpl.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/LUDecompositionImpl.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/ValueServer.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/MessagesResources_fr.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/MessagesResources_fr.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/MessagesResources_fr.java
Sat Nov  8 12:42:55 2008
@@ -174,6 +174,8 @@
     // org.apache.commons.math.linear.EigenDecompositionImpl
     { "negative element on decomposed tridiagonal of {0}x{1} matrix",
       "\u00e9l\u00e9ment n\u00e9gatif dans la d\u00e9composition tri-diagonale d''une matrice
{0}x{1}" },
+    { "internal error: please file a bug report at https://issues.apache.org/jira/browse/MATH",
+      "erreur interne : veuillez enregistrer un rapport de bogue sur https://issues.apache.org/jira/browse/MATH"
},
 
     // org.apache.commons.math.linear.NonSquareMatrixException
     { "a {0}x{1} matrix was provided instead of a square matrix",
@@ -256,11 +258,51 @@
      "norme nulle pour un axe de rotation" },
 
    // org.apache.commons.math.geometry.Vector3D
-    // org.apache.commons.math.linear.RealVectorImpl
+   // org.apache.commons.math.linear.RealVectorImpl
    { "cannot normalize a zero norm vector",
      "impossible de normer un vecteur de norme nulle" },
    { "zero norm",
-     "norme nulle" }
+     "norme nulle" },
+
+   // org.apache.commons.math.analysis.UnivariateRealIntegratorImpl
+   // org.apache.commons.math.analysis.UnivariateRealSolverImpl
+   { "no result available",
+     "aucun r\u00e9sultat n''est disponible" },
+
+   // org.apache.commons.math.linear.BigMatrixImpl
+   { "first {0} rows are not initialized yet",
+     "les {0} premi\u00e8res lignes ne sont pas encore initialis\u00e9es" },
+   { "first {0} columns are not initialized yet",
+     "les {0} premi\u00e8res colonnes ne sont pas encore initialis\u00e9es" },
+
+   // org.apache.commons.math.linear.EigenDecompositionImpl
+   // org.apache.commons.math.linear.LUDecompositionImpl
+   // org.apache.commons.math.linear.QRDecompositionImpl
+   // org.apache.commons.math.linear.SingularValueDecompositionImpl
+   { "no matrix have been decomposed yet",
+     "aucune matrice n''a encore \u00e9t\u00e9 d\u00e9compos\u00e9e" },
+
+   // org.apache.commons.math.random.EmpiricalDistributionImpl
+   { "distribution not loaded",
+     "aucune distribution n''a \u00e9t\u00e9 charg\u00e9e" },
+
+   // org.apache.commons.math.random.ValueServer
+   { "unknown mode {0}, known modes: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10})
and {11} ({12})",
+     "mode {0} inconnu, modes connus : {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10})
et {11} ({12})" },
+   { "digest not initialized",
+     "mod\u00e8le empirique non initialis\u00e9" },
+
+   // org.apache.commons.math.stat.descriptive.moment.GeometricMean
+   // org.apache.commons.math.stat.descriptive.MultivariateSummaryStatistics
+   // org.apache.commons.math.stat.descriptive.SummaryStatistics
+   { "{0} values have been added before statistic is configured",
+     "{0} valeurs ont \u00e9t\u00e9 ajout\u00e9es avant que la statistique ne soit configur\u00e9e"
},
+
+   // org.apache.commons.math.stat.descriptive.moment.Kurtosis
+   { "statistics constructed from external moments cannot be incremented",
+     "les statistiques bas\u00e9es sur des moments externes ne peuvent pas \u00eatre incr\u00e9ment\u00e9es"
},
+   { "statistics constructed from external moments cannot be cleared",
+     "les statistiques bas\u00e9es sur des moments externes ne peuvent pas \u00eatre remises
\u00e0 z\u00e9ro" }
 
   };
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealIntegratorImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealIntegratorImpl.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealIntegratorImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealIntegratorImpl.java
Sat Nov  8 12:42:55 2008
@@ -18,6 +18,8 @@
 
 import java.io.Serializable;
 
+import org.apache.commons.math.MathRuntimeException;
+
 /**
  * Provide a default implementation for several generic functions.
  *  
@@ -99,7 +101,7 @@
         if (resultComputed) {
             return result;
         } else {
-            throw new IllegalStateException("No result available.");
+            throw MathRuntimeException.createIllegalStateException("no result available",
null);
         }
     }
 
@@ -113,7 +115,7 @@
         if (resultComputed) {
             return iterationCount;
         } else {
-            throw new IllegalStateException("No result available.");
+            throw MathRuntimeException.createIllegalStateException("no result available",
null);
         }
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java
Sat Nov  8 12:42:55 2008
@@ -20,6 +20,7 @@
 import java.io.Serializable;
 
 import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.MathRuntimeException;
 
 /**
  * Provide a default implementation for several functions useful to generic
@@ -111,7 +112,7 @@
         if (resultComputed) {
             return result;
         } else {
-            throw new IllegalStateException("No result available");
+            throw MathRuntimeException.createIllegalStateException("no result available",
null);
         }
     }
 
@@ -126,7 +127,7 @@
         if (resultComputed) {
             return iterationCount;
         } else {
-            throw new IllegalStateException("No result available");
+            throw MathRuntimeException.createIllegalStateException("no result available",
null);
         }
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/BigMatrixImpl.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
Sat Nov  8 12:42:55 2008
@@ -19,6 +19,8 @@
 import java.io.Serializable;
 import java.math.BigDecimal;
 
+import org.apache.commons.math.MathRuntimeException;
+
 /**
  * Implementation of {@link BigMatrix} using a BigDecimal[][] array to store entries
  * and <a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf">
@@ -697,8 +699,13 @@
         }
 
         if (data == null) {
-            if ((row > 0) || (column > 0)) {
-                throw new IllegalStateException("matrix must be initialized to perform this
method");
+            if (row > 0) {
+                throw MathRuntimeException.createIllegalStateException("first {0} rows are
not initialized yet",
+                                                                       new Object[] { row
});
+            }
+            if (column > 0) {
+                throw MathRuntimeException.createIllegalStateException("first {0} columns
are not initialized yet",
+                                                                       new Object[] { column
});
             }
             data = new BigDecimal[nRows][nCols];
             System.arraycopy(subMatrix, 0, data, 0, subMatrix.length);          

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/LUDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/LUDecompositionImpl.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/LUDecompositionImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/LUDecompositionImpl.java
Sat Nov  8 12:42:55 2008
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.linear;
 
+import org.apache.commons.math.MathRuntimeException;
+
 /**
  * Calculates the LUP-decomposition of a square matrix.
  * <p>The LUP-decomposition of a matrix A consists of three matrices
@@ -431,7 +433,7 @@
     private void checkDecomposed()
         throws IllegalStateException {
         if (lu == null) {
-            throw new IllegalStateException("no matrix have been decomposed yet");
+            throw MathRuntimeException.createIllegalStateException("no matrix have been decomposed
yet", null);
         }
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java
Sat Nov  8 12:42:55 2008
@@ -17,6 +17,8 @@
 
 package org.apache.commons.math.linear;
 
+import org.apache.commons.math.MathRuntimeException;
+
 /**
  * Calculates the QR-decomposition of a matrix.
  * <p>The QR-decomposition of a matrix A consists of two matrices Q and R
@@ -443,7 +445,7 @@
     private void checkDecomposed()
         throws IllegalStateException {
         if (qrt == null) {
-            throw new IllegalStateException("no matrix have been decomposed yet");
+            throw MathRuntimeException.createIllegalStateException("no matrix have been decomposed
yet", null);
         }
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RealMatrixImpl.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
Sat Nov  8 12:42:55 2008
@@ -18,6 +18,8 @@
 package org.apache.commons.math.linear;
 
 import java.io.Serializable;
+
+import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.util.MathUtils;
 
 
@@ -488,8 +490,13 @@
         }
 
         if (data == null) {
-            if ((row > 0) || (column > 0)) {
-                throw new IllegalStateException("matrix must be initialized to perform this
method");
+            if (row > 0) {
+                throw MathRuntimeException.createIllegalStateException("first {0} rows are
not initialized yet",
+                                                                       new Object[] { row
});
+            }
+            if (column > 0) {
+                throw MathRuntimeException.createIllegalStateException("first {0} columns
are not initialized yet",
+                                                                       new Object[] { column
});
             }
             data = new double[nRows][nCols];
             System.arraycopy(subMatrix, 0, data, 0, subMatrix.length);          

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
Sat Nov  8 12:42:55 2008
@@ -413,7 +413,8 @@
     public double getNextValue() throws IllegalStateException {
 
         if (!loaded) {
-            throw new IllegalStateException("distribution not loaded");
+            throw MathRuntimeException.createIllegalStateException("distribution not loaded",
+                                                                   null);
         }
 
         // Start with a uniformly distributed random number in (0,1)

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/ValueServer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/ValueServer.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/ValueServer.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/ValueServer.java
Sat Nov  8 12:42:55 2008
@@ -106,8 +106,18 @@
             case EXPONENTIAL_MODE: return getNextExponential();
             case GAUSSIAN_MODE: return getNextGaussian();
             case CONSTANT_MODE: return mu;
-            default: throw new IllegalStateException
-                       ("Bad mode: " + mode);
+            default: throw MathRuntimeException.createIllegalStateException("unknown mode
{0}, known modes: " +
+                                                                            "{1} ({2}), {3}
({4}), {5} ({6}), " +
+                                                                            "{7} ({8}), {9}
({10}) and {11} ({12})",
+                                                                            new Object[]
{
+                                                                                mode,
+                                                                                "DIGEST_MODE",
     DIGEST_MODE,
+                                                                                "REPLAY_MODE",
     REPLAY_MODE,
+                                                                                "UNIFORM_MODE",
    UNIFORM_MODE,
+                                                                                "EXPONENTIAL_MODE",
EXPONENTIAL_MODE,
+                                                                                "GAUSSIAN_MODE",
   GAUSSIAN_MODE,
+                                                                                "CONSTANT_MODE",
   CONSTANT_MODE
+                                                                            });
         }
     }
 
@@ -296,7 +306,7 @@
     private double getNextDigest() {
         if ((empiricalDistribution == null) ||
             (empiricalDistribution.getBinStats().size() == 0)) {
-            throw new IllegalStateException("Digest not initialized");
+            throw MathRuntimeException.createIllegalStateException("digest not initialized",
null);
         }
         return empiricalDistribution.getNextValue();
     }

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
Sat Nov  8 12:42:55 2008
@@ -20,6 +20,7 @@
 import java.util.Arrays;
 
 import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.linear.RealMatrix;
 import org.apache.commons.math.stat.descriptive.moment.GeometricMean;
 import org.apache.commons.math.stat.descriptive.moment.Mean;
@@ -609,8 +610,8 @@
      */
     private void checkEmpty() {
         if (n > 0) {
-            throw new IllegalStateException(
-                "Implementations must be configured before values are added.");
+            throw MathRuntimeException.createIllegalStateException("{0} values have been
added before statistic is configured",
+                                                                   new Object[] { n });
         }
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
Sat Nov  8 12:42:55 2008
@@ -18,6 +18,7 @@
 
 import java.io.Serializable;
 
+import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.stat.descriptive.moment.GeometricMean;
 import org.apache.commons.math.stat.descriptive.moment.Mean;
 import org.apache.commons.math.stat.descriptive.moment.SecondMoment;
@@ -599,7 +600,8 @@
      */
     private void checkEmpty() {
         if (n > 0) {
-            throw new IllegalStateException("Implementations must be configured before values
are added.");
+            throw MathRuntimeException.createIllegalStateException("{0} values have been
added before statistic is configured",
+                                                                   new Object[] { n });
         }
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
Sat Nov  8 12:42:55 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.math.stat.descriptive.moment;
 
+import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic;
 import org.apache.commons.math.stat.descriptive.summary.SumOfLogs;
@@ -152,8 +153,8 @@
      */
     private void checkEmpty() {
         if (getN() > 0) {
-            throw new IllegalStateException(
-                "Implementation must be configured before values are added.");
+            throw MathRuntimeException.createIllegalStateException("{0} values have been
added before statistic is configured",
+                                                                   new Object[] { getN()
});
         }
     }
 

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java?rev=712430&r1=712429&r2=712430&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
Sat Nov  8 12:42:55 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.math.stat.descriptive.moment;
 
+import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 
 /**
@@ -79,8 +80,9 @@
         if (incMoment) {
             moment.increment(d);
         }  else  {
-            throw new IllegalStateException
-            ("Statistics constructed from external moments cannot be incremented");
+            throw MathRuntimeException.createIllegalStateException("statistics constructed
from external " +
+                                                                   "moments cannot be incremented",
+                                                                   null);
         }
     }
 
@@ -111,8 +113,9 @@
         if (incMoment) {
             moment.clear();
         } else  {
-            throw new IllegalStateException
-                ("Statistics constructed from external moments cannot be cleared");
+            throw MathRuntimeException.createIllegalStateException("statistics constructed
from external " +
+                                                                   "moments cannot be cleared",
+                                                                   null);
         }
     }
 



Mime
View raw message