avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Douglas Britsch (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AVRO-542) NPE in ReflectData
Date Fri, 14 May 2010 18:44:42 GMT

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

Douglas Britsch updated AVRO-542:
---------------------------------

    Description: 
On line 253 of ReflectData.java the package is retrieved with:

String space = c.getPackage().getName();

getPackage is documented to be able to return null, and in practice does with generated classes
and in certain child classloader scenarios. A safer alternative would be to derive the package
by parsing the string returned from the class's name:

String space = c.getName().substring(0, name.lastIndexOf('.'); 

Thanks

  was:
On line 253 of ReflectData.java the package is retrieved with:

String space = c.getPackage().getName();

getPackage is documented to be able to return null, and in practice does with generated classes
and in certain child classloader scenarios. A safer alternative would be to derive the package
by passing the string returned from the class's name:

String space = c.getName().substring(0, name.lastIndexOf('.'); 

Thanks


> NPE in ReflectData 
> -------------------
>
>                 Key: AVRO-542
>                 URL: https://issues.apache.org/jira/browse/AVRO-542
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.3.2
>         Environment: Java
>            Reporter: Douglas Britsch
>
> On line 253 of ReflectData.java the package is retrieved with:
> String space = c.getPackage().getName();
> getPackage is documented to be able to return null, and in practice does with generated
classes and in certain child classloader scenarios. A safer alternative would be to derive
the package by parsing the string returned from the class's name:
> String space = c.getName().substring(0, name.lastIndexOf('.'); 
> Thanks

-- 
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