changed exception type, if collection indexing failes

This commit is contained in:
Enrico Ottonello 2020-09-24 12:53:08 +02:00
parent 814c908663
commit 142a296166
2 changed files with 11 additions and 7 deletions

View File

@ -350,11 +350,16 @@ public class GraphDBClient {
List<String> collectionResourceIds = runSPQRLQuery.selectCollectionIds(datasource, collectionId);
log.info(String.format("Found %d collections to index for datasource %s - %s", collectionResourceIds.size(), datasource, collectionId));
if(!collectionResourceIds.isEmpty()) {
try {
if (!collectionResourceIds.isEmpty()) {
final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name());
collectionIndexReport = runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceIds, datasource, collectionId, true);
}
}
catch (RuntimeException re) {
throw new AriadnePlusPublisherException(re);
}
List<String> recordIds = runSPQRLQuery.selectRecordIds(datasource, collectionId);
log.info(String.format("Found %d individual resources to index for datasource %s - %s", recordIds.size(), datasource, collectionId));

View File

@ -61,8 +61,7 @@ public class RunSPARQLQueryService {
manager.shutDown();
}
public String executeMultipleQueryGraph(String queryTemplate, List<String> recordIds, String datasource, String collectionId, boolean isCollection)
throws AriadnePlusPublisherException {
public String executeMultipleQueryGraph(String queryTemplate, List<String> recordIds, String datasource, String collectionId, boolean isCollection) {
if (queryTemplate==null)
return null;
final String selectQueryTemplate = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
@ -77,7 +76,7 @@ public class RunSPARQLQueryService {
if (operationResult!=200) {
log.error(recordId + " error_code: "+ operationResult);
if (isCollection) {
throw new AriadnePlusPublisherException("Collection indexing problem - errcode: "+operationResult);
throw new RuntimeException("Collection indexing problem - errcode: "+operationResult);
}
int currentErrorsCount = errorCodesCount.get(0).intValue();
currentErrorsCount+=1;