From issues-return-33280-archive-asf-public=cust-asf.ponee.io@struts.apache.org Mon Apr 29 05:43:07 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 0EEDA18061A for ; Mon, 29 Apr 2019 07:43:06 +0200 (CEST) Received: (qmail 96807 invoked by uid 500); 29 Apr 2019 05:43:03 -0000 Mailing-List: contact issues-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 issues@struts.apache.org Received: (qmail 96790 invoked by uid 99); 29 Apr 2019 05:43:02 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Apr 2019 05:43:02 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id CE0FAE2B57 for ; Mon, 29 Apr 2019 05:43:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0F60125820 for ; Mon, 29 Apr 2019 05:43:01 +0000 (UTC) Date: Mon, 29 Apr 2019 05:43:01 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-5029) The content allowed-methods tag of the XML configuration is sometimes truncated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-5029?page=3Dcom.atlassian.ji= ra.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1682890= 8#comment-16828908 ]=20 ASF subversion and git services commented on WW-5029: ----------------------------------------------------- Commit bb9ce7582b5b8e021eb458527777db07594e5739 in struts's branch refs/hea= ds/struts-2-5-x from Lukasz Lenart [ https://gitbox.apache.org/repos/asf?p=3Dstruts.git;h=3Dbb9ce75 ] Merge pull request #354 from JCgH4164838Gh792C124B5/localS2_25x_B10 Minor consistency update correction for WW-5029 fix to the 2.5.x branch > The content allowed-methods tag of the XML configuration is sometimes tru= ncated > -------------------------------------------------------------------------= ------ > > Key: WW-5029 > URL: https://issues.apache.org/jira/browse/WW-5029 > Project: Struts 2 > Issue Type: Bug > Components: XML Configuration > Affects Versions: 2.5.18 > Reporter: Maxime Clement > Priority: Major > Fix For: 2.5.21, 2.6 > > > Under WebSphere 8.5, the SAX parser sometimes=C2=A0create=C2=A0multiple t= ext elements to represent the value of the "allowed-methods" tag found in t= he struts.xml configuration file. This happens when the text is read in chu= nks as stated here:=C2=A0[https://docs.oracle.com/javase/8/docs/api/org/xml= /sax/ContentHandler.html#characters-char:A-int-int-]. > This case is not handled in class XmlConfigurationProvider, which only re= ads the first child of the org.w3c.dom.Node returned by the parser (see [ht= tps://github.com/apache/struts/blob/struts-2-5-x/core/src/main/java/com/ope= nsymphony/xwork2/config/providers/XmlConfigurationProvider.java#L879]). > =C2=A0 > This means that with this configuration: > {code:java} > method1,method2 > {code} > The node instance almost always contains a single child [ "method1,method= 2" ], but randomly the node instance can contain two children: [ "method1,m= e", "thod2" ]. As only the first child is considered, the retrieved text is= truncated and the configuration doesn't work. > =C2=A0 > It happens randomly and cannot be reproduced easily, but we can see in th= e XmlConfigurationProvider class that this case has been taken into account= for the=C2=A0"result" tag: > {code:java} > something > {code} > =C2=A0See:=C2=A0[https://github.com/apache/struts/blob/struts-2-5-x/core/= src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProv= ider.java#L767]=C2=A0where all node children of type Node.TEXT_NODE are con= catenated to retrieve the text value, so even if the SAX parser returns mul= tiple chunks, the word is correctly reconstructed. > =C2=A0 > As a workaround I created a custom configuration provider that overrides = StrutsXmlConfigurationProvider and redefines the method=C2=A0"buildAllowedM= ethods" in order to parse all children of the node object, as done in metho= d "buildResults". Note that the same problem applies for=C2=A0"global-allow= ed-methods" as the XmlConfigurationProvider also considers the first child = only. > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)