From bc5e6cb19f6af5f67bc5cfaad7d602841b8fdd0b Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Wed, 7 Mar 2018 10:06:29 +0200 Subject: [PATCH] Ignore NoSingleResultException in DependenciesRelation Some fixes for NoSingleResultException usage and introducing resultCount field for more detailed exception messages refs #7803 Change-Id: Id633dcfee66c44556de3943c5ec4454e9473f6f3 --- .../wrapper/DeepSingleOrErrorProcedure.java | 4 +- .../NullSingleOrExceptionProcedure.java | 2 +- .../wrapper/SingleOrErrorProcedure.java | 4 +- .../common/request/SingleObjectWithType.java | 24 +-- .../db/impl/graph/ReadGraphImpl.java | 154 +++++------------- .../db/impl/graph/SingleObjectProcedure.java | 4 +- .../genericrelation/DependenciesRelation.java | 9 +- .../db/layer0/request/SingleActiveModel.java | 4 +- .../variable/ConstantChildVariable.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../internal/DirectQuerySupportImpl.java | 11 +- .../db/exception/NoSingleResultException.java | 35 ++-- .../exception/ResourceNotFoundException.java | 10 +- .../simantics/db/service/DebugSupport.java | 3 +- .../StandardProceduralChildVariable.java | 2 +- 15 files changed, 100 insertions(+), 171 deletions(-) diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/DeepSingleOrErrorProcedure.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/DeepSingleOrErrorProcedure.java index b1de8c25d..739c03d1e 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/DeepSingleOrErrorProcedure.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/DeepSingleOrErrorProcedure.java @@ -46,7 +46,7 @@ final public class DeepSingleOrErrorProcedure { if(done.compareAndSet(false, true)) { try { if(found.compareAndSet(false, true)) { - procedure.exception(graph, new NoSingleResultException("No results.")); + procedure.exception(graph, new NoSingleResultException("No results.", -1)); } else { procedure.execute(graph, result); } @@ -66,7 +66,7 @@ final public class DeepSingleOrErrorProcedure { // Shall fire exactly once! if(done.compareAndSet(false, true)) { try { - procedure.exception(graph, new NoSingleResultException(this.result + " and " + result)); + procedure.exception(graph, new NoSingleResultException(this.result + " and " + result, -1)); } catch (Throwable t) { Logger.defaultLogError(t); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/NullSingleOrExceptionProcedure.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/NullSingleOrExceptionProcedure.java index 183859340..d8cfe3607 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/NullSingleOrExceptionProcedure.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/NullSingleOrExceptionProcedure.java @@ -62,7 +62,7 @@ final public class NullSingleOrExceptionProcedure { // Shall fire exactly once! if(done.compareAndSet(false, true)) { try { - procedure.exception(graph, new NoSingleResultException(procedure.toString())); + procedure.exception(graph, new NoSingleResultException(procedure.toString(), -1)); } catch (Throwable t) { Logger.defaultLogError(t); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/SingleOrErrorProcedure.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/SingleOrErrorProcedure.java index da542b4b3..826ca5987 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/SingleOrErrorProcedure.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/wrapper/SingleOrErrorProcedure.java @@ -37,7 +37,7 @@ final public class SingleOrErrorProcedure extends AsyncMultiProcedureAda if(done.compareAndSet(false, true)) { try { if(result == null) { - procedure.exception(graph, new NoSingleResultException("No items " + procedure)); + procedure.exception(graph, new NoSingleResultException("No items " + procedure, 0)); } else { procedure.execute(graph, result); } @@ -56,7 +56,7 @@ final public class SingleOrErrorProcedure extends AsyncMultiProcedureAda // Shall fire exactly once! if(done.compareAndSet(false, true)) { try { - procedure.exception(graph, new NoSingleResultException("Multiple items " + this.result + " and " + result)); + procedure.exception(graph, new NoSingleResultException("Multiple items " + this.result + " and " + result, -1)); } catch (Throwable t) { Logger.defaultLogError(t); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/SingleObjectWithType.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/SingleObjectWithType.java index ae72985c4..a98603488 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/SingleObjectWithType.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/SingleObjectWithType.java @@ -29,23 +29,25 @@ public final class SingleObjectWithType extends ResourceRead3 { @Override public Resource perform(ReadGraph graph) throws DatabaseException { Resource result = null; + int resultCount = 0; for (Resource object : graph.getObjects(resource, resource2)) { if (graph.isInstanceOf(object, resource3)) { - if (result != null) - throw new NoSingleResultException("More than 1 objects for relation " - + NameUtils.getSafeName(graph, resource2) + " with type " - + NameUtils.getSafeName(graph, resource3) + " at " - + NameUtils.getSafeName(graph, resource)); - - result = object; + if (result == null) { + result = object; + } else { + // okay, too many results but lets calculate for debug + resultCount++; + } } } - - if (result == null) - throw new NoSingleResultException("No objects for relation " + + if (resultCount != 1) { + String reason = resultCount == 0 ? "No objects for relation " : "Multiple objects for relation "; + throw new NoSingleResultException(reason + NameUtils.getSafeName(graph, resource2) + " with type " + NameUtils.getSafeName(graph, resource3) + " at " - + NameUtils.getSafeName(graph, resource)); + + NameUtils.getSafeName(graph, resource), resultCount); + } return result; } 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 ff127a09b..614a96df3 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 @@ -283,7 +283,7 @@ public class ReadGraphImpl implements ReadGraph { } catch (ResourceNotFoundException e) { - throw new ResourceNotFoundException(e); + throw new ResourceNotFoundException(id, e); } catch (ValidationException e) { @@ -347,7 +347,7 @@ public class ReadGraphImpl implements ReadGraph { } catch (ResourceNotFoundException e) { - throw new ResourceNotFoundException(e); + throw new ResourceNotFoundException(id, e); } catch (ServiceException e) { @@ -900,83 +900,57 @@ public class ReadGraphImpl implements ReadGraph { if( relation == null) throw new IllegalArgumentException("relation can not be null"); try { - int single = processor.getSingleObject(this, subject, relation); - if(single == 0) throw new NoSingleResultException("subject=" + subject + " relation="+relation); + if (single == 0) { + if (EMPTY_RESOURCE_CHECK) { + if (!hasStatement(subject)) { + throw new EmptyResourceException("Resource " + debugString(subject)); + } + } + throw new NoSingleResultException("No single object for subject " + debugString(subject) + + " and relation " + debugString(relation), single); + } return processor.querySupport.getResource(single); - } catch (NoSingleResultException e) { - - if(EMPTY_RESOURCE_CHECK) { - if(!hasStatement(subject)) throw new EmptyResourceException("Resource " + debugString(subject)); - } - - throw new NoSingleResultException("No single object for subject " - + debugString(subject) + " and relation " - + debugString(relation), e); - + throw e; } catch (DatabaseException e) { - throw new ServiceException(e); - } - } @Override - final public Statement getSingleStatement(final Resource subject, - final Resource relation) throws NoSingleResultException, - ManyObjectsForFunctionalRelationException, ServiceException { - + final public Statement getSingleStatement(final Resource subject, final Resource relation) throws NoSingleResultException, ManyObjectsForFunctionalRelationException, ServiceException { assert (subject != null); assert (relation != null); - try { - Collection statements = getStatements(subject, relation); - if(statements.size() == 1) return statements.iterator().next(); - else throw new NoSingleResultException(""); - - } catch (NoSingleResultException e) { - - if(EMPTY_RESOURCE_CHECK) { - if(!hasStatement(subject)) throw new EmptyResourceException("Resource " + debugString(subject)); - } - - throw new NoSingleResultException("No single statement for subject " - + debugString(subject) + " and relation " - + debugString(relation), e); - - } catch (DatabaseException e) { - - throw new ServiceException(e); - - } - + if (statements.size() == 1) { + return statements.iterator().next(); + } else { + if (EMPTY_RESOURCE_CHECK) + if (!hasStatement(subject)) + throw new EmptyResourceException("Resource " + debugString(subject)); + throw new NoSingleResultException("No single statement for subject " + debugString(subject) + + " and relation " + debugString(relation), statements.size()); + } + } catch (ServiceException e) { + throw new ServiceException(e); + } } @Override - final public Resource getSingleType(final Resource subject) throws NoSingleResultException, - ServiceException { - + final public Resource getSingleType(final Resource subject) throws NoSingleResultException, ServiceException { assert (subject != null); - try { - ArrayList principalTypes = (ArrayList)getPrincipalTypes(subject); - if(principalTypes.size() == 1) return principalTypes.get(0); - else throw new NoSingleResultException(""); - - } catch (NoSingleResultException e) { - - throw new NoSingleResultException(e); - + if (principalTypes.size() == 1) { + return principalTypes.get(0); + } else { + throw new NoSingleResultException("No single type for subject " + debugString(subject), principalTypes.size()); + } } catch (ServiceException e) { - throw new ServiceException(e); - } - } @Override @@ -988,23 +962,10 @@ public class ReadGraphImpl implements ReadGraph { assert (baseType != null); try { - return syncRequest(new SingleType(subject, baseType)); - - } catch (NoSingleResultException e) { - - throw new NoSingleResultException(new NoSingleResultException("subject=" + subject + ", baseType=" + baseType, e)); - - } catch (ServiceException e) { - - throw new ServiceException(e); - } catch (DatabaseException e) { - - throw new ServiceException(INTERNAL_ERROR_STRING, e); - + throw new NoSingleResultException("subject=" + subject + ", baseType=" + baseType, 0, e); } - } @Override @@ -1142,16 +1103,11 @@ public class ReadGraphImpl implements ReadGraph { assert (relation != null); try { - Resource object = getSingleObject(subject, relation); return getValue(object); - } catch (NoSingleResultException e) { - - throw new NoSingleResultException(e); - + throw new NoSingleResultException("No single value found for subject " + debugString(subject) + " and relation " + debugString(relation), e.getResultCount(), e); } catch (DoesNotContainValueException e) { - try { Layer0 L0 = processor.getL0(this); Resource object = getPossibleObject(subject, relation); @@ -1159,23 +1115,19 @@ public class ReadGraphImpl implements ReadGraph { if(isInstanceOf(object, L0.Literal)) { throw new DoesNotContainValueException(e); } else { - throw new InvalidLiteralException("The object " + object + " is not an instance of L0.Literal (use getRelatedValue2 instead)"); + throw new InvalidLiteralException("The object " + object + " is not an instance of L0.Literal (use getRelatedValue2 instead)", e); } } else { - throw new DoesNotContainValueException("The object " + object + " is not an instance of L0.Value"); + throw new DoesNotContainValueException("The object " + object + " is not an instance of L0.Value", e); } } catch (DoesNotContainValueException e2) { throw e2; } catch (DatabaseException e2) { throw new InternalException("The client failed to analyse the cause of the following exception", e); } - } catch (ServiceException e) { - throw new ServiceException(e); - - } - + } } @Override @@ -1186,16 +1138,11 @@ public class ReadGraphImpl implements ReadGraph { assert (relation != null); try { - Resource object = getSingleObject(subject, relation); return getVariantValue(object); - } catch (NoSingleResultException e) { - - throw new NoSingleResultException(e); - + throw new NoSingleResultException("No single object for subject " + debugString(subject) + " and relation " + debugString(relation), e.getResultCount(), e); } catch (DoesNotContainValueException e) { - try { Layer0 L0 = processor.getL0(this); Resource object = getPossibleObject(subject, relation); @@ -1203,23 +1150,19 @@ public class ReadGraphImpl implements ReadGraph { if(isInstanceOf(object, L0.Literal)) { throw new DoesNotContainValueException(e); } else { - throw new InvalidLiteralException("The object " + object + " is not an instance of L0.Literal (use getRelatedValue2 instead)"); + throw new InvalidLiteralException("The object " + object + " is not an instance of L0.Literal (use getRelatedValue2 instead)", e); } } else { - throw new DoesNotContainValueException("The object " + object + " is not an instance of L0.Value"); + throw new DoesNotContainValueException("The object " + object + " is not an instance of L0.Value", e); } } catch (DoesNotContainValueException e2) { throw e2; } catch (DatabaseException e2) { throw new InternalException("The client failed to analyse the cause of the following exception", e); } - } catch (ServiceException e) { - throw new ServiceException(e); - } - } @Override @@ -1230,40 +1173,23 @@ public class ReadGraphImpl implements ReadGraph { assert (relation != null); try { - Resource object = getSingleObject(subject, relation); return getValue(object, binding); - } catch (NoSingleResultException e) { - String message = ""; - try { - String subjectName = NameUtils.getSafeName(this, subject, true); String relationName = NameUtils.getSafeName(this, relation, true); message = "Subject: " + subjectName + ", Relation: " + relationName; - } catch (DatabaseException e2) { } - - throw new NoSingleResultException(message); - + throw new NoSingleResultException(message, e.getResultCount(), e); } catch (DoesNotContainValueException e) { - throw new DoesNotContainValueException(e); - } catch (ServiceException e) { - throw new ServiceException(e); - - } catch (DatabaseException e) { - - throw new ServiceException(INTERNAL_ERROR_STRING, e); - } - } @Override diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/SingleObjectProcedure.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/SingleObjectProcedure.java index 06823b09f..662d2d32d 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/SingleObjectProcedure.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/SingleObjectProcedure.java @@ -20,7 +20,7 @@ public class SingleObjectProcedure implements IntProcedure { public void execute(ReadGraphImpl graph, int i) { Resource resource = processor.querySupport.getResource(i); if(result != null) { - exception = new NoSingleResultException(""); + exception = new NoSingleResultException("", 2); } else { result = resource; } @@ -28,7 +28,7 @@ public class SingleObjectProcedure implements IntProcedure { @Override public void finished(ReadGraphImpl graph) { - if(result == null) exception = new NoSingleResultException(""); + if(result == null) exception = new NoSingleResultException("", 0); } @Override diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java index 333f3771c..fc3222208 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java @@ -43,6 +43,7 @@ import org.simantics.db.common.request.UnaryRead; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.event.ChangeListener; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.exception.NoSingleResultException; import org.simantics.db.layer0.adapter.GenericRelation; import org.simantics.db.layer0.adapter.GenericRelationIndex; import org.simantics.db.layer0.genericrelation.DependencyChanges.Change; @@ -151,7 +152,13 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic @Override public void exception(AsyncReadGraph graph, Throwable throwable) { - LOGGER.error("Could not compile for resource {}", resource, throwable); + if (throwable instanceof NoSingleResultException) { + // Ignore + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Could not compile for resource {}", resource, throwable); + } else { + LOGGER.error("Could not compile for resource {}", resource, throwable); + } } }); diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/SingleActiveModel.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/SingleActiveModel.java index 411388f7e..bff9a2213 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/SingleActiveModel.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/SingleActiveModel.java @@ -25,9 +25,9 @@ public class SingleActiveModel extends ResourceRead { return actives.iterator().next(); if (actives.size() == 0) - throw new NoSingleResultException("There are no active models."); + throw new NoSingleResultException("There are no active models.", actives.size()); - throw new NoSingleResultException("There are many active models: " + NameUtils.getSafeName(graph, actives)); + throw new NoSingleResultException("There are many active models: " + NameUtils.getSafeName(graph, actives), actives.size()); } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ConstantChildVariable.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ConstantChildVariable.java index f5bdd7936..918101fe2 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ConstantChildVariable.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ConstantChildVariable.java @@ -125,7 +125,7 @@ public class ConstantChildVariable extends AbstractChildVariable { Resource type = getPossibleType(graph, baseType); if (type != null) return type; - throw new NoSingleResultException("variable " + getPossibleURI(graph) + " has no type"); + throw new NoSingleResultException("variable " + getPossibleURI(graph) + " has no type", -1); } @Override diff --git a/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF b/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF index 107581f6b..9a5daf404 100644 --- a/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.procore/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Require-Bundle: org.apache.log4j;visibility:=reexport, gnu.trove3;bundle-version="3.0.0", org.simantics.db.impl;bundle-version="0.8.0", org.simantics.lz4, - org.simantics.compressions + org.simantics.compressions, + org.slf4j.api Export-Package: fi.vtt.simantics.procore, fi.vtt.simantics.procore.internal, org.simantics.db.procore, diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectQuerySupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectQuerySupportImpl.java index a0f6c1d1e..7f27a0261 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectQuerySupportImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectQuerySupportImpl.java @@ -8,6 +8,7 @@ import org.simantics.db.Resource; import org.simantics.db.common.procedure.wrapper.NoneToAsyncProcedure; import org.simantics.db.common.procedure.wrapper.SyncToAsyncProcedure; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.exception.NoSingleResultException; import org.simantics.db.impl.ClusterI; import org.simantics.db.impl.ClusterI.ClusterTypeEnum; import org.simantics.db.impl.ForEachObjectContextProcedure; @@ -30,9 +31,13 @@ import org.simantics.db.procore.cluster.ResourceTableSmall; import org.simantics.db.procore.cluster.ValueTableSmall; import org.simantics.db.request.AsyncRead; import org.simantics.db.service.DirectQuerySupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DirectQuerySupportImpl implements DirectQuerySupport { + private static final Logger LOGGER = LoggerFactory.getLogger(DirectQuerySupportImpl.class); + final private SessionImplSocket session; DirectQuerySupportImpl(SessionImplSocket session) { @@ -775,7 +780,7 @@ public class DirectQuerySupportImpl implements DirectQuerySupport { int so = cluster.getSingleObject(subject, procedure, session.clusterTranslator); if(so == 0) { if(result == 0) { - procedure.exception(graph, new DatabaseException("No objects " + subject + " " + procedure.predicateKey)); + procedure.exception(graph, new NoSingleResultException("No objects " + subject + " " + procedure.predicateKey, result)); // graph.dec(); } else { getValue4(graph, cluster, result, context, procedure); @@ -784,13 +789,13 @@ public class DirectQuerySupportImpl implements DirectQuerySupport { if(result == 0) { getValue4(graph, cluster, so, context, procedure); } else { - procedure.exception(graph, new DatabaseException("Multiple objects")); + procedure.exception(graph, new NoSingleResultException("Multiple objects for " + subject + " " + procedure.predicateKey, result)); // graph.dec(); } } } catch (DatabaseException e) { - e.printStackTrace(); + LOGGER.error("Could not compute related value for subject {} with predicate {}", subject, procedure.predicateKey); } } diff --git a/bundles/org.simantics.db/src/org/simantics/db/exception/NoSingleResultException.java b/bundles/org.simantics.db/src/org/simantics/db/exception/NoSingleResultException.java index 8c3e9dbe3..500964242 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/exception/NoSingleResultException.java +++ b/bundles/org.simantics.db/src/org/simantics/db/exception/NoSingleResultException.java @@ -17,32 +17,29 @@ public class NoSingleResultException extends AssumptionException { private static final long serialVersionUID = 1647209154838034514L; - public NoSingleResultException(NoSingleResultException cause) { - super(cause.getMessage()); - } - - public NoSingleResultException(DatabaseException cause) { - super(cause.getMessage()); - } + private final int resultCount; - public NoSingleResultException(String message, Throwable cause) { - super(message, cause); + public NoSingleResultException(String message, int resultCount, Throwable cause) { + super(message + " [resultCount=" + resultCount + "]", cause); + this.resultCount = resultCount; } - public NoSingleResultException(String message, int ... rs) { - super(message, rs); - } - - public NoSingleResultException(String message) { - super(message); + public NoSingleResultException(String message, int resultCount, int ... rs) { + super(message + " [resultCount=" + resultCount + "]", rs); + this.resultCount = resultCount; } - public NoSingleResultException(String message, DatabaseException cause) { - super(message, cause); + public NoSingleResultException(String message, int resultCount) { + super(message + " [resultCount=" + resultCount + "]"); + this.resultCount = resultCount; } - public NoSingleResultException(String message, Resource ... resources) { - super(message, resources); + public NoSingleResultException(String message, int resultCount, Resource ... resources) { + super(message + " [resultCount=" + resultCount + "]", resources); + this.resultCount = resultCount; } + public int getResultCount() { + return resultCount; + } } diff --git a/bundles/org.simantics.db/src/org/simantics/db/exception/ResourceNotFoundException.java b/bundles/org.simantics.db/src/org/simantics/db/exception/ResourceNotFoundException.java index 63ad77f86..f883cf2df 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/exception/ResourceNotFoundException.java +++ b/bundles/org.simantics.db/src/org/simantics/db/exception/ResourceNotFoundException.java @@ -15,16 +15,12 @@ public class ResourceNotFoundException extends AssumptionException { private static final long serialVersionUID = 1647209154838034514L; - public ResourceNotFoundException(ResourceNotFoundException cause) { - super(cause.getMessage()); - } - public ResourceNotFoundException(long id) { super("Could not find [" + id + "]."); } public ResourceNotFoundException(long id, Throwable cause) { - super("Could not find [" + id + "]."); + super("Could not find [" + id + "].", cause); } public ResourceNotFoundException(String uri) { @@ -34,9 +30,5 @@ public class ResourceNotFoundException extends AssumptionException { public ResourceNotFoundException(String uri, Throwable cause) { super("Could not find <" + uri + ">.", cause); } - - public DatabaseException newStack() { - return new ResourceNotFoundException(this); - } } diff --git a/bundles/org.simantics.db/src/org/simantics/db/service/DebugSupport.java b/bundles/org.simantics.db/src/org/simantics/db/service/DebugSupport.java index d3cfd364d..c43138025 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/service/DebugSupport.java +++ b/bundles/org.simantics.db/src/org/simantics/db/service/DebugSupport.java @@ -7,6 +7,5 @@ public interface DebugSupport { T query(WriteGraph graph, String command); T query(Session session, String command); - - + } diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/StandardProceduralChildVariable.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/StandardProceduralChildVariable.java index a5b50f6f3..f133adee0 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/StandardProceduralChildVariable.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/StandardProceduralChildVariable.java @@ -271,7 +271,7 @@ public class StandardProceduralChildVariable extends AbstractChildVariable { public Resource getType(ReadGraph graph, Resource baseType) throws DatabaseException { if (graph.isInheritedFrom(type, baseType)) return type; - throw new NoSingleResultException("variable " + getPossibleURI(graph) + " has no type"); + throw new NoSingleResultException("variable " + getPossibleURI(graph) + " has no type", -1); } @Override -- 2.43.2