fixed ckan exception

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@167182 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-04-24 08:58:24 +00:00
parent a05ca4c714
commit 5dc85cb43b
2 changed files with 10 additions and 5 deletions

View File

@ -217,7 +217,7 @@ public class CatalogueResolver extends HttpServlet{
logger.info("The dataset "+datasetName+" is a public item using public access to CKAN portlet: "+ckanPorltetUrl);
}
}catch(Exception e){
logger.warn("Error on checking if dataset: "+datasetName+" is private or not");
logger.warn("Error on checking if dataset: "+datasetName+" is private or not", e);
ckanPorltetUrl = ckanCatalogueReference.getPublicPortletURL();
}
}

View File

@ -31,6 +31,7 @@ import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import eu.trentorise.opendata.jackan.CkanClient;
import eu.trentorise.opendata.jackan.exceptions.CkanException;
import eu.trentorise.opendata.jackan.model.CkanDataset;
@ -91,14 +92,18 @@ public class CkanCatalogueConfigurationsReader {
* @throws Exception
*/
public static CkanDataset getDataset(String datasetIdorName, String catalogueURL) throws Exception{
logger.info("Request ckan dataset with id " + datasetIdorName);
logger.info("Request GET CKAN dataset with id: " + datasetIdorName);
// checks
checkNotNull(datasetIdorName);
checkArgument(!datasetIdorName.isEmpty());
CkanClient client = new CkanClient(catalogueURL);
return client.getDataset(datasetIdorName);
try{
CkanClient client = new CkanClient(catalogueURL);
return client.getDataset(datasetIdorName);
}catch(CkanException e){
logger.info("CkanException thrown, returning null");
return null;
}
}