You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tony Wu (JIRA)" <ji...@apache.org> on 2008/02/20 03:22:48 UTC
[jira] Resolved: (HARMONY-5460) [classlib][text] MessageFormat
regression at r612718
[ https://issues.apache.org/jira/browse/HARMONY-5460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Wu resolved HARMONY-5460.
------------------------------
Resolution: Fixed
Patch committed at r629320.
> [classlib][text] MessageFormat regression at r612718
> ----------------------------------------------------
>
> Key: HARMONY-5460
> URL: https://issues.apache.org/jira/browse/HARMONY-5460
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Sergey Dmitriev
> Assignee: Tony Wu
> Fix For: 5.0M5
>
> Attachments: Harmony-5460.diff
>
>
> The ICU commit r612718 brings a regression in. In particular parallel using of static method java.text.MessageFormat.format() leads to exception.
> Guess this is connected with non-synchronized usage of common code (static?).
> The failure is reproducible on multi-core system (8 cores, as well as 4 cores).
> [john@bigmac:~/tmp] cat icufail.java
> import java.text.MessageFormat;
> public class icufail {
> public static void main(String[] args) throws Exception {
> MyThread[] threads = {null, null, null, null};
> Object[] objs0 = {};
> Object[] objs1 = {"~/tmp/"};
> for (int i=0; i<threads.length; i++) {
> threads[i] = (i%2==0) ?
> new MyThread("hello", objs0) :
> new MyThread("file {0} is empty.", objs1);
> threads[i].start();
> }
> for (int i=0; i<threads.length; i++) {
> threads[i].join();
> }
> }
> static class MyThread extends Thread {
> String template = null;
> Object[] objs = null;
> public MyThread(String template, Object[] objs) {
> this.template = template;
> this.objs = objs;
> }
> public void run() {
> for (;;) {
> String res = MessageFormat.format(template, objs);
> }
> }
> }
> }
> [john@bigmac:~/tmp] time ~/j/harmony.r612717.ia32/bin/java icufail
> ^C
> real 3m26.445s
> user 11m9.465s
> sys 2m59.110s
> [john@bigmac:~/tmp] time ~/j/harmony.r612718.ia32/bin/java icufail
> Uncaught exception in Thread-14:
> java.lang.StringIndexOutOfBoundsException
> at java.lang.String.substring(String.java:1466)
> at com.ibm.icu.text.MessageFormat.subformat(MessageFormat.java:1744)
> at com.ibm.icu.text.MessageFormat.subformat(MessageFormat.java:1625)
> at com.ibm.icu.text.MessageFormat.format(MessageFormat.java:1124)
> at java.text.Format.format(Format.java:102)
> at java.text.MessageFormat.format(MessageFormat.java:454)
> at icufail$MyThread.run(icufail.java:33)
> Uncaught exception in Thread-15:
> java.lang.StringIndexOutOfBoundsException
> at java.lang.String.substring(String.java:1466)
> at com.ibm.icu.text.MessageFormat.subformat(MessageFormat.java:1744)
> at com.ibm.icu.text.MessageFormat.subformat(MessageFormat.java:1625)
> at com.ibm.icu.text.MessageFormat.format(MessageFormat.java:1124)
> at java.text.Format.format(Format.java:102)
> at java.text.MessageFormat.format(MessageFormat.java:454)
> at icufail$MyThread.run(icufail.java:33)
> Uncaught exception in Thread-16:
> java.lang.StringIndexOutOfBoundsException
> at java.lang.String.substring(String.java:1466)
> at com.ibm.icu.text.MessageFormat.subformat(MessageFormat.java:1744)
> at com.ibm.icu.text.MessageFormat.subformat(MessageFormat.java:1625)
> at com.ibm.icu.text.MessageFormat.format(MessageFormat.java:1124)
> at java.text.Format.format(Format.java:102)
> at java.text.MessageFormat.format(MessageFormat.java:454)
> at icufail$MyThread.run(icufail.java:33)
> ^C
> real 0m4.799s
> user 0m8.199s
> sys 0m0.216s
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.