Fix crashing file watcher thread 16/107316/3
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Thu, 7 May 2020 12:06:18 +0000 (14:06 +0200)
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Fri, 8 May 2020 11:22:15 +0000 (13:22 +0200)
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

pnfsimulator/src/main/java/org/onap/pnfsimulator/filesystem/WatcherEventProcessor.java
release-notes.rst

index 56a5696..c03491a 100644 (file)
@@ -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);
             }
         });
index fe2f118..79b7481 100644 (file)
@@ -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**