costin 2002/12/29 22:10:14 Modified: src/main/org/apache/tools/ant/types Path.java Log: Finally fix the jspc test failure. This is just the first round, it can be improved - not sure what's the best way to deal with classpath specific issues in path. The problem is that CLASSPATH ( as given in the system property, and added in concatSystemPath ) may contain relative paths, and they are relative to user.dir, not the project basedir. Since gump is using relative paths, the launched java didn't find the classes it needed, returning the strange -1 error. Of course, the test suite could be more informative too :-) Revision Changes Path 1.43 +25 -7 jakarta-ant/src/main/org/apache/tools/ant/types/Path.java Index: Path.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Path.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- Path.java 13 Dec 2002 12:29:33 -0000 1.42 +++ Path.java 30 Dec 2002 06:10:14 -0000 1.43 @@ -254,8 +254,22 @@ * * @param source - source path whose components are examined for existence */ - public void addExisting(Path source) { + public void addExisting(Path source) { + addExisting(source, false ); + } + + /** Same as addExisting, but support classpath behavior if tryUserDir + * is true. Classpaths are relative to user dir, not the project base. + * That used to break jspc test + * + * @param source + * @param tryUserDir + */ + public void addExisting(Path source, boolean tryUserDir) { String[] list = source.list(); + File userDir=(tryUserDir) ? new File(System.getProperty( "user.dir")) + : null; + for (int i = 0; i < list.length; i++) { File f = null; if (getProject() != null) { @@ -263,11 +277,15 @@ } else { f = new File(list[i]); } - + // probably not the best choice, but it solves the problem of + // relative paths in CLASSPATH + if( tryUserDir && ! f.exists()) { + f=new File( userDir, list[i]); + } if (f.exists()) { setLocation(f); } else { - log("dropping " + f + " from path as it doesn't exist", + log("dropping " + f + " from path as it doesn't exist", Project.MSG_VERBOSE); } } @@ -293,7 +311,7 @@ o = r.getReferencedObject(getProject()); // we only support references to paths right now if (!(o instanceof Path)) { - String msg = r.getRefId() + " doesn\'t denote a path"; + String msg = r.getRefId() + " doesn\'t denote a path " + o; throw new BuildException(msg); } } @@ -537,11 +555,11 @@ if (order.equals("only")) { // only: the developer knows what (s)he is doing - result.addExisting(Path.systemClasspath); + result.addExisting(Path.systemClasspath, true); } else if (order.equals("first")) { // first: developer could use a little help - result.addExisting(Path.systemClasspath); + result.addExisting(Path.systemClasspath, true); result.addExisting(this); } else if (order.equals("ignore")) { @@ -556,7 +574,7 @@ } result.addExisting(this); - result.addExisting(Path.systemClasspath); + result.addExisting(Path.systemClasspath, true); }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>