mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
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:
+4
-7
@@ -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;
|
||||
|
||||
+3
-2
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user