You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Douglas Britsch (JIRA)" <ji...@apache.org> on 2010/05/14 20:40:43 UTC

[jira] Created: (AVRO-542) NPE in ReflectData

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


[jira] Commented: (AVRO-542) NPE in ReflectData

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867635#action_12867635 ] 

Doug Cutting commented on AVRO-542:
-----------------------------------

This looks like a duplicate of AVRO-86, which never got applied since it lacked a test case and we somehow lost track of it.  Maybe we should resolve this issue as a duplicate and set the priority and fix-version of AVRO-86 to make it a blocker for 1.4.0 so that we make sure it's fixed before the next release?  Does that sound like reasonable plan?  Maybe I can even find some time this afternoon to put together a test case...

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


[jira] Updated: (AVRO-542) NPE in ReflectData

Posted by "Douglas Britsch (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Resolved: (AVRO-542) NPE in ReflectData

Posted by "Douglas Britsch (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Douglas Britsch resolved AVRO-542.
----------------------------------

    Release Note: AVRO-86
      Resolution: Duplicate

Seems like a reasonable approach to me. Sorry for the dupe.

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