From 01bc94ae0b052025fbd416d3f2562454042cfbe2 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Mon, 24 Mar 2014 08:02:32 -0700 Subject: [PATCH] Fixing configuration so it works from JARs --- src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java | 2 ++ .../com/rarchives/ripme/ripper/rippers/MotherlessRipper.java | 3 ++- src/main/java/com/rarchives/ripme/ui/MainWindow.java | 4 ++++ src/main/java/com/rarchives/ripme/utils/Utils.java | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java index cb737410..19917f97 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java @@ -290,6 +290,8 @@ public abstract class AbstractRipper AbstractRipper ripper = (AbstractRipper) constructor.newInstance(url); return ripper; } catch (Exception e) { + System.err.println(constructor.getName()); + e.printStackTrace(); // Incompatible rippers *will* throw exceptions during instantiation. } } diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/MotherlessRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/MotherlessRipper.java index f4273925..daf33c39 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/MotherlessRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/MotherlessRipper.java @@ -47,8 +47,9 @@ public class MotherlessRipper extends AbstractRipper { @Override public String getGID(URL url) throws MalformedURLException { - Pattern p = Pattern.compile("^https?://(www\\.)?motherless\\.com/G([VI][A-F0-9]{6,8}).*$"); + Pattern p = Pattern.compile("^https?://(www\\.)?motherless\\.com/G([MVI][A-F0-9]{6,8}).*$"); Matcher m = p.matcher(url.toExternalForm()); + System.err.println(url.toExternalForm()); if (!m.matches()) { throw new MalformedURLException("Expected URL format: http://motherless.com/GIXXXXXXX, got: " + url); } diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 87b6c056..75918378 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -356,6 +356,10 @@ public class MainWindow implements Runnable, RipStatusHandler { } catch (Exception e) { logger.error("[!] Error while ripping: " + e.getMessage(), e); status("Error: " + e.getMessage()); + ripButton.setEnabled(true); + ripTextfield.setEnabled(true); + statusProgress.setValue(0); + mainFrame.pack(); return null; } } diff --git a/src/main/java/com/rarchives/ripme/utils/Utils.java b/src/main/java/com/rarchives/ripme/utils/Utils.java index 98039c26..318524ef 100644 --- a/src/main/java/com/rarchives/ripme/utils/Utils.java +++ b/src/main/java/com/rarchives/ripme/utils/Utils.java @@ -20,7 +20,7 @@ import org.apache.log4j.Logger; public class Utils { public static final String RIP_DIRECTORY = "rips"; - private static final File configFile = new File("src/main/resources/rip.properties"); + private static final String configFile = "rip.properties"; private static final Logger logger = Logger.getLogger(Utils.class); private static Configuration config;