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