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 85822 - NPE when cutting/pasting numerous components
Summary: NPE when cutting/pasting numerous components
Status: REOPENED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Model (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-26 19:18 UTC by Nathan Fiedler
Modified: 2011-11-28 05:06 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
NPE stack trace (4.89 KB, text/plain)
2006-09-26 19:18 UTC, Nathan Fiedler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Fiedler 2006-09-26 19:18:02 UTC
Split from issue 85323, which was a different exception that has already been
fixed. This new exception is happening in the schema model.

Koslov appears to be using build 200609220000 on Windows XP with JDK 1.6.0-beta2.

Steps to reproduce:

- Open/create a Java application project
- Open the flattened OTA schema (the 800KB file)
- Create a new schema
- Tile the two editor windows so they are side-by-side
- Select all of the complex types in OTA and invoke Cut
- Select the Complex Types node in the empty schema and invoke Paste

At some point exceptions will occur. The attached stack trace is provided by
Koslov. However, I was not able to reproduce this particular exception.
Comment 1 Nathan Fiedler 2006-09-26 19:18:30 UTC
Created attachment 34538 [details]
NPE stack trace
Comment 2 Nam Nguyen 2006-09-27 02:54:34 UTC
Certainly we can chcek for parent and return false, which would avoid the NPE.

Its interesting that canPaste is called on deleted component, which mean some
coordination needs to be fixed on actions cut/paste, such that not delete should
happen until all canPaste have returned.
Comment 3 Nam Nguyen 2006-09-27 17:33:37 UTC
On rethinking, the NPE is result of client code error.  Client of canPaste
should never pass target component already deleted from the model.  

Why this situation, I can't tell because I could not reproduce it.  I guess this
is just a subordinate symtomp from racing condition from the numerous
IllegalStateException in issue 85323.

Close as WONTFIX base on contract of the API.
Comment 4 Chris Webster 2006-09-27 17:38:03 UTC
What about having canPaste check to see if the component has a parent before
running the check. 
Comment 5 Nam Nguyen 2006-09-27 20:36:40 UTC
Yes, we can improve the clarity of the API contract of AbstractComponent.canAdd
by  checking the argument and throwing IllegalArgumentException at XAM level. 
Subclasses will need to call super.canAdd in their implemenetation.

Make this an enhancement for future release.