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 76547

Summary: NPE and all links are lost while copying elements to another class diagram
Product: uml Reporter: Alexandr Scherbatiy <sunflower>
Component: General DiagramAssignee: Trey Spiva <tspiva>
Status: VERIFIED FIXED    
Severity: blocker CC: petersl
Priority: P1    
Version: 5.x   
Hardware: All   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: create diagram from selected elements
copy all elements to another diagram
Simple Graph Editor application

Description Alexandr Scherbatiy 2006-05-18 10:49:56 UTC
I have reverse engineered a UML project from my java project
and created a class diagram by creating a diagram from selected elements.
Then I created another class diagram and copied all elements 
from the first diagram to the second.
The NPE pops and there are no any links on the second diagram.

java.lang.NullPointerException
	at
org.netbeans.modules.uml.ui.products.ad.drawengines.ETNodeDrawEngine.resize(ETNodeDrawEngine.java:1461)
	at
org.netbeans.modules.uml.ui.products.ad.drawengines.ETNodeDrawEngine.sizeToContents(ETNodeDrawEngine.java:1638)
	at
org.netbeans.modules.uml.ui.products.ad.drawengines.ETDrawEngine.delayedSizeToContents(ETDrawEngine.java:661)
	at
org.netbeans.modules.uml.ui.support.applicationmanager.ProductGraphPresentation.reconnectPresentationElement(ProductGraphPresentation.java:201)
	at
org.netbeans.modules.uml.ui.swing.drawingarea.ADDrawingAreaControl.clonePresentationElements(ADDrawingAreaControl.java:3758)
	at
org.netbeans.modules.uml.ui.swing.drawingarea.ADDrawingAreaControl.crossDiagramPaste(ADDrawingAreaControl.java:3636)
	at
org.netbeans.modules.uml.ui.swing.drawingarea.diagramtools.CrossDiagramPasteTool.onMouseReleased(CrossDiagramPasteTool.java:53)
	at com.tomsawyer.editor.TSEWindowInputTool.mouseReleasedEvent(DashoA9*..)
	at com.tomsawyer.editor.TSEWindowInputTool.access$400(DashoA9*..)
	at com.tomsawyer.editor.g6.mouseReleased(DashoA9*..)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
	at java.awt.Component.processMouseEvent(Component.java:5488)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
	at java.awt.Component.processEvent(Component.java:5253)
	at java.awt.Container.processEvent(Container.java:1966)
	at java.awt.Component.dispatchEventImpl(Component.java:3955)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
	at java.awt.Container.dispatchEventImpl(Container.java:2010)
	at java.awt.Window.dispatchEventImpl(Window.java:1774)
	at java.awt.Component.dispatchEvent(Component.java:3803)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 1 Alexandr Scherbatiy 2006-05-18 10:54:19 UTC
Created attachment 30488 [details]
create diagram from selected elements
Comment 2 Alexandr Scherbatiy 2006-05-18 10:54:57 UTC
Created attachment 30489 [details]
copy all elements to another diagram
Comment 3 Peter Lam 2006-05-19 23:21:11 UTC
I tried to reproduce the problem on my Windows XP 
Comment 4 Peter Lam 2006-05-19 23:30:19 UTC
ops, I pressed the Enter key after adding myself to the cc list before
completing my comment. Here it is.

I tried several times but not able to replicate the problem. I reverse
engineered the sample application from the following URL, created class diagram
(called it cld#1) from all elements selected in the bankpack package including
the bankpack itself, create a new class diagram, I then selected all elements
from cld#1, selected Edit->Copy, and then pasted (Edit->Paste) to the new
diagram. The result is that all copied elements are pasted to the new class
diagram. No exception and no error from the ide log file either.

Could you please provide more detail on how to reproduce the problem. Thanks.

http://developers.sun.com/prodtech/javatools/jsenterprise/learning/tutorials/jse8/uml_re/BankApp.zip
Comment 5 Alexandr Scherbatiy 2006-05-22 08:58:46 UTC
Created attachment 30541 [details]
Simple Graph Editor application
Comment 6 Alexandr Scherbatiy 2006-05-22 09:10:19 UTC
I have attached my SimpleGraphEditor application. 
Try to do the next actions:
- Create a UML project by reverse engineering my app
- Select all elements under 'diagram.element' package
- Create class diagram from selected elements
- Create a class diagram under UML Model tree
- Select all elements from the first digram and
  copy them to the second diagram.
The issue still exists.
Comment 7 Peter Lam 2006-05-23 00:44:59 UTC
Thanks for providing your app. I am able to reproduce the problem with your app
now. I got the same exception which seems to indicate problem with redrawing. As
for the links not showing, you can click on the "Relationship Discovery" toolbar
button on the diagram window which draws all the existing links on the diagram.
I also tried other things after dismissing the exception dialog and so far
everything else I tried seemed to work ok functionally which can be used as a
workaround for now.

What is strange is that I tried with a few other java projects, but I was not
able to reproduce this problem. Looks like there might be something used in your
project that caused the problem but I can't tell yet.
Comment 8 Trey Spiva 2006-09-25 22:57:46 UTC
The problem are the deverivation classifier.  When being copied, the
compartments are not being initialized correctly
Comment 9 Trey Spiva 2006-09-25 23:37:56 UTC
The derivation classifier draw engine is now copying correctly.
Comment 10 Andrew Korostelev 2006-09-28 11:18:14 UTC
*** Issue 78369 has been marked as a duplicate of this issue. ***
Comment 11 Andrew Korostelev 2006-09-28 11:22:08 UTC
verified on uml nbms 20060926.