sbtourist / Journal.IO

Journal.IO is a zero-dependency, fast and easy-to-use journal storage implementation.
Apache License 2.0
260 stars 39 forks source link

Delete before write fails #23

Closed jeluard closed 11 years ago

jeluard commented 11 years ago

When deleting a Location before doing any write throws following exception:

Exception in thread "main" java.lang.IllegalStateException
    at journal.io.api.Journal.sync(Journal.java:270)
    at journal.io.api.DataFileAccessor.updateLocation(DataFileAccessor.java:60)
    at journal.io.api.Journal.delete(Journal.java:337)
    at com.github.jeluard.stone.DeleteBeforeWrite.main(DeleteBeforeWrite.java:16)
Caused by: java.lang.NullPointerException
    at journal.io.api.Journal$WriteFuture.get(Journal.java:1009)
    at journal.io.api.Journal$WriteFuture.get(Journal.java:988)
    at journal.io.api.Journal.sync(Journal.java:265)
    ... 3 more

Same code but with a write forced before the delete runs fine.

jeluard commented 11 years ago

You can find an example here. Note you need to have a file names test1.log in the directory used to run the example.

sbtourist commented 11 years ago

Fixed.