You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Jim Yu (JIRA)" <ji...@apache.org> on 2009/02/10 09:46:59 UTC
[jira] Created: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
[luni] java.util.Scanner behaves differently with RI while parsing specific pattern
------------------------------------------------------------------------------------
Key: HARMONY-6087
URL: https://issues.apache.org/jira/browse/HARMONY-6087
Project: Harmony
Issue Type: Bug
Components: Classlib
Affects Versions: 5.0M8
Reporter: Jim Yu
Fix For: 5.0M9
Here is a testcase, Scanner of Harmony behaves differently with RI
import java.util.Scanner;
import java.util.regex.Pattern;
public class SpecialPattern {
private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
public static void main(String[] args) {
Scanner scn = new Scanner(" *\n");
String found = scn.findInLine(pattern);
System.out.print(found);
}
}
Result of RI:
*
Result of Harmony:
null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-6087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison resolved HARMONY-6087.
----------------------------------
Resolution: Fixed
Thanks Jim,
Patch applied to LUNI module at repo revision r766655.
Please check it was applied as you expected.
> [luni] java.util.Scanner behaves differently with RI while parsing specific pattern
> ------------------------------------------------------------------------------------
>
> Key: HARMONY-6087
> URL: https://issues.apache.org/jira/browse/HARMONY-6087
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Jim Yu
> Assignee: Tim Ellison
> Fix For: 5.0M9
>
> Attachments: HARMONY-6087.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Here is a testcase, Scanner of Harmony behaves differently with RI
> import java.util.Scanner;
> import java.util.regex.Pattern;
> public class SpecialPattern {
> private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
> public static void main(String[] args) {
> Scanner scn = new Scanner(" *\n");
> String found = scn.findInLine(pattern);
> System.out.print(found);
> }
> }
> Result of RI:
> *
> Result of Harmony:
> null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-6087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison updated HARMONY-6087:
---------------------------------
Fix Version/s: (was: 5.0M9)
5.0M10
> [luni] java.util.Scanner behaves differently with RI while parsing specific pattern
> ------------------------------------------------------------------------------------
>
> Key: HARMONY-6087
> URL: https://issues.apache.org/jira/browse/HARMONY-6087
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Jim Yu
> Assignee: Tim Ellison
> Fix For: 5.0M10
>
> Attachments: HARMONY-6087.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Here is a testcase, Scanner of Harmony behaves differently with RI
> import java.util.Scanner;
> import java.util.regex.Pattern;
> public class SpecialPattern {
> private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
> public static void main(String[] args) {
> Scanner scn = new Scanner(" *\n");
> String found = scn.findInLine(pattern);
> System.out.print(found);
> }
> }
> Result of RI:
> *
> Result of Harmony:
> null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
Posted by "Jim Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-6087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12672241#action_12672241 ]
Jim Yu commented on HARMONY-6087:
---------------------------------
I looked into code and found the root cause why Harmony fails to find a match was that the
Scanner would ignore the next line terminator completely while trying to find a match. According
to the Spec for findInLine(Pattern) method, this method "Attempts to find the next occurrence of
the specified pattern ignoring delimiters." It seems our behavior of ignoring the delimiter complies
with the Spec. But for the specific pattern in this case which contains a special constructs'?='
which means a zero-width positive lookahead, RI's behavior indicates it didn't ignore the delimiter
completely. In fact, according to the testcase result, RI would take the delimiter into consideration
when it tries to find a match but exclude it in its match result. So it seems the Spec is obscure for
the meaning of "ignore". To ignore the delimiter at all even when scanning as Harmony does or just
ignore it in the match result ? RI's behavior indicates it means the later one.
I've attached a patch to follow RI's behavior.
> [luni] java.util.Scanner behaves differently with RI while parsing specific pattern
> ------------------------------------------------------------------------------------
>
> Key: HARMONY-6087
> URL: https://issues.apache.org/jira/browse/HARMONY-6087
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Jim Yu
> Fix For: 5.0M9
>
> Attachments: HARMONY-6087.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Here is a testcase, Scanner of Harmony behaves differently with RI
> import java.util.Scanner;
> import java.util.regex.Pattern;
> public class SpecialPattern {
> private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
> public static void main(String[] args) {
> Scanner scn = new Scanner(" *\n");
> String found = scn.findInLine(pattern);
> System.out.print(found);
> }
> }
> Result of RI:
> *
> Result of Harmony:
> null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
Posted by "Jim Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-6087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jim Yu updated HARMONY-6087:
----------------------------
Attachment: HARMONY-6087.diff
> [luni] java.util.Scanner behaves differently with RI while parsing specific pattern
> ------------------------------------------------------------------------------------
>
> Key: HARMONY-6087
> URL: https://issues.apache.org/jira/browse/HARMONY-6087
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Jim Yu
> Fix For: 5.0M9
>
> Attachments: HARMONY-6087.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Here is a testcase, Scanner of Harmony behaves differently with RI
> import java.util.Scanner;
> import java.util.regex.Pattern;
> public class SpecialPattern {
> private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
> public static void main(String[] args) {
> Scanner scn = new Scanner(" *\n");
> String found = scn.findInLine(pattern);
> System.out.print(found);
> }
> }
> Result of RI:
> *
> Result of Harmony:
> null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-6087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison reassigned HARMONY-6087:
------------------------------------
Assignee: Tim Ellison
> [luni] java.util.Scanner behaves differently with RI while parsing specific pattern
> ------------------------------------------------------------------------------------
>
> Key: HARMONY-6087
> URL: https://issues.apache.org/jira/browse/HARMONY-6087
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Jim Yu
> Assignee: Tim Ellison
> Fix For: 5.0M9
>
> Attachments: HARMONY-6087.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Here is a testcase, Scanner of Harmony behaves differently with RI
> import java.util.Scanner;
> import java.util.regex.Pattern;
> public class SpecialPattern {
> private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
> public static void main(String[] args) {
> Scanner scn = new Scanner(" *\n");
> String found = scn.findInLine(pattern);
> System.out.print(found);
> }
> }
> Result of RI:
> *
> Result of Harmony:
> null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-6087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison closed HARMONY-6087.
--------------------------------
> [luni] java.util.Scanner behaves differently with RI while parsing specific pattern
> ------------------------------------------------------------------------------------
>
> Key: HARMONY-6087
> URL: https://issues.apache.org/jira/browse/HARMONY-6087
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Jim Yu
> Assignee: Tim Ellison
> Fix For: 5.0M9
>
> Attachments: HARMONY-6087.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Here is a testcase, Scanner of Harmony behaves differently with RI
> import java.util.Scanner;
> import java.util.regex.Pattern;
> public class SpecialPattern {
> private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
> public static void main(String[] args) {
> Scanner scn = new Scanner(" *\n");
> String found = scn.findInLine(pattern);
> System.out.print(found);
> }
> }
> Result of RI:
> *
> Result of Harmony:
> null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-6087) [luni] java.util.Scanner behaves
differently with RI while parsing specific pattern
Posted by "Jim Yu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-6087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12701023#action_12701023 ]
Jim Yu commented on HARMONY-6087:
---------------------------------
Verified at r766950. Thanks, Tim.
> [luni] java.util.Scanner behaves differently with RI while parsing specific pattern
> ------------------------------------------------------------------------------------
>
> Key: HARMONY-6087
> URL: https://issues.apache.org/jira/browse/HARMONY-6087
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Jim Yu
> Assignee: Tim Ellison
> Fix For: 5.0M9
>
> Attachments: HARMONY-6087.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Here is a testcase, Scanner of Harmony behaves differently with RI
> import java.util.Scanner;
> import java.util.regex.Pattern;
> public class SpecialPattern {
> private static final Pattern pattern = Pattern.compile("^\\s*(?:\\*(?=[^/]))");
> public static void main(String[] args) {
> Scanner scn = new Scanner(" *\n");
> String found = scn.findInLine(pattern);
> System.out.print(found);
> }
> }
> Result of RI:
> *
> Result of Harmony:
> null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.