[Nice-commit] Nice/src/nice/tools/unit api.nice,1.1,1.2
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-07-02 19:31:12
|
Update of /cvsroot/nice/Nice/src/nice/tools/unit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14796/src/nice/tools/unit Modified Files: api.nice Log Message: Abstracted the resource location in pathes in the nice.tools.locator package. Index: api.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/unit/api.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** api.nice 18 Feb 2004 16:33:25 -0000 1.1 --- api.nice 2 Jul 2004 19:31:01 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- package nice.tools.unit; + import nice.tools.locator; + import java.lang.reflect.*; *************** *** 94,135 **** ClassLoader classloaderFromClasspath(String classpath) { ! LinkedList<java.net.URL> components = new LinkedList(); ! ! int start = 0; ! // skip starting separators ! while (start<classpath.length() && ! classpath.charAt(start) == java.io.File.pathSeparatorChar) ! start++; ! ! while (start<classpath.length()) ! { ! int end = classpath.indexOf(java.io.File.pathSeparatorChar, start); ! if (end == -1) ! end = classpath.length(); ! ! String pathComponent = classpath.substring(start, end); ! if (pathComponent.length() > 0) ! try{ ! java.io.File f = new java.io.File(pathComponent); ! if (f.canRead()) ! components.add(f.getCanonicalFile().toURL()); ! else ! { ! if (!f.exists()) ! System.err.println("Classpath component " + pathComponent + " does not exist"); ! else ! System.err.println("Classpath component " + pathComponent + " is not readable"); ! } ! } ! catch(java.net.MalformedURLException e){ ! System.err.println("Classpath component " + pathComponent + " is invalid"); ! } ! catch(java.io.IOException e){ ! System.err.println("Classpath component " + pathComponent + " is invalid"); ! } ! start = end + 1; ! } ! return new java.net.URLClassLoader(components.toArray(), ! /* no parent */ null); } --- 96,102 ---- ClassLoader classloaderFromClasspath(String classpath) { ! java.net.URL[] path = parsePath(classpath, ! String message => System.err.println(message)); ! return new java.net.URLClassLoader(path, /* no parent */ null); } |