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 120577

Summary: NullPointerException at org.netbeans.modules.refactoring.java.RetoucheUtils.getOverridingMethods
Product: java Reporter: evan38109 <evan38109>
Component: SourceAssignee: Tomas Zezula <tzezula>
Status: VERIFIED FIXED    
Severity: blocker CC: aldobrucale, asmotrich, bburette, bkampers, cashannon, dbalek, dfa, gnewton, grimlock81, gtzabari, jdstroy, jglick, joaope, jonast, jpokorsky, juhrik, K__P, lanceb, lytles, matthies, michael.nischt, mikemaughan, mjr_1974, mmirilovic, nuttycom, parafacundo, paulby, peterwlynch, rgw21, rkamradt, rost, smsmithee, twolf2919, tzezula
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=9948
Issue Type: DEFECT Exception Reporter: 9948
Bug Depends on:    
Bug Blocks: 165732    
Attachments: stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
Message log
ignore - just testing attachments (previous attempt for tar failed)
Test upload binary files
stacktrace
var/log/messages.log
stacktrace

Description evan38109 2007-10-31 05:06:48 UTC
Build: NetBeans IDE Dev (Build 200710241200)
VM: Java HotSpot(TM) Client VM, 1.6.0-b105
OS: Windows XP, 5.1, x86

User Comments: 
Hit ctrl + r to refactor a method name
Comment 1 evan38109 2007-10-31 05:06:52 UTC
Created attachment 52083 [details]
stacktrace
Comment 2 evan38109 2007-10-31 05:31:21 UTC
Build: NetBeans IDE Dev (Build 200710241200)
VM: Java HotSpot(TM) Client VM, 1.6.0-b105
OS: Windows XP, 5.1, x86

User Comments: 
Tried refactoring using ctrl + r to rename a method
Comment 3 evan38109 2007-10-31 05:31:29 UTC
Created attachment 52085 [details]
stacktrace
Comment 4 evan38109 2007-10-31 05:40:12 UTC
Build: NetBeans IDE Dev (Build 200710291200)
VM: Java HotSpot(TM) Client VM, 1.6.0-b105
OS: Windows XP, 5.1, x86

User Comments: 
Used ctrl - r to try and refactor a method name
Comment 5 evan38109 2007-10-31 05:40:19 UTC
Created attachment 52086 [details]
stacktrace
Comment 6 Jan Pokorsky 2007-11-01 16:12:22 UTC
The refactoring takes ClassIndex from ClasspathInfo of the CompilationInfo inside a JavaSource task and looks for all
implementors. It even checks if the found implementor is part of the ClasspathInfo. How is it possible that
ElementHandle of the implementor resolves to null inside the same JavaSource task? Reassigning to java/source for
evaluation.

evan38109, would it be possible to attach sources or a simplified test case demonstrating the problem? It would help us
to find what is going wrong. Thanks.
Comment 7 Jan Becicka 2008-01-08 15:51:55 UTC
*** Issue 124751 has been marked as a duplicate of this issue. ***
Comment 8 Jan Becicka 2008-01-09 01:15:13 UTC
evan38109 confirmed, that this issue does not happen to him in latest builds.
Comment 9 matthies 2008-03-28 14:53:12 UTC
I'm reopening this because submitting error report number 18464 (http://statistics.netbeans.org/analytics/detail.do?
id=18464) redirected me to this issue, claiming that it is fixed in 6.1M1. But the error happened for me with 6.1 Beta 
now.

Product Version: NetBeans IDE 6.1 Beta (Build 200803050202)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 10 Tomas Zezula 2008-03-28 15:24:42 UTC
to matthies: Are you able to reproduce this issue?
Can you provide a log file or project?
Comment 11 matthies 2008-03-28 15:34:01 UTC
Doesn't the error report include a log?
Cleaning the cache and restarting the IDE solved the problem, so I can't reproduce it now.
Comment 12 Tomas Zezula 2008-03-28 15:44:12 UTC
It contains just the exception not complete log.
I will add logging into the refactoring, when it happens again the exception will contain more info.
Comment 13 Exceptions Reporter 2008-03-30 12:36:19 UTC
This issue has already 10 duplicates 
Comment 14 Exceptions Reporter 2008-03-30 12:36:40 UTC
This issue has already 5 duplicates 
Comment 15 Jiri Prox 2008-04-11 00:53:24 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 16 henock 2008-04-18 22:32:17 UTC
Build: NetBeans IDE 6.0.1 (Build 200801291616)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-119
OS: Mac OS X, 10.5.2, i386

User Comments: 
I was attempting to rename a method in an abstract class.
Comment 17 henock 2008-04-18 22:33:04 UTC
Created attachment 60443 [details]
stacktrace
Comment 18 sabob 2008-05-10 19:04:12 UTC
Build: NetBeans IDE 6.1 (Build 200804211638)
VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02
OS: Windows XP, 5.1, x86

User Comments: 
wanted to refactor a method name on an interface
Comment 19 sabob 2008-05-10 19:04:20 UTC
Created attachment 61214 [details]
stacktrace
Comment 20 sabob 2008-05-10 19:04:34 UTC
Build: NetBeans IDE 6.1 (Build 200804211638)
VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02
OS: Windows XP, 5.1, x86

User Comments: 
Comment 21 sabob 2008-05-10 19:04:42 UTC
Created attachment 61215 [details]
stacktrace
Comment 22 sabob 2008-05-10 19:04:55 UTC
Build: NetBeans IDE 6.1 (Build 200804211638)
VM: Java HotSpot(TM) 64-Bit Server VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_04-b12
OS: Linux, 2.6.24-17-generic, amd64

User Comments: 
Comment 23 sabob 2008-05-10 19:05:05 UTC
Created attachment 61216 [details]
stacktrace
Comment 24 sabob 2008-05-10 19:08:35 UTC
Build: NetBeans IDE 6.1 (Build 200804211638)
VM: Java HotSpot(TM) 64-Bit Server VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_04-b12
OS: Linux, 2.6.24-17-generic, amd64

User Comments: 
Comment 25 sabob 2008-05-10 19:08:43 UTC
Created attachment 61220 [details]
stacktrace
Comment 26 mjr_1974 2008-05-26 06:26:26 UTC
Created attachment 61891 [details]
stacktrace
Comment 27 Jan Becicka 2008-06-10 15:25:42 UTC
*** Issue 136888 has been marked as a duplicate of this issue. ***
Comment 28 ace 2008-06-26 12:54:35 UTC
Created attachment 63507 [details]
stacktrace
Comment 29 Jan Pokorsky 2008-07-07 13:37:16 UTC
*** Issue 127583 has been marked as a duplicate of this issue. ***
Comment 30 Jan Pokorsky 2008-07-07 13:43:49 UTC
I have found in issue 127583 there is a problem with lower/upper case in class names. In this case ElementHandle.resolve
cannot resolve class pkg.BandLimiting from file pkg/Bandlimiting.java.
Comment 31 Jan Pokorsky 2008-07-15 15:13:47 UTC
*** Issue 140013 has been marked as a duplicate of this issue. ***
Comment 32 Jan Pokorsky 2008-07-15 15:21:17 UTC
Issue 140013 shows another class/file name inconsistency causing NPE:

Cannot resolve ElementHandle[kind=OTHER; sigs=org.netbeans.tests.examples.packb.BeanD ]; file:
/home/tester/Desktop/default/src/org/netbeans/tests/examples/packb/BeansD.java
Comment 33 Tomas Zezula 2008-07-21 15:52:28 UTC
I've fixed the last case (BeansD) in the revision: http://hg.netbeans.org/main/rev/b6f5629b3134
Not sure about the others which I am not able to reproduce.
If anyone can reproduce it in NB 6.5 newer than 07/22/08 please reopen this issue.

