Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA45F11920 for ; Fri, 28 Mar 2014 20:53:21 +0000 (UTC) Received: (qmail 97445 invoked by uid 500); 28 Mar 2014 20:53:20 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 97416 invoked by uid 500); 28 Mar 2014 20:53:19 -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 97347 invoked by uid 99); 28 Mar 2014 20:53:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Mar 2014 20:53:17 +0000 Date: Fri, 28 Mar 2014 20:53:17 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-4302) XmlConfigurationProvider.loadedFileUrls only contains the last one of urls with same file name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13951369#comment-13951369 ] ASF subversion and git services commented on WW-4302: ----------------------------------------------------- Commit 1fae47dfc6c79624488f838e3cc8790fb2d00ae8 in struts's branch refs/heads/develop from [~lukaszlenart] [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=1fae47d ] WW-4302 XmlConfigurationProvider.loadedFileUrls observs all loaded files > XmlConfigurationProvider.loadedFileUrls only contains the last one of urls with same file name > ---------------------------------------------------------------------------------------------- > > Key: WW-4302 > URL: https://issues.apache.org/jira/browse/WW-4302 > Project: Struts 2 > Issue Type: Bug > Components: XML Configuration > Affects Versions: 2.3.16.1 > Reporter: Liang Liu > Assignee: Lukasz Lenart > Priority: Minor > Labels: patch > Fix For: 2.3.17 > > > In XmlConfigurationProvider, the field loadedFileUrls contains the xml files loaded. The loaded files will be checked if they are modified for configuration reloading. > {code:java} > public boolean needsReload() { > for (String url : loadedFileUrls) { > if (fileManager.fileNeedsReloading(url)) { > return true; > } > } > return false; > } > {code} > But in method private List loadConfigurationFiles(String fileName, Element includeElement), after the while (urls.hasNext()) loop, the variable url is assigned by the last one of urls with same file name. > So when loadedFileUrls.add(url.toString()); is called in the for (Document doc : docs) loop, only THE LAST ONE is added to loadedFileUrls. > I wrote a demo. I set > . I wrote two configuration files: struts-plugin.xml and struts-biz.xml in my web project. I use struts plugins such as struts-spring-plugin, struts-json-plugin and so on. > The reloading works when I changed the file struts-biz.xml in my project. But it does not work when I changed struts-plugin.xml in my project. I debug XmlConfigurationProvider and see only the struts-plugin.xml in struts-spring-plugin is contained in loadedFileUrls. > I tried to fix it by moving the loadedFileUrls.add(url.toString()); into the while (urls.hasNext()) loop. I send a pull request in github: https://github.com/apache/struts/pull/6, and I test it running well. -- This message was sent by Atlassian JIRA (v6.2#6252)