janslow / jarjar

Automatically exported from code.google.com/p/jarjar
0 stars 0 forks source link

JarJar find can't handle absolute paths in Windows #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use an absolute file name (including drive letter: c:\home\lib\foo.jar")
as input in any of the classpath arguments. JarJar thinks the ':' in the
drive letter is a path separator and breaks the path in the wrong place.

For example:
java -jar c:\home\lib\jarjar-1.0rc6.jar\jarjar-1.0rc6.jar find jar
c:\home\test\foo.bar

What is the expected output? What do you see instead?
The expected output is the list of dependencies - which you get fine if you
 use relative paths.

What you see instead is this error:
Syntax error: File c:\home\test\c does not exist

What version of the product are you using? On what operating system?
jarjar-1.0rc6.jar on Windows XP.

Please provide any additional information below.
The fix is simple: on ClassPathIterator

instead of 
        StringTokenizer st = new StringTokenizer(classPath, ":;");

use
        StringTokenizer st = new StringTokenizer(classPath,
System.getProperty("path.separator"));

Original issue reported on code.google.com by naa...@gmail.com on 8 Feb 2008 at 12:48

GoogleCodeExporter commented 8 years ago
I've made the change in SVN. I do have some concerns it may cause problems for 
teams
that build on mixed platforms, but we'll see.

Original comment by chris.no...@gmail.com on 7 Mar 2008 at 11:31