You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2009/03/05 06:18:09 UTC

Re: svn commit: r750021 - in /camel/branches/camel-1.x: ./ camel-core/src/main/java/org/apache/camel/util/ components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/ components/camel-spring/src/test/resources/org/apache/came

On Thu, Mar 5, 2009 at 2:10 AM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Claus,
>
> Since Camel 1.x doesn't support the onException, I'd like to revert the
> SpringOnExceptionNotNormalizedClassNameTest part and keep the change of
> ObjectHelper.
Can you explain a bit more, onException is in 1.x? Is there something
that fails?

But yes the ObjectHelper changes should be there, it issue was
reported against 1.x and you get this problem when you use Eclipse to
auto format your XML files.



>
> Willem
>
> davsclaus@apache.org wrote:
>> Author: davsclaus
>> Date: Wed Mar  4 14:25:18 2009
>> New Revision: 750021
>>
>> URL: http://svn.apache.org/viewvc?rev=750021&view=rev
>> Log:
>> Merged revisions 750017 via svnmerge from
>> https://svn.apache.org/repos/asf/camel/trunk
>>
>> ........
>>   r750017 | davsclaus | 2009-03-04 15:20:14 +0100 (Wed, 04 Mar 2009) | 1 line
>>
>>   CAMEL-1418: Normalizes class names before loading to avoid \n or other chars by Spring DSL configuration with xml tags on newlines or hidden spaces etc.
>> ........
>>
>> Added:
>>     camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/SpringOnExceptionNotNormalizedClassNameTest.java
>>       - copied unchanged from r750017, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/SpringOnExceptionNotNormalizedClassNameTest.java
>>     camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionNotNormalizedClassNameTest.xml
>>       - copied unchanged from r750017, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionNotNormalizedClassNameTest.xml
>> Modified:
>>     camel/branches/camel-1.x/   (props changed)
>>     camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
>>
>> Propchange: camel/branches/camel-1.x/
>> ------------------------------------------------------------------------------
>> --- svn:mergeinfo (original)
>> +++ svn:mergeinfo Wed Mar  4 14:25:18 2009
>> @@ -1 +1 @@
>> -/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749956
>> +/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749956,750017
>>
>> Propchange: camel/branches/camel-1.x/
>> ------------------------------------------------------------------------------
>> Binary property 'svnmerge-integrated' - no diff available.
>>
>> Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
>> URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=750021&r1=750020&r2=750021&view=diff
>> ==============================================================================
>> --- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
>> +++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Wed Mar  4 14:25:18 2009
>> @@ -478,6 +478,9 @@
>>       * @return the class or null if it could not be loaded
>>       */
>>      public static Class<?> loadClass(String name, ClassLoader loader) {
>> +        // must clean the name so its pure java name, eg remoing \n or whatever people can do in the Spring XML
>> +        name = normalizeClassName(name);
>> +
>>          // try context class loader first
>>          Class clazz = doLoadClass(name, Thread.currentThread().getContextClassLoader());
>>          if (clazz == null) {
>> @@ -843,4 +846,23 @@
>>          }
>>      }
>>
>> +    /**
>> +     * Cleans the string to pure java identifier so we can use it for loading class names.
>> +     * <p/>
>> +     * Especially from Sping DSL people can have \n \t or other characters that otherwise
>> +     * would result in ClassNotFoundException
>> +     *
>> +     * @param name the class name
>> +     * @return normalized classname that can be load by a class loader.
>> +     */
>> +    public static String normalizeClassName(String name) {
>> +        StringBuffer sb = new StringBuffer(name.length());
>> +        for (char ch : name.toCharArray()) {
>> +            if (ch == '.' || Character.isJavaIdentifierPart(ch)) {
>> +                sb.append(ch);
>> +            }
>> +        }
>> +        return sb.toString();
>> +    }
>> +
>>  }
>>
>>
>>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/