diff --git a/pom.xml b/pom.xml index c882619a..3448ba28 100644 --- a/pom.xml +++ b/pom.xml @@ -102,7 +102,7 @@ com.scalableminds blosc-java - 0.1-1.21.4 + 0.3-1.21.6 com.github.luben diff --git a/src/main/java/dev/zarr/zarrjava/store/BufferedZipStore.java b/src/main/java/dev/zarr/zarrjava/store/BufferedZipStore.java index ab1afc8c..411bfa2d 100644 --- a/src/main/java/dev/zarr/zarrjava/store/BufferedZipStore.java +++ b/src/main/java/dev/zarr/zarrjava/store/BufferedZipStore.java @@ -80,7 +80,7 @@ public BufferedZipStore(@Nonnull StoreHandle underlyingStore) { } public BufferedZipStore(@Nonnull Path underlyingStore, String archiveComment) { - this(new FilesystemStore(underlyingStore.getParent()).resolve(underlyingStore.getFileName().toString()), archiveComment); + this(new FilesystemStore(underlyingStore.toAbsolutePath().getParent()).resolve(underlyingStore.getFileName().toString()), archiveComment); } public BufferedZipStore(@Nonnull Path underlyingStore) { @@ -108,7 +108,7 @@ public BufferedZipStore(@Nonnull StoreHandle underlyingStore, boolean flushOnWri } public BufferedZipStore(@Nonnull Path underlyingStore, String archiveComment, boolean flushOnWrite) { - this(new FilesystemStore(underlyingStore.getParent()).resolve(underlyingStore.getFileName().toString()), archiveComment, flushOnWrite); + this(new FilesystemStore(underlyingStore.toAbsolutePath().getParent()).resolve(underlyingStore.getFileName().toString()), archiveComment, flushOnWrite); } public BufferedZipStore(@Nonnull Path underlyingStore, boolean flushOnWrite) { diff --git a/src/main/java/dev/zarr/zarrjava/v2/ArrayMetadataBuilder.java b/src/main/java/dev/zarr/zarrjava/v2/ArrayMetadataBuilder.java index c35acd3c..00c37687 100644 --- a/src/main/java/dev/zarr/zarrjava/v2/ArrayMetadataBuilder.java +++ b/src/main/java/dev/zarr/zarrjava/v2/ArrayMetadataBuilder.java @@ -93,9 +93,6 @@ public ArrayMetadataBuilder withBloscCompressor( } public ArrayMetadataBuilder withBloscCompressor(String cname, String shuffle, int clevel, int blockSize) { - if (shuffle.equals("shuffle")) { - shuffle = "byteshuffle"; - } return withBloscCompressor(Blosc.Compressor.fromString(cname), Blosc.Shuffle.fromString(shuffle), clevel, dataType.getByteCount(), blockSize ); diff --git a/src/main/java/dev/zarr/zarrjava/v3/codec/CodecBuilder.java b/src/main/java/dev/zarr/zarrjava/v3/codec/CodecBuilder.java index d4eb697f..5c3487ce 100644 --- a/src/main/java/dev/zarr/zarrjava/v3/codec/CodecBuilder.java +++ b/src/main/java/dev/zarr/zarrjava/v3/codec/CodecBuilder.java @@ -38,9 +38,6 @@ public CodecBuilder withBlosc( } public CodecBuilder withBlosc(String cname, String shuffle, int clevel, int blockSize) { - if (shuffle.equals("shuffle")) { - shuffle = "byteshuffle"; - } return withBlosc(Blosc.Compressor.fromString(cname), Blosc.Shuffle.fromString(shuffle), clevel, dataType.getByteCount(), blockSize ); diff --git a/src/test/java/dev/zarr/zarrjava/store/BufferedZipStoreTest.java b/src/test/java/dev/zarr/zarrjava/store/BufferedZipStoreTest.java index 742a18da..88ab1d65 100644 --- a/src/test/java/dev/zarr/zarrjava/store/BufferedZipStoreTest.java +++ b/src/test/java/dev/zarr/zarrjava/store/BufferedZipStoreTest.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; import java.util.zip.ZipEntry; @@ -174,6 +175,21 @@ public void testZipStoreV2(boolean flushOnWrite) throws ZarrException, IOExcepti } + @Test + public void testBufferedZipStoreWithRelativePath() throws ZarrException, IOException { + // Path.of("filename.zip") has no parent component — getParent() returns null, + // which previously caused a NullPointerException in FilesystemStore.resolveKeys(). + Path relPath = Paths.get("testRelativePath.zip"); + Path absPath = relPath.toAbsolutePath(); + try { + BufferedZipStore store = new BufferedZipStore(relPath); + writeTestGroupV3(store.resolve(), true); + store.flush(); + } finally { + Files.deleteIfExists(absPath); + } + } + @Override Store writableStore() { Path path = TESTOUTPUT.resolve("writableStore.ZIP");