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

Method stringifyComp(String comp) in class javax.naming.NameImpl works incorrectly

XMLWordPrintable

      Method stringifyComp(String comp) in class javax.naming.NameImpl works incorrectly when is executed with sequent escape "\" symbols.
      The attached test "StringifyCompTest.java" contains method stringifyComp(String comp), some fields and other methods used by stringifyComp from javax.naming.NameImpl class.

      The test gives stringifyComp some different strings.

      For input string "\\\#" we have output string "\\\\\#", that is TWO extra escape symbols "\".
      For input string "\\ TEST" we have output string "\\\ TEST", that is ONE extra escape symbol "\".

      This is weird that in one case we have one extra escape and in the other case we have two extra escapes. This looks like a bug in JDK.

      For input string "\<\>\;\=\#" we have output string "\<\>\;\=\#", that is NO extra escape symbols "\".

      Strange behavior.

            aefimov Aleksej Efimov
            kshefov Konstantin Shefov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: