Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-713

Java compareTo method throws NPE when any field isn't set.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.3
    • Java - Compiler
    • None
    • Patch Available

    Description

      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.

      Attachments

        1. thrift-713.patch
          5 kB
          Dmitry Chechik

        Activity

          People

            bryanduxbury Bryan Duxbury
            dmitrychechik Dmitry Chechik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: