diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java index 81406c7db0..7c09c7a446 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java @@ -294,7 +294,9 @@ public final class DataManagerImpl implements DataManager { private void removeDataFile(DataFile dataFile) throws IOException{ fileMap.remove(dataFile.getNumber()); - writer.force(dataFile); + if(writer!=null){ + writer.force(dataFile); + } boolean result=dataFile.delete(); log.debug("discarding data file "+dataFile+(result?"successful ":"failed")); }