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 161790 - NullPointerException at org.netbeans.modules.editor.errorstripe.AnnotationViewDataImpl.computeTotalStatus
Summary: NullPointerException at org.netbeans.modules.editor.errorstripe.AnnotationVie...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Sergey Petrov
URL: http://statistics.netbeans.org/except...
Keywords: RANDOM
Depends on:
Blocks:
 
Reported: 2009-04-02 17:04 UTC by stefan79
Modified: 2009-04-25 07:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 148759


Attachments
stacktrace (2.05 KB, text/plain)
2009-04-02 17:04 UTC, stefan79
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stefan79 2009-04-02 17:04:28 UTC
Build: NetBeans IDE Dev (Build 200903310200)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Windows XP, 5.1, x86

User Comments:
stefan79: Added more @Override mit Alt-<Return>



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.editor.errorstripe.AnnotationViewDataImpl.computeTotalStatus(AnnotationViewDataImpl.java:441)
        at org.netbeans.modules.editor.errorstripe.AnnotationView.drawGlobalStatus(AnnotationView.java:262)
        at org.netbeans.modules.editor.errorstripe.AnnotationView.paintComponent(AnnotationView.java:342)
        at javax.swing.JComponent.paint(JComponent.java:1027)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
        at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1472)
Comment 1 stefan79 2009-04-02 17:04:34 UTC
Created attachment 79302 [details]
stacktrace
Comment 2 Vitezslav Stejskal 2009-04-06 12:54:49 UTC
Any reliable steps how to reproduce this one? Thanks
Comment 3 stefan79 2009-04-06 13:02:39 UTC
-) Make a File, implement a Interface or Override some Methods.
-) Delete all the @Override-annoations.
-) Save & Compile the File
-) Then press Alt-Return on every Override-Methode (as fast as you can)
Comment 4 Alexei Mokeev 2009-04-21 13:10:08 UTC
Tried your scenario on a class file with 5 Override methods(04/20 build). No exceptions out of 4 attempts.  
Could you please try to reproduce once more on some recent build ?
 
Comment 5 stefan79 2009-04-23 17:25:41 UTC
I´ve tested the latest release.
The NPE doesn´t occured.

But i think the problem is still alive.

Do you habe a big File (> 2000 rows) for a test?
I think it´s a problem in this Editor-Thread, because when i make more "@Override" - Tags, the Cursor is still on
WAIT-Cursor. Maybe something hangs in this Thread?
Comment 6 Sergey Petrov 2009-04-24 10:23:55 UTC
looks like between 
annotations.getNumberOfAnnotations(line) call
and annotations.getPasiveAnnotations(line) call,
number of annotations on specified line may drop and cause npe.

code should either skip nulls (may cause some redraw artifacts, but may not if this change cause next redraw and status
recalculation) or lock, synchronize in this place to be sure annotations are the same over these two lines.
If I'm right with assumption it shuold be really random issue, and relatively rare.
Comment 7 Sergey Petrov 2009-04-24 11:07:33 UTC
fixed:
remove first call annotations.getNumberOfAnnotations(line)
as next call annotations.getPasiveAnnotations(line) also checks for the same number and return null if number of
annotation not >1, the only verification now is null verification.

there still may be random issue(but new one and may be even more rare) as getPasiveAnnotations(line) may got similar
threading issue in internal logic.
Comment 8 Sergey Petrov 2009-04-24 11:11:58 UTC
http://hg.netbeans.org/jet-main/rev/02d730a10d81
Comment 9 Quality Engineering 2009-04-25 07:32:19 UTC
Integrated into 'main-golden', will be available in build *200904250201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/02d730a10d81
User: sergeyp@netbeans.org
Log: fix #161790 - remove unnecessary call as getPassiveAnnotation also verify the same number against 1 and return null if <=1