handle empty line at end of file

This commit is contained in:
Zlatin Balevsky
2018-07-20 21:54:29 +01:00
parent a14089f109
commit afb5f80e0c
2 changed files with 3 additions and 1 deletions

View File

@@ -36,6 +36,8 @@ class PersisterService {
def slurper = new JsonSlurper()
try {
location.eachLine {
if (it.trim().length() == 0)
return
def parsed = slurper.parseText it
def event = fromJson parsed
if (event != null)

View File

@@ -151,7 +151,7 @@ class PersisterServiceLoadingTest {
json2 = JsonOutput.toJson(json2)
persisted.append "$json1\n"
persisted.append json2
persisted.append "$json2\n"
PersisterService ps = new PersisterService(persisted, eventBus, 100, null)
ps.start()