Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 403128 - CDT codan generates nullPointerException
Summary: CDT codan generates nullPointerException
Status: CLOSED DUPLICATE of bug 393620
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-12 21:33 EDT by Dale Schaafsma CLA
Modified: 2013-04-10 21:13 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dale Schaafsma CLA 2013-03-12 21:33:47 EDT
What steps will reproduce the problem?
1. open indexed file with specific C-code...unsure what exactly is causing the issue, but if debugging information is provided can isolate further (can't post code as it is proprietary...)
2. null exception thrown in error log (twice)

FYI it seems that changing multiple lines in the function affected will cause the error to disappear


-- Error Details --
Date: Tue Mar 12 20:06:20 CDT 2013
Message: Internal Error
Severity: Error
Product: Eclipse 1.5.2.20130110-1126 (org.eclipse.epp.package.cpp.product)
Plugin: org.eclipse.cdt.codan.core
Session Data:
eclipse.buildId=M20130204-1200
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.cpp.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.cpp.product

Exception Stack Trace:
java.lang.NullPointerException
	at org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter$PreprocessorRangeChecker.isCommentOnSameLine(ASTCommenter.java:86)
	at org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter$PreprocessorRangeChecker.checkOffsets(ASTCommenter.java:70)
	at org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter$PreprocessorRangeChecker.visit(ASTCommenter.java:141)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTName.accept(CASTName.java:133)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTEnumerationSpecifier.accept(CASTEnumerationSpecifier.java:116)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTSimpleDeclaration.accept(CASTSimpleDeclaration.java:99)
	at org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit.accept(ASTTranslationUnit.java:251)
	at org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter.isCommentDirectlyBeforePreprocessorStatement(ASTCommenter.java:217)
	at org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter.assignPreprocessorComments(ASTCommenter.java:268)
	at org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter.addCommentsToCommentMap(ASTCommenter.java:232)
	at org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter.getCommentedNodeMap(ASTCommenter.java:191)
	at org.eclipse.cdt.codan.core.cxx.model.CxxModelsCache.getCommentedNodeMap(CxxModelsCache.java:111)
	at org.eclipse.cdt.codan.core.cxx.model.CxxModelsCache.getCommentedNodeMap(CxxModelsCache.java:100)
	at org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker.getCommentMap(AbstractIndexAstChecker.java:186)
	at org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker.getLeadingComment(CaseBreakChecker.java:205)
	at org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker$SwitchFindingVisitor.visit(CaseBreakChecker.java:108)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTSwitchStatement.accept(CASTSwitchStatement.java:85)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTCompoundStatement.accept(CASTCompoundStatement.java:81)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTWhileStatement.accept(CASTWhileStatement.java:94)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTCompoundStatement.accept(CASTCompoundStatement.java:81)
	at org.eclipse.cdt.internal.core.dom.parser.c.CASTFunctionDefinition.accept(CASTFunctionDefinition.java:138)
	at org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit.accept(ASTTranslationUnit.java:251)
	at org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker.processAst(CaseBreakChecker.java:231)
	at org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker.processModel(AbstractIndexAstChecker.java:111)
	at org.eclipse.cdt.codan.internal.core.CodanRunner.processResource(CodanRunner.java:88)
	at org.eclipse.cdt.codan.internal.core.CodanRunner.runInEditor(CodanRunner.java:42)
	at org.eclipse.cdt.codan.core.cxx.internal.model.CxxCodanReconciler.reconciledAst(CxxCodanReconciler.java:36)
	at org.eclipse.cdt.codan.internal.ui.cxx.CodanCReconciler.reconciled(CodanCReconciler.java:57)
	at org.eclipse.cdt.internal.ui.editor.CEditor.reconciled(CEditor.java:3227)
	at org.eclipse.cdt.internal.ui.text.CReconcilingStrategy.reconcile(CReconcilingStrategy.java:99)
	at org.eclipse.cdt.internal.ui.text.CReconcilingStrategy.initialReconcile(CReconcilingStrategy.java:122)
	at org.eclipse.cdt.internal.ui.text.CompositeReconcilingStrategy.initialReconcile(CompositeReconcilingStrategy.java:117)
	at org.eclipse.cdt.internal.ui.text.CCompositeReconcilingStrategy.initialReconcile(CCompositeReconcilingStrategy.java:108)
	at org.eclipse.jface.text.reconciler.MonoReconciler.initialProcess(MonoReconciler.java:105)
	at org.eclipse.cdt.internal.ui.text.CReconciler.initialProcess(CReconciler.java:347)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:173)
Comment 1 Dale Schaafsma CLA 2013-03-15 18:49:45 EDT
FYI parsing the same file with a brand-new workspace and similar definitions seems to work correctly (no null pointer exceptions).
Perhaps something related to updating eclipse's CDT?
Comment 2 Marc-André Laperle CLA 2013-04-10 21:13:13 EDT

*** This bug has been marked as a duplicate of bug 393620 ***