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 187469 - NullPointerException at org.netbeans.modules.dlight.management.api.DLightSession.prepareContext
Summary: NullPointerException at org.netbeans.modules.dlight.management.api.DLightSess...
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: D-Light (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Andrew Krasny
URL:
Keywords:
: 202972 203564 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-11 09:37 UTC by Vladimir Voskresensky
Modified: 2011-10-12 10:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 170602


Attachments
stacktrace (1.34 KB, text/plain)
2010-06-11 09:37 UTC, Vladimir Voskresensky
Details
proposed patch (1.39 KB, patch)
2011-10-03 12:34 UTC, Vladimir Voskresensky
Details | Diff
Proposed patch (4.15 KB, patch)
2011-10-03 15:43 UTC, Andrew Krasny
Details | Diff
Reworked patch (10.31 KB, patch)
2011-10-03 18:09 UTC, Andrew Krasny
Details | Diff
take #3 (8.18 KB, patch)
2011-10-04 11:19 UTC, Andrew Krasny
Details | Diff
ProcFSDataCollector to be ready for storgae absence (3.47 KB, patch)
2011-10-04 11:20 UTC, Andrew Krasny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2010-06-11 09:37:14 UTC
Build: Oracle Solaris Studio 12.2 (Build cnd-build-2711-on-100506)
VM: Java HotSpot(TM) Client VM, 16.0-b13, Java(TM) SE Runtime Environment, 1.6.0_18-b07
OS: SunOS

Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.dlight.management.api.DLightSession.prepareContext(DLightSession.java:699)
   at org.netbeans.modules.dlight.management.api.DLightSession.access$700(DLightSession.java:100)
   at org.netbeans.modules.dlight.management.api.DLightSession$2.run(DLightSession.java:422)
   at org.netbeans.modules.dlight.util.DLightExecutorService$2.run(DLightExecutorService.java:89)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1415)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1954)
Comment 1 Vladimir Voskresensky 2010-06-11 09:37:18 UTC
Created attachment 100006 [details]
stacktrace
Comment 2 Vladimir Voskresensky 2010-06-11 10:47:36 UTC
it was "run" of bunha sample on OpenSolaris using express 10/6
Comment 3 Maria Tishkova 2010-12-10 08:48:51 UTC
I cannot reproduce the problem. The source code was re-written in the DLightSession and the line from stack cannot give NPE. I will close as WORKSFORME
Comment 4 Vladimir Voskresensky 2011-10-03 11:27:16 UTC
easily reproduced with clean userdir on e**f when created Quote sample and started THA
Comment 5 Vladimir Voskresensky 2011-10-03 11:28:19 UTC
Looks like key point here: default toolchain used in project is tied to Studio 12
Comment 6 Vladimir Voskresensky 2011-10-03 12:32:35 UTC
*** Bug 202972 has been marked as a duplicate of this bug. ***
Comment 7 Vladimir Voskresensky 2011-10-03 12:34:11 UTC
Created attachment 111418 [details]
proposed patch

please, review patch for 701
Comment 8 Andrew Krasny 2011-10-03 13:29:48 UTC
There are 2 more places where result of getDataStorageFor is not verified for null value... Shouldn't these be handled as well?
Comment 9 Andrew Krasny 2011-10-03 15:43:27 UTC
Created attachment 111431 [details]
Proposed patch
Comment 10 Vladimir Voskresensky 2011-10-03 16:28:53 UTC
next proposed patch is better. Although it's preferable to have logic used before introduction of proxy storages. Otherwise collectors are started even in case of missing storages
Comment 11 Andrew Krasny 2011-10-03 18:09:49 UTC
Created attachment 111435 [details]
Reworked patch

Proposed patch contains:
- prevention of possible NPEs related to absence of particular storages;
- earlier initialization of serviceInfoDataStorage
Comment 12 Vladimir Voskresensky 2011-10-03 19:39:19 UTC
Patch is good. The only question I have:
how initial split by two exclusive groups 'idproviders' and 'collectors' handles the situation when collector was not able to be initialized due to absence storage, wehn it is still indicator data provider.
How it will be inited? it's not in list  'idproviders'
Comment 13 Andrew Krasny 2011-10-04 07:49:41 UTC
Isn't it what is commented in the patch?
+                /*
+                 * DataCollector usually acts as IndicatorDataProvider..
+                 * It could be that infrastructure cannot provide all needed
+                 * storages for the collector. This means that collector will
+                 * not be able to *store* any data, still it *may* be able to
+                 * act as an IndicatorDataProvider (with transient data).
+                 *
+                 * So do unconditional init with serviceInfoDataStorage.
+                 * This will give a chance for collector to at least provide
+                 * some information for Indicators...
+                 *
+                 * Note: It is collector's responsibility to handle the
+                 * situation when it was not initialized with DataStorages!
+                 *
+                 * Note: Collector *will* be notified about session start even
+                 * if it was not initialized with any DataStorage.
+                 *
+                 */
+                toolCollector.init(serviceInfoDataStorage);
+
Comment 14 Andrew Krasny 2011-10-04 11:19:52 UTC
Created attachment 111448 [details]
take #3

This time both operations:
+                toolCollector.init(serviceInfoDataStorage);
+                addDataFilterListener(toolCollector);
are performed unconditionally (even if cannot find all needed storages).
So in this case DataFilter events will be available to the toolCollector.. 

Also I have split the patch into two.
This one contains changes related to infrastructure.
The second one (will attach) related to preparing ProcFSDataCollector to the situation if no storage provided...
Comment 15 Andrew Krasny 2011-10-04 11:20:36 UTC
Created attachment 111449 [details]
ProcFSDataCollector to be ready for storgae absence
Comment 16 Vladimir Voskresensky 2011-10-04 11:50:50 UTC
I've reviewed both patches and now they looks like complete solution of the problem. 
Thanks for splitting as well.
Comment 17 Andrew Krasny 2011-10-04 12:29:09 UTC
pushed to releases/release701_fixes

changeset:   e7e7df47fd77 [http://hg.netbeans.org/releases/rev/e7e7df47fd77]
changeset:   afa15f6d4e27 [http://hg.netbeans.org/releases/rev/afa15f6d4e27]
Comment 18 Vladimir Voskresensky 2011-10-04 13:15:31 UTC
I agree there should be an extra fix which also keep sequence of calls in order as was before
Comment 19 Vladimir Voskresensky 2011-10-04 13:37:10 UTC
extra fix is http://hg.netbeans.org/releases/rev/078f6bc91602
Comment 20 Alexander Pepin 2011-10-05 14:36:51 UTC
verified in dev OSS IDE build #3375,
NPE does not appear any more.
Comment 21 Quality Engineering 2011-10-07 17:36:49 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/e7e7df47fd77
User: Andrew Krasny <akrasny@netbeans.org>
Log: Bug #187469 - NullPointerException at org.netbeans.modules.dlight.management.api.DLightSession.prepareContext
Comment 22 Alexander Pepin 2011-10-11 12:52:19 UTC
verified in OSS dev build #3394 (built on NB 7.0.1 patch 2 20111007)
Comment 23 Vladimir Voskresensky 2011-10-12 10:34:19 UTC
*** Bug 203564 has been marked as a duplicate of this bug. ***