diff --git a/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java b/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java index 92fe45ab73e62717566db15d8fe5fa17a95916b3..43d618498a3cd26e992bbebf2b24c8504c333638 100644 --- a/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java +++ b/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java @@ -35,6 +35,8 @@ import ch.systemsx.cisd.common.utilities.PropertyUtils; public final class FileWithHighwaterMark extends AbstractHashable implements Serializable { + static final String SEP = "-"; + public static final int DEFAULT_HIGHWATER_MARK = -1; private static final long serialVersionUID = 1L; @@ -82,7 +84,7 @@ public final class FileWithHighwaterMark extends AbstractHashable implements Ser assert StringUtils.isNotBlank(filePropertyKey) : "File property key is blank"; final String filePath = PropertyUtils.getMandatoryProperty(properties, filePropertyKey); final long highwaterMarkInKb = - PropertyUtils.getLong(properties, filePropertyKey.concat(".").concat( + PropertyUtils.getLong(properties, filePropertyKey.concat(SEP).concat( HIGHWATER_MARK_PROPERTY_KEY), -1L); return new FileWithHighwaterMark(new File(filePath), highwaterMarkInKb); } diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java index c72ce214cb061071fc5816d985c7e8d7ecb26c20..7c49ac89eb2ad55db3d7ef9c35f09c466a72e0d7 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java @@ -64,13 +64,13 @@ public final class FileWithHighwaterMarkTest assertEquals(new File(path), fileWithHighwaterMark.getFile()); assertEquals(-1, fileWithHighwaterMark.getHighwaterMark()); // 100Kb - properties.setProperty(filePropertyKey + "." + properties.setProperty(filePropertyKey + FileWithHighwaterMark.SEP + FileWithHighwaterMark.HIGHWATER_MARK_PROPERTY_KEY, "100"); fileWithHighwaterMark = FileWithHighwaterMark.fromProperties(properties, filePropertyKey); assertEquals(new File(path), fileWithHighwaterMark.getFile()); assertEquals(100, fileWithHighwaterMark.getHighwaterMark()); // Meaningless value - properties.setProperty(filePropertyKey + "." + properties.setProperty(filePropertyKey + FileWithHighwaterMark.SEP + FileWithHighwaterMark.HIGHWATER_MARK_PROPERTY_KEY, "notANumber"); fileWithHighwaterMark = FileWithHighwaterMark.fromProperties(properties, filePropertyKey); assertEquals(new File(path), fileWithHighwaterMark.getFile());