Allow shenanigans (injection) when instantiating logic.
This commit is contained in:
@@ -575,17 +575,7 @@ public class DispatcherServlet extends HttpServlet
|
|||||||
Logic logic = _logic.get(lclass);
|
Logic logic = _logic.get(lclass);
|
||||||
|
|
||||||
if (logic == null) {
|
if (logic == null) {
|
||||||
try {
|
logic = instantiateLogic(path, lclass);
|
||||||
Class<?> pcl = Class.forName(lclass);
|
|
||||||
logic = (Logic)pcl.newInstance();
|
|
||||||
|
|
||||||
} catch (ClassNotFoundException cnfe) {
|
|
||||||
// nothing interesting to report
|
|
||||||
|
|
||||||
} catch (Throwable t) {
|
|
||||||
log.warning("Unable to instantiate logic for application", "path", path,
|
|
||||||
"lclass", lclass, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if something failed, use a dummy in it's place so that we don't sit around all day
|
// if something failed, use a dummy in it's place so that we don't sit around all day
|
||||||
// freaking out about our inability to instantiate the proper logic class
|
// freaking out about our inability to instantiate the proper logic class
|
||||||
@@ -600,6 +590,23 @@ public class DispatcherServlet extends HttpServlet
|
|||||||
return logic;
|
return logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a logic instance with the supplied class name. May return null if no such class
|
||||||
|
* exists.
|
||||||
|
*/
|
||||||
|
protected Logic instantiateLogic (String path, String lclass) {
|
||||||
|
try {
|
||||||
|
Class<?> pcl = Class.forName(lclass);
|
||||||
|
return (Logic)pcl.newInstance();
|
||||||
|
} catch (ClassNotFoundException cnfe) {
|
||||||
|
// nothing interesting to report
|
||||||
|
} catch (Throwable t) {
|
||||||
|
log.warning("Unable to instantiate logic for application", "path", path,
|
||||||
|
"lclass", lclass, t);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/** The application being served by this dispatcher servlet. */
|
/** The application being served by this dispatcher servlet. */
|
||||||
protected Application _app;
|
protected Application _app;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user