1.0.22 - Fixing bug where nothing worked #20

Adding the /rippers/video subdirectory package caused the
auto-class-finder to try to initialize a class that did not exist (dir
name instead of class name).
This commit is contained in:
4pr0n 2014-04-20 17:35:17 -07:00
parent 09162522f0
commit d5822b3700
3 changed files with 8 additions and 6 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.rarchives.ripme</groupId> <groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId> <artifactId>ripme</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0.21</version> <version>1.0.22</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

@ -19,7 +19,7 @@ import org.jsoup.nodes.Document;
public class UpdateUtils { public class UpdateUtils {
private static final Logger logger = Logger.getLogger(UpdateUtils.class); private static final Logger logger = Logger.getLogger(UpdateUtils.class);
private static final String DEFAULT_VERSION = "1.0.21"; private static final String DEFAULT_VERSION = "1.0.22";
private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJsonURL = "http://rarchives.com/ripme.json";
private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String updateJarURL = "http://rarchives.com/ripme.jar";
private static final String mainFileName = "ripme.jar"; private static final String mainFileName = "ripme.jar";

View File

@ -199,23 +199,25 @@ public class Utils {
} }
} }
else { else {
// Load from JAR
try { try {
logger.debug("fullPath = " + fullPath);
String jarPath = fullPath String jarPath = fullPath
.replaceFirst("[.]jar[!].*", ".jar") .replaceFirst("[.]jar[!].*", ".jar")
.replaceFirst("file:", "") .replaceFirst("file:", "")
.replaceAll("%20", " "); .replaceAll("%20", " ");
logger.debug("jarPath = " + jarPath);
JarFile jarFile = new JarFile(jarPath); JarFile jarFile = new JarFile(jarPath);
Enumeration<JarEntry> entries = jarFile.entries(); Enumeration<JarEntry> entries = jarFile.entries();
while(entries.hasMoreElements()) { while(entries.hasMoreElements()) {
String entryName = entries.nextElement().getName(); JarEntry nextElement = entries.nextElement();
String entryName = nextElement.getName();
if(entryName.startsWith(relPath) if(entryName.startsWith(relPath)
&& entryName.length() > (relPath.length() + "/".length())) { && entryName.length() > (relPath.length() + "/".length())
&& !nextElement.isDirectory()) {
String className = entryName.replace('/', '.').replace('\\', '.').replace(".class", ""); String className = entryName.replace('/', '.').replace('\\', '.').replace(".class", "");
try { try {
classes.add(Class.forName(className)); classes.add(Class.forName(className));
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
logger.error("ClassNotFoundException loading " + className);
throw new RuntimeException("ClassNotFoundException loading " + className); throw new RuntimeException("ClassNotFoundException loading " + className);
} }
} }