You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2013/04/30 09:02:16 UTC

[jira] [Commented] (LANG-885) Apache commons StringEscapeUtils.unescapeJava(“\\”) returns “”

    [ https://issues.apache.org/jira/browse/LANG-885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13645332#comment-13645332 ] 

Henri Yandell commented on LANG-885:
------------------------------------

Note that we do have a TODO statement:

// TODO: throw "illegal character: \92" as an Exception if a \ on the end of the Java (as per the compiler)?
                
> Apache commons StringEscapeUtils.unescapeJava(“\\”) returns “”
> --------------------------------------------------------------
>
>                 Key: LANG-885
>                 URL: https://issues.apache.org/jira/browse/LANG-885
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.1
>         Environment: Linux 3.2.0-40-generic-pae #64-Ubuntu SMP i686 athlon i386 GNU/Linux
>            Reporter: Menelaos Perdikeas
>            Priority: Minor
>
> The following code:
> {code:title=foo.java|borderStyle=solid}
> final String INVALID_ESCAPE="\\";
> System.out.println(String.format("'%s' -> '%s'", INVALID_ESCAPE, 
>     StringEscapeUtils.unescapeJava(INVALID_ESCAPE)));
> {code}
> ... produces:
> '\' -> ''
> on the console. Since '\' is not a valid escape I would expect an Exception at runtime. Am I missing anything?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira