Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Null pointer exception problem with OCL parsing
Null pointer exception problem with OCL parsing [message #804311] Wed, 22 February 2012 13:10 Go to next message
Piotr J. Puczynski is currently offline Piotr J. PuczynskiFriend
Messages: 17
Registered: January 2012
Junior Member
Hi.
I am using org.eclipse.ocl_3.1.0.v20110913-1213 and org.eclipse.ocl.uml_3.1.0.v20110913-1213.

I have a problem with OCL parsing during the JUnit tests. It seems to work when the Topcased IDE is lunched but it fails during the JUnit tests (as stand alone).
I have two test cases ; one parses Boolean value "true" and other parses "Set { 1 , 2 , 5 , 88 }".
The first does not trigger an error, second does. The context of the expressions is InstanceSpecification.

I initialize ocl :
System.setProperty("org.eclipse.ocl.uml", repositoryPath + "libs/ocl");
			System.setProperty("org.eclipse.uml2.uml.resources", repositoryPath + "libs/uml");
			String result = org.eclipse.ocl.uml.OCL.initialize(null); // null for global init
			assert result == null;


The initialized system properties directories contain extracted plugins and the returned string is always null. I use null as a parameter but I also tried with resourceSet and usage of resurceSet in fact does not help.
My code of evaluation is:

UMLEnvironmentFactory envFactory = new UMLEnvironmentFactory(constraint.getModel().eResource().getResourceSet());
		UMLEnvironment env = envFactory.createEnvironment();
		org.eclipse.ocl.uml.OCL myOCL = org.eclipse.ocl.uml.OCL.newInstance(env);
		EvaluationEnvironment<?, ?, ?, ?, ?> evalEnv = myOCL.getEvaluationEnvironment();
		EvaluationOptions.setOption(evalEnv, UMLEvaluationOptions.EVALUATION_MODE, EvaluationMode.RUNTIME_OBJECTS);
		OCLExpression<?> oclConstraint = null;
		myOCL.setEvaluationTracingEnabled(true);
		myOCL.setParseTracingEnabled(true);

		OCLHelper<?, ?, ?, ?> helper = myOCL.createOCLHelper();
		helper.setInstanceContext(executor.getInstanceSpecification());
		String body = calculateBody();
		try {
			oclConstraint = helper.createQuery(body); //here the error appears
		} catch (ParserException e) {
			executor.getChecker().addOtherProblem(Diagnostic.ERROR, "OCL parsing exception of '" + body + "': " + e.getMessage(), constraint.getOwner());
			return false;
		}
		@SuppressWarnings("unchecked")
		Object result = myOCL.evaluate(executor.getInstanceSpecification(), (OCLExpression<Classifier>) oclConstraint);
		


I know this type of errors can be caused by wrong initialization but I am doing initialization... so my ideas finished. I traced an error in the OCL parser code and it seem to be thrown in line
C resultType = getSetType(env, oclFactory, getTupleType(env,
			oclFactory, createTupleParts(env, stdlib.getT(), stdlib.getT2())));

in org.eclipse.ocl.util.OCLStandardLibraryUtil.createCollectionOperations funkction when I try to parse "Set { 1 , 2 , 5 , 88 }" body. I tried to see what are the differences in the returned values and I noticed that created tuples have the value of:
first : "<null>"
second : "<null>"
during the test and during the IDE run they have a value:
first : T
second : T2

The Error cause is NullPointer exception and stack trace is:
org.eclipse.ocl.ParserException
at org.eclipse.ocl.internal.helper.OCLHelperImpl.propagate(OCLHelperImpl.java:404)
at org.eclipse.ocl.internal.helper.OCLHelperImpl.createQuery(OCLHelperImpl.java:179)
at org.eclipse.ocl.uml.OCLHelperImpl.createQuery(OCLHelperImpl.java:91)
at org.eclipse.ocl.uml.OCLHelperImpl.createQuery(OCLHelperImpl.java:1)
at dk.dtu.imm.esculapauml.core.validators.OCLValidator.validateConstraint(OCLValidator.java:82)
at dk.dtu.imm.esculapauml.core.validators.OpaqueValidator.validateConstraint(OpaqueValidator.java:45)
at dk.dtu.imm.esculapauml.core.executors.guards.SimpleGuardEvaluator.isGuardSatisfied(SimpleGuardEvaluator.java:80)
at dk.dtu.imm.esculapauml.core.executors.guards.SimpleGuardEvaluator$1.apply(SimpleGuardEvaluator.java:42)
at dk.dtu.imm.esculapauml.core.executors.guards.SimpleGuardEvaluator$1.apply(SimpleGuardEvaluator.java:1)
at ch.lambdaj.function.matcher.Predicate$InnerMatcher.matchesSafely(Predicate.java:33)
at org.hamcrest.TypeSafeMatcher.matches(TypeSafeMatcher.java:54)
at ch.lambdaj.function.matcher.Predicate.matches(Predicate.java:24)
at ch.lambdaj.Lambda.select(Lambda.java:302)
at ch.lambdaj.Lambda.select(Lambda.java:315)
at ch.lambdaj.Lambda.filter(Lambda.java:278)
at dk.dtu.imm.esculapauml.core.executors.guards.GuardWithElseEvaluator.getTransitionsWithEnabledGuards(GuardWithElseEvaluator.java:70)
at dk.dtu.imm.esculapauml.core.executors.BehaviorExecutor.calculateEnabledTransitions(BehaviorExecutor.java:119)
at dk.dtu.imm.esculapauml.core.executors.BehaviorExecutor.prepare(BehaviorExecutor.java:104)
at dk.dtu.imm.esculapauml.core.checkers.BehaviorChecker.registerInstance(BehaviorChecker.java:61)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.prepareBehaviorCheckerForLifeline(LifelineChecker.java:125)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.checkBehaviorExistence(LifelineChecker.java:105)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.structuralExistenceCheck(LifelineChecker.java:87)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.check(LifelineChecker.java:60)
at dk.dtu.imm.esculapauml.core.checkers.CollectionChecker.check(CollectionChecker.java:73)
at dk.dtu.imm.esculapauml.core.checkers.AbstractInteractionChecker.checkLifelines(AbstractInteractionChecker.java:40)
at dk.dtu.imm.esculapauml.core.checkers.UseCaseChecker.check(UseCaseChecker.java:42)
at dk.dtu.imm.esculapauml.core.tests.uml.GuardWithWrongValueTypeTest.guardWithWrongValueType(GuardWithWrongValueTypeTest.java:41)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.eclipse.ocl.uml.internal.OCLFactoryImpl.createTupleType(OCLFactoryImpl.java:153)
at org.eclipse.ocl.util.OCLStandardLibraryUtil.getTupleType(OCLStandardLibraryUtil.java:2076)
at org.eclipse.ocl.util.OCLStandardLibraryUtil.createCollectionOperations(OCLStandardLibraryUtil.java:1594)
at org.eclipse.ocl.util.OCLStandardLibraryUtil.createSetOperations(OCLStandardLibraryUtil.java:1621)
at org.eclipse.ocl.uml.internal.OCLStandardLibraryImpl.createCollectionTypeOperations(OCLStandardLibraryImpl.java:505)
at org.eclipse.ocl.uml.TypeResolverImpl.resolveCollectionType(TypeResolverImpl.java:161)
at org.eclipse.ocl.uml.TypeResolverImpl.resolveCollectionType(TypeResolverImpl.java:1)
at org.eclipse.ocl.util.TypeUtil.resolveCollectionType(TypeUtil.java:703)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.getCollectionType(AbstractOCLAnalyzer.java:4560)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.getCollectionType(AbstractOCLAnalyzer.java:4532)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.collectionLiteralExpCS(AbstractOCLAnalyzer.java:3366)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.literalExpCS(AbstractOCLAnalyzer.java:3109)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.oclExpressionCS(AbstractOCLAnalyzer.java:1982)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invCS(AbstractOCLAnalyzer.java:1439)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invOrDefCS(AbstractOCLAnalyzer.java:1419)
at org.eclipse.ocl.parser.OCLAnalyzer.parseInvOrDefCS(OCLAnalyzer.java:266)
at org.eclipse.ocl.internal.helper.HelperUtil.parseQuery(HelperUtil.java:164)
at org.eclipse.ocl.internal.helper.OCLHelperImpl.createQuery(OCLHelperImpl.java:176)
... 48 more


Please any help with this is appreciated.

Cheers,
Piotr

[Updated on: Wed, 22 February 2012 13:53]

Report message to a moderator

Re: Null pointer exception problem with OCL parsing [message #804489 is a reply to message #804311] Wed, 22 February 2012 17:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Well it works for "true" but fails for "Set { 1 , 2 , 5 , 88 }". "true"
is pretty easy, whereas as Set requires the creation of a synthesized
type but your failure is in the creation of the OCL Standard Library,
which is really rather hard to understand. You don't give the stack
trace so it's difficult to be more than puzzled.

Standalone usage is troublesome so perhaps your repositoryPath is
incompatible with the standalone resolution capabilities.

Perhaps you have some strange Internet connection;
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364797 discusses a
potential access stupidity. You might check with Wireshark to eliminate
useless accesses.

I would check all NPEs and CCEs; EMF catches some and hides them in
Resource.errors where not everyone remembers to look for them.

Regards

Ed Willink



On 22/02/2012 13:10, Piotr J. Puczynski wrote:
> Hi.
> I am using org.eclipse.ocl_3.1.0.v20110913-1213 and
> org.eclipse.ocl.uml_3.1.0.v20110913-1213.
>
> I have a problem with OCL parsing during the JUnit tests. It seems to
> work when the IDE is lunched but it fails during the JUnit tests (as
> stand alone).
> I have two test cases ; one parses Boolean value "true" and other
> parses "Set { 1 , 2 , 5 , 88 }".
> The first does not trigger an error, second does. The context of the
> expressions is InstanceSpecification.
>
> I initialize ocl :
> System.setProperty("org.eclipse.ocl.uml", repositoryPath + "libs/ocl");
> System.setProperty("org.eclipse.uml2.uml.resources",
> repositoryPath + "libs/uml");
> String result = org.eclipse.ocl.uml.OCL.initialize(null);
> // null for global init
> assert result == null;
>
> The initialized system properties directories contain extracted
> plugins and the returned string is always null. I use null as a
> parameter but I also tried with resourceSet and usage of resurceSet in
> fact does not help.
> My code of evaluation is:
>
> UMLEnvironmentFactory envFactory = new
> UMLEnvironmentFactory(constraint.getModel().eResource().getResourceSet());
> UMLEnvironment env = envFactory.createEnvironment();
> org.eclipse.ocl.uml.OCL myOCL =
> org.eclipse.ocl.uml.OCL.newInstance(env);
> EvaluationEnvironment<?, ?, ?, ?, ?> evalEnv =
> myOCL.getEvaluationEnvironment();
> EvaluationOptions.setOption(evalEnv,
> UMLEvaluationOptions.EVALUATION_MODE, EvaluationMode.RUNTIME_OBJECTS);
> OCLExpression<?> oclConstraint = null;
> myOCL.setEvaluationTracingEnabled(true);
> myOCL.setParseTracingEnabled(true);
>
> OCLHelper<?, ?, ?, ?> helper = myOCL.createOCLHelper();
> helper.setInstanceContext(executor.getInstanceSpecification());
> String body = calculateBody();
> try {
> oclConstraint = helper.createQuery(body); //here the error
> appears
> } catch (ParserException e) {
> executor.getChecker().addOtherProblem(Diagnostic.ERROR,
> "OCL parsing exception of '" + body + "': " + e.getMessage(),
> constraint.getOwner());
> return false;
> }
> @SuppressWarnings("unchecked")
> Object result =
> myOCL.evaluate(executor.getInstanceSpecification(),
> (OCLExpression<Classifier>) oclConstraint);
>
>
> I know this type of errors can be caused by wrong initialization but I
> am doing initialization... so my ideas finished. I traced an error in
> the OCL parser code and it seem to be thrown in line
> C resultType = getSetType(env, oclFactory, getTupleType(env,
> oclFactory, createTupleParts(env, stdlib.getT(),
> stdlib.getT2())));
> in
> org.eclipse.ocl.util.OCLStandardLibraryUtil.createCollectionOperations
> funkction when I try to parse "Set { 1 , 2 , 5 , 88 }" body. I tried
> to see what are the differences in the returned values and I noticed
> that created tuples have the value of:
> first : "<null>"
> second : "<null>"
> during the test and during the IDE run they have a value:
> first : T
> second : T2
>
> Please any help with this is appreciated.
>
> Cheers,
> Piotr
Re: Null pointer exception problem with OCL parsing [message #804490 is a reply to message #804489] Wed, 22 February 2012 17:34 Go to previous messageGo to next message
Piotr J. Puczynski is currently offline Piotr J. PuczynskiFriend
Messages: 17
Registered: January 2012
Junior Member
I gave a stack trace in post edit after a few minutes. If you're reading by mail I post it again:


The Error cause is NullPointer exception and stack trace is:
org.eclipse.ocl.ParserException
at org.eclipse.ocl.internal.helper.OCLHelperImpl.propagate(OCLHelperImpl.java:404)
at org.eclipse.ocl.internal.helper.OCLHelperImpl.createQuery(OCLHelperImpl.java:179)
at org.eclipse.ocl.uml.OCLHelperImpl.createQuery(OCLHelperImpl.java:91)
at org.eclipse.ocl.uml.OCLHelperImpl.createQuery(OCLHelperImpl.java:1)
at dk.dtu.imm.esculapauml.core.validators.OCLValidator.validateConstraint(OCLValidator.java:82)
at dk.dtu.imm.esculapauml.core.validators.OpaqueValidator.validateConstraint(OpaqueValidator.java:45)
at dk.dtu.imm.esculapauml.core.executors.guards.SimpleGuardEvaluator.isGuardSatisfied(SimpleGuardEvaluator.java:80)
at dk.dtu.imm.esculapauml.core.executors.guards.SimpleGuardEvaluator$1.apply(SimpleGuardEvaluator.java:42)
at dk.dtu.imm.esculapauml.core.executors.guards.SimpleGuardEvaluator$1.apply(SimpleGuardEvaluator.java:1)
at ch.lambdaj.function.matcher.Predicate$InnerMatcher.matchesSafely(Predicate.java:33)
at org.hamcrest.TypeSafeMatcher.matches(TypeSafeMatcher.java:54)
at ch.lambdaj.function.matcher.Predicate.matches(Predicate.java:24)
at ch.lambdaj.Lambda.select(Lambda.java:302)
at ch.lambdaj.Lambda.select(Lambda.java:315)
at ch.lambdaj.Lambda.filter(Lambda.java:278)
at dk.dtu.imm.esculapauml.core.executors.guards.GuardWithElseEvaluator.getTransitionsWithEnabledGuards(GuardWithElseEvaluator.java:70)
at dk.dtu.imm.esculapauml.core.executors.BehaviorExecutor.calculateEnabledTransitions(BehaviorExecutor.java:119)
at dk.dtu.imm.esculapauml.core.executors.BehaviorExecutor.prepare(BehaviorExecutor.java:104)
at dk.dtu.imm.esculapauml.core.checkers.BehaviorChecker.registerInstance(BehaviorChecker.java:61)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.prepareBehaviorCheckerForLifeline(LifelineChecker.java:125)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.checkBehaviorExistence(LifelineChecker.java:105)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.structuralExistenceCheck(LifelineChecker.java:87)
at dk.dtu.imm.esculapauml.core.checkers.LifelineChecker.check(LifelineChecker.java:60)
at dk.dtu.imm.esculapauml.core.checkers.CollectionChecker.check(CollectionChecker.java:73)
at dk.dtu.imm.esculapauml.core.checkers.AbstractInteractionChecker.checkLifelines(AbstractInteractionChecker.java:40)
at dk.dtu.imm.esculapauml.core.checkers.UseCaseChecker.check(UseCaseChecker.java:42)
at dk.dtu.imm.esculapauml.core.tests.uml.GuardWithWrongValueTypeTest.guardWithWrongValueType(GuardWithWrongValueTypeTest.java:41)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.eclipse.ocl.uml.internal.OCLFactoryImpl.createTupleType(OCLFactoryImpl.java:153)
at org.eclipse.ocl.util.OCLStandardLibraryUtil.getTupleType(OCLStandardLibraryUtil.java:2076)
at org.eclipse.ocl.util.OCLStandardLibraryUtil.createCollectionOperations(OCLStandardLibraryUtil.java:1594)
at org.eclipse.ocl.util.OCLStandardLibraryUtil.createSetOperations(OCLStandardLibraryUtil.java:1621)
at org.eclipse.ocl.uml.internal.OCLStandardLibraryImpl.createCollectionTypeOperations(OCLStandardLibraryImpl.java:505)
at org.eclipse.ocl.uml.TypeResolverImpl.resolveCollectionType(TypeResolverImpl.java:161)
at org.eclipse.ocl.uml.TypeResolverImpl.resolveCollectionType(TypeResolverImpl.java:1)
at org.eclipse.ocl.util.TypeUtil.resolveCollectionType(TypeUtil.java:703)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.getCollectionType(AbstractOCLAnalyzer.java:4560)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.getCollectionType(AbstractOCLAnalyzer.java:4532)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.collectionLiteralExpCS(AbstractOCLAnalyzer.java:3366)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.literalExpCS(AbstractOCLAnalyzer.java:3109)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.oclExpressionCS(AbstractOCLAnalyzer.java:1982)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invCS(AbstractOCLAnalyzer.java:1439)
at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invOrDefCS(AbstractOCLAnalyzer.java:1419)
at org.eclipse.ocl.parser.OCLAnalyzer.parseInvOrDefCS(OCLAnalyzer.java:266)
at org.eclipse.ocl.internal.helper.HelperUtil.parseQuery(HelperUtil.java:164)
at org.eclipse.ocl.internal.helper.OCLHelperImpl.createQuery(OCLHelperImpl.java:176)
... 48 more


Piotr
Re: Null pointer exception problem with OCL parsing [message #804512 is a reply to message #804490] Wed, 22 February 2012 18:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi
>
> The Error cause is NullPointer exception and stack trace is:
> org.eclipse.ocl.ParserException
No, you have to look further...
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.ocl.uml.internal.OCLFactoryImpl.createTupleType(OCLFactoryImpl.java:153)
This is clearly because no EnvironmentFactory was registered to create
an environment.

The standalone JUnit tests do

Environment.Registry.INSTANCE.registerEnvironment(
new UMLEnvironmentFactory().createEnvironment());

I'm afraid this is a secret; it could be added to OCL.initialize().

https://bugs.eclipse.org/bugs/show_bug.cgi?id=372258 raised.

Thanks for the report.

Regards

Ed Willink
Re: Null pointer exception problem with OCL parsing [message #804523 is a reply to message #804490] Wed, 22 February 2012 18:27 Go to previous messageGo to next message
Piotr J. Puczynski is currently offline Piotr J. PuczynskiFriend
Messages: 17
Registered: January 2012
Junior Member
Hi, my repositoryPath is just a local directory in this case. No problem with that. I am also importing some UML types in other test cases and they all pass (if I couldn't access they will fail dramatically).

No NPE or CCE or any other in any of the UMLResourceImpl in the VM (before or after parsing).

I should also mentioned that I am using Topcased IDE when it works Wink

I tried to add to initialization (according to bug walk-around) mapping by URIConverter.URI_MAP oclstdlib.ecore and oclstdlib.uml; with no results whatsoever.

I fear I may not have all necessary files in included directories. Let's list them:
libs\ocl
libs\uml
libs\ocl\model
libs\ocl\model\OCL.ecore
libs\ocl\model\OCL.genmodel
libs\ocl\model\OCL.properties
libs\ocl\model\OCL.uml
libs\ocl\model\OCLCST.ecore
libs\ocl\model\OCLCST.genmodel
libs\ocl\model\OCLCST.properties
libs\ocl\model\OCLCST.uml
libs\ocl\model\OCLEcore.ecore
libs\ocl\model\OCLEcore.genmodel
libs\ocl\model\oclstdlib.ecore
libs\ocl\model\oclstdlib.uml
libs\ocl\model\OCLUML.ecore
libs\ocl\model\OCLUML.genmodel
libs\ocl\model\OCLUML.properties
libs\ocl\model\OCLUML.uml
libs\uml\libraries
libs\uml\metamodels
libs\uml\profiles
libs\uml\libraries\EcorePrimitiveTypes.library.properties
libs\uml\libraries\EcorePrimitiveTypes.library.uml
libs\uml\libraries\JavaPrimitiveTypes.library.properties
libs\uml\libraries\JavaPrimitiveTypes.library.uml
libs\uml\libraries\UMLPrimitiveTypes.library.properties
libs\uml\libraries\UMLPrimitiveTypes.library.uml
libs\uml\libraries\XMLPrimitiveTypes.library.properties
libs\uml\libraries\XMLPrimitiveTypes.library.uml
libs\uml\metamodels\Ecore.metamodel.properties
libs\uml\metamodels\Ecore.metamodel.uml
libs\uml\metamodels\UML.metamodel.properties
libs\uml\metamodels\UML.metamodel.uml
libs\uml\profiles\Ecore.profile.properties
libs\uml\profiles\Ecore.profile.uml
libs\uml\profiles\Standard.profile.properties
libs\uml\profiles\Standard.profile.uml
libs\uml\profiles\UML2.profile.properties
libs\uml\profiles\UML2.profile.uml

Am I missing something?
I hope we do not have /strange/ Internet connection at CS department otherwise we gonna explode soon.


Cheers,
Piotr
Re: Null pointer exception problem with OCL parsing [message #804526 is a reply to message #804523] Wed, 22 February 2012 18:31 Go to previous message
Piotr J. Puczynski is currently offline Piotr J. PuczynskiFriend
Messages: 17
Registered: January 2012
Junior Member
Thanks Ed, it is working now in JUnit tests.

Cheers,
Piotr
Previous Topic:Compile Ecore
Next Topic:[Announce] Eclipse OCL 3.1.2 and OCL 3.1.2a (Indigo SR2) is now available
Goto Forum:
  


Current Time: Fri Mar 29 05:36:43 GMT 2024

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

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

Back to the top