Return-Path: Delivered-To: apmail-struts-dev-archive@www.apache.org Received: (qmail 92333 invoked from network); 25 Apr 2006 18:55:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Apr 2006 18:55:14 -0000 Received: (qmail 17463 invoked by uid 500); 25 Apr 2006 18:55:07 -0000 Delivered-To: apmail-struts-dev-archive@struts.apache.org Received: (qmail 17330 invoked by uid 500); 25 Apr 2006 18:55:06 -0000 Mailing-List: contact dev-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list dev@struts.apache.org Received: (qmail 17292 invoked by uid 99); 25 Apr 2006 18:55:06 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Apr 2006 11:55:06 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Apr 2006 11:55:05 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 36DDD714294 for ; Tue, 25 Apr 2006 18:54:45 +0000 (GMT) Message-ID: <29451474.1145991285221.JavaMail.root@brutus> Date: Tue, 25 Apr 2006 18:54:45 +0000 (GMT+00:00) From: "Don Brown (JIRA)" To: dev@struts.apache.org Subject: [jira] Updated: (STR-2843) PropertyMessageResources.loadLocale(String localeKey) has a problem! In-Reply-To: <729278.1145991165219.JavaMail.root@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/struts/browse/STR-2843?page=all ] Don Brown updated STR-2843: --------------------------- Summary: PropertyMessageResources.loadLocale(String localeKey) has a problem! (was: CLONE -PropertyMessageResources.loadLocale(String localeKey) has a problem!) Bugzilla Id: (was: 35155) Assign To: (was: Struts Developer Mailing List) Had to clone due to corrupted ticket > PropertyMessageResources.loadLocale(String localeKey) has a problem! > -------------------------------------------------------------------- > > Key: STR-2843 > URL: http://issues.apache.org/struts/browse/STR-2843 > Project: Struts Action 1 > Type: Bug > Components: Action > Versions: Nightly Build > Environment: Operating System: other > Platform: Other > Reporter: qxo > > when > struts-config.xml -->message-resources -->parameter:resourceA > if resourceA not existed,it should show some error message,but not! > cause: > PropertyMessageResources.loadLocale(String localeKey) has a problem! > I fixed it; > Code: > protected synchronized void loadLocale(String localeKey) { > // Have we already attempted to load messages for this locale? > if (locales.get(localeKey) != null) { > return; > } > > if (log.isTraceEnabled()) { > log.trace("loadLocale(" + localeKey + ")"); > } > > > > locales.put(localeKey, localeKey); > // Set up to load the property resource for this locale key, if we can > String name = config.replace('.', '/'); > if (localeKey.length() > 0) { > name += "_" + localeKey; > } > > name += ".properties"; > InputStream is = null; > > // Load the specified property resource > if (log.isTraceEnabled()) { > log.trace(" Loading resource '" + name + "'"); > } > > ClassLoader classLoader = > Thread.currentThread().getContextClassLoader(); > if (classLoader == null) { > classLoader = this.getClass().getClassLoader(); > } > > is = classLoader.getResourceAsStream(name); > if (is != null) { > Properties props = new Properties(); > > try { > props.load(is); > } catch (IOException e) { > log.error("loadLocale()", e); > } finally { > try { > is.close(); > } catch (IOException e) { > log.error("loadLocale()", e); > } > } > > // Copy the corresponding values into our cache > if (props.size() < 1) { > return; > } > > synchronized (messages) { > Iterator names = props.keySet().iterator(); > while (names.hasNext()) { > String key = (String) names.next(); > if (log.isTraceEnabled()) { > log.trace(" Saving message key '" + > messageKey(localeKey, key)); > } > messages.put(messageKey(localeKey, key), > props.getProperty(key)); > } > } > if (log.isTraceEnabled()) { > log.trace(" Loading resource completed"); > } > }else{ > > if (log.isWarnEnabled()) { > log.warn("the resource not found."); > } > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org For additional commands, e-mail: dev-help@struts.apache.org