Comment 34 Jan Becicka 2008-08-06 14:27:10 UTC
*** Issue 143059 has been marked as a duplicate of this issue. ***
Comment 35 Jiri Prox 2008-09-10 12:03:53 UTC
*** Issue 146727 has been marked as a duplicate of this issue. ***
Comment 36 Exceptions Reporter 2008-10-14 14:57:20 UTC
Reopening - reproduced in NetBeans IDE 6.5 Beta (Build 200808111757)
http://statistics.netbeans.org/exceptions/detail.do?id=127796
Comment 37 Jan Pokorsky 2008-10-14 15:19:06 UTC
paulby: please attach your ${nb.userdir}/var/log/messages.log to this issue. It will help us to identify the problem.
Comment 38 Paul Byrne 2008-10-14 15:58:20 UTC
Created attachment 71780 [details]
Message log
Comment 39 Jan Lahoda 2008-11-03 08:45:19 UTC
*** Issue 152135 has been marked as a duplicate of this issue. ***
Comment 40 twolf2919 2008-12-10 03:18:26 UTC
I just got a NullPointerException when trying to refactor->rename a method in one of my base classes.  NB 6.5 offered to
report the problem for me and I took it up on that offer...it then told me that my bug report was a duplicate of an
existing one (presumably this one, but I don't see mine as a duplicate at the bottom of this list) nor do I see any
attachments from my messages.log....but somehow I was added on the 'cc' list for this bug.

Why is this languishing as a P3?  Aren't NullPointerException at least a P2?  Since I can't do this important refactor,
I'm raising this to P2.
Comment 41 twolf2919 2008-12-10 03:31:21 UTC
By the way, currently this NullPointerException is reproducible every time on my machine.  Is there something I can do
to expedite the fixing of this bug?
Comment 42 Jan Lahoda 2008-12-10 07:16:41 UTC
Steps to reproduce would certainly help a lot - it will likely be necessary to place a few breakpoints and do some
debugging to find the cause. Thanks.

BTW: the exception you reported is here:
http://statistics.netbeans.org/analytics/exception.do?id=145618
Comment 43 twolf2919 2008-12-10 13:55:07 UTC
At the moment, I can reproduce every time in my project.  I'd be glad to help, but I can't send you the project.  Tell
me what to do - I imagine NB captured my messages.log when I submitted from within NB?  I think on another bug a
developer asked me to set some flags in NB to get extended debugging info - I don't remember what it is, but do you want
me to turn that on?

I was going to try and remove $HOME/.netbeans this morning to see if this fixes things, because I _really_ need to do
this refactor this morning.  I will save the old .netbeans/ directory, so if a corruption in it caused the problem, I'll
hopefully be able to reproduce after I do this.

Comment 44 twolf2919 2008-12-10 14:30:57 UTC
The problem disappeared (i.e. I was able to do the refactor) once I removed $HOME/.netbeans and restarted the IDE.

As I mentioned in the earlier comment, I kept the old .netbeans/ so I can still reproduce the problem if someone wants
me to.  I do consider it a problem - since I never manually mess around with $HOME/.netbeans.  Therefore, NB itself is
causing this problem.

Let me know if I can do anything else.
Comment 45 Jan Pokorsky 2008-12-11 15:56:20 UTC
*** Issue 154221 has been marked as a duplicate of this issue. ***
Comment 46 Dusan Balek 2008-12-15 18:12:15 UTC
Fine, if you still have your old $HOME/.netbeans directory, please, look into your messages.log file and find the NPE.
Just before it, there should be a message: Cannot resolve ElementHandle[...]. There should be a type name written in the
message. Please, go into your old $HOME/.netbeans/var/cache/index and try to find the class/sig file that corresponds to
the unresolved type name. If such file exists, attach it to this issue. Thanks. 
Comment 47 twolf2919 2008-12-15 21:39:40 UTC
Hi dbalek,
The "Cannot resolve:" shows 
sigs=com.netforensics.ui.admin.notification.AlarmNotificationDetailsPanel$SelectNotificationDestinationPanel$SelectDestinationAction$AlarmNotificationDetailsPanel

It can't find that class - not surprising, since I don't think there should be such a class.  I looked at the source
code for com.netforensics.ui.admin.notification.AlarmNotificationDetailsPanel and note that the inner classes are only
nested two deep - i.e. there's a SelectNotificationDestinationPanel and inside it, there's a SelectDestinationAction
class.  According to the sig above, there should be yet another class of the same name as the global class nested inside
of SelectDestinationAction.

If you want, I can attach the class file corresponding to SelectDestinationAction.
Comment 48 Dusan Balek 2008-12-16 14:44:01 UTC
The problem seems to be in the usages index. Could you please attach the index data files to this issue? (please go to
your old $HOME/.netbeans/var/cache/index and find which segment directory (s1....s?) contains
com.netforensics.ui.admin.notification.AlarmNotificationDetailsPanel. Then go into this directory and attach content of
its 'refs' subdirectory). Thanks.
Comment 49 twolf2919 2008-12-16 15:35:09 UTC
Created attachment 75034 [details]
ignore - just testing attachments (previous attempt for tar failed)
Comment 50 twolf2919 2008-12-16 16:45:40 UTC
DBalek,
I don't know what the issue is, but I can't seem to upload binary files - not sure if the problem is on my side or
netbeans (text files upload fine).  Is there any way for you to check if NB site is causing the issue?

thnx,
tom
Comment 51 Dusan Balek 2008-12-17 09:08:03 UTC
Created attachment 75073 [details]
Test upload binary files
Comment 52 Dusan Balek 2008-12-17 09:18:13 UTC
It seems to work fine for me - however - I think there is a size limit (1MB or so) for the attached files. Maybe you can
try to zip it and send it directly to me.
Comment 53 twolf2919 2008-12-17 14:09:32 UTC
I sent the file directly to you as I'm still having trouble uploading the file.
Comment 54 Dusan Balek 2008-12-18 08:01:14 UTC
Thanks for sending the index files. Information about
com.netforensics.ui.admin.notification.AlarmNotificationDetailsPanel$SelectNotificationDestinationPanel$SelectDestinationAction$AlarmNotificationDetailsPanel
is really stored in the index. CCing tzezula - do you have any idea how the information could get there?
Comment 55 Jan Pokorsky 2009-01-07 14:23:01 UTC
*** Issue 152812 has been marked as a duplicate of this issue. ***
Comment 56 Jiri Prox 2009-01-12 10:48:05 UTC
*** Issue 156582 has been marked as a duplicate of this issue. ***
Comment 57 mjr_1974 2009-01-12 21:44:56 UTC
Build: NetBeans IDE 6.5 (Build 200811100001)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Windows XP, 5.1, x86

User Comments: 
renaming a method

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.refactoring.java.RetoucheUtils.getOverridingMethods(RetoucheUtils.java:219)
        at org.netbeans.modules.refactoring.java.plugins.RenameRefactoringPlugin$2.run(RenameRefactoringPlugin.java:414)
        at org.netbeans.modules.refactoring.java.plugins.RenameRefactoringPlugin$2.run(RenameRefactoringPlugin.java:387)
        at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:680)
        at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:607)
        at org.netbeans.modules.refactoring.java.plugins.RenameRefactoringPlugin.getRelevantFiles(RenameRefactoringPlugin.java:381)
