From issues-return-32340-apmail-struts-issues-archive=struts.apache.org@struts.apache.org Wed Sep 5 12:44:03 2018 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 B9CE21CD3F for ; Wed, 5 Sep 2018 12:44:03 +0000 (UTC) Received: (qmail 77473 invoked by uid 500); 5 Sep 2018 12:44:03 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 77434 invoked by uid 500); 5 Sep 2018 12:44: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 77424 invoked by uid 99); 5 Sep 2018 12:44:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2018 12:44:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 2B737C1C64 for ; Wed, 5 Sep 2018 12:44:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id OaOnYAMT2Nti for ; Wed, 5 Sep 2018 12:44:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id DCAB85F385 for ; Wed, 5 Sep 2018 12:44:01 +0000 (UTC) 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 04EDCE261D for ; Wed, 5 Sep 2018 12:44: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 487F926B5A for ; Wed, 5 Sep 2018 12:44:00 +0000 (UTC) Date: Wed, 5 Sep 2018 12:44:00 +0000 (UTC) From: "Lukasz Lenart (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (WW-4957) Update struts version from 2.5.10 to 2.5.17. LocalizedTextUtil class is removed and GlobalLocalizedTextProvider&StrutsLocalizedTextProvider cannot be used instead. 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-4957?page=3Dcom.atlassian.ji= ra.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1660434= 9#comment-16604349 ]=20 Lukasz Lenart edited comment on WW-4957 at 9/5/18 12:43 PM: ------------------------------------------------------------ This doesn't work that way, you cannot manually create {{GlobalLocalizedTex= tProvider}} and change its properties. It's a bean that will be injected by= internal DI mechanism. And {{GlobalLocalizedTextProvider}} is a dedicated = implementation that only loads and uses global properties, it doesn't scan = package hierarchy to find related properties files (eg. {{package.propertie= s}} or {{.properties}}). If you just want to add a global properties file, just define the below con= stant and that's all. It supposed to work and your custom code is not neede= d. {code:xml} {code} was (Author: lukaszlenart): This doesn't work that way, you cannot manually create {{GlobalLocalizedTex= tProvider}} and change its properties. It's a bean that will be injected bt= internal DI mechanism. And {{GlobalLocalizedTextProvider}} is a dedicated = implementation that only loads and uses global properties, it doesn't scan = package hierarchy to find related properties files (eg. {{package.propertie= s}} or {{.properties}}). If you just want to add a global properties file, just define the below con= stant and that's all. It supposed to work and your custom code is not neede= d. {code:xml} {code} > Update struts version from 2.5.10 to 2.5.17. LocalizedTextUtil class is r= emoved and GlobalLocalizedTextProvider&StrutsLocalizedTextProvider cannot b= e used instead. > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= --------------- > > Key: WW-4957 > URL: https://issues.apache.org/jira/browse/WW-4957 > Project: Struts 2 > Issue Type: Bug > Components: Core > Affects Versions: 2.5.17 > Reporter: Konstantinos > Assignee: Lukasz Lenart > Priority: Major > Fix For: 2.6 > > Original Estimate: 72h > Remaining Estimate: 72h > > I have an application that uses struts version 2.5.10.1. i want to update= it to version 2.5.17 after=C2=A0the announcement of the Apache Software Fo= undation that Struts 2.5 to 2.5.16 versions are vulnerable to remote attack= ers. In my current version i use a struts-core library class called Localiz= edTextUtil=C2=A0to load messages from the global message bundle. My code be= low: > {code:java} > private void initialiseMessageBundle() throws InitializationError{ > LOG.info("Loading global messages from " + DEFAULT_RESOURCE); > URL[] urls; > try { > String resourceFolder =3D PropertiesManager.get(Constants.PROP_RE= SOURCES_FOLDER); > File file =3D new File(resourceFolder); > if (!file.exists() || !file.isDirectory()){ > LOG.error("file not found: path(" + Constants.PROP_RESOURCES_= FOLDER + ") =3D " + resourceFolder); > throw new InitializationError("External resource not found fi= le not found"); > } else { > LOG.debug("resources file: " + file.toURI().toURL()); > } > URL url =3D file.toURI().toURL(); > urls =3D new URL[]{url}; > ClassLoader cl =3D new URLClassLoader(urls); > LocalizedTextUtil.setDelegatedClassLoader(cl); > LocalizedTextUtil.addDefaultResourceBundle("global"); > } catch (MalformedURLException e) { > throw new InitializationError("MalformedURLException occured duri= ng the messageBundle initialisation", e); > } > LOG.info("Global messages loaded."); > } > {code} > =C2=A0 > After updating the struts version to 2.5.17 the *LocalizedTextUtil* class= is removed. Although i create a new instance of class *GlobalLocalizedText= Provider* and *StrutsLocalizedTextProvider* and used the same methods (*set= DelegatedClassLoader*,*addDefaultResourceBundle*) my messages=C2=A0are not = been=C2=A0loaded. Also i create a bean of these classes on struts.xml and t= ried to inject it but again without success. Do you have any thought how ca= n i replace the LocalizedTextUtil in my code above? > Thank you. > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)