NPE in diagram profile TypeGroup implementation
This happend with current platform master and Apros while doing a diagram import that overwrites a diagram that is currently open in a diagram editor.
!ENTRY org.simantics.utils.ui 4 0 2019-08-13 14:21:46.024
!MESSAGE DiagramContentRequest failed
!STACK 0
org.simantics.db.common.utils.InvalidOrderedSetException: Invalid list element: [id=$3707191] [id=$3707191] 0 successors.
at org.simantics.db.common.utils.OrderedSetUtils.next(OrderedSetUtils.java:53)
at org.simantics.db.common.utils.OrderedSetUtils.toList(OrderedSetUtils.java:230)
at org.simantics.diagram.adapter.DiagramContentRequest.perform(DiagramContentRequest.java:70)
at org.simantics.diagram.adapter.DiagramContentRequest.perform(DiagramContentRequest.java:1)
at org.simantics.db.impl.query.ReadEntry$1.recompute(ReadEntry.java:60)
at org.simantics.db.impl.query.QueryProcessor.compareTo(QueryProcessor.java:1636)
at org.simantics.db.impl.query.QueryProcessor.performScheduledUpdates(QueryProcessor.java:1726)
at fi.vtt.simantics.procore.internal.State.commitWriteTransaction(State.java:342)
at fi.vtt.simantics.procore.internal.SessionRequestManager$4.run0(SessionRequestManager.java:236)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:306)
at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:254)
org.simantics.db.common.utils.InvalidOrderedSetException: Invalid list element: [id=$3707191] [id=$3707191] 0 successors.
at org.simantics.db.common.utils.OrderedSetUtils.next(OrderedSetUtils.java:53)
at org.simantics.db.common.utils.OrderedSetUtils.toList(OrderedSetUtils.java:230)
at org.simantics.diagram.adapter.DiagramContentRequest.perform(DiagramContentRequest.java:70)
at org.simantics.diagram.adapter.DiagramContentRequest.perform(DiagramContentRequest.java:1)
at org.simantics.db.impl.query.ReadEntry$1.recompute(ReadEntry.java:60)
at org.simantics.db.impl.query.QueryProcessor.compareTo(QueryProcessor.java:1636)
at org.simantics.db.impl.query.QueryProcessor.performScheduledUpdates(QueryProcessor.java:1726)
at fi.vtt.simantics.procore.internal.State.commitWriteTransaction(State.java:342)
at fi.vtt.simantics.procore.internal.SessionRequestManager$4.run0(SessionRequestManager.java:236)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:306)
at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:254)
org.simantics.db.exception.DatabaseException: Unexpected exception in ReadGraph.syncRequest(AsyncMultiRead)
at org.simantics.db.impl.graph.ReadGraphImpl$AsyncMultiReadProcedure.checkAndThrow(ReadGraphImpl.java:2184)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:2206)
at org.simantics.diagram.adapter.TypeGroup$1.perform(TypeGroup.java:111)
at org.simantics.diagram.adapter.TypeGroup$1.perform(TypeGroup.java:1)
at org.simantics.db.impl.query.ReadEntry$1.recompute(ReadEntry.java:60)
at org.simantics.db.impl.query.QueryProcessor.compareTo(QueryProcessor.java:1636)
at org.simantics.db.impl.query.QueryProcessor.performScheduledUpdates(QueryProcessor.java:1726)
at fi.vtt.simantics.procore.internal.State.commitWriteTransaction(State.java:342)
at fi.vtt.simantics.procore.internal.SessionRequestManager$4.run0(SessionRequestManager.java:236)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:306)
at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:254)
Caused by: java.lang.NullPointerException
at fi.vtt.simantics.procore.internal.QuerySupportImpl.ensureLoaded(QuerySupportImpl.java:1429)
at org.simantics.db.impl.query.OrderedSet.nextElement(OrderedSet.java:35)
at org.simantics.db.impl.query.OrderedSet.computeForEach(OrderedSet.java:80)
at org.simantics.db.impl.query.QueryCache.runnerOrderedSet(QueryCache.java:423)
at org.simantics.db.impl.query.QueryProcessor.forOrderedSet(QueryProcessor.java:4199)
at org.simantics.db.impl.graph.ReadGraphImpl.forOrderedSet(ReadGraphImpl.java:4953)
at org.simantics.db.common.primitiverequest.OrderedSet.perform(OrderedSet.java:27)
at org.simantics.db.impl.query.QueryCacheBase.performQuery(QueryCacheBase.java:201)
at org.simantics.db.impl.query.AsyncMultiReadEntry.compute(AsyncMultiReadEntry.java:190)
at org.simantics.db.impl.query.QueryCache.runnerAsyncMultiReadEntry(QueryCache.java:1270)
at org.simantics.db.impl.query.QueryProcessor.runAsyncMultiRead(QueryProcessor.java:670)
at org.simantics.db.impl.query.QueryProcessor.query(QueryProcessor.java:4357)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:2243)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:2204)
... 9 more```
Any ideas Antti? Is the ordered set resource input to TypeGroup an invalid ordered set and this is just how it manifests? Diagram import does delete an existing diagram and import another in place of the old one, which might cause refreshing cached queries to fail..