aboutsummaryrefslogtreecommitdiffstats
path: root/pnfsimulator
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-05-07 14:06:18 +0200
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-05-08 13:22:15 +0200
commit1d7525f0379dcd0fc00f40bc0fa46cf11d97e4db (patch)
tree64344127ffdd9ee85fc00a7c98c7a317d7d39129 /pnfsimulator
parent29ae13b305b7c7f6a3d6d92da58e580b07ed3e8a (diff)
Fix crashing file watcher thread
When file is empty it throws BSONException, that wasn't handled Issue-ID: INT-1533 Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Change-Id: If868e40e8120b3d935895b6c4c4fe38d14a41843
Diffstat (limited to 'pnfsimulator')
-rw-r--r--pnfsimulator/src/main/java/org/onap/pnfsimulator/filesystem/WatcherEventProcessor.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/pnfsimulator/src/main/java/org/onap/pnfsimulator/filesystem/WatcherEventProcessor.java b/pnfsimulator/src/main/java/org/onap/pnfsimulator/filesystem/WatcherEventProcessor.java
index 56a5696..c03491a 100644
--- a/pnfsimulator/src/main/java/org/onap/pnfsimulator/filesystem/WatcherEventProcessor.java
+++ b/pnfsimulator/src/main/java/org/onap/pnfsimulator/filesystem/WatcherEventProcessor.java
@@ -34,6 +34,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
+import org.bson.BSONException;
import org.bson.json.JsonParseException;
import org.onap.pnfsimulator.db.Storage;
import org.onap.pnfsimulator.template.Template;
@@ -97,7 +98,7 @@ public enum WatcherEventProcessor {
processor.processEvent(templatePath, storage);
} catch (IOException e) {
log.error("Error during processing DB record for template.", e);
- } catch (JsonParseException e) {
+ } catch (BSONException | JsonParseException e) {
log.error("Invalid JSON format provided for template.", e);
}
});