removed old out-commented code
This commit is contained in:
parent
9694a0a5a2
commit
cb555e6ec8
@ -223,161 +223,5 @@ public class XClassLoader {
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param pathlist
|
||||
* @return
|
||||
*/
|
||||
/* public static ArrayList<Class<?>> getClasses(ArrayList<String> pathlist) {
|
||||
|
||||
ArrayList<Class<?>> result = new ArrayList<>();
|
||||
|
||||
for (String path : pathlist) {
|
||||
|
||||
ArrayList<File> 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<Class<?>> getClasses(String path) {
|
||||
ArrayList<String> 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<Class<UIManager.LookAndFeelInfo>> 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;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user