re PR libgcj/2429 (java.text.MessageFormat should usefully set text on exceptions)

2004-01-14  Michael Koch  <konqueror@gmx.de>

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

From-SVN: r75877
This commit is contained in:
Michael Koch 2004-01-14 19:45:11 +00:00 committed by Michael Koch
parent 47f62b27c8
commit b3e5b4528d
2 changed files with 15 additions and 6 deletions

View 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.

View 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];