]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libgcj/2429 (java.text.MessageFormat should usefully set text on exceptions)
authorMichael Koch <konqueror@gmx.de>
Wed, 14 Jan 2004 19:45:11 +0000 (19:45 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Wed, 14 Jan 2004 19:45:11 +0000 (19:45 +0000)
2004-01-14  Michael Koch  <konqueror@gmx.de>

* java/text/MessageFormat.java:
Added descriptions to exceptions.
This fixes PR libgcj/2429.

From-SVN: r75877

libjava/ChangeLog
libjava/java/text/MessageFormat.java

index b771b1f69a0e7185fefaf6548d5b9d89f98e510c..6481570d7e1dcbc9a4d14324526901c165aae5fa 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-14  Michael Koch  <konqueror@gmx.de>
+
+       * java/text/MessageFormat.java:
+       Added descriptions to exceptions.
+       This fixes PR libgcj/2429.
+
 2004-01-13  Fernando Nasser  <fnasser@redhat.com>
 
        * java/awt/EventQueue.java (isDispatchThread): Do check on top of stack.
index e34fe2c89d1bd2beaab503e0e67c86c137d2b1e0..7bb7760c90e0973bd002edac0e0aa3b5e26c9fa5 100644 (file)
@@ -170,7 +170,7 @@ public class MessageFormat extends Format
        else if (c == '{')
          break;
        else if (c == '}')
-         throw new IllegalArgumentException ();
+         throw new IllegalArgumentException("Found '}' without '{'");
        else
          buffer.append(c);
       }
@@ -245,7 +245,7 @@ public class MessageFormat extends Format
       }
     catch (NumberFormatException nfx)
       {
-       throw new IllegalArgumentException ();
+       throw new IllegalArgumentException("Failed to parse integer string");
       }
 
     // Extract the element format.
@@ -264,7 +264,7 @@ public class MessageFormat extends Format
 
     // Advance past the last terminator.
     if (index >= max || pat.charAt(index) != '}')
-      throw new IllegalArgumentException ();
+      throw new IllegalArgumentException("Missing '}' at end of message format");
     ++index;
 
     // Now fetch trailing string.
@@ -349,7 +349,8 @@ public class MessageFormat extends Format
     for (int i = 0; i < elements.length; ++i)
       {
        if (elements[i].argNumber >= arguments.length)
-         throw new IllegalArgumentException ();
+         throw new IllegalArgumentException("Not enough arguments given");
+
        Object thisArg = arguments[elements[i].argNumber];
 
        Format formatter = null;
@@ -359,7 +360,8 @@ public class MessageFormat extends Format
          {
            if (elements[i].formatClass != null
                && ! elements[i].formatClass.isInstance(thisArg))
-             throw new IllegalArgumentException ();
+             throw new IllegalArgumentException("Wrong format class");
+           
            formatter = elements[i].format;
          }
        else if (thisArg instanceof Number)
@@ -596,7 +598,8 @@ public class MessageFormat extends Format
   public void setFormats (Format[] newFormats)
   {
     if (newFormats.length < elements.length)
-      throw new IllegalArgumentException ();
+      throw new IllegalArgumentException("Not enough format objects");
+
     int len = Math.min(newFormats.length, elements.length);
     for (int i = 0; i < len; ++i)
       elements[i].setFormat = newFormats[i];