]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphResourcePropertyVariable.java
Merge "Fixed ProfileObserver.update race with multiple query threads"
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / StandardGraphResourcePropertyVariable.java
index 0159e7ac69e099be424e282519930ec88aa920c9..6fa5127db65112153c8858617874d6506d82d570 100644 (file)
@@ -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> 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> 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);
                } 
        }