Bug 222741

Summary: NullPointerException at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.isAlreadyInResult
Product: groovy Reporter: Martin Janicek <mjanicek>
Component: RefactoringAssignee: Martin Janicek <mjanicek>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3    
Version: 7.3   
Target Milestone: 7.3   
Hardware: All   
OS: All   
Whiteboard: EXCEPTIONS_REPORT
Issue Type: DEFECT Exception Report: 195683
Attachments: stacktrace

Description Martin Janicek 2012-11-26 09:17:59 UTC
Build: NetBeans IDE Dev (Build 20121121-a0d218e90fbf)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.2-b06, Java(TM) SE Runtime Environment, 1.6.0_27-b07
OS: Linux

User Comments:
mjanicek: Trying to refactor class name in file with multiple inner subclasses




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.isAlreadyInResult(RenameRefactoringPlugin.java:120)
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.addModificationToResult(RenameRefactoringPlugin.java:101)
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.collectModifications(RenameRefactoringPlugin.java:95)
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.refactorResults(RenameRefactoringPlugin.java:81)
   at org.netbeans.modules.groovy.refactoring.findusages.FindUsagesPlugin.prepare(FindUsagesPlugin.java:85)
   at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare2(AbstractRefactoring.java:437)
Comment 1 Martin Janicek 2012-11-26 09:18:01 UTC
Created attachment 128376 [details]
stacktrace
Comment 2 Martin Janicek 2012-11-26 09:20:27 UTC
Reproducible test case:

Superclass x = new Superclass()

class Superclass {
}

..rename refactoring on Superclass and the NPE shows up
Comment 3 Martin Janicek 2012-11-26 10:17:22 UTC
Ok, this is happening only in cases where the file name is the same as class declared inside. This is generally problem and makes groovy compiler complains about duplicate definition of the class.
I'll improve the code to get rid of the exception but the refactoring won't work in this special case anyway.
Comment 4 Martin Janicek 2012-11-26 10:22:47 UTC
Fixed in: web-main #ee8e34360cd5
Comment 5 Quality Engineering 2012-11-27 02:56:51 UTC
Integrated into 'main-golden', will be available in build *201211270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ee8e34360cd5
User: Martin Janicek <mjanicek@netbeans.org>
Log: #222741 - NullPointerException at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.isAlreadyInResult
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo