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 267276 - ClassCastException: org.netbeans.modules.editor.NbEditorDocument cannot be cast to org.netbeans.api.editor.document.AtomicLockDocument
Summary: ClassCastException: org.netbeans.modules.editor.NbEditorDocument cannot be ca...
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: Editing infrastructure (show other bugs)
Version: 8.2
Hardware: All All
: P2 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-24 08:58 UTC by Jenselme
Modified: 2016-07-27 15:46 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 224957


Attachments
stacktrace (1.30 KB, text/plain)
2016-07-24 08:58 UTC, Jenselme
Details
stacktrace (1.30 KB, text/plain)
2016-07-27 07:58 UTC, vidhyadharantechdays
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jenselme 2016-07-24 08:58:24 UTC
Build: NetBeans IDE Dev (Build 201607220002)
VM: OpenJDK 64-Bit Server VM, 25.92-b14, OpenJDK Runtime Environment, 1.8.0_92-b14
OS: Linux

User Comments:
m1k0: Please provide a description of the problem or the steps to reproduce

Jenselme: - Open an HTML file with a custom attribute
- Select "Declare global attribute" so the attribute is not reported as an error
- Exception occurs

Note: using "declare <attribute> as attribute of element" throws the same exception

Sample code:

<!DOCTYPE html>
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <!-- Want to add if.bind to global attribute -->
        <div if.bind="toto">TODO write content</div>
    </body>
</html>

m1k0: trying to add custom tag

Jenselme: This happened when I was trying to add a tag to the project tags elements

m1k0: create sample HTML app, 
choose Angular template, 
create project
on page index.html click on bubble on 29 line, choose add custom...
Error window opens

Jenselme: This happened when I tried to add an attribute as part of a custom tag




Stacktrace: 
java.lang.ClassCastException: org.netbeans.modules.editor.NbEditorDocument cannot be cast to org.netbeans.api.editor.document.AtomicLockDocument
   at org.netbeans.modules.web.common.api.LexerUtils$1.run(LexerUtils.java:76)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
   at java.awt.EventQueue.access$500(EventQueue.java:97)
   at java.awt.EventQueue$3.run(EventQueue.java:709)
   at java.awt.EventQueue$3.run(EventQueue.java:703)
Comment 1 Jenselme 2016-07-24 08:58:27 UTC
Created attachment 161402 [details]
stacktrace
Comment 2 vidhyadharantechdays 2016-07-27 07:58:12 UTC
Created attachment 161460 [details]
stacktrace

When i editing Html 5 projects - angular 2 project ,
"Add elements 'vde' to  projects custom elements"
Comment 3 vidhyadharantechdays 2016-07-27 08:00:18 UTC
i got this exception when adding custom elements in editor suggestion
Comment 4 Milutin Kristofic 2016-07-27 09:31:05 UTC
Can you please attach messages.log? Thank you http://wiki.netbeans.org/FaqLogMessagesFile
Comment 5 Jenselme 2016-07-27 15:37:09 UTC
I have this in messages.log:

INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/jenselme/projects/arena-of-titans took: 4,936 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 1 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 1 source roots took: 4,936 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 1 ms]
WARNING [org.netbeans.modules.parsing.impl.TaskProcessor]: ParserManager.parse called in AWT event thread by: org.netbeans.modules.html.editor.gsf.HtmlStructureItem.runTask(HtmlStructureItem.java:164)
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@35e49c63, mimeType='text/html', kitClass=null, length=4211, version=1, file=org.netbeans.modules.html.HtmlDataObject@1838e949[/home/jenselme/projects/arena-of-titans/app/game/create/create.html@b9fe214a:770b4b5e]
INFO [org.netbeans.modules.html.custom.conf.Configuration]: Config file /home/jenselme/projects/arena-of-titans/nbproject/customs.json changed - reloading configuration.
SEVERE [global]
java.lang.ClassCastException: org.netbeans.modules.editor.NbEditorDocument cannot be cast to org.netbeans.api.editor.document.AtomicLockDocument
	at org.netbeans.modules.web.common.api.LexerUtils$1.run(LexerUtils.java:76)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Comment 6 Martin Entlicher 2016-07-27 15:46:17 UTC
Thanks. I managed to reproduce it and it's fixed by http://hg.netbeans.org/web-main/rev/b8d128318f1a.
Credits for how to fix it go to Milutin.