Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 399209

Summary: Extract Local Variable throws an exception extracting fprintf()
Product: [Tools] CDT Reporter: Farnaz Behrang <behrang.farnaz>
Component: cdt-refactoringAssignee: Project Inbox <cdt-refactoring-inbox>
Status: CLOSED DUPLICATE QA Contact: Sergey Prigogin <eclipse.sprigogin>
Severity: minor    
Priority: P3 CC: cdtdoug, com-eclipse-dot-org, malaperle
Version: 8.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Farnaz Behrang CLA 2013-01-27 17:51:10 EST
In the following program...
==========
typedef struct {    /* */
};

#define a

int main()
{
    fprintf("%s","a"); //select fprintf()
    return 0;
}
==========

If you select 'fprintf()', and invoke the Extract Local Variable refactoring, program throws the following exception:

Caused by: 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.CASTCompositeTypeSpecifier.accept(CASTCompositeTypeSpecifier.java:147)
	.
	.
	.
Comment 1 Marc-André Laperle CLA 2013-05-14 13:23:05 EDT

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