From 868b312e2dd4ab6eac787137a0caeb568f6a7c77 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Thu, 28 May 2020 10:30:11 +0300 Subject: [PATCH] Workaround for query cache returning Exceptions instead of throwing them gitlab #540 Change-Id: Ia43c3827b4ed16f02f038f4782894852b5c266d9 (cherry picked from commit 549142b0107e4a73d557fc4fc777e6ab77469625) --- .../src/org/simantics/db/impl/graph/ReadGraphImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java index 27336b23d..cc15c1eac 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java @@ -1349,7 +1349,10 @@ public class ReadGraphImpl implements AsyncReadGraph { Statement stm = getSingleStatement(resource, relation); - return adaptContextual(stm.getObject(), new RelationContextImpl(resource, stm), RelationContext.class, clazz); + Object o = adaptContextual(stm.getObject(), new RelationContextImpl(resource, stm), RelationContext.class, clazz); + if (clazz.isInstance(o)) + return (T)o; + throw new AdaptionException("Returned value is not expected class , got " + o.getClass().getName()+ " , expected " + clazz.getName()); } -- 2.47.1