Protect against Exceptions in ResultHandler code
This commit is contained in:
@@ -27,7 +27,7 @@ import org.springframework.shell.ResultHandler;
|
||||
*
|
||||
* @author Eric Bottard
|
||||
*/
|
||||
public abstract class TerminalAwareResultHandler<T> implements ResultHandler<T> {
|
||||
public abstract class TerminalAwareResultHandler<T> implements ResultHandler<T> {
|
||||
protected Terminal terminal;
|
||||
|
||||
@Autowired @Lazy
|
||||
|
||||
@@ -47,7 +47,13 @@ public class TypeHierarchyResultHandler implements ResultHandler<Object> {
|
||||
}
|
||||
Class<?> clazz = result.getClass();
|
||||
ResultHandler handler = getResultHandler(clazz);
|
||||
handler.handleResult(result);
|
||||
try {
|
||||
handler.handleResult(result);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Protect against exceptions happening in ResultHandlers
|
||||
getResultHandler(e.getClass()).handleResult(e);
|
||||
}
|
||||
}
|
||||
|
||||
private ResultHandler getResultHandler(Class<?> clazz) {
|
||||
|
||||
Reference in New Issue
Block a user