You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2015/09/28 20:53:16 UTC
[27/33] struts git commit: Inherits parents' strict DMI
Inherits parents' strict DMI
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/29407614
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/29407614
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/29407614
Branch: refs/heads/master
Commit: 294076145f153e291eb7c38bb58a9b04bf3fb0e5
Parents: a61a369
Author: Lukasz Lenart <lu...@gmail.com>
Authored: Tue Sep 8 08:24:28 2015 +0200
Committer: Lukasz Lenart <lu...@gmail.com>
Committed: Tue Sep 8 08:24:28 2015 +0200
----------------------------------------------------------------------
.../xwork2/config/entities/PackageConfig.java | 102 +++++++++----------
...mlConfigurationProviderInterceptorsTest.java | 2 -
2 files changed, 46 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/29407614/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java b/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
index aa53a12..10286c4 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
@@ -53,6 +53,7 @@ public class PackageConfig extends Located implements Comparable, Serializable,
protected String namespace = "";
protected boolean isAbstract = false;
protected boolean needsRefresh;
+ protected boolean strictMethodInvocation = true;
protected PackageConfig(String name) {
this.name = name;
@@ -82,6 +83,7 @@ public class PackageConfig extends Located implements Comparable, Serializable,
this.globalExceptionMappingConfigs = new ArrayList<>(orig.globalExceptionMappingConfigs);
this.parents = new ArrayList<>(orig.parents);
this.location = orig.location;
+ this.strictMethodInvocation = orig.strictMethodInvocation;
}
public boolean isAbstract() {
@@ -330,7 +332,6 @@ public class PackageConfig extends Located implements Comparable, Serializable,
return resultTypeConfigs;
}
-
public boolean isNeedsRefresh() {
return needsRefresh;
}
@@ -345,80 +346,64 @@ public class PackageConfig extends Located implements Comparable, Serializable,
return globalExceptionMappingConfigs;
}
+ public boolean isStrictMethodInvocation() {
+ return strictMethodInvocation;
+ }
+
@Override
public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof PackageConfig)) {
- return false;
- }
-
- final PackageConfig packageConfig = (PackageConfig) o;
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
- if (isAbstract != packageConfig.isAbstract) {
- return false;
- }
+ PackageConfig that = (PackageConfig) o;
- if ((actionConfigs != null) ? (!actionConfigs.equals(packageConfig.actionConfigs)) : (packageConfig.actionConfigs != null)) {
+ if (isAbstract != that.isAbstract) return false;
+ if (needsRefresh != that.needsRefresh) return false;
+ if (strictMethodInvocation != that.strictMethodInvocation) return false;
+ if (actionConfigs != null ? !actionConfigs.equals(that.actionConfigs) : that.actionConfigs != null)
return false;
- }
-
- if ((defaultResultType != null) ? (!defaultResultType.equals(packageConfig.defaultResultType)) : (packageConfig.defaultResultType != null)) {
+ if (globalResultConfigs != null ? !globalResultConfigs.equals(that.globalResultConfigs) : that.globalResultConfigs != null)
return false;
- }
-
- if ((defaultClassRef != null) ? (!defaultClassRef.equals(packageConfig.defaultClassRef)) : (packageConfig.defaultClassRef != null)) {
+ if (globalAllowedMethods != null ? !globalAllowedMethods.equals(that.globalAllowedMethods) : that.globalAllowedMethods != null)
return false;
- }
-
- if ((globalResultConfigs != null) ? (!globalResultConfigs.equals(packageConfig.globalResultConfigs)) : (packageConfig.globalResultConfigs != null)) {
+ if (interceptorConfigs != null ? !interceptorConfigs.equals(that.interceptorConfigs) : that.interceptorConfigs != null)
return false;
- }
-
- if ((interceptorConfigs != null) ? (!interceptorConfigs.equals(packageConfig.interceptorConfigs)) : (packageConfig.interceptorConfigs != null)) {
+ if (resultTypeConfigs != null ? !resultTypeConfigs.equals(that.resultTypeConfigs) : that.resultTypeConfigs != null)
return false;
- }
-
- if ((name != null) ? (!name.equals(packageConfig.name)) : (packageConfig.name != null)) {
+ if (globalExceptionMappingConfigs != null ? !globalExceptionMappingConfigs.equals(that.globalExceptionMappingConfigs) : that.globalExceptionMappingConfigs != null)
return false;
- }
-
- if ((namespace != null) ? (!namespace.equals(packageConfig.namespace)) : (packageConfig.namespace != null)) {
+ if (parents != null ? !parents.equals(that.parents) : that.parents != null) return false;
+ if (defaultInterceptorRef != null ? !defaultInterceptorRef.equals(that.defaultInterceptorRef) : that.defaultInterceptorRef != null)
return false;
- }
-
- if ((parents != null) ? (!parents.equals(packageConfig.parents)) : (packageConfig.parents != null)) {
+ if (defaultActionRef != null ? !defaultActionRef.equals(that.defaultActionRef) : that.defaultActionRef != null)
return false;
- }
-
- if ((resultTypeConfigs != null) ? (!resultTypeConfigs.equals(packageConfig.resultTypeConfigs)) : (packageConfig.resultTypeConfigs != null)) {
+ if (defaultResultType != null ? !defaultResultType.equals(that.defaultResultType) : that.defaultResultType != null)
return false;
- }
-
- if ((globalExceptionMappingConfigs != null) ? (!globalExceptionMappingConfigs.equals(packageConfig.globalExceptionMappingConfigs)) : (packageConfig.globalExceptionMappingConfigs != null)) {
+ if (defaultClassRef != null ? !defaultClassRef.equals(that.defaultClassRef) : that.defaultClassRef != null)
return false;
- }
+ if (!name.equals(that.name)) return false;
+ return !(namespace != null ? !namespace.equals(that.namespace) : that.namespace != null);
- return true;
}
@Override
public int hashCode() {
- int result;
- result = ((name != null) ? name.hashCode() : 0);
- result = (29 * result) + ((parents != null) ? parents.hashCode() : 0);
- result = (29 * result) + ((actionConfigs != null) ? actionConfigs.hashCode() : 0);
- result = (29 * result) + ((globalResultConfigs != null) ? globalResultConfigs.hashCode() : 0);
- result = (29 * result) + ((interceptorConfigs != null) ? interceptorConfigs.hashCode() : 0);
- result = (29 * result) + ((resultTypeConfigs != null) ? resultTypeConfigs.hashCode() : 0);
- result = (29 * result) + ((globalExceptionMappingConfigs != null) ? globalExceptionMappingConfigs.hashCode() : 0);
- result = (29 * result) + ((defaultResultType != null) ? defaultResultType.hashCode() : 0);
- result = (29 * result) + ((defaultClassRef != null) ? defaultClassRef.hashCode() : 0);
- result = (29 * result) + ((namespace != null) ? namespace.hashCode() : 0);
- result = (29 * result) + (isAbstract ? 1 : 0);
-
+ int result = actionConfigs != null ? actionConfigs.hashCode() : 0;
+ result = 31 * result + (globalResultConfigs != null ? globalResultConfigs.hashCode() : 0);
+ result = 31 * result + (globalAllowedMethods != null ? globalAllowedMethods.hashCode() : 0);
+ result = 31 * result + (interceptorConfigs != null ? interceptorConfigs.hashCode() : 0);
+ result = 31 * result + (resultTypeConfigs != null ? resultTypeConfigs.hashCode() : 0);
+ result = 31 * result + (globalExceptionMappingConfigs != null ? globalExceptionMappingConfigs.hashCode() : 0);
+ result = 31 * result + (parents != null ? parents.hashCode() : 0);
+ result = 31 * result + (defaultInterceptorRef != null ? defaultInterceptorRef.hashCode() : 0);
+ result = 31 * result + (defaultActionRef != null ? defaultActionRef.hashCode() : 0);
+ result = 31 * result + (defaultResultType != null ? defaultResultType.hashCode() : 0);
+ result = 31 * result + (defaultClassRef != null ? defaultClassRef.hashCode() : 0);
+ result = 31 * result + name.hashCode();
+ result = 31 * result + (namespace != null ? namespace.hashCode() : 0);
+ result = 31 * result + (isAbstract ? 1 : 0);
+ result = 31 * result + (needsRefresh ? 1 : 0);
+ result = 31 * result + (strictMethodInvocation ? 1 : 0);
return result;
}
@@ -620,6 +605,11 @@ public class PackageConfig extends Located implements Comparable, Serializable,
}
public boolean isStrictMethodInvocation() {
+ for (PackageConfig parent : target.parents) {
+ if (parent.isStrictMethodInvocation()) {
+ return true;
+ }
+ }
return strictDMI;
}
http://git-wip-us.apache.org/repos/asf/struts/blob/29407614/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
index b10eb49..cfd7f60 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorsTest.java
@@ -120,7 +120,6 @@ public class XmlConfigurationProviderInterceptorsTest extends ConfigurationTestB
// this should inherit
ActionConfig actionWithNoRef = new ActionConfig.Builder("", "ActionWithNoRef", SimpleAction.class.getName())
.addInterceptor(new InterceptorMapping("timer", objectFactory.buildInterceptor(timerInterceptor, new HashMap<String, String>())))
- .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
.build();
interceptors = new ArrayList<>();
@@ -128,7 +127,6 @@ public class XmlConfigurationProviderInterceptorsTest extends ConfigurationTestB
ActionConfig anotherActionWithOwnRef = new ActionConfig.Builder("", "AnotherActionWithOwnRef", SimpleAction.class.getName())
.addInterceptor(new InterceptorMapping("logging", objectFactory.buildInterceptor(loggingInterceptor, new HashMap<String, String>())))
- .addAllowedMethod(ActionConfig.REGEX_WILDCARD)
.build();
RuntimeConfiguration runtimeConfig = configurationManager.getConfiguration().getRuntimeConfiguration();