diff --git a/src/main/java/org/apache/commons/math/MathRuntimeException.java b/src/main/java/org/apache/commons/math/MathRuntimeException.java
index ee4f6b443..581873086 100644
--- a/src/main/java/org/apache/commons/math/MathRuntimeException.java
+++ b/src/main/java/org/apache/commons/math/MathRuntimeException.java
@@ -549,6 +549,36 @@ public class MathRuntimeException extends RuntimeException {
};
}
+ /**
+ * Constructs a new UnsupportedOperationException
with specified formatted detail message.
+ * Message formatting is delegated to {@link java.text.MessageFormat}.
+ * @param pattern format specifier
+ * @param arguments format arguments
+ * @return built exception
+ * @since 2.2
+ */
+ public static UnsupportedOperationException createUnsupportedOperationException(final Localizable pattern,
+ final Object ... arguments) {
+ return new UnsupportedOperationException() {
+
+ /** Serializable version identifier. */
+ private static final long serialVersionUID = -4284649691002411505L;
+
+ /** {@inheritDoc} */
+ @Override
+ public String getMessage() {
+ return buildMessage(Locale.US, pattern, arguments);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getLocalizedMessage() {
+ return buildMessage(Locale.getDefault(), pattern, arguments);
+ }
+
+ };
+ }
+
/**
* Constructs a new NullPointerException
with specified formatted detail message.
* Message formatting is delegated to {@link java.text.MessageFormat}.
diff --git a/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java b/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
index 0c7443c4e..72f4aa177 100644
--- a/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
+++ b/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
@@ -23,8 +23,8 @@ import java.util.NoSuchElementException;
import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.analysis.BinaryFunction;
-import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.analysis.ComposableFunction;
+import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.util.LocalizedFormats;
/**
@@ -816,7 +816,7 @@ public abstract class AbstractRealVector implements RealVector {
/** {@inheritDoc} */
public void remove() {
- throw new UnsupportedOperationException("Not supported");
+ throw MathRuntimeException.createUnsupportedOperationException(LocalizedFormats.UNSUPPORTED_OPERATION);
}
};
}
@@ -924,7 +924,7 @@ public abstract class AbstractRealVector implements RealVector {
/** {@inheritDoc} */
public void remove() {
- throw new UnsupportedOperationException("Not supported");
+ throw MathRuntimeException.createUnsupportedOperationException(LocalizedFormats.UNSUPPORTED_OPERATION);
}
}
diff --git a/src/main/java/org/apache/commons/math/util/LocalizedFormats.java b/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
index ac150c5a6..ed1cca112 100644
--- a/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
+++ b/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
@@ -278,6 +278,7 @@ public enum LocalizedFormats implements Localizable {
UNPARSEABLE_FRACTION_NUMBER("unparseable fraction number: \"{0}\""),
UNPARSEABLE_REAL_VECTOR("unparseable real vector: \"{0}\""),
UNSUPPORTED_EXPANSION_MODE("unsupported expansion mode {0}, supported modes are {1} ({2}) and {3} ({4})"),
+ UNSUPPORTED_OPERATION("unsupported operation"),
URL_CONTAINS_NO_DATA("URL {0} contains no data"),
VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC("{0} values have been added before statistic is configured"),
VECTOR_LENGTH_MISMATCH("vector length mismatch: got {0} but expected {1}"),
diff --git a/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties b/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
index 9f046cd6d..025b7f44d 100644
--- a/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
+++ b/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
@@ -248,7 +248,8 @@ UNPARSEABLE_3D_VECTOR = vecteur 3D non analysable : "{0}"
UNPARSEABLE_COMPLEX_NUMBER = nombre complexe non analysable : "{0}"
UNPARSEABLE_FRACTION_NUMBER = nombre fractionnaire non analysable : "{0}"
UNPARSEABLE_REAL_VECTOR = vecteur r\u00e9el non analysable : "{0}"
-UNSUPPORTED_EXPANSION_MODE = mode d''extension {0} no support\u00e9, les modes support\u00e9s sont {1} ({2}) et {3} ({4})
+UNSUPPORTED_EXPANSION_MODE = mode d''extension {0} non support\u00e9, les modes support\u00e9s sont {1} ({2}) et {3} ({4})
+UNSUPPORTED_OPERATION = op\u00e9ration non disponible
URL_CONTAINS_NO_DATA = l''adresse {0} ne contient aucune donn\u00e9e
VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC = {0} valeurs ont \u00e9t\u00e9 ajout\u00e9es
VECTOR_LENGTH_MISMATCH = taille de vecteur invalide : {0} au lieu de {1} attendue