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.
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.
Created attachment 34538 [details] NPE stack trace
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.
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.
What about having canPaste check to see if the component has a parent before running the check.
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.