Fix video rippers: Revert breaking change to exception handling.

This commit is contained in:
MetaPrime 2017-05-23 10:38:08 -07:00
parent 0164656d39
commit 33520a205e

View File

@ -20,7 +20,6 @@ import com.rarchives.ripme.ui.RipStatusHandler;
import com.rarchives.ripme.ui.RipStatusMessage; import com.rarchives.ripme.ui.RipStatusMessage;
import com.rarchives.ripme.ui.RipStatusMessage.STATUS; import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
import com.rarchives.ripme.utils.Utils; import com.rarchives.ripme.utils.Utils;
import java.lang.reflect.InvocationTargetException;
public abstract class AbstractRipper public abstract class AbstractRipper
extends Observable extends Observable
@ -294,31 +293,19 @@ public abstract class AbstractRipper
public static AbstractRipper getRipper(URL url) throws Exception { public static AbstractRipper getRipper(URL url) throws Exception {
for (Constructor<?> constructor : getRipperConstructors("com.rarchives.ripme.ripper.rippers")) { for (Constructor<?> constructor : getRipperConstructors("com.rarchives.ripme.ripper.rippers")) {
try { try {
AlbumRipper ripper = (AlbumRipper) constructor.newInstance(url); AlbumRipper ripper = (AlbumRipper) constructor.newInstance(url); // by design: can throw ClassCastException
logger.debug("Found album ripper: " + ripper.getClass().getName()); logger.debug("Found album ripper: " + ripper.getClass().getName());
return ripper; return ripper;
} catch (InstantiationException e) { } catch (Exception e) {
// Incompatible rippers *will* throw exceptions during instantiation.
} catch (IllegalAccessException e) {
// Incompatible rippers *will* throw exceptions during instantiation.
} catch (IllegalArgumentException e) {
// Incompatible rippers *will* throw exceptions during instantiation.
} catch (InvocationTargetException e) {
// Incompatible rippers *will* throw exceptions during instantiation. // Incompatible rippers *will* throw exceptions during instantiation.
} }
} }
for (Constructor<?> constructor : getRipperConstructors("com.rarchives.ripme.ripper.rippers.video")) { for (Constructor<?> constructor : getRipperConstructors("com.rarchives.ripme.ripper.rippers.video")) {
try { try {
VideoRipper ripper = (VideoRipper) constructor.newInstance(url); VideoRipper ripper = (VideoRipper) constructor.newInstance(url); // by design: can throw ClassCastException
logger.debug("Found video ripper: " + ripper.getClass().getName()); logger.debug("Found video ripper: " + ripper.getClass().getName());
return ripper; return ripper;
} catch (InstantiationException e) { } catch (Exception e) {
// Incompatible rippers *will* throw exceptions during instantiation.
} catch (IllegalAccessException e) {
// Incompatible rippers *will* throw exceptions during instantiation.
} catch (IllegalArgumentException e) {
// Incompatible rippers *will* throw exceptions during instantiation.
} catch (InvocationTargetException e) {
// Incompatible rippers *will* throw exceptions during instantiation. // Incompatible rippers *will* throw exceptions during instantiation.
} }
} }