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


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.

Reply via email to