Thanks Hiral, that is the feeling i'm getting.
 
But this test came right out of an Avro unit test that serialized an
object containing Strings?
 
If it's true that reflection does not support Strings, then is there
some other way to use the Avro to support serialization of arbitrary
Java object, especially basic object types like Strings that are so
pervasive?
 
If there are constraints on the type of objects that are supported by
Avro, is there any doc with details?
 
In the absence of any documentation or help, i will have to drop Avro
for now.
 
Marko.
.

________________________________

From: tazan007 [mailto:[email protected]] 
Sent: Monday, November 30, 2009 7:01 PM
To: [email protected]
Subject: Re: reflected char array returning null package.


Not sure if 1.2 supports strings but 1.0 did not support String for
reflection.  Try using Utf8 instead.

-Hiral


On Mon, Nov 30, 2009 at 1:43 PM, Marko Milicevic <[email protected]>
wrote:


        I tried to simplify the sample, and I'm still getting the same
error?
        
               static void test() throws Exception
               {
                       String foobar = "foobar";
                       Schema s =
        ReflectData.get().getSchema(foobar.getClass());
                       ReflectDatumWriter writer = new
ReflectDatumWriter(s);
                       ByteArrayOutputStream out = new
ByteArrayOutputStream();
                       BinaryEncoder binaryEncoder = new
BinaryEncoder(out);
        
                       writer.write(foobar, binaryEncoder);
        
               }
        
        Exception in thread "main" java.lang.NullPointerException
               at
        
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:259)
               at
        
org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:3
        03)
               at
        
org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:291)
               at
        
        
org.apache.avro.reflect.ReflectData.getSchema(ReflectData.java:210)
               at test.Test.test(Test.java:136)
               at test.Test.main(Test.java:39)
        
        
        It almost seems as though java.lang.String is not supported?
But I got
        this code from an avro unit test (TestReflect.java) that
serialized
        objects containing Strings?
        
        Thanks.
        
        Marko.
        .
        


Reply via email to