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 223231 - Handling of fields needs to be improved in the null pointer check hint
Summary: Handling of fields needs to be improved in the null pointer check hint
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-04 09:22 UTC by elp
Modified: 2016-07-07 07:16 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (64.70 KB, text/plain)
2012-12-04 09:22 UTC, elp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description elp 2012-12-04 09:22:38 UTC
Product Version = NetBeans IDE 7.3 Beta 2 (Build 201211062253)
Operating System = Mac OS X version 10.8.2 running on x86_64
Java; VM; Vendor = 1.7.0_10-ea
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.6-b04


I noticed this issue while editing the piece of code below:

    void onShowContentViewAction(ActionEvent event) {
        if (contentPanelStage == null) {
            contentPanelStage = new Stage();                                            ##### LINE B
            contentPanelStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
                @Override
                public void handle(WindowEvent t) {
                    contentPanelController.setHost(null);
                    contentPanelStage = null;                                                ##### LINE C
                }
            });
            
            final ScrollPane rootScrollPane = new ScrollPane();
            contentPanelController.setHost(rootScrollPane);
            contentPanelStage.setScene(new Scene(rootScrollPane));          ##### LINE A
            contentPanelStage.sizeToScene();
            contentPanelStage.show();
        }
        contentPanelStage.toFront();
    }


NB reports a "Dereferencing null pointer" at LINE A : this not true because
obviously contentPaneStage is initialized at LINE B.
However if I comment LINE C, then  the warning disappear.
So it looks like the EventHandler inline class confuses NB and makes it
think the contentPaneStage variable has been reset to null.

PS: NB is great, thanks for making this tool :)
Comment 1 elp 2012-12-04 09:22:43 UTC
Created attachment 128819 [details]
IDE log
Comment 2 Quality Engineering 2013-01-07 09:46:33 UTC
Integrated into 'main-golden', will be available in build *201301070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/be2410ee3319
User: Jan Lahoda <jlahoda@netbeans.org>
Log: Disabling fields handling by default in the NPECheck hint for now, as that will need more work. See e.g. bug #223231.
Comment 3 Martin Balin 2016-07-07 07:16:46 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss