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 258868

Summary: Invalid editor hint: deferencing possible null pointer.
Product: java Reporter: oluwasayo
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: Macintosh   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description oluwasayo 2016-04-16 12:06:55 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Mac OS X version 10.11.3 running on x86_64
Java; VM; Vendor = 1.8.0_45
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.45-b02

Reproducibility: Happens every time

STEPS:
  * Create a method as follows:
  public String marshal(Date input) {
    try {
      return input == null ? null : new SimpleDateFormat(format).format(input);
    } catch (Exception ex) {
      return input.toString();
    }
  }

ACTUAL:
  IDE complains about the return statement in the catch block.

EXPECTED:
  Try block already ensures input can never be null beyond there so IDE should not complain
Comment 1 Svata Dedic 2016-04-20 12:09:24 UTC
Correct; no sane Exception can be thrown in case input == null (Errors can be thrown, but not Exceptions). Requires quite precise control flow analysis