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 235211 - IllegalStateException: Annotation not added: org-netbeans-spi-editor-hints-parser_annotation_verifier_fixableIf-Else Statements Must Use Braces ---- (Alt-Enter shows hints)
Summary: IllegalStateException: Annotation not added: org-netbeans-spi-editor-hints-pa...
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2013-08-29 08:04 UTC by Exceptions Reporter
Modified: 2014-05-26 07:39 UTC (History)
20 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 200175

stacktrace (1.13 KB, text/plain)
2013-08-29 08:04 UTC, Exceptions Reporter
stacktrace (1.12 KB, text/plain)
2013-09-05 19:55 UTC, Exceptions Reporter
stacktrace (1.31 KB, text/plain)
2013-09-19 09:18 UTC, szmitek
stacktrace (1.21 KB, text/plain)
2013-10-16 11:52 UTC, Ondrej Vrabec
stacktrace (1.21 KB, text/plain)
2013-12-10 10:30 UTC, Ralph Ruijs
stacktrace (1.24 KB, text/plain)
2014-01-12 14:39 UTC, Martin Fousek
stacktrace (1.02 KB, text/plain)
2014-02-18 22:10 UTC, Jesse Glick
stacktrace (1.13 KB, text/plain)
2014-02-25 12:14 UTC, Alexander Simon
stacktrace (1.06 KB, text/plain)
2014-02-25 18:20 UTC, Jesse Glick
stacktrace (1.21 KB, text/plain)
2014-03-20 03:12 UTC, _ tboudreau
stacktrace (1.12 KB, text/plain)
2014-03-26 10:51 UTC, IrianR
stacktrace (963 bytes, text/plain)
2014-03-27 15:30 UTC, theshadow27
stacktrace (1.13 KB, text/plain)
2014-04-04 06:58 UTC, Alexander Simon

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2013-08-29 08:04:43 UTC
Build: NetBeans IDE 7.4 Beta (Build 201307092200)
VM: OpenJDK 64-Bit Server VM, 24.0-b50, OpenJDK Runtime Environment, 1.7.0_40-b31
OS: Linux

User Comments:
GUEST: Tab was closed, that's all

cyhelsky: Editing java file

GUEST: <Please provide a description of the problem or the steps to reproduce

jkovalsky: Closed leaving only opened in Editor.

tomoke: Changed "Enumeration<ZipEntry> entries = zipfile.getEntries();" to "Ennumeration entries = zipfile.getEntries()'"

yardus: hit a breakpoint

java.lang.IllegalStateException: Annotation not added: org-netbeans-spi-editor-hints-parser_annotation_verifier_fixableIf-Else Statements Must Use Braces
(Alt-Enter shows hints)
   at org.netbeans.modules.editor.NbEditorDocument.removeAnnotation(
   at org.openide.text.NbDocument.removeAnnotation(
   at org.netbeans.modules.editor.hints.ParseErrorAnnotation.detachAnnotation(
   at org.netbeans.modules.editor.hints.AnnotationHolder.attachDetach(
   at org.netbeans.modules.editor.hints.AnnotationHolder.access$400(
   at org.netbeans.modules.editor.hints.AnnotationHolder$
Comment 1 Exceptions Reporter 2013-08-29 08:04:59 UTC
Created attachment 139408 [details]
Comment 2 Exceptions Reporter 2013-09-05 19:55:44 UTC
Created attachment 139726 [details]

Please provide a description of the problem or the steps to reproduce
Comment 3 szmitek 2013-09-19 09:18:05 UTC
Created attachment 140239 [details]

Close a tab of open PHP file (without HTML)
Comment 4 Exceptions Reporter 2013-09-19 09:18:10 UTC
This bug already has 10 duplicates 
Comment 5 Ondrej Vrabec 2013-10-16 11:52:21 UTC
Created attachment 141144 [details]

closing a file
Comment 6 Ralph Ruijs 2013-12-10 10:30:42 UTC
Created attachment 143004 [details]

Closed a lot of tabs by using the Close Other... action
Comment 7 Martin Fousek 2014-01-12 14:39:45 UTC
Created attachment 143863 [details]

writting into the code
Comment 8 Jesse Glick 2014-02-18 22:10:30 UTC
Created attachment 145377 [details]

Running Ant target from context menu in Files.
Comment 9 Alexander Simon 2014-02-25 12:14:15 UTC
Created attachment 145569 [details]

close editors
Comment 10 Alexander Simon 2014-02-25 14:25:42 UTC
39 reports => P2
Comment 11 Jesse Glick 2014-02-25 18:20:20 UTC
Created attachment 145579 [details]

Not sure; noticed error icon after doing some Java editing.
Comment 12 Milutin Kristofic 2014-02-26 15:30:03 UTC
There was already a few attempts to fix this issue. #207563, #195733. This is risky to fix to NB 8.0.
Comment 13 _ tboudreau 2014-03-20 03:12:22 UTC
Created attachment 146162 [details]

Closing a project
Comment 14 IrianR 2014-03-26 10:51:45 UTC
Created attachment 146325 [details]

Closing a project.
Comment 15 theshadow27 2014-03-27 15:30:49 UTC
Created attachment 146356 [details]

Saved and closed a tab.
Comment 16 Alexander Simon 2014-04-04 06:58:26 UTC
Created attachment 146534 [details]

close other editors
Comment 17 Alexander Simon 2014-04-04 07:00:09 UTC
55 reports => P1
Comment 18 David Strupl 2014-04-04 13:30:13 UTC
P2 is high enough priority for this.
Comment 19 Svata Dedic 2014-04-25 13:16:14 UTC
Folks, I was really not able to find an error, since 
a/ the document from which the ParseErrorAnnotation is being detached is the very same instance on which it has been attached
b/ no other write access to 'attachedTo' field - so the document instance must remain as it was set by attach
c/ the code path through NbDocument.addAnnotation() MUST proceed through annoMap.put() for ParseErrorAnnotation (returns always a non-null type)
d/ the ParseErrorAnnotation.attachedTo is cleared as soon as the NbDocument is asked for annotation removal

=> the removeAnnotation is called once and only once, on the exactly the same doc instance and the same annoMap.

BUT - I've noticed that NbDocument.addAnnotation() and .removeAnnotation() - is synchronized 'just' by the readLock(). Access to getAnnotations() and the Annotations object itself has its own synchronization, but WRITE access to annoMap is only guarded by readLock -- which permits multiple listeners.

It is possible that the annoMap gets corrupted if addAnnotation() is called from unrelated threads simultaneously. The visibility of data should be OK as after all the same sync primitive is used by all the threads.

Synchronization added in jet-main#9269bff7cdc1
Comment 20 Svata Dedic 2014-04-25 13:17:09 UTC
(In reply to Svata Dedic from comment #19)
> annoMap is only guarded by readLock -- which permits multiple listeners.

should be 'multiple concurrent readers' :)
Comment 21 Quality Engineering 2014-05-25 01:29:56 UTC
Integrated into 'main-silver', will be available in build *201405250001* on (upload may still be in progress)

User: Svata Dedic <>
Log: #235211: modifications of annoMap synchronized
Comment 22 IrianR 2014-05-26 07:39:35 UTC
I got the feeling Bug 244726 might have something in common with this one.