Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-710

StringIndexOutOfBoundsException when calling unescapeHtml4("&#03")

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0
    • Component/s: lang.*
    • 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)

      Description

      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)

        Attachments

          Activity

            People

            • Assignee:
              bayard Henri Yandell
              Reporter:
              benpicco Benjamin Valentin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: