The result of following is different in JDK1.5 and JDK6.
Scanner scanner = new Scanner("\n");
String result = scanner.findInLine("(?s).*");
System.out.print(result);
It seems that JDK6 does not work with embedded flag expression "(?s)".
I'm trying on Windows XP.
JDK1.5 (1.5.0_10-b03)
result : \n
JDK6 (j1.6.0-b105, 1.6.0_01-ea-b02)
result: null
The following example using Pettern and "(?s)" returns the
expected result on both JDK1.5 and JDK6, so it seems that
the behavior of Scanner class is changing.
Pattern pattern = Pattern.compile("(?s).*");
Matcher matcher = pattern.matcher("\n");
System.out.println(matcher.matches());
Scanner scanner = new Scanner("\n");
String result = scanner.findInLine("(?s).*");
System.out.print(result);
It seems that JDK6 does not work with embedded flag expression "(?s)".
I'm trying on Windows XP.
JDK1.5 (1.5.0_10-b03)
result : \n
JDK6 (j1.6.0-b105, 1.6.0_01-ea-b02)
result: null
The following example using Pettern and "(?s)" returns the
expected result on both JDK1.5 and JDK6, so it seems that
the behavior of Scanner class is changing.
Pattern pattern = Pattern.compile("(?s).*");
Matcher matcher = pattern.matcher("\n");
System.out.println(matcher.matches());
- relates to
-
JDK-6269946 Scanner.findInLine does not process empty lines correctly
-
- Resolved
-