dstl / Open_Source_ECOA_Toolset_AS5

The Open Source ECOA Toolset (OSETS) allows developers to produce experimental system software which conforms to version 5 of the European Component Oriented Architecture (ECOA) standard.
http://www.ECOA.technology
MIT License
8 stars 8 forks source link

API Codegen failure #9

Open SimonJPCox opened 6 years ago

SimonJPCox commented 6 years ago

Populating a simple model (following the tutorial with different contents) when I attempt to Generate API Code I get the following exception: java.lang.NullPointerException at com.iawg.ecoa.xmlprocessor.XMLProc0Types.processTypeFile(XMLProc0Types.java:122) at com.iawg.ecoa.xmlprocessor.XMLProc0Types.updateSystemModel(XMLProc0Types.java:263) at com.iawg.ecoa.SystemModelManager.processTypes(SystemModelManager.java:412) at com.iawg.ecoa.SystemModelManager.processFiles(SystemModelManager.java:287) at com.iawg.ecoa.ECOA_System_Model.(ECOA_System_Model.java:59) at com.iawg.ecoa.ECOA_API_Code_Gen.(ECOA_API_Code_Gen.java:62) at tech.ecoa.osets.eclipse.plugin.common.GenerateAPIAction.run(GenerateAPIAction.java:64) 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:4118) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3534) 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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)

The only types file is: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

ECOA-developer commented 6 years ago

Unfortunately the code generator does not output enough information to determine what the problem is. Not sure if you meant to attach the XML type file (your message above just seems to stop), but this is required to determine what is going on.

SimonJPCox commented 6 years ago

Not sure what github is doing with the text. If I click edit I can see the whole message. Odd. Think maybe the xml is conflicting with built in markdown?

Adding file here: Test.types.txt

ECOA-developer commented 6 years ago

So the file that you attached worked perfectly for me, but I decided to investigte a bit further. I introduced an error into the file (changed type to "booleadn8") and re-generated code by right clicking on blank initial assembly file. The code still generated OK, which is odd! If I exit and restart eclipse and then try generating the code, I get the error you originally posted, which incidentally is caused by the code generator incorrectly detecting when the XML is invalid. What actually happens is that a null object is passed along to the next stage and it falls over with the original error. So that's the first problem, which I think requires a bit more sorting out of the error philosophy...so I haven't got a fix for this at present.

The other problem, where it is not 'updating' the model I think confirms the theory I had a while ago that the implementation of the XML processor is using 'static' lists in certain parts. What this means is that the plugin maintains the previous version in memory, even when you have changed the XML provided. This can be VERY confusing if you don't realise it is happening. Removal of the 'static' from the lists in the XML processor files and regenerating the plugin fixes this. My fork of the repository includes this fix now: https://github.com/ECOA-developer/Open_Source_ECOA_Toolset_AS5. A pre-built plugin in a zip file is attached - had to rename it from zip to txt to get it to upload though.

osets-plugin.txt

ECOA-developer commented 6 years ago

Just a follow up on the error reporting. It seems that if you run the plugin in debug from another eclipse instance, then you get the exception reported from the eclipse running the plugin (as you observed), but you also get the following from the 'main' eclipse instance: 12:32:27.834 [main] INFO com.iawg.ecoa.SystemModelManager - WARNING - config file not found using default tool config and searching directories... 12:32:27.834 [main] INFO com.iawg.ecoa.SystemModelManager - INFO - using default output directory of D:\runtime-EclipseApplication\jps\target\Steps\output 12:32:27.834 [main] INFO com.iawg.ecoa.SystemModelManager - 12:32:27.834 [main] INFO com.iawg.ecoa.SystemModelManager - Starting parse of types file Test.types.xml... 12:32:27.897 [main] INFO com.iawg.ecoa.xmlprocessor.XMLFileProcessor - There have been no validation errors... 12:32:27.897 [main] INFO com.iawg.ecoa.xmlprocessor.ECOAFile - Namespace for this types file is "Test"... 12:32:27.897 [main] INFO com.iawg.ecoa.xmlprocessor.XMLProc0Types - ERROR: Type: booleadn8 Not Found. 12:32:27.897 [main] INFO com.iawg.ecoa.xmlprocessor.XMLProc0Types - ERROR: Referenced Type: booleadn8 Not Found.

So it appears that the error reporting is in there, but just not being output to the correct place, so all you see is the null pointer exception. Needs some looking at to sort out how to fix it.

leeveenee123 commented 12 months ago

I use your updated plugin,but still get this error when generating UID and platform code: java.lang.NullPointerException at com.iawg.ecoa.xmlprocessor.XMLProc5cDeployment.updateSystemModel(XMLProc5cDeployment.java:104) at com.iawg.ecoa.SystemModelManager.processDeployment(SystemModelManager.java:280) at com.iawg.ecoa.SystemModelManager.processFiles(SystemModelManager.java:300) at com.iawg.ecoa.ECOA_System_Model.(ECOA_System_Model.java:59) at com.iawg.ecoa.ECOA_UID_Gen.(ECOA_UID_Gen.java:44) at tech.ecoa.osets.eclipse.plugin.common.GenerateUIDAction.run(GenerateUIDAction.java:63) 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:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138) 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519) so, it seems to be the problem about "updateSystem Model" still exists. anybody active in this project?