Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 623743 Details for
Bug 864209
xom - please remove dependency on icu4j
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch fixing the bug
0001-Replace-icu4j-Normalizer-with-java.text.Normalizer-f.patch (text/plain), 54.11 KB, created by
Mikolaj Izdebski
on 2012-10-08 21:10:37 UTC
(
hide
)
Description:
Patch fixing the bug
Filename:
MIME Type:
Creator:
Mikolaj Izdebski
Created:
2012-10-08 21:10:37 UTC
Size:
54.11 KB
patch
obsolete
>From 8d023fba9b035cc5daa02bba8b9dd17a1cc7fd3d Mon Sep 17 00:00:00 2001 >From: Mikolaj Izdebski <mizdebsk@redhat.com> >Date: Mon, 8 Oct 2012 23:00:21 +0200 >Subject: [PATCH] Replace icu4j Normalizer with java.text.Normalizer from JDK > >--- > xom-Replace-icu4j-with-JDK.patch | 1560 ++++++++++++++++++++++++++++++++++++++ > xom-betterdocclasspath.patch | 3 +- > xom.spec | 11 +- > 3 files changed, 1568 insertions(+), 6 deletions(-) > create mode 100644 xom-Replace-icu4j-with-JDK.patch > >diff --git a/xom-Replace-icu4j-with-JDK.patch b/xom-Replace-icu4j-with-JDK.patch >new file mode 100644 >index 0000000..8b837b2 >--- /dev/null >+++ b/xom-Replace-icu4j-with-JDK.patch >@@ -0,0 +1,1560 @@ >+From ac174778e9c4f85a3a11126fef8b689b6f143f37 Mon Sep 17 00:00:00 2001 >+From: Mikolaj Izdebski <mizdebsk@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/EncodingTest.java | 358 ----------- >+ src/nu/xom/tests/FastTests.java | 1 - >+ src/nu/xom/tests/VerifierTest.java | 1061 ------------------------------- >+ src/nu/xom/tests/XOMTests.java | 2 - >+ 6 files changed, 8 insertions(+), 1430 deletions(-) >+ delete mode 100644 src/nu/xom/tests/EncodingTest.java >+ delete mode 100644 src/nu/xom/tests/VerifierTest.java >+ >+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/EncodingTest.java b/src/nu/xom/tests/EncodingTest.java >+deleted file mode 100644 >+index 44fdae9..0000000 >+--- a/src/nu/xom/tests/EncodingTest.java >++++ /dev/null >+@@ -1,358 +0,0 @@ >+-/* Copyright 2002-2004 Elliotte Rusty Harold >+- >+- This library is free software; you can redistribute it and/or modify >+- it under the terms of version 2.1 of the GNU Lesser General Public >+- License as published by the Free Software Foundation. >+- >+- This library is distributed in the hope that it will be useful, >+- but WITHOUT ANY WARRANTY; without even the implied warranty of >+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+- GNU Lesser General Public License for more details. >+- >+- You should have received a copy of the GNU Lesser General Public >+- License along with this library; if not, write to the >+- Free Software Foundation, Inc., 59 Temple Place, Suite 330, >+- Boston, MA 02111-1307 USA >+- >+- You can contact Elliotte Rusty Harold by sending e-mail to >+- elharo@metalab.unc.edu. Please include the word "XOM" in the >+- subject line. The XOM home page is located at http://www.xom.nu/ >+-*/ >+- >+-package nu.xom.tests; >+- >+-import java.io.ByteArrayInputStream; >+-import java.io.ByteArrayOutputStream; >+-import java.io.IOException; >+-import java.io.InputStream; >+-import java.io.UnsupportedEncodingException; >+- >+-import nu.xom.Attribute; >+-import nu.xom.Builder; >+-import nu.xom.Document; >+-import nu.xom.Element; >+-import nu.xom.ParsingException; >+-import nu.xom.Serializer; >+- >+-import com.ibm.icu.text.UTF16; >+- >+-/** >+- * <p> >+- * Check serialization of almost all of Unicode >+- * in a variety of encodings. >+- * </p> >+- * >+- * @author Elliotte Rusty Harold >+- * @version 1.0 >+- * >+- */ >+-public class EncodingTest extends XOMTestCase { >+- >+- >+- public EncodingTest(String name) { >+- super(name); >+- } >+- >+- >+- private Document doc; >+- >+- protected void setUp() { >+- >+- Element root = new Element("root"); >+- doc = new Document(root); >+- >+- for (int i = 0x20; i <= 0xD7FF; i++) { >+- Element data = new Element("d"); >+- data.appendChild(String.valueOf(((char) i))); >+- data.addAttribute(new Attribute("c", String.valueOf(i))); >+- root.appendChild(data); >+- } >+- >+- // skip surrogates between 0xD800 and 0xDFFF >+- for (int i = 0xE000; i <= 0xFFFD; i++) { >+- Element data = new Element("d"); >+- data.appendChild(String.valueOf(((char) i))); >+- data.addAttribute(new Attribute("c", String.valueOf(i))); >+- root.appendChild(data); >+- } >+- >+- // Test Plane-1 characters. These are tricky because Java >+- // strings encode them as surrogate pairs. We'll test with >+- // the characters from 1D100 to 1D1FF (the musical symbols) >+- for (int i = 0; i < 256; i++) { >+- int u = 0x1D100 + i; >+- // algorithm from RFC 2781 >+- /* int uprime = u - 0x10000; >+- int W1 = 0xD800; >+- int W2 = 0xDC00; >+- W2 = W2 | (uprime & 0x7FF ); >+- W1 = W1 | (uprime & 0xFF800); */ >+- Element data = new Element("d"); >+- // data.appendChild( String.valueOf(((char) W1)) + ((char) W2) ); >+- String s = UTF16.valueOf(u); >+- data.appendChild( s ); >+- data.addAttribute(new Attribute("c", String.valueOf(u))); >+- // data.addAttribute(new Attribute("c", String.valueOf(W1))); >+- root.appendChild(data); >+- } >+- >+- } >+- >+- >+- protected void tearDown() { >+- doc = null; >+- System.gc(); >+- } >+- >+- >+- public void testEUCJP() throws ParsingException, IOException { >+- checkAll("EUC-JP"); >+- } >+- >+- >+- public void testShift_JIS() throws ParsingException, IOException { >+- checkAll("Shift_JIS"); >+- } >+- >+- >+- public void testISO2022JP() throws ParsingException, IOException { >+- checkAll("ISO-2022-JP"); >+- } >+- >+- >+- public void testGeneric() throws ParsingException, IOException { >+- checkAll("Cp1252"); >+- } >+- >+- >+- // Main purpose here is to test a character set whose name is >+- // case dependent >+- public void testMacRoman() throws ParsingException, IOException { >+- checkAll("MacRoman"); >+- } >+- >+- >+- public void testBig5() throws ParsingException, IOException { >+- checkAll("Big5"); >+- } >+- >+- public void testUSASCII() throws ParsingException, IOException { >+- checkAll("US-ASCII"); >+- } >+- >+- public void testASCII() throws ParsingException, IOException { >+- checkAll("ASCII"); >+- } >+- >+- public void testLatin1() throws ParsingException, IOException { >+- checkAll("ISO-8859-1"); >+- } >+- >+- public void testLatin2() throws ParsingException, IOException { >+- checkAll("ISO-8859-2"); >+- } >+- >+- public void testLatin3() throws ParsingException, IOException { >+- checkAll("ISO-8859-3"); >+- } >+- >+- public void testLatin4() throws ParsingException, IOException { >+- checkAll("ISO-8859-4"); >+- } >+- >+- public void testCyrillic() throws ParsingException, IOException { >+- checkAll("ISO-8859-5"); >+- } >+- >+- public void testArabic() throws ParsingException, IOException { >+- checkAll("ISO-8859-6"); >+- } >+- >+- public void testGreek() throws ParsingException, IOException { >+- checkAll("ISO-8859-7"); >+- } >+- >+- public void testThai() throws ParsingException, IOException { >+- checkAll("TIS-620"); >+- } >+- >+- public void testHebrew() throws ParsingException, IOException { >+- checkAll("ISO-8859-8"); >+- } >+- >+- public void testLatin5() throws ParsingException, IOException { >+- checkAll("ISO-8859-9"); >+- } >+- >+- public void testUTF8() throws ParsingException, IOException { >+- checkAll("UTF-8"); >+- } >+- >+- public void testUTF16() throws ParsingException, IOException { >+- checkAll("UTF-16"); >+- } >+- >+- public void testUCS2() throws ParsingException, IOException { >+- checkAll("ISO-10646-UCS-2"); >+- } >+- >+- public void testEBCDIC() throws ParsingException, IOException { >+- checkAll("Cp037"); >+- } >+- >+- // These encodings are only available after Java 1.3 >+- private static boolean java14OrLater = false; >+- >+- static { >+- String version = System.getProperty("java.version"); >+- String majorVersion = version.substring(0, 3); >+- double versionNumber = Double.parseDouble(majorVersion); >+- if (versionNumber >= 1.4) java14OrLater = true; >+- } >+- >+- public void testLatin7() throws ParsingException, IOException { >+- if (java14OrLater) checkAll("ISO-8859-13"); >+- } >+- >+- public void testLatin9() throws ParsingException, IOException { >+- if (java14OrLater) checkAll("ISO-8859-15"); >+- } >+- >+- public void testGB18030() throws ParsingException, IOException { >+- if (java14OrLater) checkAll("GB18030"); >+- } >+- >+- // These encodings are not installed in all distributions by >+- // default. They are only found currently in IBM's Java 1.4.1 VM. >+- // They don't seem to be supported in the 1.5 alpha >+- // either. >+- public void testUCS4() throws ParsingException, IOException { >+- if (charsetAvailable("ISO-10646-UCS-4")) checkAll("ISO-10646-UCS-4"); >+- } >+- >+- public void testLatin6() throws ParsingException, IOException { >+- if (charsetAvailable("ISO-8859-10")) checkAll("ISO-8859-10"); >+- } >+- >+- public void testLatin8() throws ParsingException, IOException { >+- if (charsetAvailable("ISO-8859-14")) checkAll("ISO-8859-14"); >+- } >+- >+- public void testLatin10() throws ParsingException, IOException { >+- if (charsetAvailable("ISO-8859-16")) checkAll("ISO-8859-16"); >+- } >+- >+- >+- // Test that with an encoding XOM does not specifically support >+- // but the VM does, everything still works. >+- public void testUnsupportedEncoding() >+- throws ParsingException, IOException { >+- checkAll("Cp1252"); >+- } >+- >+- >+- private static boolean charsetAvailable(String name) { >+- // hack to avoid using 1.4 classes >+- try { >+- "d".getBytes(name); >+- return true; >+- } >+- catch (UnsupportedEncodingException ex) { >+- return false; >+- } >+- >+- } >+- >+- >+- private void checkAll(String encoding) >+- throws ParsingException, IOException { >+- >+- Builder builder = new Builder(); >+- byte[] data = null; >+- ByteArrayOutputStream out = new ByteArrayOutputStream(100000); >+- // Write data into a byte array using encoding >+- Serializer serializer = new Serializer(out, encoding); >+- serializer.write(doc); >+- serializer.flush(); >+- out.flush(); >+- out.close(); >+- data = out.toByteArray(); >+- InputStream in = new ByteArrayInputStream(data); >+- Document reparsed = builder.build(in); >+- in.close(); >+- serializer = null; >+- >+- Element reparsedRoot = reparsed.getRootElement(); >+- int childCount = reparsedRoot.getChildCount(); >+- for (int i = 0; i < childCount; i++) { >+- Element test = (Element) reparsedRoot.getChild(i); >+- String value = test.getValue(); >+- int expected >+- = Integer.parseInt(test.getAttributeValue("c")); >+- // workaround for EBCDIC bugs >+- if (expected == 133 && encoding.equalsIgnoreCase("Cp037")) { >+- continue; >+- } >+- int actual = value.charAt(0); >+- if (value.length() > 1) { >+- actual = UTF16.charAt(value, 0); >+- } >+- // This doesn't work for all encodings, because there are >+- // a few cases where you write a Unicode compatibility >+- // character such as an Arabic presentation form, >+- // but read back what is essentially a different version >+- // of the same character. That is the mapping from some >+- // legacy character sets to Unicode is not always 1-1. >+- assertEquals("Expected 0x" >+- + Integer.toHexString(expected).toUpperCase() >+- + " but was 0x" >+- + Integer.toHexString(actual).toUpperCase(), expected, actual); >+- } >+- >+- in = null; >+- >+- } >+- >+- >+- private void checkSome(String encoding) >+- throws ParsingException, IOException { >+- >+- Builder builder = new Builder(); >+- byte[] data = null; >+- ByteArrayOutputStream out = new ByteArrayOutputStream(100000); >+- // Write data into a byte array using encoding >+- Serializer serializer = new Serializer(out, encoding); >+- serializer.write(doc); >+- serializer.flush(); >+- out.flush(); >+- out.close(); >+- data = out.toByteArray(); >+- InputStream in = new ByteArrayInputStream(data); >+- Document reparsed = builder.build(in); >+- in.close(); >+- serializer = null; >+- >+- Element reparsedRoot = reparsed.getRootElement(); >+- int childCount = reparsedRoot.getChildCount(); >+- for (int i = 0; i < childCount; i++) { >+- Element test = (Element) reparsedRoot.getChild(i); >+- String value = test.getValue(); >+- int expected >+- = Integer.parseInt(test.getAttributeValue("c")); >+- // workaround for EBCDIC bugs >+- if (expected == 133 && encoding.equalsIgnoreCase("Cp037")) { >+- continue; >+- } >+- int actual = value.charAt(0); >+- if (value.length() > 1) { >+- actual = UTF16.charAt(value, 0); >+- } >+- if (expected != actual) System.err.println(expected); >+- } >+- >+- in = null; >+- >+- } >+- >+- >+-} >+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/VerifierTest.java b/src/nu/xom/tests/VerifierTest.java >+deleted file mode 100644 >+index df43dda..0000000 >+--- a/src/nu/xom/tests/VerifierTest.java >++++ /dev/null >+@@ -1,1061 +0,0 @@ >+-/* Copyright 2002-2004 Elliotte Rusty Harold >+- >+- This library is free software; you can redistribute it and/or modify >+- it under the terms of version 2.1 of the GNU Lesser General Public >+- License as published by the Free Software Foundation. >+- >+- This library is distributed in the hope that it will be useful, >+- but WITHOUT ANY WARRANTY; without even the implied warranty of >+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+- GNU Lesser General Public License for more details. >+- >+- You should have received a copy of the GNU Lesser General Public >+- License along with this library; if not, write to the >+- Free Software Foundation, Inc., 59 Temple Place, Suite 330, >+- Boston, MA 02111-1307 USA >+- >+- You can contact Elliotte Rusty Harold by sending e-mail to >+- elharo@metalab.unc.edu. Please include the word "XOM" in the >+- subject line. The XOM home page is located at http://www.xom.nu/ >+-*/ >+- >+-package nu.xom.tests; >+- >+-import nu.xom.Attribute; >+-import nu.xom.DocType; >+-import nu.xom.Element; >+-import nu.xom.IllegalDataException; >+-import nu.xom.IllegalNameException; >+-import nu.xom.MalformedURIException; >+-import nu.xom.Text; >+- >+-import org.apache.xerces.util.XMLChar; >+- >+-import com.ibm.icu.text.UTF16; >+- >+-/** >+- * <p> >+- * Tests to make sure name and character rules are enforced. >+- * The rules are tested by comparison with the rules in >+- * the org.apache.xerces.util.XMLChar class. >+- * This is an undocumented class so this is potentially dangerous >+- * in the long run. it also means the tests depend on Xerces 2 >+- * specifically. However, this dependence does not extend into the >+- * core API. >+- * </p> >+- * >+- * @author Elliotte Rusty Harold >+- * @version 1.0 >+- * >+- */ >+-public class VerifierTest extends XOMTestCase { >+- >+- private final static char[] subdelims = {'!', '$', '&', '\'', '(', ')' , '*', '+', ',', ';', '='}; >+- private final static char[] unreserved = {'-', '.', '_', '~'}; >+- private final static char[] unwise = {'{', '}', '|', '\\', '^', '[', ']', '`'}; >+- private final static char[] delims = {'<', '>', '#', '%', '^', '"'}; >+- >+- public VerifierTest(String name) { >+- super(name); >+- } >+- >+- >+- public void testElementNames() { >+- >+- for (char c = 0; c < 65535; c++) { >+- >+- if (XMLChar.isNCNameStart(c)) { >+- String name = String.valueOf(c); >+- Element e = new Element(name); >+- assertEquals(name, e.getLocalName()); >+- } >+- else { >+- try { >+- new Element(String.valueOf(c)); >+- fail("Allowed illegal name start character " >+- + Integer.toHexString(c) + " in element name"); >+- } >+- catch (IllegalNameException success) { >+- assertNotNull(success.getMessage()); >+- } >+- } >+- >+- if (XMLChar.isNCName(c)) { >+- String name = "a" + c; >+- Element e = new Element(name); >+- assertEquals(name, e.getLocalName()); >+- } >+- else { >+- try { >+- new Element(String.valueOf(c)); >+- fail("Allowed illegal character " >+- + Integer.toHexString(c) + " in element name"); >+- } >+- catch (IllegalNameException success) { >+- assertNotNull(success.getMessage()); >+- assertEquals(String.valueOf(c), success.getData()); >+- } >+- } >+- >+- } >+- >+- } >+- >+- >+- // From IRI draft: >+- /* ucschar = %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF / >+- / %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD >+- / %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD >+- / %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD >+- / %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD >+- / %xD0000-DFFFD / %xE1000-EFFFD */ >+- >+- // From RFC 2396 reallowed into IRIs >+- // "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" >+- public void testLegalIRIs() { >+- >+- int[] legalChars = { >+- '{', '}', '<', '>', '"', '|', '\\', '^', '`', '\u007F', >+- 0xA0, 0xD7FF, 0xF900, 0xFDCF, 0xFDF0, >+- 0xFFEF, 0x10000, 0x1FFFD, 0x20000, 0x2FFFD, 0x30000, >+- 0x3FFFD, 0x40000, 0x4FFFD, 0x50000, 0x5FFFD, 0x60000, >+- 0x6FFFD, 0x70000, 0x7FFFD, 0x80000, 0x8FFFD, 0x90000, >+- 0x9FFFD, 0xA0000, 0xAFFFD, 0xB0000, 0xBFFFD, 0xC0000, >+- 0xCFFFD, 0xD0000, 0xDFFFD, 0xE1000, 0xEFFFD, 0xCFFFD}; >+- >+- Element element = new Element("test"); >+- for (int i = 0; i < legalChars.length; i++) { >+- String utf16 = convertToUTF16(legalChars[i]); >+- String url = "http://www.example.com/" + utf16 + ".xml"; >+- element.addAttribute(new Attribute("xml:base", >+- "http://www.w3.org/XML/1998/namespace", url)); >+- assertEquals(url, element.getAttributeValue("base", >+- "http://www.w3.org/XML/1998/namespace")); >+- } >+- >+- } >+- >+- >+- public void testAllASCIILettersAllowedToBeginSchemeNames() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 'A'; c <= 'Z'; c++) { >+- String uri = c + "scheme:schemeSpecificData"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- for (char c = 'a'; c <= 'z'; c++) { >+- String uri = c + "scheme:schemeSpecificData"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllASCIILettersAllowedInSchemeNames() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 'A'; c <= 'Z'; c++) { >+- String uri = "scheme" + c + ":schemeSpecificData"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- for (char c = 'a'; c <= 'z'; c++) { >+- String uri = "scheme" + c + ":schemeSpecificData"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllASCIILettersAllowedInQueryStrings() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 'A'; c <= 'Z'; c++) { >+- String uri = "http://www.example.com/?name=" + c; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- for (char c = 'a'; c <= 'z'; c++) { >+- String uri = "http://www.example.com/?name=" + c; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllASCIIDigitsAllowedInQueryStrings() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = '0'; c <= '9'; c++) { >+- String uri = "http://www.example.com/?value=" + c; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testSlashAllowedInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "http://www.example.com/?path=/home/elharo/docs/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testQuestionMarkAllowedInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "http://www.example.com/?path=?home?elharo?docs?"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testColonAllowedInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "http://www.example.com/?path=:home:elharo:docs:"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testAtSignAllowedInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "http://www.example.com/?path=@home@elharo@docs@"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testNonASCIICharactersNotAllowedInQueryStrings() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 128; c <= 1024; c++) { >+- String uri = "http://www.example.com/?value=" + c; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unescaped non-ASCII character " + c + " in query string"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testDelimsNotAllowedInQueryStrings() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < delims.length; i++) { >+- String uri = "http://www.example.com/?value=" + delims[i] + "#Must_Use_Fragment_ID"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed delimiter character " + delims[i] + " in query string"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testUnwiseCharactersNotAllowedInQueryStrings() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < unwise.length; i++) { >+- String uri = "http://www.example.com/?value=" + unwise[i]; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unwise character " + unwise[i] + " in query string"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testUnwiseCharactersNotAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < unwise.length; i++) { >+- String uri = "http://user" + unwise[i] + "name@www.example.com/?value=" + unwise[i]; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unwise character " + unwise[i] + " in user info"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testUnwiseCharactersNotAllowedInHost() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < unwise.length; i++) { >+- String uri = "http://u" + unwise[i] + "www.example.com/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unwise character " + unwise[i] + " in host"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testDelimsNotAllowedInHost() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < delims.length; i++) { >+- String uri = "http://u" + delims[i] + "www.example.com/#value"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unwise character " + delims[i] + " in host"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testUnwiseCharactersNotAllowedInPath() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < unwise.length; i++) { >+- String uri = "http://www.example.com/path" + unwise[i] + "/path"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unwise character " + unwise[i] + " in path"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testAllASCIILettersAllowedInHostNames() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 'A'; c <= 'Z'; c++) { >+- String uri = "http://" + c + ".com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- for (char c = 'a'; c <= 'z'; c++) { >+- String uri = "http://" + c + ".com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllASCIIDigitsAllowedInHostNames() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = '0'; c <= '9'; c++) { >+- String uri = "http://c" + c + ".com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testNonASCIICharactersNotAllowedInHostNames() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 128; c <= 1024; c++) { >+- String uri = "http://c" + c + ".com/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unescaped non-ASCII character " + c + " in host name"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testAllASCIILettersAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 'A'; c <= 'Z'; c++) { >+- String uri = "http://" + c + "@c.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- for (char c = 'a'; c <= 'z'; c++) { >+- String uri = "http://" + c + "@c.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllSubDelimsAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < subdelims.length; i++) { >+- String uri = "http://c" + subdelims[i] + "x@c.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllSubDelimsAllowedInPath() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < subdelims.length; i++) { >+- String uri = "http://cc.com/path" + subdelims[i] +".html"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllUnreservedPunctuationMarksAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < unreserved.length; i++) { >+- String uri = "http://c" + unreserved[i] + "x@c.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllUnreservedPunctuationMarksAllowedInHost() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < unreserved.length; i++) { >+- String uri = "http://c" + unreserved[i] + "xc.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllSubDelimsAllowedInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < subdelims.length; i++) { >+- String uri = "http://cx@c.com/?name=" + subdelims[i]; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllSubDelimsAllowedInHost() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < subdelims.length; i++) { >+- String uri = "http://cx" + subdelims[i] + "c.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllUnreservedPunctuationMarksAllowedInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < unreserved.length; i++) { >+- String uri = "http://cx@c.com/?name=" + unreserved[i]; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testAllASCIIDigitsAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = '0'; c <= '9'; c++) { >+- String uri = "http://" + c + "@c.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- } >+- >+- } >+- >+- >+- public void testNonASCIICharactersNotAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 128; c <= 1024; c++) { >+- String uri = "http://" + c + "@c.com/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed unescaped non-ASCII character " + c + " in user info"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testDelimCharactersNotAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (int i = 0; i < delims.length; i++) { >+- String uri = "http://c" + delims[i] + "c@c.com/?name=value#fragID"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed delim character " + delims[i] + " in user info"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testMalformedURI() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "http://c#c@c.com/?name=value#fragID"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed http://c#c@c.com/?name=value#fragID as URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- } >+- >+- >+- public void testFragmentIDContainsQuestionMark() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "http://cc@c.com/?name=value#fragID?home/?elharo?"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- uri = "http://cc@c.com/#fragID?name=value"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testFragmentIDContainsFirstColon() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "http://c.com/#fragID:home"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- uri = "http://c.com/#fragID:home@eharo.com/somewhere"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testEmptyHostAllowed() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "scheme://elharo@:80/data"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testC0ControlsNotAllowedInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 0; c <= ' '; c++) { >+- String uri = "http://" + c + "@c.com/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed C0 control 0x" + Integer.toHexString(c) + " in user info"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testC0ControlsNotAllowedInPath() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 0; c <= ' '; c++) { >+- String uri = "http://www.example.com/test/" + c + "data/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed C0 control 0x" + Integer.toHexString(c) + " in path"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testC0ControlsNotAllowedInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 0; c <= ' '; c++) { >+- String uri = "http://www.c.com/?name=" + c + "&value=7"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("Allowed C0 control 0x" + Integer.toHexString(c) + " in query string"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testHostNameTooLong() { >+- >+- StringBuffer uri = new StringBuffer("http://"); >+- for (int i = 0; i < 255; i++) uri.append('c'); >+- uri.append(".com/"); >+- Element e = new Element("e"); >+- try { >+- e.setNamespaceURI(uri.toString()); >+- fail("Allowed excessively long host name"); >+- } >+- catch (MalformedURIException success) { >+- assertNotNull(success.getMessage()); >+- } >+- >+- } >+- >+- >+- public void testSymbolsNotAllowedInSchemeNames() { >+- >+- Element e = new Element("e"); >+- >+- char[] disallowed = { ';', '@', '&', '=', '$', ',', '"', '?', '#', '/', '\\', '|', >+- '_', '!', '~', '*', '\'', '(', ')', '<', '>', '[', ']', '{', '}', '^', '`'}; >+- >+- for (int i = 0; i < disallowed.length; i++) { >+- String uri = "scheme" + disallowed[i] + ":schemeSpecificData"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testNonASCIILettersNotAllowedToBeginSchemeNames() { >+- >+- Element e = new Element("e"); >+- >+- for (char c = 'Z' +1; c < 'a'; c++) { >+- String uri = c + "scheme:schemeSpecificData"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testBadHexEscapeInQueryString() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "scheme:schemeSpecificData?test%5test"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- uri = "scheme:schemeSpecificData?test%5"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- } >+- >+- >+- public void testHexEscapeInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "scheme://user%C3%80TED@www.example.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testHexEscapeInHost() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "scheme://user%C3%80www.example.com/"; >+- e.setNamespaceURI(uri); >+- assertEquals(uri, e.getNamespaceURI()); >+- >+- } >+- >+- >+- public void testBadHexEscapeInUserInfo() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "scheme://user%5TED@www.example.com/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- uri = "scheme://user%5@www.example.com/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- } >+- >+- >+- public void testBadHexEscapeInHost() { >+- >+- Element e = new Element("e"); >+- >+- String uri = "scheme://user%5TEDwww.example.com/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- uri = "scheme://www.example.co%5/"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- } >+- >+- >+- public void testQuestionmarkIsNotAHexDigit() { >+- >+- Element e = new Element("e"); >+- >+- // Have to do this in a fragment ID to keep it from being >+- // interpreted as a query string separator >+- String uri = "scheme://user@www.example.com/#fragment%?Adata"; >+- try { >+- e.setNamespaceURI(uri); >+- fail("allowed " + uri + " as namespace URI"); >+- } >+- catch (MalformedURIException success) { >+- assertEquals(uri, success.getData()); >+- } >+- >+- } >+- >+- >+- public void testIllegalIRIs() { >+- >+- int[] illegalChars = {0x00, 0xDC00, 0xE7FF, 0xF899, 0xD800, >+- 0xFDE0, 0xFFFF, 0x1FFFE, 0x2FFFE, 0x3FFFF, 0x4FFFE, >+- 0x4FFFF, 0x5FFFE, 0x6FFFF, 0x7FFFE, 0x8FFFF, 0x9FFFE, >+- 0xAFFFE, 0xBFFFF, 0xCFFFE, 0xDFFFE, 0xEFFFF, 0xFDDF}; >+- >+- for (int i = 0; i < illegalChars.length; i++) { >+- String utf16 = convertToUTF16(illegalChars[i]); >+- String url = "http://www.example.com/" + utf16 + ".xml"; >+- try { >+- new DocType("root", url); >+- fail("Allowed URL containing 0x" + >+- Integer.toHexString(illegalChars[i]).toUpperCase()); >+- } >+- catch (MalformedURIException success) { >+- assertNotNull(success.getMessage()); >+- assertEquals(url, success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testLegalIP6Addresses() { >+- >+- String[] addresses = { >+- "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210", >+- "1080:0:0:0:8:800:200C:4171", >+- "3ffe:2a00:100:7031::1", >+- "1080::8:800:200C:417A", >+- "::192.9.5.5", >+- "::FFFF:129.144.52.38", >+- "2010:836B:4179::836B:4179", >+- "1080:0:0:0:8:800:200C:417A", >+- "FF01:0:0:0:0:0:0:101", >+- "0:0:0:0:0:0:0:1", >+- "0:0:0:0:0:0:0:0", >+- "1080::8:800:200C:417A", >+- "FF01::101", >+- "::1", >+- "::", >+- "0:0:0:0:0:0:13.1.68.3", >+- "0:0:0:0:0:FFFF:129.144.52.38", >+- "::13.1.68.3", >+- "::FFFF:129.144.52.38" >+- }; >+- >+- Element element = new Element("test"); >+- for (int i = 0; i < addresses.length; i++) { >+- String url = "http://[" + addresses[i] + "]/"; >+- element.addAttribute(new Attribute("xml:base", >+- "http://www.w3.org/XML/1998/namespace", url)); >+- assertEquals(url, element.getBaseURI()); >+- } >+- >+- } >+- >+- >+- public void testIllegalIP6Addresses() { >+- >+- String[] addresses = { >+- "FEDC:BA98:7654:3210:GEDC:BA98:7654:3 210", >+- "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:4352", >+- "FEDC:BA98:7654:3210:GEDC:BA98:7654:3210", >+- "FEDC:BA98:7654:3210:GEDC:BA98:7654:G210", >+- "FEDC:BA98:7654:3210:GEDC:BA98:7654: 3210", >+- "FEDC:BA98:7654:3210:GEDC:BA98:7654:+3210", >+- "FEDC:BA98:7654:3210:GEDC:BA98:7654:3210 ", >+- "FEDC:BA98:7654:3210:GEDC:BA98:7654:32 10", >+- "1080:0:::8:800:200C:4171", >+- "3ffe::100:7031::1", >+- "::192.9.5", >+- "::FFFF:129.144.52.38.56", >+- "::FFFF:129.144.52.A3", >+- "::FFFF:129.144.52.-22", >+- "::FFFF:129.144.52.+22", >+- "::FFFF:256.144.52.+22", >+- "::FFFF:www.apple.com", >+- "1080:0:0:0:8:800:-200C:417A", >+- "1080:0:0:0:-8:800:-200C:417A" >+- }; >+- >+- for (int i = 0; i < addresses.length; i++) { >+- String url = "http://[" + addresses[i] + "]/"; >+- try { >+- new DocType("root", url); >+- fail("Allowed illegal IPv6 address: " + addresses[i] ); >+- } >+- catch (MalformedURIException success) { >+- assertNotNull(success.getMessage()); >+- assertTrue(success.getData().indexOf(addresses[i]) >= 0); >+- } >+- } >+- >+- } >+- >+- >+- private static String convertToUTF16(int c) { >+- >+- if (c <= 0xFFFF) return "" + (char) c; >+- char high = UTF16.getLeadSurrogate(c); >+- char low = UTF16.getTrailSurrogate(c); >+- StringBuffer sb = new StringBuffer(2); >+- sb.append(high); >+- sb.append(low); >+- return sb.toString().toLowerCase(); >+- >+- } >+- >+- >+- public void testC0Controls() { >+- >+- for (char c = 0; c < '\t'; c++) { >+- try { >+- new Text(String.valueOf(c)); >+- } >+- catch (IllegalDataException success) { >+- assertNotNull(success.getMessage()); >+- } >+- } >+- >+- for (char c = '\r'+1; c < ' '; c++) { >+- try { >+- new Text(String.valueOf(c)); >+- } >+- catch (IllegalDataException success) { >+- assertNotNull(success.getMessage()); >+- assertEquals(String.valueOf(c), success.getData()); >+- } >+- } >+- >+- } >+- >+- >+- public void testAttributeNameThatEndsWithAColon() { >+- >+- try { >+- new Attribute("name:", "http://www.example.com", "value", Attribute.Type.CDATA); >+- fail("Allowed attribute name that ends with a colon"); >+- } >+- catch (IllegalNameException success) { >+- assertNotNull(success.getMessage()); >+- assertEquals("name:", success.getData()); >+- } >+- >+- } >+- >+- >+- public void testAttributeNameThatBeginsWithAColon() { >+- >+- try { >+- new Attribute(":name", "http://www.example.com", "value", Attribute.Type.CDATA); >+- fail("Allowed attribute name that begins with a colon"); >+- } >+- catch (IllegalNameException success) { >+- assertNotNull(success.getMessage()); >+- assertEquals(":name", success.getData()); >+- } >+- >+- } >+- >+- >+- public void testElementNameThatEndsWithAColon() { >+- >+- try { >+- new Element("name:", "http://www.example.com"); >+- fail("Allowed element name that ends with a colon"); >+- } >+- catch (IllegalNameException success) { >+- assertNotNull(success.getMessage()); >+- assertEquals("name:", success.getData()); >+- } >+- >+- } >+- >+- >+- public void testElementNameThatBeginsWithAColon() { >+- >+- try { >+- new Element(":name", "http://www.example.com"); >+- fail("Allowed element name that begins with a colon"); >+- } >+- catch (IllegalNameException success) { >+- assertNotNull(success.getMessage()); >+- assertEquals(":name", success.getData()); >+- } >+- >+- } >+- >+- >+-} >+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..0edf6d2 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,6 +105,7 @@ Requires: %{name} = 0:%{version} > %setup -q -n XOM > %patch0 > %patch1 >+%patch2 -p1 > # remove all binary libs > find . -name "*.jar" -exec rm -f {} \; > >@@ -113,7 +114,6 @@ 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 +186,9 @@ rm -rf $RPM_BUILD_ROOT > %{_datadir}/%{name}-%{version}/xom-samples.jar > > %changelog >+* Mon Oct 8 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:1.0-10 >+- Replace icu4j Normalizer with java.text.Normalizer from JDK >+ > * Fri Aug 10 2012 Andy Grimm <agrimm@gmail.com> - 0:1.0-9 > - add POM > >-- >1.7.11.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 864209
: 623743