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 2019/04/29 05:42:18 UTC
[struts] branch struts-2-5-x updated: Minor consistency update
correction for WW-5029 fix to the 2.5.x branch: - Correct missing
verification in buildAllowedMethods()/loadGlobalAllowedMethods() that the
nodes are of type Node.TEXT_NODE (as buildResults() does). - Made two class
fields final, as suggested by IDE.
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/struts-2-5-x by this push:
new 11d373f Minor consistency update correction for WW-5029 fix to the 2.5.x branch: - Correct missing verification in buildAllowedMethods()/loadGlobalAllowedMethods() that the nodes are of type Node.TEXT_NODE (as buildResults() does). - Made two class fields final, as suggested by IDE.
new bb9ce75 Merge pull request #354 from JCgH4164838Gh792C124B5/localS2_25x_B10
11d373f is described below
commit 11d373f8b4a41778c1afeb55269929ac76decf07
Author: JCgH4164838Gh792C124B5 <43...@users.noreply.github.com>
AuthorDate: Sat Apr 27 12:35:40 2019 -0400
Minor consistency update correction for WW-5029 fix to the 2.5.x branch:
- Correct missing verification in buildAllowedMethods()/loadGlobalAllowedMethods() that the nodes are
of type Node.TEXT_NODE (as buildResults() does).
- Made two class fields final, as suggested by IDE.
---
.../config/providers/XmlConfigurationProvider.java | 24 +++++++++++++---------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
index 9cd21fb..1613ae2 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
@@ -93,12 +93,12 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
private String configFileName;
private ObjectFactory objectFactory;
- private Set<String> loadedFileUrls = new HashSet<>();
+ private final Set<String> loadedFileUrls = new HashSet<>();
private boolean errorIfMissing;
private Map<String, String> dtdMappings;
private Configuration configuration;
private boolean throwExceptionOnDuplicateBeans = true;
- private Map<String, Element> declaredPackages = new HashMap<>();
+ private final Map<String, Element> declaredPackages = new HashMap<>();
private FileManager fileManager;
private ValueSubstitutor valueSubstitutor;
@@ -881,10 +881,12 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
final StringBuilder allowedMethodsSB = new StringBuilder();
for (int i = 0; i < allowedMethodsChildren.getLength(); i++) {
Node allowedMethodsChildNode = allowedMethodsChildren.item(i);
- String childNodeValue = (allowedMethodsChildNode != null ? allowedMethodsChildNode.getNodeValue() : "");
- childNodeValue = (childNodeValue != null ? childNodeValue.trim() : "");
- if (childNodeValue.length() > 0) {
- allowedMethodsSB.append(childNodeValue);
+ if (allowedMethodsChildNode != null && allowedMethodsChildNode.getNodeType() == Node.TEXT_NODE) {
+ String childNodeValue = allowedMethodsChildNode.getNodeValue();
+ childNodeValue = (childNodeValue != null ? childNodeValue.trim() : "");
+ if (childNodeValue.length() > 0) {
+ allowedMethodsSB.append(childNodeValue);
+ }
}
}
if (allowedMethodsSB.length() > 0) {
@@ -951,10 +953,12 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
final StringBuilder globalAllowedMethodsSB = new StringBuilder();
for (int i = 0; i < globaAllowedMethodsChildren.getLength(); i++) {
Node globalAllowedMethodsChildNode = globaAllowedMethodsChildren.item(i);
- String childNodeValue = (globalAllowedMethodsChildNode != null ? globalAllowedMethodsChildNode.getNodeValue() : "");
- childNodeValue = (childNodeValue != null ? childNodeValue.trim() : "");
- if (childNodeValue.length() > 0) {
- globalAllowedMethodsSB.append(childNodeValue);
+ if (globalAllowedMethodsChildNode != null && globalAllowedMethodsChildNode.getNodeType() == Node.TEXT_NODE) {
+ String childNodeValue = globalAllowedMethodsChildNode.getNodeValue();
+ childNodeValue = (childNodeValue != null ? childNodeValue.trim() : "");
+ if (childNodeValue.length() > 0) {
+ globalAllowedMethodsSB.append(childNodeValue);
+ }
}
}
if (globalAllowedMethodsSB.length() > 0) {