viatra / EMF-IncQuery

This repository is only kept for historic reasons. All development happens on eclipse.org
http://eclipse.org/viatra
13 stars 4 forks source link

NPE during XMI serialization #179

Closed ujhelyiz closed 12 years ago

ujhelyiz commented 12 years ago

@szabta89 reported this exception trace yesterday in the mailing list, that happens periodically.

java.lang.NullPointerException
   at org.eclipse.viatra2.emf.incquery.tooling.generator.util.EMFPatternURIHandler.<init>(EMFPatternURIHandler.java:17)
   at org.eclipse.viatra2.emf.incquery.tooling.generator.util.XmiModelBuilder.build(XmiModelBuilder.java:230)
   at org.eclipse.viatra2.emf.incquery.tooling.generator.builder.EMFPatternLanguageBuilderParticipant.buildXmiModel(EMFPatternLanguageBuilderParticipant.java:442)
   at org.eclipse.viatra2.emf.incquery.tooling.generator.builder.EMFPatternLanguageBuilderParticipant.build(EMFPatternLanguageBuilderParticipant.java:164)
   at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
   at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:161)
   at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:188)
   at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:85)
   at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
   at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
   at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
   at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
   at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
   at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
   at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
   at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
   at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
   at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
   at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
ujhelyiz commented 12 years ago

As I have seen, the issue is caused by the fact that EPackages from the EPackage registry are not contained in a resource.

As for these resources the default serialization might be used, I simply added a check to avoid this issue. @CMark please, review the solution then close the ticket.

cmark commented 12 years ago

Yes, the null check fixes the problem. If no EResource, we can't determine the URI, so we can't replace it. I am closing the issue.