Fix up URLDecoding as per @zreed's recommendation

This commit is contained in:
libraryaddict 2014-05-25 17:57:34 +12:00
parent e24f404e42
commit 6652959553

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Entity;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder;
import java.security.CodeSource; import java.security.CodeSource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
@ -43,8 +44,9 @@ public class ClassGetter {
} }
private static void processJarfile(URL resource, String pkgname, ArrayList<Class<?>> classes) { private static void processJarfile(URL resource, String pkgname, ArrayList<Class<?>> classes) {
try {
String relPath = pkgname.replace('.', '/'); String relPath = pkgname.replace('.', '/');
String resPath = resource.getPath().replace("%20", " "); String resPath = URLDecoder.decode(resource.getPath(), "UTF-8");
String jarPath = resPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", ""); String jarPath = resPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", "");
JarFile jarFile; JarFile jarFile;
try { try {
@ -68,5 +70,8 @@ public class ClassGetter {
classes.add(c); classes.add(c);
} }
} }
} catch (Exception ex) {
ex.printStackTrace();
}
} }
} }