commit | f96d0e31503a64e7648c7f78f9b9db6ae4ad9cf7 | [log] [tgz] |
---|---|---|
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Wed Dec 29 21:53:50 2021 +0100 |
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Wed Dec 29 21:53:50 2021 +0100 |
tree | 5fc40e065833d5c23ee845b2df85e09f84129ac9 | |
parent | 05114647f0cd37fd09d344a088d5c57c4ac68a32 [diff] |
Checksum: Convert 0-sized checksums to all-zeros checksums. Change-Id: Ia2429edafcdc93aad01310f66f489c3dd54ec365
diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java index 705e27c..ce5f9b0 100644 --- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java +++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java
@@ -16,6 +16,10 @@ private static final Decoder<Checksum> DECODER = ByteString.decoder().map(Checksum::new); public Checksum { + if (byteString.size() == 0) { + byteString = zero().byteString; + } + if (byteString.size() != SIZE) { throw new IllegalArgumentException( "attempted to construct Checksum of length %d (expected: %d)"