Test for [LANG-720] StringEscapeUtils.escapeXml(input) outputs wrong results when an input contains characters in Supplementary Planes. [LANG-708] StringEscapeUtils.escapeEcmaScript from lang3 cuts off long unicode string.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1147212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4c2ae062ff
commit
c04611f260
|
@ -24,3 +24,4 @@
|
|||
repository=${user.home}/.m2/repository
|
||||
junit.home=${repository}/junit/junit/4.7/
|
||||
easymock.home=${repository}/org/easymock/easymock/2.5.2/
|
||||
commons-io.home=${repository}/commons-io/commons-io/2.0.1/
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<pathelement location="${build.home}/tests"/>
|
||||
<pathelement location="${junit.jar}"/>
|
||||
<pathelement location="${easymock.jar}"/>
|
||||
<pathelement location="${commons-io.jar}"/>
|
||||
</path>
|
||||
|
||||
<!-- ========== Executable Targets ======================================== -->
|
||||
|
|
|
@ -23,6 +23,9 @@ junit.jar = ${junit.home}/junit-4.7.jar
|
|||
# The location of the Easymock jar
|
||||
easymock.jar = ${easymock.home}/easymock-2.5.2.jar
|
||||
|
||||
# The location of the Commons-IO jar
|
||||
commons-io.jar = ${commons-io.home}/commons-io-2.0.1.jar
|
||||
|
||||
# Whether or not to fork tests
|
||||
junit.fork = true
|
||||
|
||||
|
|
7
pom.xml
7
pom.xml
|
@ -424,6 +424,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<body>
|
||||
|
||||
<release version="3.0" date="Unreleased" description="Backwards incompatible update of Commons Lang to Java 5">
|
||||
<action type="fix" issue="LANG-720">StringEscapeUtils.escapeXml(input) outputs wrong results when an input contains characters in Supplementary Planes.</action>
|
||||
<action type="update" issue="LANG-718">build.xml Java 1.5+ updates.</action>
|
||||
<action type="fix" issue="LANG-716">swapCase and *capitalize speedups.</action>
|
||||
<action type="fix" issue="LANG-715">CharSetUtils.squeeze() speedup.</action>
|
||||
|
@ -29,6 +30,7 @@
|
|||
<action type="update" issue="LANG-713">Increase test coverage of FieldUtils read methods and tweak javadoc</action>
|
||||
<action type="fix" issue="LANG-711">Add includeantruntime=false to javac targets to quell warnings in ant 1.8.1 and better (and modest performance gain).</action>
|
||||
<action type="fix" issue="LANG-710">StringIndexOutOfBoundsException when calling unescapeHtml4("&#03")</action>
|
||||
<action type="fix" issue="LANG-708">StringEscapeUtils.escapeEcmaScript from lang3 cuts off long unicode string</action>
|
||||
<action type="fix" issue="LANG-703">StringUtils.join throws NPE when toString returns null for one of objects in collection</action>
|
||||
<action type="add" issue="LANG-697">Add FormattableUtils class</action>
|
||||
<action type="add">Add ClassUtils.getSimpleName() methods</action>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.commons.lang3;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Constructor;
|
||||
|
@ -23,6 +24,8 @@ import java.lang.reflect.Modifier;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link StringEscapeUtils}.
|
||||
*
|
||||
|
@ -390,7 +393,11 @@ public class StringEscapeUtilsTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
// https://issues.apache.org/jira/browse/LANG-480
|
||||
/**
|
||||
* Tests // https://issues.apache.org/jira/browse/LANG-480
|
||||
*
|
||||
* @throws java.io.UnsupportedEncodingException
|
||||
*/
|
||||
public void testEscapeHtmlHighUnicode() throws java.io.UnsupportedEncodingException {
|
||||
// this is the utf8 representation of the character:
|
||||
// COUNTING ROD UNIT DIGIT THREE
|
||||
|
@ -411,7 +418,9 @@ public class StringEscapeUtilsTest extends TestCase {
|
|||
// assertEquals( "High unicode should have been unescaped", original, unescapedFromEntity);
|
||||
}
|
||||
|
||||
// https://issues.apache.org/jira/browse/LANG-339
|
||||
/**
|
||||
* Tests https://issues.apache.org/jira/browse/LANG-339
|
||||
*/
|
||||
public void testEscapeHiragana() {
|
||||
// Some random Japanese unicode characters
|
||||
String original = "\u304B\u304C\u3068";
|
||||
|
@ -424,7 +433,24 @@ public class StringEscapeUtilsTest extends TestCase {
|
|||
assertEquals( "Hiragana character unicode behaviour has changed - expected no unescaping", escaped, unescaped);
|
||||
}
|
||||
|
||||
// https://issues.apache.org/jira/browse/LANG-720
|
||||
/**
|
||||
* Tests https://issues.apache.org/jira/browse/LANG-708
|
||||
*
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
*/
|
||||
public void testLang708() throws IOException {
|
||||
String input = IOUtils.toString(new FileInputStream("src/test/resources/lang-708-input.txt"), "UTF-8");
|
||||
String escaped = StringEscapeUtils.escapeEcmaScript(input);
|
||||
// just the end:
|
||||
assertTrue(escaped, escaped.endsWith("}]"));
|
||||
// a little more:
|
||||
assertTrue(escaped, escaped.endsWith("\"valueCode\\\":\\\"\\\"}]"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests https://issues.apache.org/jira/browse/LANG-720
|
||||
*/
|
||||
public void testLang720() {
|
||||
String input = new StringBuilder("\ud842\udfb7").append("A").toString();
|
||||
String escaped = StringEscapeUtils.escapeXml(input);
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue