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 171544 - org.openide.text.FilterDocument cannot be cast to org.netbeans.editor.BaseDocument
Summary: org.openide.text.FilterDocument cannot be cast to org.netbeans.editor.BaseDoc...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P3 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-05 10:45 UTC by _ dcaoyuan
Modified: 2009-09-07 14:48 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ dcaoyuan 2009-09-05 10:45:21 UTC
Per recent changes (after Sep 1 or 2), the Document instance contained in Snapshot that passed by Parsing API can not be casted to BaseDocument 
anymore ?

Tha following exception was caused by:
snapshot.getSource.getDocument(true).asInstanceOf[BaseDocument] --- in Scala
or,
BaseDocument doc = (BaseDocument) snapshot.getSource.getDocument(true)  --- in Java

java.lang.ClassCastException: org.openide.text.FilterDocument cannot be cast to org.netbeans.editor.BaseDocument
	at org.netbeans.modules.scala.editor.ScalaParser.parseBuffer(ScalaParser.scala:386)
	at org.netbeans.modules.scala.editor.ScalaParser.parse(ScalaParser.scala:83)
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:198)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:648)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[catch] at java.lang.Thread.run(Thread.java:637)
Comment 1 _ dcaoyuan 2009-09-05 18:33:30 UTC
The issue seems come from: http://hg.netbeans.org/main/rev/52f4cc2e85f1
Where, editor.libs' "layer.xml" register a global("" mimeType) SearchableEditorKitImpl instance:

        <file name="EditorKit.instance">
            <attr name="instanceCreate" methodvalue="org.netbeans.modules.editor.lib2.actions.SearchableEditorKitImpl.createGlobalKit"/>
        </file>
 
which causes org.openide.text.CloneableEditorSupport#getEditorKit(String mimePath) always ignore 
org.netbeans.modules.csl.core.GsfEditorKitFactory$GsfEditorKit, and returns a SearchableEditorKitImpl instance always.
Comment 2 Miloslav Metelka 2009-09-07 14:48:11 UTC
Fixed by issue 171600.