Author: luc
Date: Fri Jun 19 12:33:36 2009
New Revision: 786478
URL: http://svn.apache.org/viewvc?rev=786478&view=rev
Log:
added internal error generation for defensive programming
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java?rev=786478&r1=786477&r2=786478&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/MathRuntimeException.java
Fri Jun 19 12:33:36 2009
@@ -424,4 +424,28 @@
};
}
+ /** Create an {...@link java.lang.RuntimeException} for an internal error.
+ * @param cause underlying cause
+ * @return an {...@link java.lang.RuntimeException} for an internal error
+ */
+ public static RuntimeException createInternalError(final Throwable cause) {
+
+ final String pattern = "internal error, please fill a bug report at
{0}";
+ final String argument = "https://issues.apache.org/jira/browse/MATH";
+
+ return new RuntimeException(buildMessage(Locale.US, pattern,
argument)) {
+
+ /** Serializable version identifier. */
+ private static final long serialVersionUID = -201865440834027016L;
+
+ /** {...@inheritdoc} */
+ @Override
+ public String getLocalizedMessage() {
+ return buildMessage(Locale.getDefault(), pattern, argument);
+ }
+
+ };
+
+ }
+
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=786478&r1=786477&r2=786478&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
Fri Jun 19 12:33:36 2009
@@ -228,11 +228,19 @@
{ "unable to bracket optimum in line search",
"impossible d''encadrer l''optimum lors de la recherche lin\u00e9aire" },
- // org.apache.commons.math.optimization.linear2.NoFeasibleSolutionException
+ // org.apache.commons.math.optimization.fitting.HarmonicCoefficientsGuesser
+ { "unable to first guess the harmonic coefficients",
+ "impossible de faire une premi\u00e8re estimation des coefficients
harmoniques" },
+
+ // org.apache.commons.math.optimization.fitting.HarmonicCoefficientsGuesser
+ { "sample contains {0} observed points, at least {1} are required",
+ "l''\u00e9chantillon ne contient que {0} points alors qu''au moins {1}
sont n\u00e9cessaires" },
+
+ // org.apache.commons.math.optimization.linear.NoFeasibleSolutionException
{ "no feasible solution",
"aucune solution r\u00e9alisable" },
- // org.apache.commons.math.optimization.linear2.UnboundedSolutionException
+ // org.apache.commons.math.optimization.linear.UnboundedSolutionException
{ "unbounded solution",
"solution non born\u00e9e" },
@@ -275,10 +283,9 @@
{ "too small integration interval: length = {0}",
"intervalle d''int\u00e9gration trop petit : {0}" },
- // org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegrator
- // org.apache.commons.math.ode.nonstiff.AdamsMoultonIntegrator
- { "{0} is supported only for orders 2 or more",
- "la m\u00e9thode {0} n''est disponible que pour les ordres 2 ou plus" },
+ // org.apache.commons.math.ode.MultistepIntegrator
+ { "{0} is supported only for 2 points or more",
+ "la m\u00e9thode {0} n''est disponible que pour 2 points ou plus" },
// org.apache.commons.math.ode.stiff.BDFIntegrator
{ "unsupported order {0} for BDF methods, must be between {1} and {2}",
@@ -806,7 +813,11 @@
{ "map has been modified while iterating",
"la table d''adressage a \u00e9t\u00e9 modifi\u00e9e pendant
l''it\u00e9ration" },
{ "iterator exhausted",
- "it\u00e9ration achev\u00e9e" }
+ "it\u00e9ration achev\u00e9e" },
+
+ // org.apache.commons.math.MathRuntimeException
+ { "internal error, please fill a bug report at {0}",
+ "erreur interne, veuillez signaler l''erreur \u00e0 {0}" }
};