Workaround for query cache returning Exceptions instead of throwing them 48/4248/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 28 May 2020 07:30:11 +0000 (10:30 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 28 May 2020 19:22:32 +0000 (19:22 +0000)
gitlab #540

Change-Id: Ia43c3827b4ed16f02f038f4782894852b5c266d9
(cherry picked from commit 549142b0107e4a73d557fc4fc777e6ab77469625)

bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java

index 27336b23d32474eda7bf7b00ab368a9cb5b56e02..cc15c1eac9111e063369cadd9c7167b3c843b4a9 100644 (file)
@@ -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());
                
        }