X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FStandardGraphResourcePropertyVariable.java;fp=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FStandardGraphResourcePropertyVariable.java;h=6fa5127db65112153c8858617874d6506d82d570;hb=321607bdbd3ca800128d40b5511092f71cb66367;hp=0159e7ac69e099be424e282519930ec88aa920c9;hpb=e18cdb01663e3ebdae25e66bf158348bbf823a07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphResourcePropertyVariable.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphResourcePropertyVariable.java index 0159e7ac6..6fa5127db 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphResourcePropertyVariable.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphResourcePropertyVariable.java @@ -7,10 +7,13 @@ import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.NoSingleResultException; import org.simantics.db.layer0.exception.MissingVariableValueException; -import org.simantics.db.layer0.exception.VariableException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class StandardGraphResourcePropertyVariable extends StandardGraphPropertyVariable { - + + private static final Logger LOGGER = LoggerFactory.getLogger(StandardGraphResourcePropertyVariable.class); + public StandardGraphResourcePropertyVariable(ReadGraph graph, Variable parent, Resource parentResource, Resource property) throws DatabaseException { super(graph, parent, null, parentResource, property); } @@ -18,24 +21,24 @@ public class StandardGraphResourcePropertyVariable extends StandardGraphProperty @Override public T getValue(ReadGraph graph) throws DatabaseException { if (parentResource == null) - throw new VariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ")."); + throw new MissingVariableValueException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ")."); try { return (T)graph.getSingleObject(parentResource, property.predicate); } catch (NoSingleResultException e) { - System.err.println("No object for " + parentResource + " " + property); - throw new MissingVariableValueException(getPossibleURI(graph)); + LOGGER.error("No object for " + parentResource + " " + property); + throw new MissingVariableValueException(getPossibleURI(graph), e); } } @Override public T getValue(ReadGraph graph, Binding binding) throws DatabaseException { if (parentResource == null) - throw new VariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ")."); + throw new MissingVariableValueException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ")."); try { return (T)graph.getSingleObject(parentResource, property.predicate); } catch (NoSingleResultException e) { - System.err.println("No object for " + parentResource + " " + property); - throw new MissingVariableValueException(getPossibleURI(graph)); + LOGGER.error("No object for " + parentResource + " " + property); + throw new MissingVariableValueException(getPossibleURI(graph), e); } }