harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolay Kuznetsov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-271) HARMONY-39 java.util.regex.Pattern.split() method discards last trailing empty string
Date Wed, 29 Mar 2006 11:20:25 GMT
HARMONY-39 java.util.regex.Pattern.split() method discards last trailing empty string
-------------------------------------------------------------------------------------

         Key: HARMONY-271
         URL: http://issues.apache.org/jira/browse/HARMONY-271
     Project: Harmony
        Type: Bug
  Components: Classlib  
 Environment: Any
    Reporter: Nikolay Kuznetsov
    Priority: Minor


HARMONY-39 Pattern.split() method discards last trailing empty string when given pattern matches
last symbol of input character sequence.

The same problem appears if the input string is empty. JavaDoc says that if the expression
does not match any part of the input sequence then the resulting array has just one element,
namely this string. Thus in the case of empty input string one element array containing empty
string should be returned, however HARMONY-39 Pattern.split() returns empty array.

This problem also affects java.lang.String.split() method, because according to JavaDoc it
uses Pattern.split() method.

The following test demonstrates the problem:

",,".split(",", 3).length; //Resulted array will have two elements, while it should have three.



-- 
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


Mime
View raw message