[Nice-commit] Nice/src/nice/tools/util DirectoryClassLoader.java,1.1,1.2
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-08-05 11:24:12
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4131/src/nice/tools/util Modified Files: DirectoryClassLoader.java Log Message: Make DirectoryClassLoader also find resources. Index: DirectoryClassLoader.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/util/DirectoryClassLoader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DirectoryClassLoader.java 28 Nov 2003 02:57:13 -0000 1.1 --- DirectoryClassLoader.java 5 Aug 2004 11:24:02 -0000 1.2 *************** *** 37,41 **** * This is the method where the task of class loading * is delegated to our custom loader. ! * * @param name the name of the class * @return the resulting <code>Class</code> object --- 37,41 ---- * This is the method where the task of class loading * is delegated to our custom loader. ! * * @param name the name of the class * @return the resulting <code>Class</code> object *************** *** 78,80 **** --- 78,100 ---- } } + + protected java.net.URL findResource(String name) + { + for (int i = 0; i < dirs.length; i++) + { + File res = new File(dirs[i], name); + if (res.exists()) + try { + return res.toURL(); + } + catch(java.net.MalformedURLException e) { + // TODO: probably use the following when we drop JDK 1.3: + // throw new RuntimeException(e); + + return null; + } + } + + return null; + } } |