Added a localized UnsupportedOperationException
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@981244 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2431890261
commit
972ab8b3b2
|
@ -549,6 +549,36 @@ public class MathRuntimeException extends RuntimeException {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>UnsupportedOperationException</code> 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 <code>NullPointerException</code> with specified formatted detail message.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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}"),
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue