[jira] [Resolved] (AVRO-1948) Not setting a non-null field in GenericRecord causes a NullPointer exception on Serialisation even though a default is defined in the schema
[ https://issues.apache.org/jira/browse/AVRO-1948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mike Hurd resolved AVRO-1948. - Resolution: Information Provided Thanks Tom, I've closed the issue > Not setting a non-null field in GenericRecord causes a NullPointer exception > on Serialisation even though a default is defined in the schema > > > Key: AVRO-1948 > URL: https://issues.apache.org/jira/browse/AVRO-1948 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.1 > Environment: Windows 7, JDK8 >Reporter: Mike Hurd >Priority: Minor > > As per the summary, I had a search through the existing JIRAs but couldn't > find a match apologies if this is a duplicate: > example schema: > {noformat} > {"namespace": "example.data", > "type": "record", > "name": "Data", > "fields": [ > {"name": "name", "type": "string"}, > {"name": "favorite_season", "type": "string", "default": "Autumn"} > ] > } > {noformat} > {noformat} > GenericRecord record = new GenericData.Record(schema); > record.put("name", "my name"); > {noformat} > Serialising the above throws a NullPointerException: > {noformat} > java.lang.NullPointerException: null of string in field favorite_season of > example.data.Data > at > org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:145) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:139) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:75) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:62) > ~[classes/:?] > {noformat} > Surely, given that the schema is available the writeField method should check > to see if there is a default field available to use if the required field > does not have a value supplied (and is not-null). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1948) Not setting a non-null field in GenericRecord causes a NullPointer exception on Serialisation even though a default is defined in the schema
[ https://issues.apache.org/jira/browse/AVRO-1948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15636083#comment-15636083 ] Mike Hurd commented on AVRO-1948: - Many thanks Tom, that works as expected. Just out of interest, when would you use GenericData.Record over the GenericRecordBuilder? > Not setting a non-null field in GenericRecord causes a NullPointer exception > on Serialisation even though a default is defined in the schema > > > Key: AVRO-1948 > URL: https://issues.apache.org/jira/browse/AVRO-1948 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.1 > Environment: Windows 7, JDK8 >Reporter: Mike Hurd >Priority: Minor > > As per the summary, I had a search through the existing JIRAs but couldn't > find a match apologies if this is a duplicate: > example schema: > {noformat} > {"namespace": "example.data", > "type": "record", > "name": "Data", > "fields": [ > {"name": "name", "type": "string"}, > {"name": "favorite_season", "type": "string", "default": "Autumn"} > ] > } > {noformat} > {noformat} > GenericRecord record = new GenericData.Record(schema); > record.put("name", "my name"); > {noformat} > Serialising the above throws a NullPointerException: > {noformat} > java.lang.NullPointerException: null of string in field favorite_season of > example.data.Data > at > org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:145) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:139) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:75) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:62) > ~[classes/:?] > {noformat} > Surely, given that the schema is available the writeField method should check > to see if there is a default field available to use if the required field > does not have a value supplied (and is not-null). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (AVRO-1949) Not setting a non-null field in GenericRecord causes a NullPointer exception on Serialisation even though a default is defined in the schema
[ https://issues.apache.org/jira/browse/AVRO-1949?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mike Hurd resolved AVRO-1949. - Resolution: Duplicate Duplicate of AVRO-1948 (sorry a re-submit of the JIRA create) > Not setting a non-null field in GenericRecord causes a NullPointer exception > on Serialisation even though a default is defined in the schema > > > Key: AVRO-1949 > URL: https://issues.apache.org/jira/browse/AVRO-1949 > Project: Avro > Issue Type: Bug > Components: java >Affects Versions: 1.8.1 > Environment: Windows 7, JDK8 >Reporter: Mike Hurd >Priority: Minor > > As per the summary, I had a search through the existing JIRAs but couldn't > find a match apologies if this is a duplicate: > example schema: > {noformat} > {"namespace": "example.data", > "type": "record", > "name": "Data", > "fields": [ > {"name": "name", "type": "string"}, > {"name": "favorite_season", "type": "string", "default": "Autumn"} > ] > } > {noformat} > {noformat} > GenericRecord record = new GenericData.Record(schema); > record.put("name", "my name"); > {noformat} > Serialising the above throws a NullPointerException: > {noformat} > java.lang.NullPointerException: null of string in field favorite_season of > example.data.Data > at > org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:145) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:139) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:75) > ~[classes/:?] > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:62) > ~[classes/:?] > {noformat} > Surely, given that the schema is available the writeField method should check > to see if there is a default field available to use if the required field > does not have a value supplied (and is not-null). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (AVRO-1949) Not setting a non-null field in GenericRecord causes a NullPointer exception on Serialisation even though a default is defined in the schema
Mike Hurd created AVRO-1949: --- Summary: Not setting a non-null field in GenericRecord causes a NullPointer exception on Serialisation even though a default is defined in the schema Key: AVRO-1949 URL: https://issues.apache.org/jira/browse/AVRO-1949 Project: Avro Issue Type: Bug Components: java Affects Versions: 1.8.1 Environment: Windows 7, JDK8 Reporter: Mike Hurd Priority: Minor As per the summary, I had a search through the existing JIRAs but couldn't find a match apologies if this is a duplicate: example schema: {noformat} {"namespace": "example.data", "type": "record", "name": "Data", "fields": [ {"name": "name", "type": "string"}, {"name": "favorite_season", "type": "string", "default": "Autumn"} ] } {noformat} {noformat} GenericRecord record = new GenericData.Record(schema); record.put("name", "my name"); {noformat} Serialising the above throws a NullPointerException: {noformat} java.lang.NullPointerException: null of string in field favorite_season of example.data.Data at org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:145) ~[classes/:?] at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:139) ~[classes/:?] at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:75) ~[classes/:?] at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:62) ~[classes/:?] {noformat} Surely, given that the schema is available the writeField method should check to see if there is a default field available to use if the required field does not have a value supplied (and is not-null). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (AVRO-1948) Not setting a non-null field in GenericRecord causes a NullPointer exception on Serialisation even though a default is defined in the schema
Mike Hurd created AVRO-1948: --- Summary: Not setting a non-null field in GenericRecord causes a NullPointer exception on Serialisation even though a default is defined in the schema Key: AVRO-1948 URL: https://issues.apache.org/jira/browse/AVRO-1948 Project: Avro Issue Type: Bug Components: java Affects Versions: 1.8.1 Environment: Windows 7, JDK8 Reporter: Mike Hurd Priority: Minor As per the summary, I had a search through the existing JIRAs but couldn't find a match apologies if this is a duplicate: example schema: {noformat} {"namespace": "example.data", "type": "record", "name": "Data", "fields": [ {"name": "name", "type": "string"}, {"name": "favorite_season", "type": "string", "default": "Autumn"} ] } {noformat} {noformat} GenericRecord record = new GenericData.Record(schema); record.put("name", "my name"); {noformat} Serialising the above throws a NullPointerException: {noformat} java.lang.NullPointerException: null of string in field favorite_season of example.data.Data at org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:145) ~[classes/:?] at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:139) ~[classes/:?] at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:75) ~[classes/:?] at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:62) ~[classes/:?] {noformat} Surely, given that the schema is available the writeField method should check to see if there is a default field available to use if the required field does not have a value supplied (and is not-null). -- This message was sent by Atlassian JIRA (v6.3.4#6332)