diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java index e90642e..d499e63 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/model/entities/EntityManagement.java @@ -537,7 +537,14 @@ public abstract class EntityManagement Iterable references = null; if(referenceUUID != null) { - OElement element = ElementManagementUtility.getAnyElementByUUID(oDatabaseDocument, referenceUUID); + OElement element = null; + try { + element = ElementManagementUtility.getAnyElementByUUID(oDatabaseDocument, referenceUUID); + }catch (ResourceRegistryException e) { + String error = String.format("No instace with UUID % exists", referenceUUID); + throw new InvalidQueryException(error); + } + if(element instanceof OVertex) { EntityManagement entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(), oDatabaseDocument, (OVertex) element); @@ -547,8 +554,7 @@ public abstract class EntityManagement if(polymorphic && getOClass().isSubClassOf(referenceType)) { // OK } else { - String error = String.format("Referenced instace with UUID %s is not a %s", referenceUUID, - referenceType); + String error = String.format("Referenced instace with UUID %s is not a %s", referenceUUID, referenceType); throw new InvalidQueryException(error); } } @@ -558,7 +564,7 @@ public abstract class EntityManagement references = vertexes; } else { - String error = String.format("Referenced instace with UUID %s is not an %s", referenceUUID, Entity.NAME); + String error = String.format("Referenced instace with UUID %s is not a %s", referenceUUID, referenceType); throw new InvalidQueryException(error); } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java index bdd3a9e..ec7beb0 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java @@ -287,8 +287,8 @@ public class Access extends BaseRest { /*@QueryParam(AccessPath._INCLUDE_RELATION_PARAM) @DefaultValue("false") Boolean includeRelation,*/ @Context UriInfo uriInfo) throws ResourceRegistryException { - logger.info("Requested {} instances having a(n) {} ({}={}} with {} ({}={}. Complete Request is {})", resourcetype, relationType, - AccessPath._DIRECTION_PARAM, direction, referenceType, AccessPath._POLYMORPHIC_PARAM, polymorphic, uriInfo.getPath()); + logger.info("Requested {} instances having a(n) {} ({}={}} with {} ({}={}). Request URI is {})", resourcetype, relationType, + AccessPath._DIRECTION_PARAM, direction, referenceType, AccessPath._POLYMORPHIC_PARAM, polymorphic, uriInfo.getRequestUri()); CalledMethodProvider.instance.set("query");