diff --git a/performanceDb/src/main/java/org/lucares/performance/db/PdbWriter.java b/performanceDb/src/main/java/org/lucares/performance/db/PdbWriter.java index 49e2c41..378f31b 100644 --- a/performanceDb/src/main/java/org/lucares/performance/db/PdbWriter.java +++ b/performanceDb/src/main/java/org/lucares/performance/db/PdbWriter.java @@ -4,9 +4,12 @@ import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.util.logging.Logger; class PdbWriter implements AutoCloseable { + private final static Logger LOGGER = Logger.getLogger(PdbWriter.class.getCanonicalName()); + private static final boolean APPEND = true; private final OutputStream outputStream; private final PdbFile pdbFile; @@ -29,10 +32,11 @@ class PdbWriter implements AutoCloseable { } public void write(final Entry entry) throws WriteException { + // System.out.println(entry); write(entry.getEpochMilli(), entry.getValue()); } - void write(final long epochMilli, final long value) throws WriteException { + private void write(final long epochMilli, final long value) throws WriteException { final long offsetEpochMilli = pdbFile.getOffsetInEpochMilli(); final long adjustedValue = epochMilli - offsetEpochMilli; assertValueInRange(adjustedValue); @@ -46,7 +50,10 @@ class PdbWriter implements AutoCloseable { private void assertEpochMilliInRange(final long epochMilli) { if (epochMilli < minimalEpochMilli) { - throw new IllegalArgumentException("value must not be smaller than: " + minimalEpochMilli); + LOGGER.warning("epochMilli must not be smaller than " + minimalEpochMilli + ", but was " + epochMilli + + ". We'll accept this for now. " + + "Currently there is no code that relies on monotonically increasing date values. " + + "Log4j does not guarantee it either."); } }