From d679109b0e5c2cdf17cf3896bd9d4ad0ce15f218 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Mon, 17 Dec 2018 14:52:31 +0000 Subject: [PATCH] Added exception InvalidCacheLoadException git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@174935 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../resolver/services/AnalyticsGetResolver.java | 4 +++- .../datatransfer/resolver/services/CatalogueResolver.java | 6 ++++-- .../gcube/datatransfer/resolver/services/GisResolver.java | 6 ++++-- .../datatransfer/resolver/services/KnimeGetResolver.java | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/AnalyticsGetResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/AnalyticsGetResolver.java index 34958c8..5220ea3 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/AnalyticsGetResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/AnalyticsGetResolver.java @@ -20,6 +20,8 @@ import org.gcube.datatransfer.resolver.services.error.ExceptionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.cache.CacheLoader.InvalidCacheLoadException; + /** * The Class AnalyticsGetResolver. @@ -65,7 +67,7 @@ public class AnalyticsGetResolver { //CHECKING IF THE INPUT VRE NAME IS REGISTRED IN THE INFRASTRUCTURE... try{ fullScope = LoadingVREsScopeCache.get(vreName); - }catch(ExecutionException e){ + }catch(ExecutionException | InvalidCacheLoadException e){ logger.error("Error on getting the fullscope from cache for vreName "+vreName, e); throw ExceptionManager.wrongParameterException(req, "Error on getting full scope for the VRE name "+vreName+". Is it registered as VRE in the D4Science Infrastructure System?", this.getClass(), helpURI); } 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 c3f80fa..167859a 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java @@ -29,6 +29,8 @@ import org.gcube.smartgears.utils.InnerMethodName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.cache.CacheLoader.InvalidCacheLoadException; + import eu.trentorise.opendata.jackan.model.CkanDataset; /** @@ -174,9 +176,9 @@ public class CatalogueResolver { String fullScope = ""; try{ fullScope = LoadingVREsScopeCache.get(vreName); - }catch(ExecutionException e){ + }catch(ExecutionException | InvalidCacheLoadException e){ logger.error("Error on getting the fullscope from cache for vreName "+vreName, e); - throw ExceptionManager.wrongParameterException(req, "Error on getting full scope for the VRE name "+vreName+". Is it registered as VRE in the D4Science Infrastructure System?", CatalogueResolver.class, helpURI); + throw ExceptionManager.wrongParameterException(req, "Error on getting full scope for the VRE name '"+vreName+"'. Is it registered as VRE in the D4Science Infrastructure System?", CatalogueResolver.class, helpURI); } logger.info("Read fullScope: "+fullScope + " for VRE_NAME: "+vreName +" from cache created by: "+GetAllInfrastructureVREs.class.getSimpleName()); diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/GisResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/GisResolver.java index d66bfba..b6c9e27 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/GisResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/GisResolver.java @@ -29,6 +29,8 @@ import org.gcube.datatransfer.resolver.services.error.ExceptionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.cache.CacheLoader.InvalidCacheLoadException; + /** @@ -120,7 +122,7 @@ public class GisResolver { String gisViewerPortletUrl = null; try{ gisViewerPortletUrl = LoadingGisViewerApplicationURLCache.get(scope); - }catch(ExecutionException e){ + }catch(ExecutionException | InvalidCacheLoadException e){ logger.error("Error on getting the GisViewer Applicaton URL from cache for scope "+scope, e); throw ExceptionManager.wrongParameterException(req, "Error on getting the GisViewer Applicaton URL from cache for scope "+scope+".\nIs the Application Profile with APPID "+UriResolverSmartGearManagerInit.getGisViewerProfile().getAppId()+" registered for this scope: "+scope+"?", this.getClass(), help); } @@ -196,7 +198,7 @@ public class GisResolver { GeonetworkInstance gi = null; try { gi = LoadingGeonetworkInstanceCache.get(scope); - }catch(ExecutionException e){ + }catch(ExecutionException | InvalidCacheLoadException e){ logger.error("Error on getting the Geonetwork Instance from cache for scope "+scope, e); throw ExceptionManager.wrongParameterException(req, "Error on getting the Geonetwork Instance from cache for scope "+scope+". Is it registered for this scope: "+scope+"?", this.getClass(), help); } diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/KnimeGetResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/KnimeGetResolver.java index f8afd83..b2886d4 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/KnimeGetResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/KnimeGetResolver.java @@ -20,6 +20,8 @@ import org.gcube.datatransfer.resolver.services.error.ExceptionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.cache.CacheLoader.InvalidCacheLoadException; + /** * The Class KnimeGetResolver. @@ -62,7 +64,7 @@ public class KnimeGetResolver { String fullScope = ""; try{ fullScope = LoadingVREsScopeCache.get(vreName); - }catch(ExecutionException e){ + }catch(ExecutionException | InvalidCacheLoadException e){ logger.error("Error on getting the fullscope from cache for vreName "+vreName, e); throw ExceptionManager.wrongParameterException(req, "Error on getting full scope for the VRE name "+vreName+". Is it registered as VRE in the D4Science Infrastructure System?", this.getClass(), helpURI); }