This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 219404 - NullPointerException at org.netbeans.modules.refactoring.java.plugins.EncapsulateFieldRefactoringPlugin.getRelevantFiles
Summary: NullPointerException at org.netbeans.modules.refactoring.java.plugins.Encapsu...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
: 220689 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-02 20:42 UTC by javydreamercsw
Modified: 2013-06-05 09:29 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 147004


Attachments
stacktrace (1.00 KB, text/plain)
2012-10-02 20:42 UTC, javydreamercsw
Details
stacktrace (1.00 KB, text/plain)
2012-12-12 01:59 UTC, ecerichter
Details
Video on how to reproduce (2.51 MB, video/avi)
2013-06-03 12:49 UTC, ecerichter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javydreamercsw 2012-10-02 20:42:02 UTC
Build: NetBeans IDE Dev (Build 201210020001)
VM: Java HotSpot(TM) Client VM, 23.3-b01, Java(TM) SE Runtime Environment, 1.7.0_07-b11
OS: Windows 7

User Comments:
javydreamercsw: Trying to refactor.

salaboy: Refactoring -> encapulating fields




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.refactoring.java.plugins.EncapsulateFieldRefactoringPlugin.getRelevantFiles(EncapsulateFieldRefactoringPlugin.java:508)
   at org.netbeans.modules.refactoring.java.plugins.EncapsulateFieldRefactoringPlugin.prepareEncapsulator(EncapsulateFieldRefactoringPlugin.java:472)
   at org.netbeans.modules.refactoring.java.plugins.EncapsulateFieldsPlugin.prepare(EncapsulateFieldsPlugin.java:198)
   at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare2(AbstractRefactoring.java:437)
   at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare(AbstractRefactoring.java:421)
   at org.netbeans.modules.refactoring.api.AbstractRefactoring.prepare(AbstractRefactoring.java:232)
Comment 1 javydreamercsw 2012-10-02 20:42:06 UTC
Created attachment 125254 [details]
stacktrace
Comment 2 Ralph Ruijs 2012-10-04 11:04:47 UTC
changeset    : 090ecbb0b71e
author         : Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date             : Thu Oct 04 12:59:09 CEST 2012
summary     : Removed use of deprecated method SourceUtils.getFile
Comment 3 Quality Engineering 2012-10-05 02:03:32 UTC
Integrated into 'main-golden', will be available in build *201210050002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/090ecbb0b71e
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Removed use of deprecated method SourceUtils.getFile
Issue #219404 - NullPointerException at org.netbeans.modules.refactoring.java.plugins.EncapsulateFieldRefactoringPlugin.getRelevantFiles
Comment 4 ecerichter 2012-10-23 18:14:18 UTC
Still a problem in DEV 201210210002.
Comment 5 ecerichter 2012-10-23 18:20:57 UTC
It only happens if I hit "Ctrl+Enter" to confirm the window.
If I click in the "confirm" button, error is not thrown.
Comment 6 Marian Mirilovic 2012-10-26 14:17:45 UTC
*** Bug 220689 has been marked as a duplicate of this bug. ***
Comment 7 ecerichter 2012-12-12 01:59:06 UTC
Created attachment 129227 [details]
stacktrace

Encapsulating field.
I've just hint "Enter" couple of times, then realized that I really need to "Ctrl+Enter" - then the exception was thrown.
Comment 8 ecerichter 2013-05-30 20:11:37 UTC
Problem still happen in 201305282300.

Please, provide a fix for 7.4!!!
Comment 9 Ralph Ruijs 2013-06-03 09:30:56 UTC
(In reply to comment #8)
> Problem still happen in 201305282300.
> Please, provide a fix for 7.4!!!

Hard to fix without a reproducible test case. I added a null check, but would really like to solve the underlying problem. Please provide steps to reproduce.
Comment 10 Ralph Ruijs 2013-06-03 09:35:15 UTC
changeset   : a566f3d5bdaa
Comment 11 ecerichter 2013-06-03 12:49:34 UTC
Created attachment 135267 [details]
Video on how to reproduce

An Image worth million of words. A video should be even more.
Notice that after I open the Encapsulate Fields (I've set the keyboard shortcut Shift Ctrl E for this), I've hit Enter - and then, Ctrl+Enter to confirm the fields generation (in most applications, Ctrl+Enter is the same as hit the default button for the window).
Comment 12 Ralph Ruijs 2013-06-03 14:27:29 UTC
(In reply to comment #11)
> Created attachment 135267 [details]
> Video on how to reproduce
> An Image worth million of words. A video should be even more.
> Notice that after I open the Encapsulate Fields (I've set the keyboard shortcut
> Shift Ctrl E for this), I've hit Enter - and then, Ctrl+Enter to confirm the
> fields generation (in most applications, Ctrl+Enter is the same as hit the
> default button for the window).

I followed the steps you did in the video, but this works perfectly fine for me. Tried different versioning systems and also adding the keyboard shortcut, but to no avail.


Can you try if the problem still occurs in a build with a566f3d5bdaa? A comment will appear when this is integrated in the daily build.
Comment 13 Quality Engineering 2013-06-04 01:48:16 UTC
Integrated into 'main-golden', will be available in build *201306032301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a566f3d5bdaa
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #219404 - NullPointerException at org.netbeans.modules.refactoring.java.plugins.EncapsulateFieldRefactoringPlugin.getRelevantFiles
Comment 14 ecerichter 2013-06-04 20:23:23 UTC
Seems that you changes are in effect.
It is working fine for me since 201306032300.

Thanks,

Edson