Some refactoring

This commit is contained in:
7u83 2017-11-19 12:29:12 +01:00
parent cfb18e0584
commit 07b724c0f6

View File

@ -25,27 +25,17 @@
*/ */
package sesim; package sesim;
import gui.Globals;
import java.io.File; import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarInputStream; import java.util.jar.JarInputStream;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
/** /**
* *
@ -69,7 +59,7 @@ public class SeSimClassLoader {
* Create a SeSimClassLoader object with an empty default path * Create a SeSimClassLoader object with an empty default path
*/ */
public SeSimClassLoader() { public SeSimClassLoader() {
this(new ArrayList<String>()); this(new ArrayList<>());
} }
/** /**
@ -154,7 +144,7 @@ public class SeSimClassLoader {
return null; return null;
} }
URL url = null; URL url;
try { try {
url = new File(directory).toURI().toURL(); url = new File(directory).toURI().toURL();
@ -173,7 +163,7 @@ public class SeSimClassLoader {
return null; return null;
} }
if (iface != null){ if (iface != null) {
if (!isInstance(cls, iface)) { if (!isInstance(cls, iface)) {
return null; return null;
} }
@ -258,7 +248,8 @@ public class SeSimClassLoader {
} finally { } finally {
try { try {
jarstream.close(); if (jarstream != null)
jarstream.close();
} catch (IOException ex) { } catch (IOException ex) {
java.util.logging.Logger.getLogger(AutoTraderLoader.class.getName()).log(Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(AutoTraderLoader.class.getName()).log(Level.SEVERE, null, ex);
} }
@ -267,7 +258,7 @@ public class SeSimClassLoader {
} }
} }
// System.exit(0);
} }
return result; return result;
} }