Skip to content

Commit

Permalink
Adds proper exception handling during calling action
Browse files Browse the repository at this point in the history
This will allow ExceptionHandler to work
  • Loading branch information
lukaszlenart committed Sep 23, 2014
1 parent 4f4f526 commit 3b9d586
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
import ognl.MethodFailedException;
import ognl.NoSuchPropertyException;
import ognl.OgnlException;

import java.util.ArrayList;
Expand Down Expand Up @@ -439,17 +441,23 @@ protected String invokeAction(Object action, ActionConfig actionConfig) throws E
}
}
return saveResult(actionConfig, methodResult);
} catch (OgnlException e) {
} catch (NoSuchPropertyException e) {
throw new IllegalArgumentException("The " + methodName + "() is not defined in action " + getAction().getClass() + "");
} catch (MethodFailedException e) {
// We try to return the source exception.
//Throwable t = e.getTargetException();
Throwable t = e.getCause();

if (actionEventListener != null) {
String result = actionEventListener.handleException(e, getStack());
String result = actionEventListener.handleException(t, getStack());
if (result != null) {
return result;
}
}
throw e;
if (t instanceof Exception) {
throw (Exception) t;
} else {
throw e;
}
} finally {
UtilTimerStack.pop(timerKey);
}
Expand Down

0 comments on commit 3b9d586

Please sign in to comment.