[prev in list] [next in list] [prev in thread] [next in thread]
List: avro-dev
Subject: [jira] [Updated] (AVRO-999) NPE in Java, RecordBuilderBase.defaultValue
From: "Scott Carey (Updated) (JIRA)" <jira () apache ! org>
Date: 2012-02-23 23:15:48
Message-ID: 1145896083.12499.1330038948674.JavaMail.tomcat () hel ! zones ! apache ! org
[Download RAW message or body]
[ https://issues.apache.org/jira/browse/AVRO-999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]
Scott Carey updated AVRO-999:
-----------------------------
Fix Version/s: 1.6.2
Fixed in 1.6.2 as part of AVRO-1007
> NPE in Java, RecordBuilderBase.defaultValue
> -------------------------------------------
>
> Key: AVRO-999
> URL: https://issues.apache.org/jira/browse/AVRO-999
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.6.1
> Environment: Java
> Reporter: Jay Rutten
> Fix For: 1.6.2
>
> Attachments: AVRO-999.patch
>
>
> If you have a union with a default of null, the code in \
> RecordBuilderBase.defaultValue will cause an NPE in ConcurrentHashMap, since it is \
> trying to add a null to the map. Sample union:
> {code}
> record Sample {
> union{null, string} value = null;
> }
> {code}
> Code:
> {code}
> // If not cached, get the default Java value by encoding the default JSON
> // value and then decoding it:
> if (defaultValue == null) {
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> encoder = EncoderFactory.get().binaryEncoder(baos, encoder);
> ResolvingGrammarGenerator.encode(encoder, field.schema(), defaultJsonValue);
> encoder.flush();
> decoder = DecoderFactory.get().binaryDecoder(baos.toByteArray(), decoder);
> defaultValue = new GenericDatumReader(field.schema()).read(null, decoder);
> defaultSchemaValues.putIfAbsent(field.pos(), defaultValue); // <-- NPE from here
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: \
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more \
information on JIRA, see: http://www.atlassian.com/software/jira
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic