+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.
else if (c == '{')
break;
else if (c == '}')
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException("Found '}' without '{'");
else
buffer.append(c);
}
}
catch (NumberFormatException nfx)
{
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException("Failed to parse integer string");
}
// Extract the element 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.
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;
{
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)
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];