X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FStandardGraphPropertyVariable.java;h=d0ab88907ee10183445e70ca875a8cb71beb3a85;hb=c2829bf1ae3cc54a813d02a5803ead2c15187055;hp=9d7fded696ce2e7c06f572e46c164406907a1e6f;hpb=564cbf99b9cc2cd4ce3a645c206c9742d8123035;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphPropertyVariable.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphPropertyVariable.java index 9d7fded69..d0ab88907 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphPropertyVariable.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphPropertyVariable.java @@ -15,7 +15,6 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; -import org.simantics.db.common.utils.Logger; import org.simantics.db.common.validation.L0Validations; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ValidationException; @@ -25,13 +24,17 @@ import org.simantics.db.layer0.exception.VariableException; import org.simantics.db.layer0.function.All; import org.simantics.db.layer0.request.PropertyInfo; import org.simantics.db.layer0.request.PropertyInfoRequest; +import org.simantics.db.layer0.scl.SCLDatabaseException; import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.layer0.Layer0; import org.simantics.utils.Development; import org.simantics.utils.datastructures.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class StandardGraphPropertyVariable extends AbstractPropertyVariable { - + private static final Logger LOGGER = LoggerFactory.getLogger(StandardGraphPropertyVariable.class); + protected static final PropertyInfo NO_PROPERTY = new PropertyInfo(null, null, false, Collections. emptySet(), null, null, null, null, null, null, Collections.> emptyMap(), @@ -119,7 +122,7 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { if(Development.DEVELOPMENT) { String error = L0Validations.checkValueType(graph, parentResource, property.predicate); if(error != null) { - Logger.defaultLogError(new ValidationException(error)); + LOGGER.error(error); //throw new ValidationException(error); } } @@ -138,16 +141,18 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { if(Development.DEVELOPMENT) { String error = L0Validations.checkValueType(graph, parentResource, property.predicate); if(error != null) { - Logger.defaultLogError(new ValidationException(error)); + LOGGER.error(error); throw new ValidationException(error); } } try { - return (T)getValueAccessor(graph).getValue(graph, this, binding); - } catch (PendingVariableException e) { - throw e; + return (T) getValueAccessor(graph).getValue(graph, this, binding); + } catch (SCLDatabaseException e) { // these can be thrown when compiling e.g. derived properties + throw e; + } catch (MissingVariableValueException | PendingVariableException e) { + throw e; } catch (Throwable t) { throw new MissingVariableValueException(t); } @@ -175,7 +180,7 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { if(Development.DEVELOPMENT) { String error = L0Validations.checkValueType(graph, parentResource, property.predicate); if(error != null) { - Logger.defaultLogError(new ValidationException(error)); + LOGGER.error(error); //throw new ValidationException(error); } } @@ -190,7 +195,7 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { if(Development.DEVELOPMENT) { String error = L0Validations.checkValueType(graph, parentResource, property.predicate); if(error != null) { - Logger.defaultLogError(new ValidationException(error)); + LOGGER.error(error); throw new ValidationException(error); } } @@ -304,8 +309,8 @@ public class StandardGraphPropertyVariable extends AbstractPropertyVariable { return valueMap.getVariable(graph, this, name); } catch (DatabaseException e) { return null; - } catch (Throwable t) { - System.err.println("err: " + getURI(graph) + " # " + name); + } catch (Exception t) { + LOGGER.error("getPossibleDomainProperty is implemented incorrectly, but returns null on Exception for backward compatibility. URI="+getURI(graph)+", name="+name+".", t); return null; }