WW-4071 Changes interface a bit after review

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1485311 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Lukasz Lenart
2013-05-22 17:51:40 +00:00
parent 07f97efcfd
commit d72ae0cffa
3 changed files with 9 additions and 11 deletions
@@ -209,13 +209,10 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
protected String processValidationErrorAware(final Object action, final String currentResultName) {
String resultName = currentResultName;
if (action instanceof ValidationErrorAware) {
String validationErrorAwareResult = ((ValidationErrorAware) action).actionErrorOccurred();
if (validationErrorAwareResult != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Changing result name from [#0] to [#1] because of processing interface [#2] on action [#3]",
currentResultName, resultName, ValidationErrorAware.class.getSimpleName(), action);
}
resultName = validationErrorAwareResult;
resultName = ((ValidationErrorAware) action).actionErrorOccurred(currentResultName);
if (LOG.isDebugEnabled()) {
LOG.debug("Changing result name from [#0] to [#1] because of processing interface [#2] on action [#3]",
currentResultName, resultName, ValidationErrorAware.class.getSimpleName(), action);
}
}
return resultName;
@@ -30,8 +30,9 @@ public interface ValidationErrorAware {
/**
* Allows to notify action about occurred action/field errors
*
* @return new result name or null to keep result of {@link com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor}
* @param currentResultName current result name, action can change it or return the same
* @return new result name or passed currentResultName
*/
String actionErrorOccurred();
String actionErrorOccurred(final String currentResultName);
}
@@ -37,7 +37,7 @@ public class ValidationErrorAwareTest extends XWorkTestCase {
public void testNotChangeResultWhenNotifyAboutValidationError() throws Exception {
// given
actionResult = null;
actionResult = Action.INPUT;
ValidationInterceptor validationInterceptor = create();
// when
@@ -56,7 +56,7 @@ public class ValidationErrorAwareTest extends XWorkTestCase {
interceptor = new DefaultWorkflowInterceptor();
ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
EasyMock.expect(action.actionErrorOccurred()).andAnswer(new IAnswer<String>() {
EasyMock.expect(action.actionErrorOccurred(EasyMock.<String>anyObject())).andAnswer(new IAnswer<String>() {
public String answer() throws Throwable {
return actionResult;
}