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 244726 - NullPointerException at org.netbeans.editor.Annotations.addAnnotation
Summary: NullPointerException at org.netbeans.editor.Annotations.addAnnotation
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 8.0
Hardware: All All
: P1 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-26 07:33 UTC by IrianR
Modified: 2014-06-05 08:44 UTC (History)
15 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 209919


Attachments
stacktrace (3.05 KB, text/plain)
2014-05-26 07:33 UTC, IrianR
Details
stacktrace (3.05 KB, text/plain)
2014-05-26 07:42 UTC, akobberup
Details
stacktrace (872 bytes, text/plain)
2014-05-26 09:06 UTC, Vladimir Voskresensky
Details
stacktrace (3.05 KB, text/plain)
2014-05-26 09:21 UTC, Alexander Simon
Details
stacktrace (3.05 KB, text/plain)
2014-05-26 09:30 UTC, Jiri Skrivanek
Details
stacktrace (3.05 KB, text/plain)
2014-05-26 09:36 UTC, Alexander Simon
Details
stacktrace (3.05 KB, text/plain)
2014-05-26 12:15 UTC, Tomas Stupka
Details
stacktrace (5.15 KB, text/plain)
2014-05-26 12:36 UTC, Maria Tishkova
Details
stacktrace (3.05 KB, text/plain)
2014-05-26 14:54 UTC, Vladimir Riha
Details
stacktrace (3.05 KB, text/plain)
2014-05-27 05:27 UTC, Martin Fousek
Details
stacktrace (3.05 KB, text/plain)
2014-05-27 06:09 UTC, Martin Fousek
Details
stacktrace (3.05 KB, text/plain)
2014-05-27 08:12 UTC, Jiri Prox
Details
stacktrace (3.05 KB, text/plain)
2014-05-27 09:12 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description IrianR 2014-05-26 07:33:42 UTC
Build: NetBeans IDE Dev (Build 201405260001)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.45-b08, Java(TM) SE Runtime Environment, 1.7.0_45-b18
OS: Windows 7

User Comments:
GUEST: The problem seems to be that anoying NPE popup that keeps appearing and prevents me to work.

akobberup: Changed project group

GUEST: suddenly happened

IrianR: started up IDE afres updating to latest DEV build.

GUEST: Importing JBuilder files onto Netbeans IDE

IrianR: Started up IDE after an update to latest DEV version.

GUEST: Tried to execute C compiler, a shame its not simple to integrate the compiler

GUEST: I started the program, open my project and ... the program fail




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.editor.Annotations.addAnnotation(Annotations.java:224)
   at org.netbeans.modules.editor.NbEditorDocument.addAnnotation(NbEditorDocument.java:244)
   at org.openide.text.NbDocument.addAnnotation(NbDocument.java:518)
   at org.openide.text.DocumentLine$Part$1.run(DocumentLine.java:744)
   at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1391)
   at org.openide.text.DocumentLine$Part.addAnnotation(DocumentLine.java:738)
Comment 1 IrianR 2014-05-26 07:33:45 UTC
Created attachment 147438 [details]
stacktrace
Comment 2 akobberup 2014-05-26 07:42:23 UTC
Created attachment 147439 [details]
stacktrace

Nothing code related - using the terminal window
Comment 3 Vladimir Voskresensky 2014-05-26 09:06:23 UTC
Created attachment 147441 [details]
stacktrace

reopened IDE
Comment 4 Alexander Simon 2014-05-26 09:21:24 UTC
Created attachment 147442 [details]
stacktrace

start IDE with opened project
Comment 5 Jiri Skrivanek 2014-05-26 09:30:24 UTC
Created attachment 147444 [details]
stacktrace

I moved mouse over source code in editor.
Comment 6 Alexander Simon 2014-05-26 09:32:24 UTC
NPE is a result of fixing bug #235211.
Comment 7 Alexander Simon 2014-05-26 09:35:38 UTC
NPE blocks editor.
Comment 8 Alexander Simon 2014-05-26 09:36:24 UTC
Created attachment 147446 [details]
stacktrace

NPE blocks editor
Comment 9 Tomas Stupka 2014-05-26 12:15:25 UTC
Created attachment 147450 [details]
stacktrace

just opened a file in the editor
Comment 10 Maria Tishkova 2014-05-26 12:36:25 UTC
Created attachment 147452 [details]
stacktrace

Opening a set of projects
Comment 11 Maria Tishkova 2014-05-26 13:18:30 UTC
result of fixing #235211 


getAnnotations().addAnnotation(a); should be inside  if statement

if (annotation.getAnnotationType() != null) {

}

patch should be 

hg diff editor/src/org/netbeans/modules/editor/NbEditorDocument.java
diff --git a/editor/src/org/netbeans/modules/editor/NbEditorDocument.java b/editor/src/org/netbeans/modules/editor/NbEditorDocument.java
--- a/editor/src/org/netbeans/modules/editor/NbEditorDocument.java
+++ b/editor/src/org/netbeans/modules/editor/NbEditorDocument.java
@@ -239,9 +239,9 @@
                 if (annotation.getAnnotationType() != null) {
                     a = new AnnotationDescDelegate(this, startPos, length, annotation);
                     annoMap.put(annotation, a);
+                    getAnnotations().addAnnotation(a);
                 }
             }
-            getAnnotations().addAnnotation(a);
         } finally {
             readUnlock();
         }
Comment 12 Vladimir Riha 2014-05-26 14:54:24 UTC
Created attachment 147455 [details]
stacktrace

sorry, no idea (I had a running HTML5 project in embedded browser)
Comment 13 Martin Fousek 2014-05-27 05:27:32 UTC
Created attachment 147460 [details]
stacktrace

Just openned IDE with 4 projects (1 HTML, 1 PHP, 2 Maven's web projects)
Comment 14 Martin Fousek 2014-05-27 06:08:47 UTC
Please could you fix that ASAP, that's pretty blocker for usage of daily builds. Thanks.
Comment 15 Martin Fousek 2014-05-27 06:09:32 UTC
Created attachment 147462 [details]
stacktrace

Still more and more these issues. :/
Comment 16 Vladimir Voskresensky 2014-05-27 07:35:36 UTC
Svata, please, evaluate regression
Comment 17 Jiri Prox 2014-05-27 08:12:33 UTC
Created attachment 147463 [details]
stacktrace

NPE when pasting html code
Comment 18 markiewb 2014-05-27 09:12:33 UTC
Created attachment 147466 [details]
stacktrace

Switchted to a file from the documents window
Comment 19 Milutin Kristofic 2014-05-27 11:29:53 UTC
Fix: http://hg.netbeans.org/jet-main/rev/f090420e43b4

I made same fix as Maria suggested. I discussed this also with Svata.
Comment 20 Quality Engineering 2014-05-31 03:43:13 UTC
Integrated into 'main-silver', will be available in build *201405310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f090420e43b4
User: Milutin Kristofic <mkristofic@netbeans.org>
Log: #244726 - NullPointerException at org.netbeans.editor.Annotations.addAnnotation