Claus

unfortunatly the iterator being returned there has got exactly the same bug
marked with a TODO!

See ObjectHelper lines 516..519

        } else if (value.getClass().isArray()) {
            // TODO we should handle primitive array types?
            List list = Arrays.asList((Object[])value);
            return list.iterator();

IMHO a possible solution would be to grap into the array content (e.g.
array[0] if it's size > 0) and check for e.g.:

  (array[0] != null && array[0].getClass().isPrimitive())

Or something like that, e.g. byte.class.isPrimitive() returns true.

Babak


Claus Ibsen-2 wrote
> On Thu, Jan 10, 2013 at 11:54 AM, Babak Vahdat
> <

> babak.vahdat@

> > wrote:
>> Hi
>>
>> Don't know much about CXF itself but this is more than obvious as the
>> code
>> (DefaultCxfBinding line 344) is buggy because one can not simply cast an
>> array of *primitive* type ("[B" means array of byte) to Object[] which is
>> an
>> array of *reference* type!
>>
>> You would get the same stack trace if you would try to run the crappy
>> code
>> below:
>>
>>     public static void main(String[] args) {
>>         byte[] bytes = new byte[] {3, 4};
>>
>>         if (bytes.getClass().isArray()) {
>>             System.out.println("yes it's an array BUT of the primitive
>> type!");
>>             Object array = bytes;
>>             Object[] casted = (Object[]) array; // BOOM
>>         }
>>     }
>>
> 
> Yes there is some code in ObjectHelper or one of the helper/util
> classes in the util package
> that can check for array and primitives.
> 
> And better yet there is an iterator that can deal with that too.
> So can can more safely grab the data.
> 
> 
>> Babak
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Question-camel-cxf-CXF-MESSAGE-tp5725227p5725230.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: 

> cibsen@

> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen





--
View this message in context: 
http://camel.465427.n5.nabble.com/Question-camel-cxf-CXF-MESSAGE-tp5725227p5725245.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to