aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--pnfsimulator/src/main/java/org/onap/pnfsimulator/filesystem/WatcherEventProcessor.java3
-rw-r--r--release-notes.rst6
2 files changed, 6 insertions, 3 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);
}
});
diff --git a/release-notes.rst b/release-notes.rst
index fe2f118..79b7481 100644
--- a/release-notes.rst
+++ b/release-notes.rst
@@ -21,7 +21,8 @@ The Frankfurt Release is the first official release of the PNF Simulator, Netcon
**Known Issues**
- N/A
+ - https://jira.onap.org/browse/INT-1533
+ File watcher thread crashes when empty file is added to template folder
**Security Notes**
@@ -61,7 +62,8 @@ Version: 1.0.1
**Bug Fixes**
- - No new fixes were implemented for this release
+ - https://jira.onap.org/browse/INT-1533
+ File watcher no longer crashes after adding empty file to template folder. In stead it logs information about wrong template format
**Known Issues**