avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Armbrust (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-387) hashCode throws a NullPointerException when unions are uninitialized
Date Mon, 01 Feb 2010 19:06:18 GMT

    [ https://issues.apache.org/jira/browse/AVRO-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12828226#action_12828226
] 

Michael Armbrust commented on AVRO-387:
---------------------------------------

I still seem to be having the issue when working with specific types.

{noformat}
scala> val x = new Key                
val x = new Key
java.lang.NullPointerException
	at org.apache.avro.specific.SpecificData.hashCode(SpecificData.java:223)
	at org.apache.avro.generic.GenericData.hashCodeAdd(GenericData.java:443)
	at org.apache.avro.specific.SpecificData.hashCode(SpecificData.java:223)
	at org.apache.avro.specific.SpecificRecordBase.hashCode(SpecificRecordBase.java:40)
	at edu.berkeley.cs.scads.Key.hashCode(Key.java:50001)
	at java.lang.Object.toString(Object.java:219)
	at edu.berkeley.cs.scads.Key.toString(Key.java:50001)
....
{noformat}

I will try to create a unit test that triggers the problem.

> hashCode throws a NullPointerException when unions are uninitialized
> --------------------------------------------------------------------
>
>                 Key: AVRO-387
>                 URL: https://issues.apache.org/jira/browse/AVRO-387
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.2.0
>            Reporter: Michael Armbrust
>            Priority: Minor
>         Attachments: AVRO-387.patch.txt
>
>
> This is a very similar issue to AVRO-382, except this time it happens for uninitialized
unions instead of primitive fields.  Once again, this makes it very difficult to use avro
from the scala console.
> Stacktrace:
> {noformat}
> org.apache.avro.AvroRuntimeException: Not in union [{"type":"record","name":"GetRequest","namespace":"edu.berkeley.cs.scads.comm","fields":[{"name":"namespace","type":"string"},{"name":"key","type":"bytes"}]}]:
null
> 	at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:339)
> 	at org.apache.avro.generic.GenericData.hashCode(GenericData.java:429)
> 	at org.apache.avro.specific.SpecificData.hashCode(SpecificData.java:227)
> 	at org.apache.avro.generic.GenericData.hashCodeAdd(GenericData.java:439)
> 	at org.apache.avro.specific.SpecificData.hashCode(SpecificData.java:223)
> 	at org.apache.avro.specific.SpecificRecordBase.hashCode(SpecificRecordBase.java:52)
> 	at java.lang.Object.toString(Object.java:219)
> 	at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:165)
> 	at RequestResult$.<init>(<console>:4)
> 	at RequestResult$.<clinit>(<console>)
> 	at RequestResult$result(<console>)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at scala.tools.nsc.Interpreter$Request.loadAndRun(Interpreter.scala:889)
> 	at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:508)
> 	at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:242)
> 	at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:230)
> 	at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:142)
> 	at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:298)
> 	at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:141)
> 	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message