[ 
https://issues.apache.org/jira/browse/KYLIN-1461?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dong Li closed KYLIN-1461.
--------------------------

> Avro: NullPointerException from Json.ObjectWriter
> -------------------------------------------------
>
>                 Key: KYLIN-1461
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1461
>             Project: Kylin
>          Issue Type: Bug
>          Components: General
>         Environment: avro 1.8.0, jackson-core-asl 1.9.13, jackson-mapper-asl 
> 1.9.13,  Java 7, Mac OS X 10.11.3
>            Reporter: Thomas Lörtsch
>            Assignee: Dong Li
>
> The complete, slightly more involved code is on 
> https://github.com/tomlurge/converTor, especially 
> https://github.com/tomlurge/converTor/blob/master/src/converTor/WriterObject.java,
>  but the relevant parts are as follows:
> Json.ObjectWriter jsonDatumWriter = new Json.ObjectWriter();
> OutputStream out = new FileOutputStream(outputFile);
> Encoder encoder = EncoderFactory.get().jsonEncoder(schema, out, pretty);
> System.out.println(load);
> jsonDatumWriter.write(load, encoder);
> ((Json.ObjectWriter) dataFileWriter).write(load, jsonEncoder);
> The console will print out a nice JSON string (load), followed by the 
> following exception:
> Exception in thread "main" java.lang.NullPointerException
>       at org.apache.avro.data.Json.write(Json.java:183)
>       at org.apache.avro.data.Json.writeObject(Json.java:272)
>       at org.apache.avro.data.Json.access$000(Json.java:48)
>       at org.apache.avro.data.Json$ObjectWriter.write(Json.java:122)
>       at converTor.WriterObject.append(WriterObject.java:59)
>       at converTor.ConverTor.main(ConverTor.java:251)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> My guess is that the problem is the call of asToken() in 
> org.codehaus.jackson.JsonNode, which is abstract.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to