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:
parent
a05ca4c714
commit
5dc85cb43b
|
@ -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);
|
logger.info("The dataset "+datasetName+" is a public item using public access to CKAN portlet: "+ckanPorltetUrl);
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}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();
|
ckanPorltetUrl = ckanCatalogueReference.getPublicPortletURL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.w3c.dom.Node;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
import eu.trentorise.opendata.jackan.CkanClient;
|
import eu.trentorise.opendata.jackan.CkanClient;
|
||||||
|
import eu.trentorise.opendata.jackan.exceptions.CkanException;
|
||||||
import eu.trentorise.opendata.jackan.model.CkanDataset;
|
import eu.trentorise.opendata.jackan.model.CkanDataset;
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,14 +92,18 @@ public class CkanCatalogueConfigurationsReader {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static CkanDataset getDataset(String datasetIdorName, String catalogueURL) 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
|
// checks
|
||||||
checkNotNull(datasetIdorName);
|
checkNotNull(datasetIdorName);
|
||||||
checkArgument(!datasetIdorName.isEmpty());
|
checkArgument(!datasetIdorName.isEmpty());
|
||||||
|
try{
|
||||||
CkanClient client = new CkanClient(catalogueURL);
|
CkanClient client = new CkanClient(catalogueURL);
|
||||||
return client.getDataset(datasetIdorName);
|
return client.getDataset(datasetIdorName);
|
||||||
|
}catch(CkanException e){
|
||||||
|
logger.info("CkanException thrown, returning null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue