Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 401854898 for ; Thu, 7 Jul 2011 03:45:21 +0000 (UTC) Received: (qmail 84168 invoked by uid 500); 7 Jul 2011 03:45:08 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 84098 invoked by uid 500); 7 Jul 2011 03:44:50 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 84090 invoked by uid 99); 7 Jul 2011 03:44:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 03:44:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 03:44:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0270D23889B1 for ; Thu, 7 Jul 2011 03:44:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1143641 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java Date: Thu, 07 Jul 2011 03:44:22 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110707034423.0270D23889B1@eris.apache.org> Author: bayard Date: Thu Jul 7 03:44:22 2011 New Revision: 1143641 URL: http://svn.apache.org/viewvc?rev=1143641&view=rev Log: Making unescapeHtml _NOT_ escape unfinished numeric entities by default (it ignores them); however adding options that will fire an exception or unescape the numeric entity. LANG-710 Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java?rev=1143641&r1=1143640&r2=1143641&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaper.java Thu Jul 7 03:44:22 2011 @@ -18,6 +18,8 @@ package org.apache.commons.lang3.text.tr import java.io.IOException; import java.io.Writer; +import java.util.Arrays; +import java.util.EnumSet; /** * Translate XML numeric entities of the form &#[xX]?\d+;? to @@ -30,6 +32,41 @@ import java.io.Writer; */ public class NumericEntityUnescaper extends CharSequenceTranslator { + public static enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon } + + // TODO?: Create an OptionsSet class to hide some of the conditional logic below + private final EnumSet