Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 98828 invoked from network); 21 Mar 2010 08:17:28 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Mar 2010 08:17:28 -0000 Received: (qmail 1118 invoked by uid 500); 21 Mar 2010 08:17:19 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 1063 invoked by uid 500); 21 Mar 2010 08:17:19 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 1047 invoked by uid 99); 21 Mar 2010 08:17:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Mar 2010 08:17:18 +0000 X-ASF-Spam-Status: No, hits=-1068.5 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Mar 2010 08:17:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DD5B923888CD; Sun, 21 Mar 2010 08:16:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r925739 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/util/IntrospectionSupport.java test/java/org/apache/camel/util/IntrospectionSupportTest.java test/java/org/apache/camel/util/jndi/ExampleBean.java Date: Sun, 21 Mar 2010 08:16:56 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100321081656.DD5B923888CD@eris.apache.org> Author: davsclaus Date: Sun Mar 21 08:16:56 2010 New Revision: 925739 URL: http://svn.apache.org/viewvc?rev=925739&view=rev Log: CAMEL-2561: Fixed Camel bean introspection to use English locale to avoid issues with foregin languages in upper casing letters. Thanks to Christian Mueller for patch. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java camel/trunk/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java camel/trunk/camel-core/src/test/java/org/apache/camel/util/jndi/ExampleBean.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=925739&r1=925738&r2=925739&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java Sun Mar 21 08:16:56 2010 @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.regex.Pattern; @@ -156,7 +157,7 @@ public final class IntrospectionSupport ObjectHelper.notNull(target, "target"); ObjectHelper.notNull(property, "property"); - property = property.substring(0, 1).toUpperCase() + property.substring(1); + property = property.substring(0, 1).toUpperCase(Locale.ENGLISH) + property.substring(1); Class clazz = target.getClass(); Method method = getPropertyGetter(clazz, property); Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java?rev=925739&r1=925738&r2=925739&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java Sun Mar 21 08:16:56 2010 @@ -19,6 +19,7 @@ package org.apache.camel.util; import java.lang.reflect.Method; import java.util.Collections; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import org.apache.camel.ContextTestSupport; @@ -126,6 +127,28 @@ public class IntrospectionSupportTest ex Object name = IntrospectionSupport.getProperty(bean, "name"); assertEquals("Claus", name); } + + public void testGetPropertyLocaleIndependend() throws Exception { + Locale oldLocale = Locale.getDefault(); + Locale.setDefault(new Locale("tr", "TR")); + + try { + ExampleBean bean = new ExampleBean(); + bean.setName("Claus"); + bean.setPrice(10.0); + bean.setId("1"); + + Object name = IntrospectionSupport.getProperty(bean, "name"); + Object id = IntrospectionSupport.getProperty(bean, "id"); + Object price = IntrospectionSupport.getProperty(bean, "price"); + + assertEquals("Claus", name); + assertEquals(10.0, price); + assertEquals("1", id); + } finally { + Locale.setDefault(oldLocale); + } + } public void testGetPropertyGetter() throws Exception { ExampleBean bean = new ExampleBean(); Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/util/jndi/ExampleBean.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/util/jndi/ExampleBean.java?rev=925739&r1=925738&r2=925739&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/util/jndi/ExampleBean.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/util/jndi/ExampleBean.java Sun Mar 21 08:16:56 2010 @@ -20,11 +20,12 @@ package org.apache.camel.util.jndi; * @version $Revision$ */ public class ExampleBean { + private String id; private String name; private double price; public String toString() { - return "ExampleBean[name: " + name + " price: " + price + "]"; + return "ExampleBean[name: " + name + " price: " + price + " id: " + id + "]"; } public String getName() { @@ -42,4 +43,12 @@ public class ExampleBean { public void setPrice(double price) { this.price = price; } -} + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} \ No newline at end of file