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

Bug 399208

Summary: Extract Local Variable throws an exception...
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:39:46 EST
In the following program...
==========
typedef struct
{
#ifndef a
    unsigned long b[3];     /* */
#endif
};
int main(){
  int c;
  if (c==1){}; //select c==1
  return 0;
}
==========

If you select 'c=1', 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)
	.
	.
	.
Comment 1 Marc-André Laperle CLA 2013-05-14 13:25:32 EDT

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