Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 7866 invoked from network); 21 May 2008 14:26:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2008 14:26:22 -0000 Received: (qmail 78636 invoked by uid 500); 21 May 2008 14:26:21 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 78615 invoked by uid 500); 21 May 2008 14:26:21 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 78585 invoked by uid 99); 21 May 2008 14:26:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 May 2008 07:26:21 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 May 2008 14:25:34 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id D06BB234C123 for ; Wed, 21 May 2008 07:25:55 -0700 (PDT) Message-ID: <1675037870.1211379955852.JavaMail.jira@brutus> Date: Wed, 21 May 2008 07:25:55 -0700 (PDT) From: "Albert Lee (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-604) Log spec sets in persistence unit's property fail with exception when run in different locale In-Reply-To: <122421146.1211211955605.JavaMail.jira@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 [ https://issues.apache.org/jira/browse/OPENJPA-604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598654#action_12598654 ] Albert Lee commented on OPENJPA-604: ------------------------------------ The consensus is to take option 1 for its simplicity and intuitive usage. Thanks for all the input. Albert Lee. > Log spec sets in persistence unit's property fail with exception when run in different locale > --------------------------------------------------------------------------------------------- > > Key: OPENJPA-604 > URL: https://issues.apache.org/jira/browse/OPENJPA-604 > Project: OpenJPA > Issue Type: Improvement > Components: lib > Affects Versions: 1.0.3, 1.1.0, 1.2.0 > Reporter: Albert Lee > Assignee: Albert Lee > Priority: Minor > Fix For: 1.2.0 > > Attachments: OPENJPA-604.opt1.patch, OPENJPA-604.opt2.patch > > > When an application sets the Log property in a persistence unit (persistence.xml) or passes in through map during createEntityManager[Factory] using one locale, this setting will fail when runs in a different locale. > It is caused by the LogImpl: > 1) retrieve the *_STR from the localizer.properties > public static final String TRACE_STR = _loc.get("log-trace").getMessage(); > public static final String INFO_STR = _loc.get("log-info").getMessage(); > public static final String WARN_STR = _loc.get("log-warn").getMessage(); > public static final String ERROR_STR = _loc.get("log-error").getMessage(); > public static final String FATAL_STR = _loc.get("log-fatal").getMessage(); > 2) compare only the current locale *_STR values; > public static short getLevel(String str) { > str = str.toUpperCase().trim(); > short val = TRACE_STR.equals(str) ? Log.TRACE : > INFO_STR.equals(str) ? Log.INFO : > WARN_STR.equals(str) ? Log.WARN : > ERROR_STR.equals(str) ? Log.ERROR : > FATAL_STR.equals(str) ? Log.FATAL : -1; > if (val == -1) > throw new IllegalArgumentException > (_loc.get("log-bad-constant", str).getMessage()); > return val; > } > I understand the intention is to match the Log setting using the same locale, however if the Log string is set in an application's persistence unit (persistence.xml) or business logic (createEntityManagerFactory( ...., map)), the application will fail. > I see two alternatives: > 1) Since Log is part of the property and configuration framework, none of these property settings are local sensitive. We can make Log property NOT locale sensitive, i.e. always use TRACE, INFO, WARN, ERROR and FATAL as the Log values. > 2) Access both English (as in alternative 1) and also whatever current locale Log values. I.e. English only Log values will work when set in persistence.xml and business logic regardless of the current locale setting but locale specific settings ONLY work in the same current locale. > Personally, the second option is more attractive and also backward compatible with existing application that uses locale specific behavior. > Please comment on your preference! > Albert Lee. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.