On 18.09.2007 7:45 Uhr, Reinhard Poetz wrote:

Test set: org.apache.cocoon.components.source.impl.ZipSourceTestCase
------------------------------------------------------------------------------- Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec <<< FAILURE! testURIHandling(org.apache.cocoon.components.source.impl.ZipSourceTestCase) Time elapsed: 0.01 sec <<< FAILURE! junit.framework.ComparisonFailure: Uri is wrong. expected:<zip:file://[/]test.zip!/test.xml> but was:<zip:file://[]test.zip!/test.xml>
    at junit.framework.Assert.assertEquals(Assert.java:81)
at org.apache.cocoon.components.source.impl.ZipSourceTestCase.testURIHandling(ZipSourceTestCase.java:45)

This code was updated on 20.07.2007 with the upgrade to sourceresolve 2.2.3 (rev 557982 and 557994 [1, 2] and 557984 on 2.1 [3]). Since then it must be failing. From what I get it's now failing for Windows with 2 slashes while the test expects 3. Linux/Mac OS X seems to work since they have 3 slashes now. Before it was the other way around, Windows worked with 2, Linux/Mac OS X failed with 1.

From the implementation [4] this is pretty clear:

uri = file.toURL().toExternalForm();
// toExternalForm() is buggy, see e.g. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4924415
// therefore we check if file: is followed by just one slash
// TODO when we move to JDK 1.4+, we should use file.toURI().toASCIIString() instead.
if ( uri.length() > 6 && uri.startsWith("file:/") && uri.charAt(6) != '/' )
{
    uri = "file:///" + uri.substring(6);
}

It just adds 3 slashes instead of 2 as it is supposed to do. So we probably need a sourceresolve 2.2.4. Is this likely to happen fast or do we need to revert the test case to not fail for the moment? Anyway, I'm going to change the test case back to 2 slashes. sourceresolve's own test case also only checks for 2 slashes [5].

Joerg

[1] http://svn.apache.org/viewvc?view=rev&revision=557982
[2] http://svn.apache.org/viewvc?view=rev&revision=557994
[3] http://svn.apache.org/viewvc?view=rev&revision=557984
[4] http://svn.apache.org/viewvc/excalibur/tags/excalibur-sourceresolve-2.2.3/src/java/org/apache/excalibur/source/impl/FileSource.java?revision=540857&view=markup [5] http://svn.apache.org/viewvc/excalibur/tags/excalibur-sourceresolve-2.2.3/src/test/org/apache/excalibur/source/test/FileSourceTestCase.java?revision=553534&view=markup

Reply via email to