From commits-return-18370-archive-asf-public=cust-asf.ponee.io@struts.apache.org Mon Apr 29 05:42:20 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9362C18067E for ; Mon, 29 Apr 2019 07:42:20 +0200 (CEST) Received: (qmail 95710 invoked by uid 500); 29 Apr 2019 05:42:19 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 95579 invoked by uid 99); 29 Apr 2019 05:42:19 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Apr 2019 05:42:19 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 1C536854B4; Mon, 29 Apr 2019 05:42:19 +0000 (UTC) Date: Mon, 29 Apr 2019 05:42:18 +0000 To: "commits@struts.apache.org" Subject: [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. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155651653886.21040.6803635026303115137@gitbox.apache.org> From: lukaszlenart@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: struts X-Git-Refname: refs/heads/struts-2-5-x X-Git-Reftype: branch X-Git-Oldrev: b23bfd42d24868045ee826a1651ec98fb35e470b X-Git-Newrev: 11d373f8b4a41778c1afeb55269929ac76decf07 X-Git-Rev: 11d373f8b4a41778c1afeb55269929ac76decf07 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 <43964333+JCgH4164838Gh792C124B5@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 loadedFileUrls = new HashSet<>(); + private final Set loadedFileUrls = new HashSet<>(); private boolean errorIfMissing; private Map dtdMappings; private Configuration configuration; private boolean throwExceptionOnDuplicateBeans = true; - private Map declaredPackages = new HashMap<>(); + private final Map 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) {