diff --git a/src/opensesim/util/XClassLoader.java b/src/opensesim/util/XClassLoader.java index a2ae626..2936c51 100644 --- a/src/opensesim/util/XClassLoader.java +++ b/src/opensesim/util/XClassLoader.java @@ -223,161 +223,5 @@ public class XClassLoader { } } - /** - * - * @param pathlist - * @return - */ - /* public static ArrayList> getClasses(ArrayList pathlist) { - ArrayList> result = new ArrayList<>(); - - for (String path : pathlist) { - - ArrayList files = Files.listFiles(path); - - for (File file : files) { - - if (!file.exists()) { - java.util.logging.Logger.getLogger("opensesim").log(Level.WARNING, - "File dos not exists: " + file.getAbsolutePath()); - continue; - } - - String fn = file.toString(); - - // handle file with .class extension - if (fn.toLowerCase().endsWith(".class")) { - - String class_name; - class_name = fn.substring(path.length()); - // in case we are under Windows, replace \ with / - class_name = class_name.replace("\\", "/"); - class_name = class_name.substring(1, class_name.length() - 6).replace('/', '.'); - - //java.util.logging.Logger.getLogger(XClassLoader.class.getName()).log(Level.SEVERE, null, null); - java.util.logging.Logger.getLogger("opensesim").log(Level.SEVERE, fn); - Class c = checkClass(path, class_name); - // if (null == c) { - // continue; - // } - // result.add(c); - } - - // handle file .jar extension - if (fn.toLowerCase().endsWith(".jar")) { - JarInputStream jarstream = null; - try { - File jarfile = new File(fn); - jarstream = new JarInputStream(new FileInputStream(jarfile)); - JarEntry jarentry; - - while ((jarentry = jarstream.getNextJarEntry()) != null) { - - String class_name = jarentry.getName(); - - if (class_name.endsWith(".class")) { - - class_name = class_name.substring(0, class_name.length() - 6).replace('/', '.'); - Class c = checkClass(fn, class_name); -// if (null == c) { -// continue; - // } - // result.add(c); - } - } - } catch (IOException ex) { - - } finally { - try { - if (jarstream != null) { - jarstream.close(); - } - } catch (IOException ex) { - // java.util.logging.Logger.getLogger(AutoTraderLoader.class.getName()).log(Level.SEVERE, null, ex); - } - } - - } - - } - - } - return result; - } - - public static ArrayList> getClasses(String path) { - ArrayList pathlist = new ArrayList(); - pathlist.add(path); - return getClasses(pathlist); - - } - - */ - /* - private static Class checkClass(String directory, String class_name) { - - if (class_name == null) { - return null; - } - - URL url; - try { - url = new File(directory).toURI().toURL(); - - } catch (MalformedURLException ex) { - return null; - } - URL[] urls = new URL[]{url}; - - ClassLoader cl; - cl = new URLClassLoader(urls); - - try { - Class cls; - cls = cl.loadClass(class_name); - if (cls == null) { - return null; - } - - System.out.printf("ClassChecker: %s\n", class_name); - - String gn = cls.toGenericString(); - - ArrayList> res; - - Class xxx = javax.swing.LookAndFeel.class; - - if (Modifier.isAbstract(cls.getModifiers())) { - return null; - } - - if (Modifier.isInterface(cls.getModifiers())) { - return null; - } - - boolean rrr = xxx.isAssignableFrom(cls); - - if (rrr) { - System.out.print(class_name); - System.out.print("\n"); - //javax.swing.LookAndFeel laf; - - //UIManager.installLookAndFeel(class_name, class_name); - //UIManager.installLookAndFeel(class_name, class_name); - } - - //res.getClass().isAssignableFrom(cls); - - return (Class) cls; - - } catch (NoClassDefFoundError ex) { - return null; - } catch (ClassNotFoundException ex) { - Logger.getLogger(XClassLoader.class.getName()).log(Level.SEVERE, null, ex); - return null; - } - - } - */ }