Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 3003 invoked from network); 25 Jun 2009 03:55:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Jun 2009 03:55:33 -0000 Received: (qmail 67257 invoked by uid 500); 25 Jun 2009 03:55:43 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 67151 invoked by uid 500); 25 Jun 2009 03:55:43 -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 67142 invoked by uid 99); 25 Jun 2009 03:55:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jun 2009 03:55:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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, 25 Jun 2009 03:55:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 29A2623888EA; Thu, 25 Jun 2009 03:55:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r788245 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java Date: Thu, 25 Jun 2009 03:55:19 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090625035519.29A2623888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bayard Date: Thu Jun 25 03:55:18 2009 New Revision: 788245 URL: http://svn.apache.org/viewvc?rev=788245&view=rev Log: Updating ESCAPE_JAVA to use the new .with() approach and to fold the two unicode escape methods into one. Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java?rev=788245&r1=788244&r2=788245&view=diff ============================================================================== --- commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java (original) +++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/translate/EscapeUtils.java Thu Jun 25 03:55:18 2009 @@ -30,15 +30,21 @@ public class EscapeUtils { public static final CharSequenceTranslator ESCAPE_JAVA = - new AggregateTranslator( - new LookupTranslator( - new String[][] { - {"\"", "\\\""}, - {"\\", "\\\\"} - }), - new EscapeLowAsciiAsUnicode(), - new EscapeNonAsciiAsUnicode() - ); + new LookupTranslator( + new String[][] { + {"\"", "\\\""}, + {"\\", "\\\\"}, + }).with( + new LookupTranslator( + new String[][] { + {"\b", "\\b"}, + {"\n", "\\n"}, + {"\t", "\\t"}, + {"\f", "\\f"}, + {"\r", "\\r"} + }).with( + UnicodeEscaper.outsideOf(32, 0x7f) + )); public static final String escapeJava(String input) { return ESCAPE_JAVA.translate(input);