From: <bo...@us...> - 2011-02-03 10:48:00
|
Revision: 488 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=488&view=rev Author: bodewig Date: 2011-02-03 10:47:53 +0000 (Thu, 03 Feb 2011) Log Message: ----------- try to fix one of the test failures in Gump Modified Paths: -------------- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java 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 2011-01-30 07:37:26 UTC (rev 487) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java 2011-02-03 10:47:53 UTC (rev 488) @@ -22,6 +22,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Source; +import javax.xml.transform.TransformerFactory; import org.w3c.dom.Document; import net.sf.xmlunit.TestResources; import net.sf.xmlunit.util.Convert; @@ -151,12 +152,25 @@ private static String toFileUri(String fileName) { 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, + && ("1.5".equals(System.getProperty("java.specification.version")) + || transformerIsApacheXalan()) + ) { + // Java5's StreamSource as well as the one used by apache + // Xalan create a triple slash URLs, // Java6's sticks with only one - toURI uses only one // slash in either version url = "file:///" + url.substring(6); } return url; } + + private static boolean transformerIsApacheXalan() { + try { + TransformerFactory fac = TransformerFactory.newInstance(); + return fac.getClass().getName() + .equals("org.apache.xalan.processor.TransformerFactoryImpl"); + } catch (Exception ex) { + return false; + } + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |