Skip to content
This repository was archived by the owner on Sep 13, 2020. It is now read-only.
This repository was archived by the owner on Sep 13, 2020. It is now read-only.

CoffeeScriptHTMLParserTask: Missing READ-LOCK when accessing TokenHierarchy #38

@bennycode

Description

@bennycode

When editing HTML files in my NetBeans HTML5 projects, then I often see this exception in the IDE Log:

INFO [org.netbeans.spi.lexer.MutableTextInput]: !!WARNING!! Missing READ-LOCK when accessing TokenHierarchy: input-source:org.netbeans.modules.editor.NbEditorDocument@4e32085c, mimeType='text/html', kitClass=null, length=247, version=1, file=org.netbeans.modules.html.HtmlDataObject@f194afb[Q:\dev\projects\trash\editorconfig-test-project-2\index.html@a2dea57f:40ebf435]
java.lang.Exception
 at org.netbeans.lib.lexer.TokenHierarchyOperation.ensureReadLocked(TokenHierarchyOperation.java:406)
 at org.netbeans.lib.lexer.TokenHierarchyOperation.tokenSequence(TokenHierarchyOperation.java:431)
 at org.netbeans.api.lexer.TokenHierarchy.tokenSequence(TokenHierarchy.java:201)
 at coffeescript.nb.CoffeeScriptHTMLParserTask.run(CoffeeScriptHTMLParserTask.java:42)
 at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:573)
 at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:744)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
 at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

Are you handling file locks when writing / reading files?

Here is an example how file locks should / can be handled:

  DataObject dataObject = ...;
  FileObject fo = dataObject.getPrimaryFile();

  FileLock lock = FileLock.NONE;

  try {
    if (!fo.isLocked()) {
      BufferedOutputStream os = new BufferedOutputStream(fo.getOutputStream(lock));
      os.write("Hello World".getBytes("ASCII"));
      os.flush();
      os.close();
    }
  } catch (IOException ex) {
    Exceptions.printStackTrace(ex);
    return false;
  } finally {
    lock.releaseLock();
  }

I am using Version 1.4 (1373799590_coffeescript-nb.nbm) and apart from that the plugin is really great!! Thank you for your efforts so far! 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions