Aggiunta eccezione nel caso non sia registrata una PATH nel ClassRouter
This commit is contained in:
parent
a0f2dfc4a6
commit
4c10a409c4
@ -31,7 +31,8 @@ public class CommonConst {
|
|||||||
|
|
||||||
public static String[] forErrors = {
|
public static String[] forErrors = {
|
||||||
"syslogs@integry.it",
|
"syslogs@integry.it",
|
||||||
"g.scorrano@integry.it"
|
"g.scorrano@integry.it",
|
||||||
|
"v.castellana@integry.it"
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import android.util.Pair;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.class_router.exceptions.MethodPathNotRegisteredException;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
|
|
||||||
public class ClassRouter {
|
public class ClassRouter {
|
||||||
@ -62,16 +63,14 @@ public class ClassRouter {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
if (!checkIClassExists(path)) {
|
if (!checkIClassExists(path)) {
|
||||||
//throw new MethodPathNotRegisteredException(path);
|
throw new MethodPathNotRegisteredException(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Class clazz = mRouteClasses.get(getClassIndex(path)).second;
|
Class clazz = mRouteClasses.get(getClassIndex(path)).second;
|
||||||
|
|
||||||
return (T)clazz.newInstance();
|
return (T)clazz.newInstance();
|
||||||
|
|
||||||
} catch (InstantiationException ex) {
|
} catch (InstantiationException | MethodPathNotRegisteredException | IllegalAccessException ex) {
|
||||||
UtilityExceptions.defaultException(context, ex, true);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
UtilityExceptions.defaultException(context, ex, true);
|
UtilityExceptions.defaultException(context, ex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
package it.integry.integrywmsnative.core.class_router.exceptions;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||||
|
|
||||||
|
public class MethodPathNotRegisteredException extends Exception {
|
||||||
|
|
||||||
|
public MethodPathNotRegisteredException(ClassRouter.PATH path) {
|
||||||
|
super(String.format("Path %s is not registered", path.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user