[xom] Replace icu4j Normalizer with java.text.Normalizer from JDK

Mikolaj Izdebski mizdebsk at fedoraproject.org
Fri Jan 11 11:13:05 UTC 2013


commit 15d7036e1d9a3a23962e4d00d6d5ca5308810a54
Author: Mikolaj Izdebski <mizdebsk at redhat.com>
Date:   Mon Oct 8 23:00:21 2012 +0200

    Replace icu4j Normalizer with java.text.Normalizer from JDK

 xom-Replace-icu4j-with-JDK.patch |  125 ++++++++++++++++++++++++++++++++++++++
 xom-betterdocclasspath.patch     |    3 +-
 xom.spec                         |   13 +++-
 3 files changed, 135 insertions(+), 6 deletions(-)
---
diff --git a/xom-Replace-icu4j-with-JDK.patch b/xom-Replace-icu4j-with-JDK.patch
new file mode 100644
index 0000000..d15a088
--- /dev/null
+++ b/xom-Replace-icu4j-with-JDK.patch
@@ -0,0 +1,125 @@
+From 65729c231d312b791497ef98d941871c1d848c36 Mon Sep 17 00:00:00 2001
+From: Mikolaj Izdebski <mizdebsk at redhat.com>
+Date: Mon, 8 Oct 2012 22:26:01 +0200
+Subject: [PATCH] Replace icu4j with JDK
+
+---
+ src/nu/xom/TextWriter.java              | 10 +++++-----
+ src/nu/xom/tests/CanonicalizerTest.java |  6 +++---
+ src/nu/xom/tests/FastTests.java         |  1 -
+ src/nu/xom/tests/XOMTests.java          |  2 --
+ 4 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/src/nu/xom/TextWriter.java b/src/nu/xom/TextWriter.java
+index 46f8877..6107021 100644
+--- a/src/nu/xom/TextWriter.java
++++ b/src/nu/xom/TextWriter.java
+@@ -24,7 +24,7 @@ package nu.xom;
+ import java.io.IOException;
+ import java.io.Writer;
+ 
+-import com.ibm.icu.text.Normalizer;
++import java.text.Normalizer;
+ 
+ /**
+  * <p>
+@@ -415,7 +415,7 @@ abstract class TextWriter {
+     final void writePCDATA(String s) throws IOException {
+         
+         if (normalize) {
+-            s = Normalizer.normalize(s, Normalizer.NFC);   
++            s = Normalizer.normalize(s, Normalizer.Form.NFC);   
+         }
+         int length = s.length();
+         for (int i=0; i < length; i++) {
+@@ -429,7 +429,7 @@ abstract class TextWriter {
+       throws IOException {
+         
+         if (normalize) {
+-            s = Normalizer.normalize(s, Normalizer.NFC);   
++            s = Normalizer.normalize(s, Normalizer.Form.NFC);   
+         }
+         int length = s.length();
+         for (int i=0; i < length; i++) {
+@@ -442,7 +442,7 @@ abstract class TextWriter {
+     final void writeMarkup(String s) throws IOException {
+         
+         if (normalize) {
+-            s = Normalizer.normalize(s, Normalizer.NFC);   
++            s = Normalizer.normalize(s, Normalizer.Form.NFC);   
+         }
+         int length = s.length();
+         for (int i=0; i < length; i++) {
+@@ -667,4 +667,4 @@ abstract class TextWriter {
+     }
+ 
+     
+-}
+\ No newline at end of file
++}
+diff --git a/src/nu/xom/tests/CanonicalizerTest.java b/src/nu/xom/tests/CanonicalizerTest.java
+index 9de4d50..e0df901 100644
+--- a/src/nu/xom/tests/CanonicalizerTest.java
++++ b/src/nu/xom/tests/CanonicalizerTest.java
+@@ -31,7 +31,7 @@ import java.io.FilenameFilter;
+ import java.io.IOException;
+ import java.io.InputStream;
+ 
+-import com.ibm.icu.text.Normalizer;
++import java.text.Normalizer;
+ 
+ import nu.xom.Attribute;
+ import nu.xom.Builder;
+@@ -361,7 +361,7 @@ public class CanonicalizerTest extends XOMTestCase {
+         InputStream in = new ByteArrayInputStream(data);
+         Document doc = builder.build(in);
+         String rawResult = doc.getValue();
+-        String normalizedResult = Normalizer.normalize(rawResult, Normalizer.NFC);
++        String normalizedResult = Normalizer.normalize(rawResult, Normalizer.Form.NFC);
+         assertEquals("Parser doesn't use NFC when converting from " + encoding, 
+           normalizedResult, rawResult);
+         
+@@ -390,7 +390,7 @@ public class CanonicalizerTest extends XOMTestCase {
+         InputStream in = new ByteArrayInputStream(data);
+         Document doc = builder.build(in);
+         String rawResult = doc.getValue();
+-        String normalizedResult = Normalizer.normalize(rawResult, Normalizer.NFC);
++        String normalizedResult = Normalizer.normalize(rawResult, Normalizer.Form.NFC);
+         assertEquals("Parser doesn't use NFC when converting from " + encoding, 
+           normalizedResult, rawResult);
+         
+diff --git a/src/nu/xom/tests/FastTests.java b/src/nu/xom/tests/FastTests.java
+index a1ae5fe..a8ce239 100644
+--- a/src/nu/xom/tests/FastTests.java
++++ b/src/nu/xom/tests/FastTests.java
+@@ -45,7 +45,6 @@ public class FastTests extends TestCase {
+ 
+     public static Test suite() {
+         TestSuite result = new TestSuite();
+-        result.addTest(new TestSuite(VerifierTest.class));
+         result.addTest(new TestSuite(SubclassTest.class));
+         result.addTest(new TestSuite(NodeFactoryTest.class));
+         result.addTest(new TestSuite(ParentNodeTest.class));
+diff --git a/src/nu/xom/tests/XOMTests.java b/src/nu/xom/tests/XOMTests.java
+index 246a31e..b17eea1 100644
+--- a/src/nu/xom/tests/XOMTests.java
++++ b/src/nu/xom/tests/XOMTests.java
+@@ -46,7 +46,6 @@ public class XOMTests extends TestCase {
+     
+     public static Test suite() {
+         TestSuite result = new TestSuite();
+-        result.addTest(new TestSuite(VerifierTest.class));
+         result.addTest(new TestSuite(SubclassTest.class));
+         result.addTest(new TestSuite(NodeFactoryTest.class));
+         result.addTest(new TestSuite(ParentNodeTest.class));
+@@ -82,7 +81,6 @@ public class XOMTests extends TestCase {
+         result.addTest(new TestSuite(BaseURITest.class));
+         result.addTest(new TestSuite(TextTest.class));
+         result.addTest(new TestSuite(XSLTransformTest.class));
+-        result.addTest(new TestSuite(EncodingTest.class));
+         return result;
+     }
+ 
+-- 
+1.7.11.4
+
diff --git a/xom-betterdocclasspath.patch b/xom-betterdocclasspath.patch
index 9a55dbd..fdc96a5 100644
--- a/xom-betterdocclasspath.patch
+++ b/xom-betterdocclasspath.patch
@@ -1,13 +1,12 @@
 --- build.xml.orig	2007-02-14 17:22:32.000000000 -0500
 +++ build.xml	2007-02-14 17:22:36.000000000 -0500
-@@ -368,7 +368,11 @@
+@@ -368,7 +368,10 @@
             encoding="UTF-8"
             includes="nu/xom/tools/*">
        <classpath>
 -        <pathelement path="${compile.class.path}"/>
 +        <pathelement location="${xml-apis.jar}"/>
 +        <pathelement location="${parser.jar}"/>
-+        <pathelement location="${normalizer.jar}"/>
 +        <pathelement location="${junit.jar}"/>
 +        <pathelement location="${servlet.jar}"/>
          <pathelement path="${tagsoup.jar}"/> 
diff --git a/xom.spec b/xom.spec
index 149f394..5fb5f08 100644
--- a/xom.spec
+++ b/xom.spec
@@ -36,7 +36,7 @@
 Summary:        XML Pull Parser
 Name:           xom
 Version:        1.0
-Release:        9%{?dist}
+Release:        10%{?dist}
 Epoch:          0
 License:        LGPLv2
 URL:            http://www.xom.nu
@@ -51,12 +51,13 @@ Patch0:         %{name}-gjdocissues.patch
 # I don't know if this is a libgcj bug or if this is a legitimate typo
 # in build.xml
 Patch1:         %{name}-betterdocclasspath.patch
+# Replace icu4j by java.text from JDK to reduce dependency chain
+Patch2:         %{name}-Replace-icu4j-with-JDK.patch
 
 BuildRequires:  ant >= 0:1.6, jpackage-utils >= 0:1.6
 BuildRequires:  junit
 BuildRequires:  xalan-j2
 BuildRequires:  xerces-j2
-BuildRequires:  icu4j
 %if %{with_dom4j}
 BuildRequires:  dom4j
 %endif
@@ -70,7 +71,6 @@ BuildRequires:  servlet
 
 Requires:  xalan-j2
 Requires:  xerces-j2
-Requires:  icu4j
 Requires:  xml-commons-apis
 Requires:  jpackage-utils
 BuildArch: noarch
@@ -105,15 +105,17 @@ Requires:       %{name} = 0:%{version}
 %setup -q -n XOM
 %patch0
 %patch1
+%patch2 -p1
 # remove all binary libs
 find . -name "*.jar" -exec rm -f {} \;
+# disable tests that require icu4j
+rm -f src/nu/xom/tests/{Encoding,Verifier}Test.java
 
 %build
 pushd lib
 ln -sf $(build-classpath junit) junit.jar
 ln -sf $(build-classpath xerces-j2) xercesImpl.jar
 ln -sf $(build-classpath xalan-j2) xalan.jar
-ln -sf $(build-classpath icu4j) normalizer.jar
 ln -sf $(build-classpath xml-commons-apis) xmlParserAPIs.jar
 popd
 mkdir lib2
@@ -186,6 +188,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/%{name}-%{version}/xom-samples.jar
 
 %changelog
+* Mon Oct  8 2012 Mikolaj Izdebski <mizdebsk at redhat.com> - 0:1.0-10
+- Replace icu4j Normalizer with java.text.Normalizer from JDK
+
 * Fri Aug 10 2012 Andy Grimm <agrimm at gmail.com> - 0:1.0-9
 - add POM
 


More information about the scm-commits mailing list