Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Is C++ project reverse engineering to UML broken in Photon?(Getting null pointer exception while generating UML class diagram from .uml file created using "Reverse -> To New UML" on C++ source files)
Is C++ project reverse engineering to UML broken in Photon? [message #1794155] Fri, 24 August 2018 14:47 Go to next message
Olivier H. Martin is currently offline Olivier H. MartinFriend
Messages: 3
Registered: August 2018
Junior Member
Hi

In preparation for a larger project, I am trying to apply - to a trivial C++ project - the reverse engineering method that leverages Papyrus Designer.

Note that I am new to this process and to the forum, so please kindly let me know if I missed anything, including regarding forum protocol ;-)

I am using Eclipse Photon CDT (Platform 4.8.0, CDT 9.5.2) and Papyrus for UML 4.1.0 with C++ profile 1.0.5 (All components on the latest version of Photon's release train).

I do get the .uml file created in the reversed_models directory, and that appears to have the expected contents. I then copy that file to a Papyrus project, and convert it to a Papyrus model using the C_CPP profile, while only selecting the Class Diagram option.

During that processing, I get the following null pointer exception in the event log:

java.lang.NullPointerException
	at org.eclipse.papyrus.infra.core.resource.AbstractDynamicModel.saveModel(AbstractDynamicModel.java:87)
	at org.eclipse.papyrus.infra.core.resource.ModelSet.save(ModelSet.java:776)
	at org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard.saveDiagram(CreateModelWizard.java:741)
	at org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard.createAndOpenPapyrusModel(CreateModelWizard.java:336)
	at org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard.performFinish(CreateModelWizard.java:284)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:772)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:411)
	at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:81)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4940)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4518)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.ui.internal.navigator.wizards.WizardShortcutAction.run(WizardShortcutAction.java:99)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4940)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4518)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1471)


Would anyone have encountered this error, and know perhaps what I am missing or if this is just not working in the present Photon release train?

Any advice much appreciated.

Sincerely,

-- Olivier H.Martin.
Re: Is C++ project reverse engineering to UML broken in Photon? [message #1794214 is a reply to message #1794155] Mon, 27 August 2018 15:01 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi,

can you please check, whether the problem also exists with the 1.1.0 version that you can install from the following update-site (which we'd like to release this week):

https://hudson.eclipse.org/papyrus/job/papyrus-designer-photon/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.designer.p2/target/repository/
Re: Is C++ project reverse engineering to UML broken in Photon? [message #1794234 is a reply to message #1794214] Mon, 27 August 2018 19:02 Go to previous messageGo to next message
Olivier H. Martin is currently offline Olivier H. MartinFriend
Messages: 3
Registered: August 2018
Junior Member
Hi Ansgar,

I just retried the whole conversion process, after upgrading Papyrus Designer as per your post:
- Reverse C++ to new UML model
- Copy the resulting .uml file to new Papyrus project
- Select New->Papyrus Model from contextual menu on the newly copied .uml file in Papyrus project, to convert it while using the C++ profile and only selecting Class Diagrams.


The same error occurs:

eclipse.buildId=4.8.0.I20180611-0500
java.version=1.8.0_181
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.cpp.product
Command-line arguments:  -data file:/root/eclipse-workspace-test/ -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.cpp.product

org.eclipse.papyrus.infra.core
Error
Mon Aug 27 14:43:41 EDT 2018
Unexpected Error

java.lang.NullPointerException
	at org.eclipse.papyrus.infra.core.resource.AbstractDynamicModel.saveModel(AbstractDynamicModel.java:87)
	at org.eclipse.papyrus.infra.core.resource.ModelSet.save(ModelSet.java:776)
	at org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard.saveDiagram(CreateModelWizard.java:741)
	at org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard.createAndOpenPapyrusModel(CreateModelWizard.java:336)
	at org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard.performFinish(CreateModelWizard.java:284)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:772)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:411)
	at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:81)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4940)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4518)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.ui.internal.navigator.wizards.WizardShortcutAction.run(WizardShortcutAction.java:99)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4940)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4518)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1471)



As far as Papyrus is concerned, my config now reads:

    Papyrus base elements for code generation (Incubation)	1.1.0
    Papyrus C++ profile, view and code generation (Incubation)	1.1.0
    Papyrus Debug Tools	1.0.0.201808270822
    Papyrus Debug Tools Developer Resources	1.0.0.201808270822
    Papyrus Designer Components, develop and deploy component based applications (Incubation)	0.8.0
    Papyrus Designer Monitoring (Incubation)	0.8.0
    Papyrus Designer Transformation, develop and deploy component based applications (Incubation)	0.8.0
    Papyrus Designer Unified component model (Incubation)	0.8.0
    Papyrus Diagram Assistants Generator	4.0.0.201808270822
    Papyrus Diagram Assistants Generator Developer Resources	4.0.0.201808270822
    Papyrus Diagram Generation Tools	1.0.0.201808270822
    Papyrus Diagram Generation Tools Developer Resources	1.0.0.201808270822
    Papyrus for UML	4.1.0.201808270800
    Papyrus for UML Developer Resources	4.1.0.201808270800
    Papyrus IDL profile and code generation (Incubation)	1.1.0
    Papyrus Java profile, library and code generation (Incubation)	1.1.0
    Papyrus JUnit Framework	1.0.0.201808270822
    Papyrus JUnit Framework Developer Resources	1.0.0.201808270822
    Papyrus Toolsmiths tools	1.2.0.201808270822
    Papyrus Toolsmiths tools Developer Resources	1.2.0.201808270822
    Papyrus Tracing support for Designer (Incubation)	0.8.0
    Papyrus User Examples	0.0.1.201808270800
    Papyrus User Examples Developer Resources	0.0.1.201808270800


BTW, the Papyrus project does get populated with .di, .notation, and .uml file upon conversion. The class diagram remains empty however...

I attached the minimal project I use to test this.

Thank you for looking into it :)

[Updated on: Mon, 27 August 2018 19:32]

Report message to a moderator

Re: Is C++ project reverse engineering to UML broken in Photon? [message #1794256 is a reply to message #1794234] Tue, 28 August 2018 07:29 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
When I create the vector.di/.notation from the .uml file via File -> New Papyrus Model, I can't reproduce the exception (yet it's likely a Papyrus bug)

However, it's quite normal that the class diagram is initially empty: by default, the diagram is not synchronized with the model, i.e in general it only contains a subset of the elements of your models, unless you synchronize it. You can either activate "Sync with model" in the "Appearance" tab of the property view or rag&drop the Vector class from the model-explorer into the diagram. Then again, you do not see any the attributes and operations first. Again, you have the choice to either add the elements you want to see explicitly via drag&drop or by pressing F4 ("Filters -> Show/Hide contents" in the context menu) or activating "Sync with model" after selecting the Vector class (with the disadvantage that behaviors are shown as nested classifiers, but you can hide this compartment via Filters -> Show/Hide compartments").
Re: Is C++ project reverse engineering to UML broken in Photon? [message #1794287 is a reply to message #1794256] Tue, 28 August 2018 13:17 Go to previous message
Olivier H. Martin is currently offline Olivier H. MartinFriend
Messages: 3
Registered: August 2018
Junior Member
Ok. That worked, in spite of the exception seen in the event log. Thank you very much for the hints!
Previous Topic:a question about sysml activity diagram
Next Topic:Automatic synchronization between UML class and reversed Java class
Goto Forum:
  


Current Time: Thu Apr 25 05:34:57 GMT 2024

Powered by FUDForum. Page generated in 0.03558 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top