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 232210 - NullPointerException at org.netbeans.editor.MarkBlockChain.compareBlock
Summary: NullPointerException at org.netbeans.editor.MarkBlockChain.compareBlock
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-03 14:36 UTC by stefan79
Modified: 2013-07-20 02:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 197235


Attachments
stacktrace (6.32 KB, text/plain)
2013-07-03 14:36 UTC, stefan79
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stefan79 2013-07-03 14:36:22 UTC
Build: NetBeans IDE Dev (Build 201307012300)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b11
OS: Windows 7

User Comments:
stefan79: ..




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.editor.MarkBlockChain.compareBlock(MarkBlockChain.java:112)
   at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.isInGuarded(HintsInvoker.java:771)
   at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker$ScannerImpl.runAndAdd(HintsInvoker.java:638)
   at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker$ScannerImpl.scan(HintsInvoker.java:672)
   at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker$ScannerImpl.scan(HintsInvoker.java:610)
   at com.sun.source.util.TreeScanner.visitMemberSelect(TreeScanner.java:342)
Comment 1 stefan79 2013-07-03 14:36:23 UTC
Created attachment 136664 [details]
stacktrace
Comment 2 Jan Lahoda 2013-07-18 20:06:13 UTC
I have synchronized the access to the MarkBlockChain.currentBlock - lets see how that will work. Alternatives I see would be to either require write lock to access the MarkBlockChain (which would prevent the hints from using it altogether, as background tasks cannot take document write locks), using ThreadLocal for the currentBlock (second best option, IMO if the current one will cause problems), or rewriting the hints to iterate over the chain itself.

http://hg.netbeans.org/jet-main/rev/3e6229cab112
Comment 3 Quality Engineering 2013-07-20 02:10:06 UTC
Integrated into 'main-silver', will be available in build *201307192300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3e6229cab112
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #232210: synchronizing the access to the currentBlock field, as the MarkBlockChain can be access from multiple threads (otherwise would required a write/exclusive lock from the caller, but that is impossible for some callers).