Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339948

Summary: Setting CDOCollectionLoadingPolicy can cause OCL queries to fail
Product: [Modeling] EMF Reporter: Cameron Bateman <cbateman>
Component: cdo.coreAssignee: Project Inbox <emf.cdo-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: laurent.lemoux, lothar, lu.xingxiao
Version: 4.13   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Cameron Bateman CLA 2011-03-14 17:34:40 EDT
Build Identifier: 

We tried following the advice at http://wiki.eclipse.org/CDO/Tweaking_Performance#Loading_Partial_Collections_.E2.80.93_CDOCollectionLoadingPolicy with this code on our client:

CDOCollectionLoadingPolicy policy =
      CDOUtil.createCollectionLoadingPolicy(0, 500);
    session.options().setCollectionLoadingPolicy(policy);

However, this resulted in the following failure when we attempted to execute our custom OCL queries.  It appears that during the list copy, it tries to cast each item to EObject.  However, there are some elements in the list that are of type CDORevisionUtil$Uninitialized.  I confirmed this fact using the debugger.  Note that this occurs only if the policy code is called on the very first query, but then will break all subsequent query on the server.  It appears that there is a lot one-time lazy init the first time a query is executed and then much subsequently.

!ENTRY org.eclipse.ocl 4 10 2011-03-14 15:12:39.247
!MESSAGE Evaluation failed with an exception: org.eclipse.emf.cdo.common.revision.CDORevisionUtil$Uninitialized cannot be cast to org.eclipse.emf.ecore.EObject
!STACK 0
java.lang.ClassCastException: org.eclipse.emf.cdo.common.revision.CDORevisionUtil$Uninitialized cannot be cast to org.eclipse.emf.ecore.EObject
	at org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(DelegatingEcoreEList.java:279)
	at org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEList.java:236)
	at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(AbstractEList.java:709)
	at org.eclipse.emf.common.util.AbstractEList$EIterator.next(AbstractEList.java:696)
	at java.util.AbstractCollection.addAll(Unknown Source)
	at java.util.LinkedHashSet.<init>(Unknown Source)
	at org.eclipse.ocl.util.CollectionUtil.createNewCollection(CollectionUtil.java:1108)
	at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.coerceValue(EcoreEvaluationEnvironment.java:304)
	at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:246)
	at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:1)
	at org.eclipse.ocl.EvaluationVisitorImpl.visitPropertyCallExp(EvaluationVisitorImpl.java:1925)
	at org.eclipse.ocl.ecore.impl.PropertyCallExpImpl.accept(PropertyCallExpImpl.java:238)
	at org.eclipse.ocl.EvaluationVisitorImpl.visitIteratorExp(EvaluationVisitorImpl.java:1423)
	at org.eclipse.ocl.ecore.impl.IteratorExpImpl.accept(IteratorExpImpl.java:114)
	at org.eclipse.ocl.AbstractEvaluationVisitor.visitExpression(AbstractEvaluationVisitor.java:247)
	at org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:129)
	at biz.tradescape.mmt.cdo.query.OCLQueryHandler.evaluate(Unknown Source)
	at biz.tradescape.mmt.cdo.query.OCLQueryHandler.executeQuery(Unknown Source)
	at org.eclipse.emf.cdo.internal.server.QueryManager$QueryContext.run(QueryManager.java:284)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Reproducible: Always
Comment 1 Eike Stepper CLA 2011-06-23 04:27:49 EDT
Moving all open problem reports to 4.0
Comment 2 Eike Stepper CLA 2012-06-05 07:30:55 EDT
Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems.

Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!!
Comment 3 Eike Stepper CLA 2012-08-14 22:54:03 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 4 Eike Stepper CLA 2013-06-29 12:19:33 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 5 Eike Stepper CLA 2015-07-14 02:16:06 EDT
Moving all open bugzillas to 4.5.
Comment 6 Eike Stepper CLA 2016-07-31 00:59:03 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 7 Eike Stepper CLA 2017-12-28 01:16:22 EST
Moving all open bugs to 4.7
Comment 8 Eike Stepper CLA 2019-11-08 02:11:40 EST
Moving all unresolved issues to version 4.8-
Comment 9 Eike Stepper CLA 2019-12-13 12:54:14 EST
Moving all unresolved issues to version 4.9
Comment 10 Eike Stepper CLA 2020-12-11 10:45:32 EST
Moving to 4.13.