From 70b7ec36fa5e0a004b744ea90e06da16e747724d Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 9 Nov 2018 13:34:33 +0000 Subject: [PATCH] simply changed the excpetion returned git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@174079 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../datatransfer/resolver/services/CatalogueResolver.java | 2 +- .../datatransfer/resolver/services/StorageIDResolver.java | 6 +++--- .../resolver/services/error/ExceptionManager.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java index dbd4ec6..64a3cef 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java @@ -119,7 +119,7 @@ public class CatalogueResolver { } if(fullScope==null) - ExceptionManager.throwWrongParameterException(req, "The scope '"+scope+"' does not matching any scope in the infrastructure. Is it valid?", this.getClass(), helpURI); + ExceptionManager.throwNotFoundException(req, "The scope '"+scope+"' does not matching any scope in the infrastructure. Is it valid?", this.getClass(), helpURI); ResourceCatalogueCodes rc = ResourceCatalogueCodes.valueOfCodeValue(jsonRequest.getEntity_context()); if(rc==null){ diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java index 79d544c..f272a20 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java @@ -104,12 +104,12 @@ public class StorageIDResolver { logger.info("Decoded ID"+" = "+ toSEID); }catch(Exception e){ logger.error("Storage Client Exception when getting file from storage: ", e); - ExceptionManager.throwBadRequestException(httpRequest, "Storage Client Exception when getting file from storage with id: "+storageId, StorageIDResolver.class, help); + ExceptionManager.throwNotFoundException(httpRequest, "Storage Client Exception when getting file from storage with id: "+storageId, StorageIDResolver.class, help); } if(toSEID==null || toSEID.isEmpty()){ logger.error("Decrypted id for storageId: "+storageId +" is null or empty!"); - ExceptionManager.throwWrongParameterException(httpRequest, "Error on decrypting the "+STORAGE_ID+ " '"+storageId+"'. Is it a valid id?", StorageIDResolver.class, help); + ExceptionManager.throwNotFoundException(httpRequest, "Error on decrypting the "+STORAGE_ID+ " '"+storageId+"'. Is it a valid id?", StorageIDResolver.class, help); } long size = iClient.getSize().RFileById(toSEID); @@ -205,7 +205,7 @@ public class StorageIDResolver { if(toSEID==null || toSEID.isEmpty()){ logger.error("Decrypted id for storageId: "+storageId +" is null or empty!"); - ExceptionManager.throwWrongParameterException(httpRequest, "Error on decrypting the "+STORAGE_ID+ " '"+storageId+"'. Is it a valid id?", StorageIDResolver.class, help); + ExceptionManager.throwNotFoundException(httpRequest, "Error on decrypting the "+STORAGE_ID+ " '"+storageId+"'. Is it a valid id?", StorageIDResolver.class, help); } diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/error/ExceptionManager.java b/src/main/java/org/gcube/datatransfer/resolver/services/error/ExceptionManager.java index ca39fa6..3985b0d 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/error/ExceptionManager.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/error/ExceptionManager.java @@ -52,7 +52,7 @@ public class ExceptionManager { public static void throwBadRequestException(HttpServletRequest httpRequest, String errorMessage, Class thrownBy, String helpURI){ URI theURI = checkURI(helpURI); - throw new BadRequestException(httpRequest, Status.NOT_ACCEPTABLE, errorMessage, thrownBy, theURI); + throw new BadRequestException(httpRequest, Status.BAD_REQUEST, errorMessage, thrownBy, theURI); }