Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8276694

Pattern trailing unescaped backslash causes internal error

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b05
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      Compiling a Regex Pattern with an unescaped trailing backslash causes an internal error:
      Pattern.compile("\\")

      Exception:
      Exception java.util.regex.PatternSyntaxException: Unexpected internal error near index 1

      ---

      This report is about the fact that an internal error is reported; it is not (like JDK-4783892) about the misunderstanding that backslashes need to be escaped.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Pattern.compile("\\")

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      An exception with a message saying something similar to:
      > Unescaped trailing backslash at index ...
      ACTUAL -
      Exception java.util.regex.PatternSyntaxException: Unexpected internal error near index 1

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igraves Ian Graves
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: