Catch exception also when trying to get application
@@ -427,18 +427,17 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
Set<String> fileReferencesInUse = new HashSet<>();
// Intentionally skip applications that we for some reason do not find
// or that we fail to get file references for (they will be retried on the next run)
- listApplications().stream()
- .map(this::getOptionalApplication)
- .map(Optional::get)
- .forEach(application -> {
+ for (var application : listApplications()) {
try {
- fileReferencesInUse.addAll(application.getModel().fileReferences().stream()
+ Optional<Application> app = getOptionalApplication(application);
+ if (app.isEmpty()) continue;
+ fileReferencesInUse.addAll(app.get().getModel().fileReferences().stream()
.map(FileReference::value)
.collect(Collectors.toSet()));
} catch (Exception e) {
- log.log(LogLevel.WARNING, "Getting file references in use from : " + application + " failed", e);
+ log.log(LogLevel.WARNING, "Getting file references in use for '" + application + "' failed", e);
+ }
}
- });
log.log(LogLevel.DEBUG, "File references in use : " + fileReferencesInUse);
// Find those on disk that are not in use
