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 268442

Summary: org.openide.text.FilterDocument cannot be cast to org.netbeans.editor.BaseDocument
Product: cnd Reporter: Alexander Simon <alexvsimon>
Component: Code ModelAssignee: Vladimir Kvashin <vkvashin>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P2    
Version: Dev   
Hardware: PC   
OS: Solaris   
Issue Type: DEFECT Exception Reporter:

Description Alexander Simon 2016-10-10 10:42:59 UTC
Performance tests, job "llvm-xref-linux", build 478 has a severe exception in log:

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.cnd.modelimpl.csm.core.FakeRegistrationWorker$FixRegistrationRunnable
java.lang.ClassCastException: org.openide.text.FilterDocument cannot be cast to org.netbeans.editor.BaseDocument
	at org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.performQueryTask(CsmCompletionQuery.java:368)
	at org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.queryObjects(CsmCompletionQuery.java:299)
	at org.netbeans.modules.cnd.completion.cplusplus.CsmExpressionResolverImpl.resolveObjects(CsmExpressionResolverImpl.java:64)
	at org.netbeans.modules.cnd.api.model.services.CsmExpressionResolver$Default.resolveObjects(CsmExpressionResolver.java:436)
	at org.netbeans.modules.cnd.api.model.services.CsmExpressionResolver.resolveObjects(CsmExpressionResolver.java:103)
	at org.netbeans.modules.cnd.api.model.services.CsmExpressionResolver.resolveObjects(CsmExpressionResolver.java:90)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionImplEx.findOwner(FunctionImplEx.java:201)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionImplEx.findQualifiedName(FunctionImplEx.java:268)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.findQualifiedName(FunctionDefinitionImpl.java:335)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionImplEx.fixFakeRegistration(FunctionImplEx.java:407)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.fixFakeFunctionRegistrations(FileImpl.java:2020)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.fixFakeRegistrations(FileImpl.java:1991)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.onProjectParseFinished(FileImpl.java:906)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FakeRegistrationWorker$FixRegistrationRunnable.run(FakeRegistrationWorker.java:146)
	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)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Comment 1 Vladimir Kvashin 2016-10-10 14:43:44 UTC
I'm able to reproduce this on a LLVM34 that is copies from perf-linux.
File it fails on is
~/src/LLVM34/build/lib/Target/ARM/ARMGenSubtargetInfo.inc
and as far as I understand that's because the mime type for this file is "text/plain"
Comment 2 Vladimir Kvashin 2016-10-10 17:18:09 UTC
The ClassCastException is fixed in sputnik (just by removing editor.plain from the list of disabled modules), change set 9da095281ac4


However I've got an NPE
java.lang.NullPointerException
	at org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.getResolvedContext(CsmCompletionQuery.java:861)
	at org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.performQueryTask(CsmCompletionQuery.java:413)
	at org.netbeans.modules.cnd.completion.cplusplus.ext.CsmCompletionQuery.queryObjects(CsmCompletionQuery.java:301)
	at org.netbeans.modules.cnd.completion.cplusplus.CsmExpressionResolverImpl.resolveObjects(CsmExpressionResolverImpl.java:64)
	at org.netbeans.modules.cnd.api.model.services.CsmExpressionResolver$Default.resolveObjects(CsmExpressionResolver.java:436)
	at org.netbeans.modules.cnd.api.model.services.CsmExpressionResolver.resolveObjects(CsmExpressionResolver.java:103)
	at org.netbeans.modules.cnd.api.model.services.CsmExpressionResolver.resolveObjects(CsmExpressionResolver.java:90)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionImplEx.findOwner(FunctionImplEx.java:201)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionImplEx.findQualifiedName(FunctionImplEx.java:268)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionDefinitionImpl.findQualifiedName(FunctionDefinitionImpl.java:335)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionImplEx.fixFakeRegistration(FunctionImplEx.java:407)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.fixFakeFunctionRegistrations(FileImpl.java:2020)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.fixFakeRegistrations(FileImpl.java:1991)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.onProjectParseFinished(FileImpl.java:906)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FakeRegistrationWorker$FixRegistrationRunnable.run(FakeRegistrationWorker.java:146)
Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to
	at org.openide.util.RequestProcessor.post(RequestProcessor.java:420)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FakeRegistrationWorker.fixFakeRegistration(FakeRegistrationWorker.java:99)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.onParseFinishImpl(ProjectBase.java:3173)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.onParseFinish(ProjectBase.java:3156)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ParserQueue.handleLastProjectFile(ParserQueue.java:927)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ParserQueue.onEndAddingProjectFiles(ParserQueue.java:876)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.ensureFilesCreated(ProjectBase.java:972)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.onAddedToModelImpl(ProjectBase.java:1291)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase.access$200(ProjectBase.java:181)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase$2.run(ProjectBase.java:1256)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl$3.run(ModelImpl.java:440)
	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)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

the NOE can be easily reproduced if you open an LLVM34 project (taken from pref-linux) and answer "no" to the question about ".inc" files mime type.

So I added a null check in 28ab2964f78c (enum/release82).
Comment 3 Quality Engineering 2016-10-20 01:59:02 UTC
Integrated into 'main-silver', will be available in build *201610200002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/32bc9f1aa989
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: additional fix for #268442 - org.openide.text.FilterDocument cannot be cast to org.netbeans.editor.BaseDocument
(transplanted from 28ab2964f78c30e9fd2d6592dcf862f61e767732)
Comment 4 soldatov 2016-12-14 14:24:26 UTC
No exceptions in NetBeans Platform 8.2 (Build cnd-release82-build-204-on-20161212).