Bug 102754 - [NPE] caused by CPPMethod#getVisibility() line: 143 when indexing Mozilla in Linux
Summary: [NPE] caused by CPPMethod#getVisibility() line: 143 when indexing Mozilla in ...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0 RC2   Edit
Assignee: Andrew Niefer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2005-07-05 13:33 EDT by Devin Steffler CLA
Modified: 2008-06-19 13:05 EDT (History)
2 users (show)

See Also:


Attachments
fix for this PR (889 bytes, patch)
2005-07-07 13:27 EDT, Devin Steffler CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Steffler CLA 2005-07-05 13:33:33 EDT
Discovered during indexing the built Mozilla project in Linux.

NPE caused by the file 
/home/dsteffle/mozilla-1_7_5/mozilla/xpcom/ds/nsStringEnumerator.cpp
during a call to CPPMethod#getVisibility() with
CPPASTQualifiedName==nsStringEnumerator::GetNext

java.lang.NullPointerException
	at
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod.getVisibility(CPPMethod.java:143)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.IndexVisitorUtil.getModifiers(IndexVisitorUtil.java:61)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.processNameBinding(CPPGenerateIndexVisitor.java:296)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.processName(CPPGenerateIndexVisitor.java:169)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.visit(CPPGenerateIndexVisitor.java:112)
	at
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName.accept(CPPASTName.java:90)
	at
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName.accept(CPPASTQualifiedName.java:175)
	at
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator.accept(CPPASTDeclarator.java:126)
	at
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDefinition.accept(CPPASTFunctionDefinition.java:92)
	at
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit.accept(CPPASTTranslationUnit.java:520)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexerRunner.indexFile(DOMSourceIndexerRunner.java:133)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.AbstractIndexerRunner.index(AbstractIndexerRunner.java:76)
	at org.eclipse.cdt.internal.core.index.cindexstorage.Index.add(Index.java:110)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.DOMAddCompilationUnitToIndex.indexDocument(DOMAddCompilationUnitToIndex.java:29)
	at
org.eclipse.cdt.internal.core.index.domsourceindexer.DOMAddFileToIndex.execute(DOMAddFileToIndex.java:60)
	at
org.eclipse.cdt.internal.core.search.processing.JobManager.run(JobManager.java:466)
	at java.lang.Thread.run(Thread.java:595)
Comment 1 John Camelon CLA 2005-07-06 20:36:06 EDT
Can this be a candidate for RC2?
Comment 2 Devin Steffler CLA 2005-07-07 10:21:29 EDT
Would it be ok to have CPPMethod#getVisibility() return 
ICPPASTVisibilityLabel.v_private if the declaration for the CPPMethod is null?

The declaration is null because getPrimaryDeclaration() returns null since 
declarations==null and no member in the scope has the same binding as the 
CPPMethod.  Or would it be better to troubleshoot this further since this 
should probably never happen anyways?
Comment 3 John Camelon CLA 2005-07-07 10:27:56 EDT
troubleshoot to find the scenario to see if it is preventable.  
implement your solution (returning private) irregardless of the scenario.
Comment 4 Devin Steffler CLA 2005-07-07 13:27:28 EDT
Created attachment 24430 [details]
fix for this PR

The reason why getPrimaryDeclaration() returns null still needs to be
investigated.
Comment 5 Andrew Niefer CLA 2005-07-07 15:16:40 EDT
done. though, if we can, we check the containing class and return public if its
a struct.