Safe iteration

This commit is contained in:
Fabio Sinibaldi 2020-12-16 15:26:53 +01:00
parent a9aad3724d
commit 977623247c
3 changed files with 14 additions and 7 deletions

View File

@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.data-publishing.gFeed.oai-pmh # Changelog for org.gcube.data-publishing.gFeed.oai-pmh
## [1.0.5-SNAPSHOT] - 2020-12-15
Do not stop on single repository error
## [1.0.4] - 2020-12-15 ## [1.0.4] - 2020-12-15
- Dependency management - Dependency management
- Naming Convention - Naming Convention

View File

@ -9,7 +9,7 @@
</parent> </parent>
<artifactId>oai-harvester</artifactId> <artifactId>oai-harvester</artifactId>
<name>oai-harvester</name> <name>oai-harvester</name>
<version>1.0.4</version> <version>1.0.5-SNAPSHOT</version>
<scm> <scm>
<connection>scm:git:${gitBaseUrl}/gFeed</connection> <connection>scm:git:${gitBaseUrl}/gFeed</connection>

View File

@ -27,12 +27,16 @@ public class OAICollector implements DataCollector<OAIRecord> {
AccessPoint point=epr.profile().accessPoints().asCollection().iterator().next(); AccessPoint point=epr.profile().accessPoints().asCollection().iterator().next();
String baseUrl=point.address(); String baseUrl=point.address();
log.debug("Address is "+baseUrl); log.debug("Address is "+baseUrl);
OAIClient client = new OAIClient(baseUrl); try {
point.properties().iterator().forEachRemaining((Property p)->{ OAIClient client = new OAIClient(baseUrl);
if(p.name().equals("set")) point.properties().iterator().forEachRemaining((Property p)->{
client.getSpecifiedSets().add(p.value()); if(p.name().equals("set"))
}); client.getSpecifiedSets().add(p.value());
toReturn.addAll(client.getAll(OAIClient.DC_METADATA_PREFIX)); });
toReturn.addAll(client.getAll(OAIClient.DC_METADATA_PREFIX));
}catch(Throwable t) {
log.warn("Unable to use repository "+epr.id()+" NAME : "+epr.profile().name(),t);
}
} }
return toReturn; return toReturn;