You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2010/02/23 20:08:28 UTC

[jira] Closed: (THRIFT-713) Java compareTo method throws NPE when any field isn't set.

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

Bryan Duxbury closed THRIFT-713.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 0.3

I just committed this patch. Thanks for the patch (and test) Dmitry!

> Java compareTo method throws NPE when any field isn't set.
> ----------------------------------------------------------
>
>                 Key: THRIFT-713
>                 URL: https://issues.apache.org/jira/browse/THRIFT-713
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Dmitry Chechik
>            Assignee: Bryan Duxbury
>             Fix For: 0.3
>
>         Attachments: thrift-713.patch
>
>
> On line 1395 of t_java_generator.cc, the code is:
>     indent(out) << "lastComparison = Boolean.valueOf(" << generate_isset_check(field) << ").compareTo(" << generate_isset_check(field) << ");" << endl;
> So isSet*() of the object being compared is just compared to the same object. This throws a NPE if the field isn't set.
> I've attached a fix patch.

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