Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6700830

JDWP.java findbugs: Possible null pointer dereferences

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      Running findbugs on JDK7 tools.jar I got quite a few "Null on some path errors" in the JDWP.java source file (a generated source file). The code pattern is something like:


      if ((ps.vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {
          ps.vm.printTrace("Sending: XXXXXXX: " +
            (ZZZ==null?"NULL":"ref="+ZZZ.ref()));
      }
      ps.writeObjectRef(ZZZ.ref());

      Findbugs is saying that on one code path, the ZZZ object could be null, but in other code paths, no null check is made.
      If the JDWP.java code generation could be fixed, this could remove quite a few high risk findbugs errors, maybe 50 or more.

      If the null check is not needed, then the null check should be removed, if it is needed, then it needs to be checked on all paths.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ohair Kelly Ohair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: