JDK6: scanner.findInLine() does not work with embedded flag expression "(?s)"

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • None
    • Affects Version/s: 6
    • Component/s: core-libs
    • None
    • x86
    • windows_xp

      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());

            Assignee:
            Xueming Shen
            Reporter:
            Masaki Katakai (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: