osate / osate2-ba

Old Behavior Annex plug-in for OSATE repository, kept for reference
5 stars 4 forks source link

NullPointerExceptions in AadlBaUtils.java #28

Closed lwrage closed 9 years ago

lwrage commented 10 years ago

When starting Osate with my workspace I get two NPEs (AadlBaUtils.java line 1182 and line 74). In both cases the reason is a missing null check: PropertyUtils.findPropertyExpression may return null but calling code assumes that the result is not null. There is a third call in AadlBaUtils that correctly checks for null.

0    [Worker-3] DEBUG org.osate.xtext.aadl2.ui.containers.Aadl2ProjectsStateHelper  - added /Plugin_Resources/AADL_Project.aadl
7478 [Worker-4] ERROR org.eclipse.xtext.builder.clustering.ClusteringBuilderState  - Error loading resource
java.lang.NullPointerException
    at org.osate.ba.utils.AadlBaUtils.processArrayDataRepresentation(AadlBaUtils.java:1182)
    at org.osate.ba.utils.AadlBaUtils.getTypeHolder(AadlBaUtils.java:1114)
    at org.osate.ba.analyzers.AadlBaTypeChecker.getValueAndTypeHolder(AadlBaTypeChecker.java:1077)
    at org.osate.ba.analyzers.AadlBaTypeChecker.valueVariableCheck(AadlBaTypeChecker.java:1041)
    at org.osate.ba.analyzers.AadlBaTypeChecker.valueCheck(AadlBaTypeChecker.java:974)
    at org.osate.ba.analyzers.AadlBaTypeChecker.factorCheck(AadlBaTypeChecker.java:897)
    at org.osate.ba.analyzers.AadlBaTypeChecker.termCheck(AadlBaTypeChecker.java:842)
    at org.osate.ba.analyzers.AadlBaTypeChecker.simpleExpressionCheck(AadlBaTypeChecker.java:768)
    at org.osate.ba.analyzers.AadlBaTypeChecker.relationCheck(AadlBaTypeChecker.java:725)
    at org.osate.ba.analyzers.AadlBaTypeChecker.valueExpressionCheck(AadlBaTypeChecker.java:672)
    at org.osate.ba.analyzers.AadlBaTypeChecker.ifStatementCheck(AadlBaTypeChecker.java:2105)
    at org.osate.ba.analyzers.AadlBaTypeChecker.condStatementCheck(AadlBaTypeChecker.java:1839)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorActionCheck(AadlBaTypeChecker.java:1830)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorActionsCheck(AadlBaTypeChecker.java:1808)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorActionBlockCheck(AadlBaTypeChecker.java:1787)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorTransitionCheck(AadlBaTypeChecker.java:369)
    at org.osate.ba.analyzers.AadlBaTypeChecker.checkTypes(AadlBaTypeChecker.java:154)
    at org.osate.ba.AadlBaResolver.resolveAnnex(AadlBaResolver.java:86)
    at org.osate.annexsupport.AnnexResolverProxy.resolveAnnex(AnnexResolverProxy.java:70)
    at org.osate.xtext.aadl2.parsing.AnnexParserAgent.afterModelLinked(AnnexParserAgent.java:233)
    at org.eclipse.xtext.linking.impl.AbstractCleaningLinker.linkModel(AbstractCleaningLinker.java:53)
    at org.eclipse.xtext.resource.XtextResource.doLinking(XtextResource.java:290)
    at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLinking(LazyLinkingResource.java:107)
    at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:258)
    at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:248)
    at org.eclipse.xtext.resource.XtextResource.doLoad(XtextResource.java:161)
    at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLoad(LazyLinkingResource.java:100)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
    at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:229)
    at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:24)
    at org.eclipse.xtext.builder.resourceloader.SerialResourceLoader$1.next(SerialResourceLoader.java:45)
    at org.eclipse.xtext.builder.resourceloader.AbstractResourceLoader$CheckedLoadOperation.next(AbstractResourceLoader.java:74)
    at org.eclipse.xtext.builder.clustering.ClusteringBuilderState.writeNewResourceDescriptions(ClusteringBuilderState.java:352)
    at org.eclipse.xtext.builder.clustering.ClusteringBuilderState.doUpdate(ClusteringBuilderState.java:121)
    at org.eclipse.xtext.builder.builderState.AbstractBuilderState.update(AbstractBuilderState.java:112)
    at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:194)
    at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:220)
    at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:93)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:328)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
    at org.eclipse.core.internal.resources.Project.build(Project.java:124)
    at org.eclipse.xtext.builder.impl.BuildScheduler$BuildJob.run(BuildScheduler.java:164)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
