java.text.BreakIterator.next ()  returns incorrect value
--------------------------------------------------------

         Key: HARMONY-30
         URL: http://issues.apache.org/jira/browse/HARMONY-30
     Project: Harmony
        Type: Bug
  Components: Classlib  
    Reporter: tatyana doubtsova
 Assigned to: Geir Magnusson Jr 


java.text.BreakIterator.next () returns incorrect value

Code for reproducing Test.java:
import java.text.BreakIterator;
import java.util.Locale;

public class Test {
        public static void main (String[] args) {
                BreakIterator bi = BreakIterator.getWordInstance(Locale.US);
                bi.setText("This is the test, WordInstance");
                int n = bi.first();
                System.out.println("bi.first() = " + n);
                n = bi.next();
                System.out.println("bi.next() = " + n);
        }
}

Steps to Reproduce:
1. Build Harmony-14 j2se subset as described in README.txt.
2. Compile Test.java using BEA 1.4 javac
> javac -d . Test.java
2. Run java using compatible VM (J9)
> java -showversion Test

Output:
java version 1.4.2 (subset)

(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
applicable.
bi.first() = 0
bi.next() = 30

Output on BEA 1.4.2 to compare with:
bi.first() = 0
bi.next() = 4

Suggested junit test case:
package org.apache.harmony.tests.java.text;

import java.text.BreakIterator;
import java.util.Locale;

import junit.framework.TestCase;

public class BreakIteratorTest extends TestCase {

    public static void main(String[] args) {
        junit.textui.TestRunner.run(BreakIteratorTest.class);
   }
    
    public void test_next() {
                BreakIterator bi = BreakIterator.getWordInstance(Locale.US);
                bi.setText("This is the test, WordInstance");
                int n = bi.first();
                n = bi.next();
                assertTrue("Assert 0: next() returns incorrect value " + n, n 
== 4 );
    }
}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to