e.g. 
https://github.com/OldGrumble/NBWicketSupport/blob/e846cdd2f949af4e78433d4e74ba427453a96546/src/main/java/org/netbeans/modules/web/wicket/tree/HtmlTreeBuilder.java#L53

AbstractDocument ad = (AbstractDocument) doc;
ad.readLock();
try {
    TokenHierarchy th = TokenHierarchy.get(ad);
    // something here...
} finally {
    ad.readUnlock();
}

HTH,
Junichi

On Wed, Jul 11, 2018 at 7:38 PM Peter Nabbefeld <[email protected]> wrote:
>
>
> Hello,
>
> I'm -still looking through some parts of the code, while extending the
> module otherwise. I just found this trace in the log/output window,
> which I probably just didn't notice before (because a bunch of other
> logging messages follows):
>
> INFO [org.netbeans.spi.lexer.MutableTextInput]: !!WARNING!! Missing
> READ-LOCK when accessing TokenHierarchy:
> input-source:org.netbeans.modules.editor.NbEditorDocument@51afa06c,
> mimeType='text/html', kitClass=null, length=976, version=1,
> file=org.netbeans.modules.html.HtmlDataObject@6c020887[/home/peter/NetBeansProjects/Wicket-Test-1/src/java/com/myapp/wicket/CustomerTestPage.html@1c06400f:4586c553]
> java.lang.Exception
> [catch] at
> org.netbeans.lib.lexer.TokenHierarchyOperation.ensureReadLocked(TokenHierarchyOperation.java:407)
>      at
> org.netbeans.lib.lexer.TokenHierarchyOperation.tokenSequence(TokenHierarchyOperation.java:431)
>      at
> org.netbeans.api.lexer.TokenHierarchy.tokenSequence(TokenHierarchy.java:201)
>      at
> org.netbeans.modules.web.wicket.tree.HtmlTreeBuilder.analyze(HtmlTreeBuilder.java:55)
>      at
> org.netbeans.modules.web.wicket.tree.HtmlTreeBuilder.getTree(HtmlTreeBuilder.java:46)
>      at
> org.netbeans.modules.web.wicket.verification.WicketProblemAnnotationProvider.annotate(WicketProblemAnnotationProvider.java:180)
>      at
> org.netbeans.modules.web.wicket.verification.WicketProblemAnnotationProvider.annotate(WicketProblemAnnotationProvider.java:170)
>      at
> org.netbeans.modules.web.wicket.verification.WicketProblemAnnotationProvider.annotate(WicketProblemAnnotationProvider.java:117)
>      at
> org.netbeans.modules.web.wicket.verification.WicketProblemAnnotationProvider.annotate(WicketProblemAnnotationProvider.java:88)
>      at
> org.openide.text.CloneableEditorSupport.ensureAnnotationsLoaded(CloneableEditorSupport.java:393)
>      at
> org.openide.text.CloneableEditorInitializer.initAnnotations(CloneableEditorInitializer.java:643)
>      at
> org.openide.text.CloneableEditorInitializer.run(CloneableEditorInitializer.java:351)
>      at
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
>      at
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
>      at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
>      at
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
>
> How do I set the read lock?
>
> Code is on GitHub:
> https://github.com/OldGrumble/NBWicketSupport/
>
> For compilation and test please follow the README, as the repository
> contains some non-working code (I've requested the necessary access to
> html.editor and html.editor.lib with NETBEANS-1035).
>
> Kind regards
>
> Peter
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to