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 46267 - NPE from TransientElement.init after running Fix Imports
Summary: NPE from TransientElement.init after running Fix Imports
Status: RESOLVED DUPLICATE of bug 46451
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Martin Matula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-16 23:20 UTC by Jesse Glick
Modified: 2007-04-03 18:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace (6.31 KB, text/plain)
2004-07-16 23:21 UTC, Jesse Glick
Details
Class after exception appeared (20.30 KB, text/plain)
2004-07-18 20:29 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2004-07-16 23:20:53 UTC
040716. Just was editing some class -
syntactically correct AFAIK - and pressed
Alt-Shift-F. IDE froze for about a minute, disk
thrashing for some reason, then got an NPE. Not
sure if it actually fixed any imports or not.
Comment 1 Jesse Glick 2004-07-16 23:21:23 UTC
Created attachment 16303 [details]
Stack trace
Comment 2 Martin Matula 2004-07-17 00:00:04 UTC
The NPE is thrown from the following line of TransientElement.init:

this.resource = (ResourceImpl) ((MDRParser)
tree.getASTContext()).getResource();

At this point tree is surely not null, so it seems that
tree.getASTContext() returned null. If that's the case, then it is
likely a bug in gjast. We need to add a debug info to the source so
that next time the exception occurs the IDE reports also the type of
the tree that caused this and possibly some additional info.
Comment 3 Martin Matula 2004-07-17 00:02:54 UTC
Jesse, could you please attach the class you were editing? Is the
exception reproducible with that file?
Comment 4 Jesse Glick 2004-07-17 00:45:07 UTC
I'm sorry, I don't remember what class it was now (and anyway I have
probably made edits to it since then). Note that Fix Imports has
worked fine since then on other sources.
Comment 5 Martin Matula 2004-07-17 00:57:24 UTC
It is very likely that you had a special construct in your class that
the gjast (javac bridge) does not represent correctly (does not
provide ASTContext for it). But it is hard to find what kind of AS
tree causes that. I will try to add some debug messages so that next
time this occurs we will be able to get more info.
Comment 6 Jesse Glick 2004-07-18 20:29:25 UTC
Got it again in
projects/projectui/src/org/netbeans/modules/project/ui/ProjectChooserAccessory.java
after making some edits and running Fix Imports. Will attach text of
class after the exception appeared.
Comment 7 Jesse Glick 2004-07-18 20:29:57 UTC
Created attachment 16306 [details]
Class after exception appeared
Comment 8 Martin Matula 2004-07-19 16:48:35 UTC
Fixed.

Checking in
src/org/netbeans/modules/javacore/jmiimpl/javamodel/TransientElement.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/TransientElement.java,v
 <--  TransientElement.java
new revision: 1.5; previous revision: 1.4
done
Comment 9 Jesse Glick 2004-07-19 20:20:56 UTC
Should this now be FIXED?
Comment 10 Pavel Flaska 2004-07-23 09:33:15 UTC
There are more specific information in #46451 about this problem.

*** This issue has been marked as a duplicate of 46451 ***