Comment 58 mjr_1974 2009-01-12 21:45:02 UTC
Created attachment 75719 [details]
stacktrace
Comment 59 Jiri Prox 2009-01-27 12:32:35 UTC
*** Issue 157431 has been marked as a duplicate of this issue. ***
Comment 60 Rastislav Komara 2009-02-03 10:56:06 UTC
Overtake.
Comment 61 Rastislav Komara 2009-04-07 13:41:02 UTC
Can't replicate. There was also big change in parsing and indexing infrastructure. So, it works for me. If there is
again occurrence of this issue please reopen it. 
Comment 62 Torbjorn Norbye 2009-04-08 01:01:13 UTC
I just reproduced this on a brand new build of main-silver (as of an hour ago). I was trying to rename an abstract,
overridden method. The overrides are in innerclasses in the current class.

One possible explanation for why this happens is that when I do "Open Type", I see another occurrence of my class which
is not correct; the reference is to a package where the class previously lived. (I've moved the class, using the Move
refactoring in NetBeans). The old class name is still there.
Comment 63 Jan Pokorsky 2009-04-22 14:33:05 UTC
As tor wrote, it is still reproducible with rename refactoring. I have another duplicate (issue 135486). From log files
it fails with 'Cannot resolve: ElementHandle[kind=CLASS; sigs=com.acquamedia.view.modules.types.subTypes.generalLink ]'.

