commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-710) StringIndexOutOfBoundsException when calling unescapeHtml4("&#03")
Date Wed, 06 Jul 2011 04:58:16 GMT

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

Henri Yandell commented on LANG-710:
------------------------------------

Agreed. I was thinking of the browser accepting it, but that's only really applicable to the
escape method and because browser's support weakly defined human input. An unescape method
should run on already escaped code, and that code should have been escaped properly.

I'll look into throwing a ParseException. 

> StringIndexOutOfBoundsException when calling unescapeHtml4("&#03")
> ------------------------------------------------------------------
>
>                 Key: LANG-710
>                 URL: https://issues.apache.org/jira/browse/LANG-710
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.0
>         Environment: java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
>            Reporter: Benjamin Valentin
>            Priority: Minor
>              Labels: StringEscapeUtils, StringUtils
>             Fix For: 3.0
>
>
> When calling unescapeHtml4() on the String "&#03" (or any String that contains these
characters) an Exception is thrown:
> Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out
of range: 4
> 	at java.lang.String.charAt(String.java:686)
> 	at org.apache.commons.lang3.text.translate.NumericEntityUnescaper.translate(NumericEntityUnescaper.java:49)
> 	at org.apache.commons.lang3.text.translate.AggregateTranslator.translate(AggregateTranslator.java:53)
> 	at org.apache.commons.lang3.text.translate.CharSequenceTranslator.translate(CharSequenceTranslator.java:88)
> 	at org.apache.commons.lang3.text.translate.CharSequenceTranslator.translate(CharSequenceTranslator.java:60)
> 	at org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4(StringEscapeUtils.java:351)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message