Commit b3e5b452 by Michael Koch Committed by Michael Koch

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
parent 47f62b27
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> 2004-01-13 Fernando Nasser <fnasser@redhat.com>
* java/awt/EventQueue.java (isDispatchThread): Do check on top of stack. * java/awt/EventQueue.java (isDispatchThread): Do check on top of stack.
......
...@@ -170,7 +170,7 @@ public class MessageFormat extends Format ...@@ -170,7 +170,7 @@ public class MessageFormat extends Format
else if (c == '{') else if (c == '{')
break; break;
else if (c == '}') else if (c == '}')
throw new IllegalArgumentException (); throw new IllegalArgumentException("Found '}' without '{'");
else else
buffer.append(c); buffer.append(c);
} }
...@@ -245,7 +245,7 @@ public class MessageFormat extends Format ...@@ -245,7 +245,7 @@ public class MessageFormat extends Format
} }
catch (NumberFormatException nfx) catch (NumberFormatException nfx)
{ {
throw new IllegalArgumentException (); throw new IllegalArgumentException("Failed to parse integer string");
} }
// Extract the element format. // Extract the element format.
...@@ -264,7 +264,7 @@ public class MessageFormat extends Format ...@@ -264,7 +264,7 @@ public class MessageFormat extends Format
// Advance past the last terminator. // Advance past the last terminator.
if (index >= max || pat.charAt(index) != '}') if (index >= max || pat.charAt(index) != '}')
throw new IllegalArgumentException (); throw new IllegalArgumentException("Missing '}' at end of message format");
++index; ++index;
// Now fetch trailing string. // Now fetch trailing string.
...@@ -349,7 +349,8 @@ public class MessageFormat extends Format ...@@ -349,7 +349,8 @@ public class MessageFormat extends Format
for (int i = 0; i < elements.length; ++i) for (int i = 0; i < elements.length; ++i)
{ {
if (elements[i].argNumber >= arguments.length) if (elements[i].argNumber >= arguments.length)
throw new IllegalArgumentException (); throw new IllegalArgumentException("Not enough arguments given");
Object thisArg = arguments[elements[i].argNumber]; Object thisArg = arguments[elements[i].argNumber];
Format formatter = null; Format formatter = null;
...@@ -359,7 +360,8 @@ public class MessageFormat extends Format ...@@ -359,7 +360,8 @@ public class MessageFormat extends Format
{ {
if (elements[i].formatClass != null if (elements[i].formatClass != null
&& ! elements[i].formatClass.isInstance(thisArg)) && ! elements[i].formatClass.isInstance(thisArg))
throw new IllegalArgumentException (); throw new IllegalArgumentException("Wrong format class");
formatter = elements[i].format; formatter = elements[i].format;
} }
else if (thisArg instanceof Number) else if (thisArg instanceof Number)
...@@ -596,7 +598,8 @@ public class MessageFormat extends Format ...@@ -596,7 +598,8 @@ public class MessageFormat extends Format
public void setFormats (Format[] newFormats) public void setFormats (Format[] newFormats)
{ {
if (newFormats.length < elements.length) if (newFormats.length < elements.length)
throw new IllegalArgumentException (); throw new IllegalArgumentException("Not enough format objects");
int len = Math.min(newFormats.length, elements.length); int len = Math.min(newFormats.length, elements.length);
for (int i = 0; i < len; ++i) for (int i = 0; i < len; ++i)
elements[i].setFormat = newFormats[i]; elements[i].setFormat = newFormats[i];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment