This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228437

Summary: Dereferencing possible null pointer - not possible null pointer
Product: java Reporter: Milutin Kristofic <mkristofic>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal CC: gtzabari
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Milutin Kristofic 2013-04-10 11:43:12 UTC
Boolean revertValue = revertMap != null ? (Boolean) revertMap.get(TEST) : null; 
      if (Boolean.FALSE.equals(revertValue)) {
          revertMap.remove(TEST);
      }


There is a hint on revertMap.remove(TEST); If revertMap is null, then this branch is never visited.


Product Version: NetBeans IDE Dev (Build 201304082300)
Updates: Updates available to version , NetBeans 7.3 Beta 2
Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
Comment 1 _ gtzabari 2016-01-09 20:27:11 UTC
I can reproduce the same problem under dev build 201512240002. Given:

assert (oldValue == null || oldValue.getType() == newValue.getType()): "oldValue: " + oldValue.getType() + ", newValue: " + newValue.getType();

Netbeans flags "oldValue.getType()" as "Dereferencing possible null pointer" but if "oldValue" is null then the "oldValue.getType()" is never executed.