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.
Editor support detect wrong MIME type for first test in each test case. For example run test: org.netbeans.modules.cnd.highlight.semantic.TypedefTest The method that gets Base Documet is: org.netbeans.modules.cnd.completion.impl.xref.ReferencesSupport.getBaseDocument()
Why you think this is Lookup related? The description of the bug is pretty weak, but it seems to me the problem is editor related.
When I debugged I saw that lookup did not found C/C++ editor kit. As result plain text editor kit was found for C/C++ document and document was not BaseDocument. It is a root of problem.
Exactly where is created wrong kit: CloneableEditorSupport.getEditorKit("text/x-c++") returns PlainEditorKit Stack: org.openide.text.CloneableEditorSupport.getEditorKit(CloneableEditorSupport.java:1827) org.openide.text.CloneableEditorSupport.createEditorKit(CloneableEditorSupport.java:1842) org.openide.text.CloneableEditorSupport.prepareDocument(CloneableEditorSupport.java:629) org.openide.text.CloneableEditorSupport.openDocumentImpl(CloneableEditorSupport.java:854) org.openide.text.CloneableEditorSupport.openDocumentCheckIOE(CloneableEditorSupport.java:836) org.openide.text.CloneableEditorSupport.openDocument(CloneableEditorSupport.java:818) org.openide.text.DataEditorSupport.openDocument(DataEditorSupport.java:493) org.netbeans.modules.cnd.completion.impl.xref.ReferencesSupport.getBaseDocument(ReferencesSupport.java:163) org.netbeans.modules.cnd.completion.impl.xref.ReferencesSupport.getDocument(ReferencesSupport.java:539) org.netbeans.modules.cnd.completion.impl.xref.FileReferencesImpl._accept(FileReferencesImpl.java:118) org.netbeans.modules.cnd.completion.impl.xref.FileReferencesImpl.accept(FileReferencesImpl.java:98) org.netbeans.modules.cnd.completion.impl.xref.FileReferencesImpl.accept(FileReferencesImpl.java:92) org.netbeans.modules.cnd.highlight.semantic.ModelUtils.collect(ModelUtils.java:100) org.netbeans.modules.cnd.highlight.semantic.TypedefTest.getBlocks(TypedefTest.java:62) org.netbeans.modules.cnd.highlight.semantic.TypedefTest.getBlocks(TypedefTest.java:51) org.netbeans.modules.cnd.highlight.semantic.SemanticHighlightingTestBase.performTest(SemanticHighlightingTestBase.java:72) org.netbeans.modules.cnd.highlight.semantic.SemanticHighlightingTestBase.performTest(SemanticHighlightingTestBase.java:62) org.netbeans.modules.cnd.highlight.semantic.TypedefTest.testTypedefs(TypedefTest.java:58) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) junit.framework.TestCase.runTest(TestCase.java:168) org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:89) org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:337) org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:274) org.netbeans.junit.NbTestCase.runBare(NbTestCase.java:356) junit.framework.TestResult$1.protect(TestResult.java:110) junit.framework.TestResult.runProtected(TestResult.java:128) junit.framework.TestResult.run(TestResult.java:113) junit.framework.TestCase.run(TestCase.java:124) org.netbeans.junit.NbTestCase.run(NbTestCase.java:214) junit.framework.TestSuite.runTest(TestSuite.java:232) junit.framework.TestSuite.run(TestSuite.java:227) org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79) junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39) org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420) org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911) org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:768)
Bug is reproduced on other platforms(for example Windows).
It seems problem is: MockMimeLookup.setInstances(MimePath.parse(MIMENames.CPLUSPLUS_MIME_TYPE), new CCKit()); Method set weak entry for mime path that can be removed by JVM.
(In reply to comment #5) > It seems problem is: > MockMimeLookup.setInstances(MimePath.parse(MIMENames.CPLUSPLUS_MIME_TYPE), new > CCKit()); > > Method set weak entry for mime path that can be removed by JVM. Jardo, MockMimeLookup's MAP was changed from HashMap to WeakHashMap by you in http://hg.netbeans.org/main-golden/rev/4653c12d45ce. What exactly was the reason for that? IMO, the map should be HashMap otherwise MockMimeLookup can't work reliably.
I fixed cnd tests by creating hard reference on MimePath.parse(MIMENames.CPLUSPLUS_MIME_TYPE) in cnd base test case. So you can downgrade (or close) issue.
Integrated into 'main-golden', will be available in build *201001190201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/666720362798 User: Alexander Simon <alexvsimon@netbeans.org> Log: fixing BZ#179532 Editor detect wrong Editor Kit in cnd tests on MAC
http://hg.netbeans.org/jet-main/rev/a9b20512efe6
Integrated into 'main-golden', will be available in build *201002040200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/a9b20512efe6 User: Vita Stejskal <vstejskal@netbeans.org> Log: #179532: use HashMap to keep the contents of MockMimeLookup available wihout requiring callers to explicitely hold a reference to the MimePath instance