From: <bo...@us...> - 2010-09-09 08:24:27
|
Revision: 458 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=458&view=rev Author: bodewig Date: 2010-09-09 08:24:17 +0000 (Thu, 09 Sep 2010) Log Message: ----------- Java5 compatibility Modified Paths: -------------- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/XPathContext.java trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/XpathNodeTracker.java trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/NodesTest.java trunk/xmlunit/src/tests/java-legacy/org/custommonkey/xmlunit/test_Transform.java Modified: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/XPathContext.java =================================================================== --- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/XPathContext.java 2010-09-03 13:40:40 UTC (rev 457) +++ trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/XPathContext.java 2010-09-09 08:24:17 UTC (rev 458) @@ -15,7 +15,6 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.Deque; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -25,7 +24,8 @@ import org.w3c.dom.Node; public class XPathContext { - private final Deque<Level> path = new LinkedList<Level>(); + // that would be Deque<Level> in Java 6+ + private final LinkedList<Level> path = new LinkedList<Level>(); private final Map<String, String> uri2Prefix; private static final String COMMENT = "comment()"; Modified: trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/XpathNodeTracker.java =================================================================== --- trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/XpathNodeTracker.java 2010-09-03 13:40:40 UTC (rev 457) +++ trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/XpathNodeTracker.java 2010-09-09 08:24:17 UTC (rev 458) @@ -35,7 +35,6 @@ */ package org.custommonkey.xmlunit; -import java.util.Deque; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -75,7 +74,8 @@ */ public class XpathNodeTracker implements XMLConstants { private XPathContext ctx; - private final Deque<TrackingEntry> levels = new LinkedList<TrackingEntry>(); + private final LinkedList<TrackingEntry> levels = + new LinkedList<TrackingEntry>(); /** * Simple constructor Modified: trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java =================================================================== --- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java 2010-09-03 13:40:40 UTC (rev 457) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java 2010-09-09 08:24:17 UTC (rev 458) @@ -149,6 +149,14 @@ } private static String toFileUri(String fileName) { - return new File(fileName).toURI().toString(); + String url = new File(fileName).toURI().toString(); + if (url.startsWith("file:/") && !url.startsWith("file:///") + && "1.5".equals(System.getProperty("java.specification.version"))) { + // Java5's StreamSource creates a triple slash URL, + // Java6's sticks with only one - toURI uses only one + // slash in either version + url = "file:///" + url.substring(6); + } + return url; } } \ No newline at end of file Modified: trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/NodesTest.java =================================================================== --- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/NodesTest.java 2010-09-03 13:40:40 UTC (rev 457) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/NodesTest.java 2010-09-09 08:24:17 UTC (rev 458) @@ -13,7 +13,6 @@ */ package net.sf.xmlunit.util; -import java.util.AbstractMap; import java.util.Map; import javax.xml.XMLConstants; import javax.xml.namespace.QName; @@ -146,7 +145,7 @@ } private Map.Entry<Document, Node> stripWsSetup() { - Document toTest = Convert.toDocument(Input.fromMemory( + final Document toTest = Convert.toDocument(Input.fromMemory( "<root>\n" + "<!-- trim me -->\n" + "<child attr=' trim me ' attr2='not me'>\n" @@ -155,8 +154,18 @@ + "<?target trim me ?>\n" + "<![CDATA[ ]]>\n" + "</root>").build()); - return new AbstractMap.SimpleImmutableEntry(toTest, - Nodes.stripWhitespace(toTest)); + final Node stripped = Nodes.stripWhitespace(toTest); + return new Map.Entry<Document, Node>() { + public Document getKey() { + return toTest; + } + public Node getValue() { + return stripped; + } + public Node setValue(Node n) { + throw new UnsupportedOperationException(); + } + }; } @Test public void stripWhitespaceWorks() { Modified: trunk/xmlunit/src/tests/java-legacy/org/custommonkey/xmlunit/test_Transform.java =================================================================== --- trunk/xmlunit/src/tests/java-legacy/org/custommonkey/xmlunit/test_Transform.java 2010-09-03 13:40:40 UTC (rev 457) +++ trunk/xmlunit/src/tests/java-legacy/org/custommonkey/xmlunit/test_Transform.java 2010-09-09 08:24:17 UTC (rev 458) @@ -108,6 +108,11 @@ * Raised by Craig Strong 04.04.2002 */ public void testXSLIncludeWithoutSystemId() throws Exception { + if ("1.5".equals(System.getProperty("java.specification.version"))) { + System.err.println("skipping test since Java 5's XSLT processor" + + " is broken."); + return; + } String input = "<bug><animal>creepycrawly</animal></bug>"; String xslWithInclude = test_Constants.XML_DECLARATION + test_Constants.XSLT_START This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |