commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arne Burmeister (JIRA)" <>
Subject [jira] [Updated] (LANG-917) Exception when combining custom and choice format in ExtendedMessageFormat
Date Tue, 17 Sep 2013 08:07:03 GMT


Arne Burmeister updated LANG-917:

> Exception when combining custom and choice format in ExtendedMessageFormat
> --------------------------------------------------------------------------
>                 Key: LANG-917
>                 URL:
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.text.*
>    Affects Versions: 2.5, 2.6
>            Reporter: Arne Burmeister
>         Attachments:
> When using a custom format registered and a choice format with an inner format is used
in the same message format, an IndexOutOfBoundsException occurs in the custructor of ExtendedMessageFormat:
> {code:java}new ExtendedMessageFormat("Hi {0,test,any}, got {1,choice,0#none|1#one|1<{1,number}}",
Collections.singletonMap("test", new TestFormatFactory()));{code}
> {noformat}
> java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
> 	at java.util.ArrayList.rangeCheck(
> 	at java.util.ArrayList.get(
> 	at org.apache.commons.lang.text.ExtendedMessageFormat.insertFormats(
> 	at org.apache.commons.lang.text.ExtendedMessageFormat.applyPattern(
> 	at org.apache.commons.lang.text.ExtendedMessageFormat.<init>(
> {noformat}
> The problem occurs at the start of {{\{1,number\}}}.
> As a workaround i registered the {{TestFormatFactory}} also for "choice" and then returning
{{new ChoiceFormat(arguments)}}, but that is not the idea.
> I also checked the change logs, but there seems no change on this problem. I have not
tester, but I think the bug still is present in the current release.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message