See http://statistics.netbeans.org/exceptions/messageslog?id=178313,
http://statistics.netbeans.org/exceptions/messageslog?id=183987 or
http://statistics.netbeans.org/exceptions/messageslog?id=185008.

Unfortunately it is not possible to identify what is wrong from the log now. It will need more detailed debug info.
Comment 64 Jan Pokorsky 2009-04-22 14:34:26 UTC
*** Issue 135486 has been marked as a duplicate of this issue. ***
Comment 65 jakeh 2009-04-23 17:54:10 UTC
Just got the same exception in 6.5 on Win Vista.  Attaching log...
Comment 66 jakeh 2009-04-23 17:56:14 UTC
Created attachment 80789 [details]
var/log/messages.log
Comment 67 Rastislav Komara 2009-04-27 16:18:27 UTC
Please add to netbeans.conf followining settings to improve loggin. Thank you.

-J-Dorg.netbeans.api.java.source.ElementHandle.level=FINE
-J-Dorg.netbeans.modules.java.source.usages.ClassFileUtil.level=FINE
Comment 68 Rastislav Komara 2009-05-18 13:54:13 UTC
I understand the issue priority, but we have no successful scenario for reproducing. Lowering priority.
Comment 69 Jan Pokorsky 2009-05-20 13:29:56 UTC
*** Issue 164370 has been marked as a duplicate of this issue. ***
Comment 70 lytles 2009-05-20 20:56:46 UTC
how does reproducibility effect priority ? you know that the error is still happening, that it's a significant impact to
the usefulness of the app. the fact that you don't have the tools to reproduce it yourself shouldn't effect priority
Comment 71 Tomas Zezula 2009-06-04 12:59:13 UTC
Honza (jpokorsky) has a reproducable case of this problem.
The thing is that the refactoring is using the staled Source (JavaSource).
There are two possible solutions:
1) Refactoring will invalidate all sources before it's started. It's rather workaround than solution as the same problem may be in other features as it's quite 
generic problem.
2) The java module will invalidate needed parsers when the java file is updated.
Comment 72 Jiri Prox 2009-07-07 16:09:43 UTC
*** Issue 167850 has been marked as a duplicate of this issue. ***
Comment 73 Jiri Prox 2009-09-14 16:23:10 UTC
*** Issue 165970 has been marked as a duplicate of this issue. ***
Comment 74 Tomas Zezula 2009-10-09 08:05:46 UTC
The Honza's case fixed in jet-main 357f6d4e7154
Comment 75 Quality Engineering 2009-10-14 10:54:13 UTC
Integrated into 'main-golden', will be available in build *200910140201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/357f6d4e7154
User: Tomas Zezula <tzezula@netbeans.org>
Log: #120577:NullPointerException at org.netbeans.modules.refactoring.java.RetoucheUtils.getOverridingMethods
Comment 76 Jan Becicka 2010-09-24 06:46:53 UTC
*** Bug 184593 has been marked as a duplicate of this bug. ***
Comment 77 Jan Becicka 2010-10-04 07:49:56 UTC
*** Bug 178813 has been marked as a duplicate of this bug. ***
Comment 78 Jan Becicka 2010-12-06 07:46:53 UTC
*** Bug 192871 has been marked as a duplicate of this bug. ***
Comment 79 Jan Becicka 2010-12-06 07:48:49 UTC
still reproducible in 7 beta. See  Bug 192871
Comment 80 Jan Becicka 2011-02-04 16:50:34 UTC
*** Bug 195072 has been marked as a duplicate of this bug. ***
Comment 81 Tomas Zezula 2011-02-07 15:41:02 UTC
*** Bug 176014 has been marked as a duplicate of this bug. ***
Comment 82 aldobrucale 2011-02-18 18:16:17 UTC
Created attachment 106168 [details]
stacktrace

invoked Change method parameters on a class constructor
Comment 83 Marian Mirilovic 2011-03-16 16:24:47 UTC
20 duplicates, 319 ERs ... more then P3 (also couple reports for 7.0 Beta 2)
Comment 84 Tomas Zezula 2011-03-16 16:33:30 UTC
In fact it's not single issue. The NPE is just a cause of non resolve handle. Strictly speaking they are not duplicates of the fixed problem in comment #33 which had reproduceable case from Honza Pokorsky.
To find other root cases I need a reproduceable case.
Is anybody able to attach a reproduceable test case?
Comment 85 Tomas Zezula 2011-03-17 09:58:47 UTC
If someone has a reproduceable case please attach it or send it.
Otherwise I am closing this issue as incomplete.
Comment 86 Tomas Zezula 2011-03-18 07:45:29 UTC
I've found 2 possible cases.
Fixed jet-main c5b9690980f6
FIxed jet-main f9908b4fb46a

But probably not all of them. If someone has another please attach the reproduceable case.
Comment 87 Tomas Zezula 2011-03-18 07:46:48 UTC
Mariane, can QA verify the fix before I integrate it into 7.0?
Thanks
Comment 88 Marian Mirilovic 2011-03-18 08:15:54 UTC
(In reply to comment #87)
> Mariane, can QA verify the fix before I integrate it into 7.0?

We will look at it today.
Comment 89 Tomas Zezula 2011-03-18 09:42:05 UTC
Dik Jardo,
it's important to test if the java index is not broken. (GoTo Type works).
The case which caused the NPE was:
1) Create some  abstract class Base with abstract method foo
2) Create some other class Holder
3) In the Holder class create an inner class Impl which extends Base
4) In the editor (not by refactoring) rename Holder to Holder2 (editor will complain that it has to be placed in the Holder2 file, rename it back to Holder.
5) Rename Base.foo method to Base.foo2
Comment 90 Jaromir Uhrik 2011-03-18 12:25:08 UTC
I have verified the fix in the following jet-main build and I agree with integration to 7.0:
Product Version: NetBeans IDE Dev (Build jet-main-3754-on-110318)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)
Comment 91 Quality Engineering 2011-03-19 09:42:13 UTC
Integrated into 'main-golden', will be available in build *201103190400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c5b9690980f6
User: Tomas Zezula <tzezula@netbeans.org>
Log: #120577:NullPointerException at org.netbeans.modules.refactoring.java.RetoucheUtils.getOverridingMethods
Comment 92 Jan Lahoda 2011-03-22 09:29:18 UTC
The patches seem fine to me.
Comment 94 Jaromir Uhrik 2011-03-23 14:16:52 UTC
Verified in the following build:
Product Version: NetBeans IDE 7.0 RC1 (Build 201103230000)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)