Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] NullPointerException generating Ecore from XSD
[Texo] NullPointerException generating Ecore from XSD [message #1184340] Wed, 13 November 2013 06:31 Go to next message
Eclipse UserFriend
Hello,

I'm trying to generate an ecore file from a XSD model with Texo and having a NPE, could you help me to make it work.

I'm using STS IDE 3.4.0 based on Eclipse 4.3.1

That's the stack trace.

Thanks in advance.

!ENTRY org.eclipse.ui 4 0 2013-11-13 12:06:58.777
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.run(BaseGenerateAction.java:86)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	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:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
	at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275)
	at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:960)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:995)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:970)
	at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1166)
	at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.run(BaseGenerateAction.java:79)
	... 30 more
Caused by: java.lang.IllegalStateException: java.lang.NullPointerException
	at org.eclipse.emf.texo.eclipse.popup.actions.GenerateEcoreFromXSD.generateFromModelFiles(GenerateEcoreFromXSD.java:90)
	at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.generate(BaseGenerateAction.java:127)
	at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.generate(BaseGenerateAction.java:107)
	at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction$1.execute(BaseGenerateAction.java:75)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.NullPointerException
	at java.io.File.<init>(Unknown Source)
	at org.eclipse.emf.texo.eclipse.popup.actions.GenerateEcoreFromXSD.generateFromModelFiles(GenerateEcoreFromXSD.java:74)
	... 7 more
Re: [Texo] NullPointerException generating Ecore from XSD [message #1185641 is a reply to message #1184340] Thu, 14 November 2013 02:02 Go to previous messageGo to next message
Eclipse UserFriend
Hi Santiago,
I published a new build just now to solve this, can you try it out?

gr. Martin

On 11/13/2013 04:09 PM, Santiago Nieto wrote:
> Hello,
>
> I'm trying to generate an ecore file from a XSD model with Texo and having a NPE, could you help me to make it work.
>
> I'm using STS IDE 3.4.0 based on Eclipse 4.3.1
>
> That's the stack trace.
>
> Thanks in advance.
>
>
> !ENTRY org.eclipse.ui 4 0 2013-11-13 12:06:58.777
> !MESSAGE Unhandled event loop exception
> !STACK 0
> java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
> at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.run(BaseGenerateAction.java:86)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
> at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
> at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
> at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
> at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
> 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:636)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
> Caused by: java.lang.reflect.InvocationTargetException
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
> at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
> at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275)
> at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:960)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
> at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:995)
> at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:970)
> at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1166)
> at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.run(BaseGenerateAction.java:79)
> ... 30 more
> Caused by: java.lang.IllegalStateException: java.lang.NullPointerException
> at
> org.eclipse.emf.texo.eclipse.popup.actions.GenerateEcoreFromXSD.generateFromModelFiles(GenerateEcoreFromXSD.java:90)
> at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.generate(BaseGenerateAction.java:127)
> at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction.generate(BaseGenerateAction.java:107)
> at org.eclipse.emf.texo.eclipse.popup.actions.BaseGenerateAction$1.execute(BaseGenerateAction.java:75)
> at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
> at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
> at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
> at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
> Caused by: java.lang.NullPointerException
> at java.io.File.<init>(Unknown Source)
> at
> org.eclipse.emf.texo.eclipse.popup.actions.GenerateEcoreFromXSD.generateFromModelFiles(GenerateEcoreFromXSD.java:74)
> ... 7 more
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] NullPointerException generating Ecore from XSD [message #1186016 is a reply to message #1185641] Thu, 14 November 2013 07:16 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your fast reply. That's working fine.

However, I saw something weird.

I have a previous version of Texo in another machine, just before change the templates to : boolean addTo... And I'd like to continue using previous generation code style for not having to upgrade my application in this moment. I took the same templates I had in the previous release and custom entity_addition.xpt. I regenerated the JPA model code and there are a few diferences with the previous release as:

/**
		 * @generated
		 */
		@Override
		public void eAddTo(EStructuralFeature eStructuralFeature, Object value) {
			final int featureID = eClass().getFeatureID(eStructuralFeature);
			switch (featureID) {

			}
			super.eAddTo(eStructuralFeature, value);
		}

Instead of:
		/**
		 * @generated
		 */
		@Override
		public void eAddTo(EStructuralFeature eStructuralFeature, Object value) {
			final int featureID = eClass().getFeatureID(eStructuralFeature);
			switch (featureID) {

			default:
				super.eAddTo(eStructuralFeature, value);
			}
		}


And the more critical, entity_addition.xpt is not being executed anymore. In the previous version it did.

Could you bring me some light to me?

Thanks in advance
Re: [Texo] NullPointerException generating Ecore from XSD [message #1186154 is a reply to message #1186016] Thu, 14 November 2013 09:15 Go to previous messageGo to next message
Eclipse UserFriend
Hello!

From my previous post, I didn't see entity_addition.xpt changes but it's currently working. However, ModelFactoy and DocumentRoot are still having diferences.

I changed modelobject.xpt to change eAddTo signature for returning void and it continues generating boolean method. In DocumentRoot, the getter methods changed from:

	public ClassN getAttribute() {
		return DocumentRootMixedFeatureGroup.getSingleFeatureMapValue(
				getMixed(),
				DocumentRootMixedFeatureGroup.Feature.XXX);
	}


to

	public ClassN getAttribute() {
		return attribute;
	}



Could you support me?

Thanks
Re: [Texo] NullPointerException generating Ecore from XSD [message #1186188 is a reply to message #1186154] Thu, 14 November 2013 09:38 Go to previous messageGo to next message
Eclipse UserFriend
Hey Santiago,
That's a strange change it seems. Is the entity_addition.xpt being executed now? (I have testcases for this and it gets
executed for these testcases)

Can you change other things in modelobject.xpt to see if it really gets executed?

And if it all doesn't work, can I download the dev project you are using to try it out myself?

gr. Martin

On 11/14/2013 03:15 PM, Santiago Nieto wrote:
> Hello!
>
> From my previous post, I didn't see entity_addition.xpt changes but it's currently working. However, ModelFactoy and
> DocumentRoot are still having diferences.
> I changed modelobject.xpt to change eAddTo signature for returning void and it continues generating boolean method. In
> DocumentRoot, the getter methods changed from:
>
>
> public ClassN getAttribute() {
> return DocumentRootMixedFeatureGroup.getSingleFeatureMapValue(
> getMixed(),
> DocumentRootMixedFeatureGroup.Feature.XXX);
> }
>
>
> to
>
> public ClassN getAttribute() {
> return attribute;
> }
>
>
>
> Could you support me?
>
> Thanks


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] NullPointerException generating Ecore from XSD [message #1186221 is a reply to message #1186188] Thu, 14 November 2013 10:02 Go to previous messageGo to next message
Eclipse UserFriend
I changed modelobject.xpt modifying eAddTo to
	/**
	 * @generated
	 */
	@Override
	public void eAddTo(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, Object value) {
		final int featureID = eClass().getFeatureID(eStructuralFeature);
		String j = "";
		switch (featureID) {
		«FOREACH this.EStructuralFeatureModelGenAnnotations AS featureAnnotation-»
			«REM»
				The check !featureAnnotation.itemType.contains(",") prevents maps to be handled here
			«ENDREM»
			«IF featureAnnotation.EStructuralFeature.changeable && featureAnnotation.many && !featureAnnotation.itemType.contains(",")»
			«IF featureAnnotation.reference && featureAnnotation.featureMapFeature == null && ((EReferenceModelGenAnnotation)featureAnnotation).generateSafeManyAccess-»
			case «ePackageAnnotation.qualifiedClassName».«toUpperCase(this.name)»_«toUpperCase(featureAnnotation.name)»_FEATURE_ID:
				getTarget().addTo«toFirstUpper(featureAnnotation.validJavaMemberName)»(«cast(featureAnnotation.itemType)»value);
			«ELSE-»
			case «ePackageAnnotation.qualifiedClassName».«toUpperCase(this.name)»_«toUpperCase(featureAnnotation.name)»_FEATURE_ID:
				getTarget().«featureAnnotation.getter»().add(«(featureAnnotation.itemType)»value);
			«ENDIF-»
			«ENDIF-»
		«ENDFOREACH-»
		}
		super.eAddTo(eStructuralFeature, value);
	}


And it didn't see any change. Could you send me any testing or example xsd, ecore and annotations to generate the code with my changes?

Regards.
Re: [Texo] NullPointerException generating Ecore from XSD [message #1186244 is a reply to message #1186221] Thu, 14 November 2013 10:22 Go to previous message
Eclipse UserFriend
Hi Santiago,
I use all the test models here:
http://git.eclipse.org/c/texo/org.eclipse.emf.texo.git/tree/tests/org.eclipse.emf.texo.modelgenerator.test/src/org/eclipse/emf/texo/modelgenerator/test/models
(hyperlink maybe broken by line breaks, see the issues, samples, schemaconstructs, texo folders for examples).

Can you add a helloworld method in the modelobject.xpt to see if that gets generated? So to check if the modelobject.xpt
is being used at all.

Can you send me your modelobject.xpt by email: mtaal at elver.org

gr. Martin


On 11/14/2013 04:02 PM, Santiago Nieto wrote:
> I changed modelobject.xpt modifying eAddTo to
>
> /**
> * @generated
> */
> @Override
> public void eAddTo(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, Object value) {
> final int featureID = eClass().getFeatureID(eStructuralFeature);
> String j = "";
> switch (featureID) {
> «FOREACH this.EStructuralFeatureModelGenAnnotations AS featureAnnotation-»
> «REM»
> The check !featureAnnotation.itemType.contains(",") prevents maps to be handled here
> «ENDREM»
> «IF featureAnnotation.EStructuralFeature.changeable && featureAnnotation.many &&
> !featureAnnotation.itemType.contains(",")»
> «IF featureAnnotation.reference && featureAnnotation.featureMapFeature == null &&
> ((EReferenceModelGenAnnotation)featureAnnotation).generateSafeManyAccess-»
> case
> «ePackageAnnotation.qualifiedClassName».«toUpperCase(this.name)»_«toUpperCase(featureAnnotation.name)»_FEATURE_ID:
>
> getTarget().addTo«toFirstUpper(featureAnnotation.validJavaMemberName)»(«cast(featureAnnotation.itemType)»value);
> «ELSE-»
> case
> «ePackageAnnotation.qualifiedClassName».«toUpperCase(this.name)»_«toUpperCase(featureAnnotation.name)»_FEATURE_ID:
> getTarget().«featureAnnotation.getter»().add(«(featureAnnotation.itemType)»value);
> «ENDIF-»
> «ENDIF-»
> «ENDFOREACH-»
> }
> super.eAddTo(eStructuralFeature, value);
> }
>
>
> And it didn't see any change. Could you send me any testing or example xsd, ecore and annotations to generate the code
> with my changes?
>
> Regards.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[Teneo] VARCHAR2 issue with Oracle
Next Topic:[Texo] overwrite @CollectionTable with the ORM file
Goto Forum:
  


Current Time: Mon Jul 14 01:31:20 EDT 2025

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

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

Back to the top