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 48595 - ISE: missing SourceCookie of JavaDataObject
Summary: ISE: missing SourceCookie of JavaDataObject
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
: 48800 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-07 14:52 UTC by Jan Pokorsky
Modified: 2007-09-26 09:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ISE (11.12 KB, text/plain)
2004-09-07 14:54 UTC, Jan Pokorsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Pokorsky 2004-09-07 14:52:07 UTC
I can randomly, but quite often, reproduce ISE due
to missing SourceCookie of JavaDataObject. Most
often it occurs if I select some jmi element in
editor and then I choose Tools menu.

Strange is that the method
(BridgeUtils.getElement) where it fails already
holds ClassMember, its Resource and its DataObject.
Comment 1 Jan Pokorsky 2004-09-07 14:54:10 UTC
Created attachment 17435 [details]
ISE
Comment 2 Daniel Prusa 2004-09-10 13:01:00 UTC
*** Issue 48800 has been marked as a duplicate of this issue. ***
Comment 3 Tomas Hurka 2004-09-13 17:11:18 UTC
Steps how to reproduce it:
1) open Refactoring module
2) go to class JavaEdior
3) as soon as JavaEdior is displayed go to Tools menu
4) wait for ISE
Comment 4 Tomas Hurka 2004-09-13 17:20:01 UTC
Possible fix:

Index: org/netbeans/modules/java/ui/nodes/BridgeUtils.java
=====================================================
==============
RCS file: /cvs/java/src/org/netbeans/modules/java/ui/nodes/BridgeUtils.java,v
retrieving revision 1.4
diff -c -r1.4 BridgeUtils.java
*** org/netbeans/modules/java/ui/nodes/BridgeUtils.java 31 Aug 2004 16:21:32 
-0000      1.4
--- org/netbeans/modules/java/ui/nodes/BridgeUtils.java 13 Sep 2004 16:12:17 
-0000
***************
*** 86,92 ****
          }
          SourceCookie sc = (SourceCookie) d.getCookie(SourceCookie.class);
          if (sc == null) {
!             throwIllegalState(member, "missing source cookie"); // NOI18N
          }
          SourceElement source = sc.getSource();
          ClassElement[] els;
--- 86,92 ----
          }
          SourceCookie sc = (SourceCookie) d.getCookie(SourceCookie.class);
          if (sc == null) {
!             return null;
          }
          SourceElement source = sc.getSource();
          ClassElement[] els;

This works OK, but Honza will try to find cleaner solution (if possible).
Comment 5 Jan Pokorsky 2004-09-14 13:38:08 UTC
Tome, thanks for your patch but I am afraid it would not work under
all circumstances. BridgeUtils.getElement(JavaClass) is used also by
java node factories.

Now I am working on a workaround for beta2 but since it will not solve
the cause of this issue I have filed also the issue #48997 for
openide/nodes.
Comment 6 Jan Pokorsky 2004-09-14 15:06:11 UTC
fixed with workaround in

/cvs/java/src/org/netbeans/modules/java/ui/nodes/BridgeUtils.java
new revision: 1.5; previous revision: 1.4
/cvs/java/src/org/netbeans/modules/java/ui/nodes/JavaSourceNodeFactory.java
new revision: 1.13; previous revision: 1.12
Comment 7 ehucka 2004-09-14 16:38:48 UTC
I tested patched trunk and beta2 builds with Tomas test case and I
cannot reproduce it now.
Comment 8 Jan Pokorsky 2004-09-14 17:02:32 UTC
the fix merged to release40_beta2

/cvs/java/src/org/netbeans/modules/java/ui/nodes/BridgeUtils.java
new revision: 1.4.4.1; previous revision: 1.4
/cvs/java/src/org/netbeans/modules/java/ui/nodes/JavaSourceNodeFactory.java
new revision: 1.11.4.1; previous revision: 1.11