commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r981244 - in /commons/proper/math/trunk/src/main: java/org/apache/commons/math/ java/org/apache/commons/math/linear/ java/org/apache/commons/math/util/ resources/META-INF/localization/
Date Sun, 01 Aug 2010 15:27:20 GMT
Author: luc
Date: Sun Aug  1 15:27:20 2010
New Revision: 981244

URL: http://svn.apache.org/viewvc?rev=981244&view=rev
Log:
Added a localized UnsupportedOperationException

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/MathRuntimeException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/MathRuntimeException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/MathRuntimeException.java?rev=981244&r1=981243&r2=981244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/MathRuntimeException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/MathRuntimeException.java
Sun Aug  1 15:27:20 2010
@@ -550,6 +550,36 @@ public class MathRuntimeException extend
     }
 
     /**
+     * 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}.
      * @param pattern format specifier

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java?rev=981244&r1=981243&r2=981244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
Sun Aug  1 15:27:20 2010
@@ -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
 
             /** {@inheritDoc} */
             public void remove() {
-                throw new UnsupportedOperationException("Not supported");
+                throw MathRuntimeException.createUnsupportedOperationException(LocalizedFormats.UNSUPPORTED_OPERATION);
             }
         };
     }
@@ -924,7 +924,7 @@ public abstract class AbstractRealVector
 
         /** {@inheritDoc} */
         public void remove() {
-            throw new UnsupportedOperationException("Not supported");
+            throw MathRuntimeException.createUnsupportedOperationException(LocalizedFormats.UNSUPPORTED_OPERATION);
         }
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java?rev=981244&r1=981243&r2=981244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
Sun Aug  1 15:27:20 2010
@@ -278,6 +278,7 @@ public enum LocalizedFormats implements 
     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}"),

Modified: commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties?rev=981244&r1=981243&r2=981244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
(original)
+++ commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
Sun Aug  1 15:27:20 2010
@@ -248,7 +248,8 @@ UNPARSEABLE_3D_VECTOR = vecteur 3D non a
 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



Mime
View raw message