ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject locator fun
Date Fri, 27 Apr 2007 12:26:13 GMT

an ant-user problem has thrown me into the depts of java's URI to file 
conversion..


     public void testTripleForwardSlashNetworkURI() throws Exception {
         resolveTo("file:///PC03/jclasses/lib/ant-1.7.0.jar", 
"///PC03/jclasses/lib/ant-1.7.0.jar");
     }


     [junit]     FAILED
     [junit] file:///PC03/jclasses/lib/ant-1.7.0.jar 
expected:</[/]PC03/jclasses/lib/an...> but was:</[]PC03/jclasses/lib/an...>
     [junit] junit.framework.ComparisonFailure: 
file:///PC03/jclasses/lib/ant-1.7.0.jar 
expected:</[/]PC03/jclasses/lib/an...> but was:</[]PC03/jclasses/lib/an...>
     [junit]     at junit.framework.Assert.assertEquals(Assert.java:81)



and

     public void testUnixNetworkPath() throws Exception {
         resolveTo("file://cluster/home/ant/lib", "//cluster/home/ant/lib");
     }

fails with

     [junit] Bad URI file://cluster/home/ant/lib:URI has an authority 
component
     [junit] java.lang.IllegalArgumentException: Bad URI 
file://cluster/home/ant/lib:URI has an authority component
     [junit]     at 
org.apache.tools.ant.launch.Locator.fromURI(Locator.java:179)
     [junit]     at 
org.apache.tools.ant.launch.LocatorTest.resolve(LocatorTest.java:42) 
[junit]     at 
org.apache.tools.ant.launch.LocatorTest.resolveTo(LocatorTest.java:49)
     [junit]     at 
org.apache.tools.ant.launch.LocatorTest.testUnixNetworkPath(LocatorTest.java:66)


In Ant1.7.0, it means you cant set ant up with a file: classpath mapped 
to a network path; I've got a commit that will catch and skip such a 
failure. But it also means, well, we have a problem. And it is not one 
that lives in our java1.3 and earlier code:


     public void testUnixNetworkPath13() throws Exception {
         resolveTo13("file://cluster/home/ant/lib", 
"//cluster/home/ant/lib");
     }

this passes. Which means we may be better off abandoning the new 
File(URI) stuff and sticking with our own code. At least that way, we 
are consistent across machines.

I'm going to commit my changes with the test failing, for others to look 
at.  Before you run the tests, do a bootstrap to rebuild locator.class 
in the boostrap JVM.





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message