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 77538 - refImmediateComposite() for method body returns null after method body is set using setBodyText()
Summary: refImmediateComposite() for method body returns null after method body is set...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomas Hurka
URL:
Keywords:
: 77539 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-07 19:35 UTC by _ deva
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Example module to reproduce the prbolem (7.41 KB, application/octet-stream)
2006-06-07 21:03 UTC, _ deva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ deva 2006-06-07 19:35:04 UTC
If you set the method body using setBodyText() in a write transaction, and 
later if you try to access the start/end offset of the method body, you will 
see a NPE as follows

java.lang.NullPointerException
   at 
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.testResourceCha
nge(MetadataElement.java:1184)
   at 
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.getEndOffset
(MetadataElement.java:1217) 

Attached project description:
The example module basically inserts a statement into constructor using 
setBodyText() and then inserts a string parameter to the statement using 
setBodyText().

If you build and install the module, you will see a menu item by name "Insert 
Statement" in Refactor menu. Now if you have the Sample.java document has the 
active document and select "Insert Statement" you will see that the statement 
a.setName("Hello!"); is inserted. If you try to insert the statement again few 
more times results in inserting just a.setName(); and NPE
Comment 1 _ deva 2006-06-07 21:03:14 UTC
Created attachment 30868 [details]
Example module to reproduce the prbolem
Comment 2 _ deva 2006-06-07 21:03:37 UTC
*** Issue 77539 has been marked as a duplicate of this issue. ***
Comment 3 Tomas Hurka 2006-06-08 07:10:55 UTC
Accepted.  
Comment 4 Tomas Hurka 2006-06-08 14:33:37 UTC
Fixed in trunk and release55

Checking in src/org/netbeans/modules/javacore/jmiimpl/javamodel/BehavioralFeatureImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/
BehavioralFeatureImpl.java,v  <--  BehavioralFeatureImpl.java
new revision: 1.18; previous revision: 1.17
done

Checking in src/org/netbeans/modules/javacore/jmiimpl/javamodel/BehavioralFeatureImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/
BehavioralFeatureImpl.java,v  <--  BehavioralFeatureImpl.java
new revision: 1.11.2.4.2.1; previous revision: 1.11.2.4
done
Comment 5 Quality Engineering 2007-09-20 12:49:55 UTC
Reorganization of java component