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 77872 - IAE and RE Child Tree not found in entity class
Summary: IAE and RE Child Tree not found in entity class
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: All Linux
: P2 blocker (vote)
Assignee: Daniel Prusa
URL:
Keywords:
: 75245 78040 79645 81294 81949 82005 82362 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-14 09:16 UTC by Jindrich Sedek
Modified: 2007-09-26 09:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log (44.72 KB, text/plain)
2006-06-14 09:17 UTC, Jindrich Sedek
Details
stack trace of both exceptions (3.19 KB, text/plain)
2006-06-14 09:18 UTC, Jindrich Sedek
Details
adding todays(NetBeans 5.5Dev 200608180000) messages.log with stacktrace (20.88 KB, text/plain)
2006-08-18 12:17 UTC, Jindrich Sedek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jindrich Sedek 2006-06-14 09:16:24 UTC
1.Create new EJB module on glassfish server
2.Create new Entity class and the Persistence unit
3.Delete line 25 "@id" wait for a hint
4.Use the hint to create new EntityID
5.Type
    @PersistenceContext()
    private Integer age;
below id definition
6.use hint to import javax.persistence.PersistenceContext;
7.Right Click to age and use popup menu to Refactor/Encapsulate Fields 
8.move the focus(cursor) to the line 30: @PersistenceContext()

A java.lang.RuntimeException exception and a java.lang.IllegalArgumentException
exception occures
It's hard to reproduce try to repeat steps 3-8 few times
I've reached these exceptions at least five times an hour, but now allways by
the same process.
Comment 1 Jindrich Sedek 2006-06-14 09:17:09 UTC
Created attachment 31033 [details]
messages.log
Comment 2 Jindrich Sedek 2006-06-14 09:18:28 UTC
Created attachment 31034 [details]
stack trace of both exceptions
Comment 3 Jindrich Sedek 2006-06-14 09:20:07 UTC
since the message appears it's impossible to stop her showing again
Comment 4 Tomasz Slota 2006-06-14 10:38:37 UTC
*** Issue 75245 has been marked as a duplicate of this issue. ***
Comment 5 Tomasz Slota 2006-06-14 10:48:47 UTC
I've seen this stack trace many times but I can't find the previously reported bug. 
This issue is a P2, it leads to exception loop, the user has choice but to restart the IDE.

Reassigning to javacore (both exceptions come from ResourceImpl.getElementByOffset()).
Comment 6 Jan Becicka 2006-06-29 16:24:30 UTC
*** Issue 78040 has been marked as a duplicate of this issue. ***
Comment 7 Daniel Prusa 2006-08-10 16:17:16 UTC

*** This issue has been marked as a duplicate of 70319 ***
Comment 8 Daniel Prusa 2006-08-10 16:22:29 UTC
I would be better to leave this issue open and mark the others as duplicates
since this one includes reproduction steps...
Comment 9 Daniel Prusa 2006-08-10 16:25:00 UTC
*** Issue 81294 has been marked as a duplicate of this issue. ***
Comment 10 Daniel Prusa 2006-08-10 16:26:10 UTC
*** Issue 79645 has been marked as a duplicate of this issue. ***
Comment 11 Daniel Prusa 2006-08-10 16:29:07 UTC
*** Issue 81949 has been marked as a duplicate of this issue. ***
Comment 12 Daniel Prusa 2006-08-16 11:12:01 UTC
*** Issue 82005 has been marked as a duplicate of this issue. ***
Comment 13 Daniel Prusa 2006-08-18 11:41:27 UTC
I have added an additional info into the exception message. I have tried to
reproduce it following the given steps (repeatedly), but I was not successful.
Reporter, do these steps still work for you? If so, can you attach some stack
trace with the extended message, please?
Comment 14 Jindrich Sedek 2006-08-18 12:17:09 UTC
Created attachment 33059 [details]
adding todays(NetBeans 5.5Dev 200608180000) messages.log with stacktrace
Comment 15 Daniel Prusa 2006-08-18 15:12:18 UTC
The attached stacktrace helped, thanks. I am able to reproduce it quite reliably
now using the following steps:

1. Create a source file with annotation that needs an import to be resolved
(include the import).
2. Delete the line containing annotation import, preferably by Ctrl+E.
3. Move cursor quickly to the line where the annotation is used and quickly
invoke Fix Imports. It must be called before the source file is parsed and error
line appears.

The exception is thrown after that. Note that sometimes NPE can be thrown
instead on IAE, it depends on the position of the annotation in the source.

Here are my findings why IAE is thrown:
MultipartId corresponding to the name of annotation stores firstToken and
lastToken values to retrieve ASTree. There are old values, pointing to the tree
related to the source without the import, but the whole resourse has been
already assigned by a new tree (containing the import). It implies that
incorrect pair 'tokens and tree' are passed into parser.findTree() method and
the method fails.

I have tried to reproduce the problem also on field type, but without any
success. It seems, the scenario above causes problems in the case of annotations.

Tomasi, do you have any idea how the situation with new tree and old firstToken,
lastToken values can occure?
Comment 16 Daniel Prusa 2006-08-22 13:00:11 UTC
Fixed in trunk.

/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/MethodImpl.java
new revision: 1.45; previous revision: 1.44

/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/AnnotationImpl.java
new revision: 1.36; previous revision: 1.35
Comment 17 Pavel Rehak 2006-08-23 13:14:05 UTC
Is this issue fully fixed?
Are you planning merge fix into 5.5 branch?
(see status whiteboard)
Comment 18 Daniel Prusa 2006-08-23 13:24:48 UTC
Fixed merged into release55 branch.

/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/MethodImpl.java
new revision: 1.37.2.3.2.2; previous revision: 1.37.2.3.2.1

/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/AnnotationImpl.java
new revision: 1.19.4.5.2.7; previous revision: 1.19.4.5.2.6
Comment 19 Jindrich Sedek 2006-08-24 16:24:23 UTC
Verified NetBeans 5.5Dev 200608240000
Comment 20 Jan Becicka 2006-09-21 18:34:54 UTC
*** Issue 82362 has been marked as a duplicate of this issue. ***
Comment 21 Quality Engineering 2007-09-20 12:01:57 UTC
Reorganization of java component