[kaffe] Bug: java/text/MessageFormat.java

Guilhem Lavaux guilhem at kaffe.org
Tue Jun 15 10:29:02 PDT 2004


Ito Kazumitsu wrote:
> Hi,

Hi Ito !

> 
> While testing an example that comes with VelocityStruts
> (http://jakarta.apache.org/velocity/tools/index.html),
> I found the following bug.
> 
> What the API document says:
> 
>   An argument is unavailable if arguments is null or has
>   fewer than argumentIndex+1 elements.
> 
> 
>     Subformat   Argument      Formatted Text
> 
>     any         unavailable   "{" + argumentIndex + "}"
> 
> What java/text/MessageFormat.java does:
> 
>     if (elements[i].argNumber >= arguments.length)
>       throw new IllegalArgumentException("Not enough arguments given");
> 
> And here is my patch.  I am afraid this patch is not strictly correct
> but I think it is better than nothing.
> 

Thanks. It may be also possible to put "if (arguments == null || 
elements[i].argNumber >= arguments.length)" as the doc says. We will 
have many unused comparisons but the code will behave correctly.

Cheers,

Guilhem.




More information about the kaffe mailing list