commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <brit...@apache.org>
Subject Re: svn commit: r1568612 - in /commons/proper/lang/trunk/src: changes/ main/java/org/apache/commons/lang3/ main/java/org/apache/commons/lang3/text/translate/ test/java/org/apache/commons/lang3/
Date Tue, 18 Feb 2014 15:58:39 GMT
2014-02-18 16:28 GMT+01:00 Duncan Jones <djones@apache.org>:

> On 15 February 2014 10:35,  <britter@apache.org> wrote:
> > Author: britter
> > Date: Sat Feb 15 10:35:35 2014
> > New Revision: 1568612
> >
> > URL: http://svn.apache.org/r1568612
> > Log:
> > LANG-977: NumericEntityEscaper incorrectly encodes supplementary
> characters. Thanks to Chris Karcher.
>
>
> Chris isn't listed as a contributor in the POM file. Should we add him
> or is the "due-to" field replacing the need for that?
>

Well there are no absolute rules about this. But in this case we could add
him, I guess. I'll take care of this.

Thanks!


>
> - Duncan
>
>
>
> >
> > Modified:
> >     commons/proper/lang/trunk/src/changes/changes.xml
> >
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
> >
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
> >
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
> >
> > Modified: commons/proper/lang/trunk/src/changes/changes.xml
> > URL:
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/changes/changes.xml?rev=1568612&r1=1568611&r2=1568612&view=diff
> >
> ==============================================================================
> > --- commons/proper/lang/trunk/src/changes/changes.xml [utf-8] (original)
> > +++ commons/proper/lang/trunk/src/changes/changes.xml [utf-8] Sat Feb 15
> 10:35:35 2014
> > @@ -22,6 +22,7 @@
> >    <body>
> >
> >    <release version="3.3" date="TBA" description="Bugfix and Feature
> release">
> > +    <action issue="LANG-977" type="fix" dev="britter" due-to="Chris
> Karcher">NumericEntityEscaper incorrectly encodes supplementary
> characters</action>
> >      <action issue="LANG-973" type="fix" dev="sebb">Make some private
> fields final</action>
> >      <action issue="LANG-971" type="fix"
> dev="sebb">NumberUtils#isNumber(String) fails to reject invalid Octal
> numbers</action>
> >      <action issue="LANG-972" type="fix" dev="sebb">NumberUtils#isNumber
> does not allow for hex 0XABCD</action>
> >
> > Modified:
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java?rev=1568612&r1=1568611&r2=1568612&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
> (original)
> > +++
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
> Sat Feb 15 10:35:35 2014
> > @@ -185,7 +185,7 @@ public class StringEscapeUtils {
> >                  out.write(StringUtils.replace(input.toString(),
> CSV_QUOTE_STR, CSV_QUOTE_STR + CSV_QUOTE_STR));
> >                  out.write(CSV_QUOTE);
> >              }
> > -            return input.length();
> > +            return Character.codePointCount(input, 0, input.length());
> >          }
> >      }
> >
> > @@ -314,7 +314,7 @@ public class StringEscapeUtils {
> >
> >              if ( input.charAt(0) != CSV_QUOTE ||
> input.charAt(input.length() - 1) != CSV_QUOTE ) {
> >                  out.write(input.toString());
> > -                return input.length();
> > +                return Character.codePointCount(input, 0,
> input.length());
> >              }
> >
> >              // strip quotes
> > @@ -326,7 +326,7 @@ public class StringEscapeUtils {
> >              } else {
> >                  out.write(input.toString());
> >              }
> > -            return input.length();
> > +            return Character.codePointCount(input, 0, input.length());
> >          }
> >      }
> >
> >
> > Modified:
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java?rev=1568612&r1=1568611&r2=1568612&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
> (original)
> > +++
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
> Sat Feb 15 10:35:35 2014
> > @@ -89,10 +89,10 @@ public abstract class CharSequenceTransl
> >                  pos+= c.length;
> >                  continue;
> >              }
> > -//          // contract with translators is that they have to
> understand codepoints
> > -//          // and they just took care of a surrogate pair
> > +            // contract with translators is that they have to
> understand codepoints
> > +            // and they just took care of a surrogate pair
> >              for (int pt = 0; pt < consumed; pt++) {
> > -                pos += Character.charCount(Character.codePointAt(input,
> pt));
> > +                pos += Character.charCount(Character.codePointAt(input,
> pos));
> >              }
> >          }
> >      }
> >
> > Modified:
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java?rev=1568612&r1=1568611&r2=1568612&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
> (original)
> > +++
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
> Sat Feb 15 10:35:35 2014
> > @@ -348,6 +348,9 @@ public class StringEscapeUtilsTest {
> >
> >          assertEquals("Supplementary character must be represented using
> a single escape", "&#144308;",
> >                  escapeXml.translate("\uD84C\uDFB4"));
> > +
> > +        assertEquals("Supplementary characters mixed with basic
> characters should be encoded correctly", "a b c &#144308;",
> > +                        escapeXml.translate("a b c \uD84C\uDFB4"));
> >      }
> >
> >      @Test
> > @@ -377,6 +380,9 @@ public class StringEscapeUtilsTest {
> >      public void testUnescapeXmlSupplementaryCharacters() {
> >          assertEquals("Supplementary character must be represented using
> a single escape", "\uD84C\uDFB4",
> >                  StringEscapeUtils.unescapeXml("&#144308;") );
> > +
> > +        assertEquals("Supplementary characters mixed with basic
> characters should be decoded correctly", "a b c \uD84C\uDFB4",
> > +                StringEscapeUtils.unescapeXml("a b c &#144308;") );
> >      }
> >
> >      // Tests issue #38569
> > @@ -396,22 +402,24 @@ public class StringEscapeUtilsTest {
> >
> >      @Test
> >      public void testEscapeCsvString() throws Exception {
> > -        assertEquals("foo.bar",
>  StringEscapeUtils.escapeCsv("foo.bar"));
> > -        assertEquals("\"foo,bar\"",
>  StringEscapeUtils.escapeCsv("foo,bar"));
> > -        assertEquals("\"foo\nbar\"",
> StringEscapeUtils.escapeCsv("foo\nbar"));
> > -        assertEquals("\"foo\rbar\"",
> StringEscapeUtils.escapeCsv("foo\rbar"));
> > -        assertEquals("\"foo\"\"bar\"",
> StringEscapeUtils.escapeCsv("foo\"bar"));
> > +        assertEquals("foo.bar",
>  StringEscapeUtils.escapeCsv("foo.bar"));
> > +        assertEquals("\"foo,bar\"",
>  StringEscapeUtils.escapeCsv("foo,bar"));
> > +        assertEquals("\"foo\nbar\"",
> StringEscapeUtils.escapeCsv("foo\nbar"));
> > +        assertEquals("\"foo\rbar\"",
> StringEscapeUtils.escapeCsv("foo\rbar"));
> > +        assertEquals("\"foo\"\"bar\"",
> StringEscapeUtils.escapeCsv("foo\"bar"));
> > +        assertEquals("foo\uD84C\uDFB4bar",
> StringEscapeUtils.escapeCsv("foo\uD84C\uDFB4bar"));
> >          assertEquals("",   StringEscapeUtils.escapeCsv(""));
> >          assertEquals(null, StringEscapeUtils.escapeCsv(null));
> >      }
> >
> >      @Test
> >      public void testEscapeCsvWriter() throws Exception {
> > -        checkCsvEscapeWriter("foo.bar",        "foo.bar");
> > -        checkCsvEscapeWriter("\"foo,bar\"",    "foo,bar");
> > -        checkCsvEscapeWriter("\"foo\nbar\"",   "foo\nbar");
> > -        checkCsvEscapeWriter("\"foo\rbar\"",   "foo\rbar");
> > -        checkCsvEscapeWriter("\"foo\"\"bar\"", "foo\"bar");
> > +        checkCsvEscapeWriter("foo.bar",            "foo.bar");
> > +        checkCsvEscapeWriter("\"foo,bar\"",        "foo,bar");
> > +        checkCsvEscapeWriter("\"foo\nbar\"",       "foo\nbar");
> > +        checkCsvEscapeWriter("\"foo\rbar\"",       "foo\rbar");
> > +        checkCsvEscapeWriter("\"foo\"\"bar\"",     "foo\"bar");
> > +        checkCsvEscapeWriter("foo\uD84C\uDFB4bar",
> "foo\uD84C\uDFB4bar");
> >          checkCsvEscapeWriter("", null);
> >          checkCsvEscapeWriter("", "");
> >      }
> > @@ -428,11 +436,12 @@ public class StringEscapeUtilsTest {
> >
> >      @Test
> >      public void testUnescapeCsvString() throws Exception {
> > -        assertEquals("foo.bar",
>  StringEscapeUtils.unescapeCsv("foo.bar"));
> > -        assertEquals("foo,bar",
>  StringEscapeUtils.unescapeCsv("\"foo,bar\""));
> > -        assertEquals("foo\nbar",
> StringEscapeUtils.unescapeCsv("\"foo\nbar\""));
> > -        assertEquals("foo\rbar",
> StringEscapeUtils.unescapeCsv("\"foo\rbar\""));
> > -        assertEquals("foo\"bar",
> StringEscapeUtils.unescapeCsv("\"foo\"\"bar\""));
> > +        assertEquals("foo.bar",
>  StringEscapeUtils.unescapeCsv("foo.bar"));
> > +        assertEquals("foo,bar",
>  StringEscapeUtils.unescapeCsv("\"foo,bar\""));
> > +        assertEquals("foo\nbar",
> StringEscapeUtils.unescapeCsv("\"foo\nbar\""));
> > +        assertEquals("foo\rbar",
> StringEscapeUtils.unescapeCsv("\"foo\rbar\""));
> > +        assertEquals("foo\"bar",
> StringEscapeUtils.unescapeCsv("\"foo\"\"bar\""));
> > +        assertEquals("foo\uD84C\uDFB4bar",
> StringEscapeUtils.unescapeCsv("foo\uD84C\uDFB4bar"));
> >          assertEquals("",   StringEscapeUtils.unescapeCsv(""));
> >          assertEquals(null, StringEscapeUtils.unescapeCsv(null));
> >
> > @@ -441,11 +450,12 @@ public class StringEscapeUtilsTest {
> >
> >      @Test
> >      public void testUnescapeCsvWriter() throws Exception {
> > -        checkCsvUnescapeWriter("foo.bar",        "foo.bar");
> > -        checkCsvUnescapeWriter("foo,bar",    "\"foo,bar\"");
> > -        checkCsvUnescapeWriter("foo\nbar",   "\"foo\nbar\"");
> > -        checkCsvUnescapeWriter("foo\rbar",   "\"foo\rbar\"");
> > -        checkCsvUnescapeWriter("foo\"bar", "\"foo\"\"bar\"");
> > +        checkCsvUnescapeWriter("foo.bar",            "foo.bar");
> > +        checkCsvUnescapeWriter("foo,bar",            "\"foo,bar\"");
> > +        checkCsvUnescapeWriter("foo\nbar",           "\"foo\nbar\"");
> > +        checkCsvUnescapeWriter("foo\rbar",           "\"foo\rbar\"");
> > +        checkCsvUnescapeWriter("foo\"bar",           "\"foo\"\"bar\"");
> > +        checkCsvUnescapeWriter("foo\uD84C\uDFB4bar",
> "foo\uD84C\uDFB4bar");
> >          checkCsvUnescapeWriter("", null);
> >          checkCsvUnescapeWriter("", "");
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message