Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6564B6FC2 for ; Mon, 4 Jul 2011 06:57:52 +0000 (UTC) Received: (qmail 82365 invoked by uid 500); 4 Jul 2011 06:57:51 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 81992 invoked by uid 500); 4 Jul 2011 06:57:45 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 81975 invoked by uid 99); 4 Jul 2011 06:57:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2011 06:57:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2011 06:57:42 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id D7134444AFC for ; Mon, 4 Jul 2011 06:57:21 +0000 (UTC) Date: Mon, 4 Jul 2011 06:57:21 +0000 (UTC) From: "Joerg Schaible (JIRA)" To: issues@commons.apache.org Message-ID: <1722117789.1429.1309762641877.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <420056157.9725.1309553968607.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LANG-710) StringIndexOutOfBoundsException when calling unescapeHtml4("") MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059340#comment-13059340 ] Joerg Schaible commented on LANG-710: ------------------------------------- I am not sure whether this is really a good idea to accept this input silently. In the end it is an HTML syntax error. While a SIOOBE is not really helpful, a java.text.ParseException seems to me mkore appropriate. WDYT? > StringIndexOutOfBoundsException when calling unescapeHtml4("") > ------------------------------------------------------------------ > > 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 "" (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