Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<dependency>
<groupId>com.scalableminds</groupId>
<artifactId>blosc-java</artifactId>
<version>0.1-1.21.4</version>
<version>0.3-1.21.6</version>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/zarr/zarrjava/store/BufferedZipStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/dev/zarr/zarrjava/v2/ArrayMetadataBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/dev/zarr/zarrjava/v3/codec/CodecBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/dev/zarr/zarrjava/store/BufferedZipStoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
Loading