harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Fedotov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-62) [classlib][text] java.text.BreakIterator.getSentenceInstance().next() treats '\n' as the end of the sentence
Date Sun, 03 Feb 2008 19:48:07 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-62?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565207#action_12565207
] 

Alexei Fedotov commented on HARMONY-62:
---------------------------------------

The bug http://bugs.icu-project.org/trac/ticket/4850 is marked as fixed in ICU database in
3.6 release, but our VM continues printing 14. What is the status of new ICU integration?

> [classlib][text] java.text.BreakIterator.getSentenceInstance().next() treats '\n' as
the end of the sentence
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-62
>                 URL: https://issues.apache.org/jira/browse/HARMONY-62
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: tatyana doubtsova
>         Attachments: getSentenceInstance_check.java
>
>
> Problem details:
> java.text.BreakIterator.getSentenceInstance().next() stops searching for the sentence
end, if the new-line character is found in the text and returns the index of the last seen
non white space character. Due to j2se 1.4.2 method next() should return the boundary following
the current boundary.
> Code for reproducing Test.java:
> import java.text.BreakIterator;
> public class Test {
>     public static void main(String [] args)
>     {
>     	BreakIterator it = BreakIterator.getSentenceInstance();
>     	it.setText("One sentence \n on two lines.");
>     	System.out.println(it.next());
>     }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
> 2. Compile Test.java using BEA 1.4 javac
> > javac -d . Test.java
> 3. 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.
> 14
> Output on BEA 1.4.2 to compare with:
> 28
> 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 void test_next() {
> 		// Regression test for HARMONY-30
> 		BreakIterator bi = BreakIterator.getWordInstance(Locale.US);
> 		bi.setText("This is the test, WordInstance");
> 		int n = bi.first();
> 		n = bi.next();
> 		assertEquals("Assert 0: next() returns incorrect value ", 4, n); 
> 		// Regression test for the current issue
> 	   	bi = BreakIterator.getSentenceInstance();
>     		bi.setText("One sentence \n on two lines.");
> 		n = bi.next();
> 		assertEquals("Assert 1: next() returns incorrect value ", 28, n);
> 	}
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message