You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2010/08/01 17:35:34 UTC

svn commit: r981247 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java

Author: luc
Date: Sun Aug  1 15:35:33 2010
New Revision: 981247

URL: http://svn.apache.org/viewvc?rev=981247&view=rev
Log:
added a getMessage(final Locale locale) to class MathIllegalArgumentException
similar to the ones from MathException and MathRuntimeException

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java?rev=981247&r1=981246&r2=981247&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java Sun Aug  1 15:35:33 2010
@@ -71,32 +71,35 @@ public class MathIllegalArgumentExceptio
         this(null, general, args);
     }
 
-    /** {@inheritDoc} */
-    @Override
-    public String getMessage() {
-        final StringBuilder sb = new StringBuilder();
+    /** Gets the message in a specified locale.
+    *
+    * @param locale Locale in which the message should be translated
+    *
+    * @return localized message
+    * @since 2.2
+    */
+   public String getMessage(final Locale locale) {
+       final StringBuilder sb = new StringBuilder();
+
+       if (specific != null) {
+           sb.append(MessageFactory.buildMessage(locale, specific, arguments));
+           sb.append(": ");
+       }
+       sb.append(MessageFactory.buildMessage(locale, general, arguments));
 
-        if (specific != null) {
-            sb.append(MessageFactory.buildMessage(Locale.US, specific, arguments));
-            sb.append(": ");
-        }
-        sb.append(MessageFactory.buildMessage(Locale.US, general, arguments));
+       return sb.toString();
+   }
 
-        return sb.toString();
+   /** {@inheritDoc} */
+    @Override
+    public String getMessage() {
+        return getMessage(Locale.US);
     }
 
     /** {@inheritDoc} */
     @Override
     public String getLocalizedMessage() {
-        final StringBuilder sb = new StringBuilder();
-
-        if (specific != null) {
-            sb.append(MessageFactory.buildMessage(Locale.getDefault(), specific, arguments));
-            sb.append(": ");
-        }
-        sb.append(MessageFactory.buildMessage(Locale.getDefault(), general, arguments));
-
-        return sb.toString();
+        return getMessage(Locale.getDefault());
     }
 
     /**