You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2013/10/24 22:56:06 UTC
[jira] [Closed] (LANG-917) Exception when combining custom and
choice format in ExtendedMessageFormat
[ https://issues.apache.org/jira/browse/LANG-917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed LANG-917.
------------------------------
Resolution: Fixed
svn ci -m "Applying Thomas' patch from LANG-917 - fixing Arne Burmeister's reported exception when combining custom and choice formats"
Sending src/changes/changes.xml
Sending src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
Sending src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java
Transmitting file data ...
Committed revision 1535547.
> Exception when combining custom and choice format in ExtendedMessageFormat
> --------------------------------------------------------------------------
>
> Key: LANG-917
> URL: https://issues.apache.org/jira/browse/LANG-917
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.text.*
> Affects Versions: 2.5, 2.6
> Reporter: Arne Burmeister
> Labels: patch
> Fix For: 3.2
>
> Attachments: ExtendedMessageFormatTest.java, LANG-917.patch
>
>
> 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(ArrayList.java:604)
> at java.util.ArrayList.get(ArrayList.java:382)
> at org.apache.commons.lang.text.ExtendedMessageFormat.insertFormats(ExtendedMessageFormat.java:364)
> at org.apache.commons.lang.text.ExtendedMessageFormat.applyPattern(ExtendedMessageFormat.java:192)
> at org.apache.commons.lang.text.ExtendedMessageFormat.<init>(ExtendedMessageFormat.java:127)
> {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 was sent by Atlassian JIRA
(v6.1#6144)