7760 [Worker-4] ERROR org.eclipse.xtext.builder.clustering.ClusteringBuilderState  - Error loading resource
java.lang.NullPointerException
    at org.osate.ba.utils.AadlBaUtils.getDataRepresentation(AadlBaUtils.java:74)
    at org.osate.ba.utils.AadlBaUtils.getDataRepresentation(AadlBaUtils.java:405)
    at org.osate.ba.utils.AadlBaUtils.getDataRepresentation(AadlBaUtils.java:449)
    at org.osate.ba.utils.AadlBaUtils.getTypeHolder(AadlBaUtils.java:926)
    at org.osate.ba.utils.AadlBaUtils.getTypeHolder(AadlBaUtils.java:1036)
    at org.osate.ba.analyzers.AadlBaTypeChecker.getValueAndTypeHolder(AadlBaTypeChecker.java:1077)
    at org.osate.ba.analyzers.AadlBaTypeChecker.valueVariableCheck(AadlBaTypeChecker.java:1041)
    at org.osate.ba.analyzers.AadlBaTypeChecker.valueCheck(AadlBaTypeChecker.java:974)
    at org.osate.ba.analyzers.AadlBaTypeChecker.factorCheck(AadlBaTypeChecker.java:897)
    at org.osate.ba.analyzers.AadlBaTypeChecker.termCheck(AadlBaTypeChecker.java:842)
    at org.osate.ba.analyzers.AadlBaTypeChecker.simpleExpressionCheck(AadlBaTypeChecker.java:768)
    at org.osate.ba.analyzers.AadlBaTypeChecker.relationCheck(AadlBaTypeChecker.java:725)
    at org.osate.ba.analyzers.AadlBaTypeChecker.valueExpressionCheck(AadlBaTypeChecker.java:672)
    at org.osate.ba.analyzers.AadlBaTypeChecker.subprogramParameterListCheck(AadlBaTypeChecker.java:2833)
    at org.osate.ba.analyzers.AadlBaTypeChecker.qualifiedSubprogramClassifierCallActionResolver(AadlBaTypeChecker.java:2338)
    at org.osate.ba.analyzers.AadlBaTypeChecker.communicationActionCheck(AadlBaTypeChecker.java:2384)
    at org.osate.ba.analyzers.AadlBaTypeChecker.basicActionCheck(AadlBaTypeChecker.java:2140)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorActionCheck(AadlBaTypeChecker.java:1826)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorActionsCheck(AadlBaTypeChecker.java:1808)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorActionBlockCheck(AadlBaTypeChecker.java:1787)
    at org.osate.ba.analyzers.AadlBaTypeChecker.behaviorTransitionCheck(AadlBaTypeChecker.java:369)
    at org.osate.ba.analyzers.AadlBaTypeChecker.checkTypes(AadlBaTypeChecker.java:154)
    at org.osate.ba.AadlBaResolver.resolveAnnex(AadlBaResolver.java:86)
    at org.osate.annexsupport.AnnexResolverProxy.resolveAnnex(AnnexResolverProxy.java:70)
    at org.osate.xtext.aadl2.parsing.AnnexParserAgent.afterModelLinked(AnnexParserAgent.java:233)
    at org.eclipse.xtext.linking.impl.AbstractCleaningLinker.linkModel(AbstractCleaningLinker.java:53)
    at org.eclipse.xtext.resource.XtextResource.doLinking(XtextResource.java:290)
    at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLinking(LazyLinkingResource.java:107)
    at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:258)
    at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:248)
    at org.eclipse.xtext.resource.XtextResource.doLoad(XtextResource.java:161)
    at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLoad(LazyLinkingResource.java:100)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
    at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:229)
    at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:24)
    at org.eclipse.xtext.builder.resourceloader.SerialResourceLoader$1.next(SerialResourceLoader.java:45)
    at org.eclipse.xtext.builder.resourceloader.AbstractResourceLoader$CheckedLoadOperation.next(AbstractResourceLoader.java:74)
    at org.eclipse.xtext.builder.clustering.ClusteringBuilderState.writeNewResourceDescriptions(ClusteringBuilderState.java:352)
    at org.eclipse.xtext.builder.clustering.ClusteringBuilderState.doUpdate(ClusteringBuilderState.java:121)
    at org.eclipse.xtext.builder.builderState.AbstractBuilderState.update(AbstractBuilderState.java:112)
    at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:194)
    at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:220)
    at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:93)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:328)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
    at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
    at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
    at org.eclipse.core.internal.resources.Project.build(Project.java:124)
    at org.eclipse.xtext.builder.impl.BuildScheduler$BuildJob.run(BuildScheduler.java:164)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
SebastienGardoll commented 10 years ago

Hi,

I patched findPropertyExpression (it returns an empty list now). Do you still have NPE ?

lwrage commented 9 years ago

The NPEs are gone.