[
https://issues.apache.org/jira/browse/AVRO-1882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sachin Goyal updated AVRO-1882:
-------------------------------
Attachment: TestNonStringConcurrentMap.java
Exception for the above test is:
{noformat}
org.apache.avro.file.DataFileWriter$AppendWriteException:
java.lang.NullPointerException: in org.apache.avro.reflect.MapsPojo in union in
array in org.apache.avro.reflect.PairIntegerString null of
org.apache.avro.reflect.PairIntegerString of array of union in field map2 of
org.apache.avro.reflect.MapsPojo
at org.apache.avro.reflect.ReflectData.getField(ReflectData.java:158)
at
org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:164)
at
org.apache.avro.specific.SpecificDatumWriter.writeField(SpecificDatumWriter.java:90)
at
org.apache.avro.reflect.ReflectDatumWriter.writeField(ReflectDatumWriter.java:182)
at
org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:156)
at
org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:118)
at
org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:75)
at
org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:150)
at
org.apache.avro.generic.GenericDatumWriter.writeArray(GenericDatumWriter.java:192)
at
org.apache.avro.reflect.ReflectDatumWriter.writeArray(ReflectDatumWriter.java:65)
at
org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:120)
{noformat}
> ConcurrentHashMap with non-string keys fails in Java 1.8
> --------------------------------------------------------
>
> Key: AVRO-1882
> URL: https://issues.apache.org/jira/browse/AVRO-1882
> Project: Avro
> Issue Type: Bug
> Affects Versions: 1.8.1
> Reporter: Sachin Goyal
> Attachments: TestNonStringConcurrentMap.java
>
>
> Support for ConcurrentHashMaps with non-string keys seems to be broken when
> 1.8 version of Java is used because the newer ConcurrentHashMap uses the
> names "key" and "val" instead of "key" and "values" for its Map.Entry class.
> [HashEntry in
> 1.7|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/concurrent/ConcurrentHashMap.java#218]
> [MapEntry in
> 1.8|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/concurrent/ConcurrentHashMap.java?av=h#3468]
> Hence avro-code that assumes the presence of key/value breaks.
> ([ReflectData.java:L434-L443|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java#L434-L443])
> Run the attached test to see the same.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)