- /**
- * Unfortunately versions prior to Boron did not include any way to evolve the snapshot format and contained
- * only the raw data stored in the datastore. Furthermore utilities involved do not check if the array is
- * completely consumed, which has a nasty side-effect when coupled with the fact that PayloadVersion writes
- * a short value.
- *
- * Since our versions fit into a single byte, we end up writing the 0 as the first byte, which would be
- * interpreted as 'not present' by the old snapshot format, which uses writeBoolean/readBoolean. A further
- * complication is that readBoolean interprets any non-zero value as true, hence we cannot use a wild value
- * to cause it to fail.
- */
- if (isLegacyStream(bytes)) {
- return deserializeLegacy(bytes);
- }
-
- try {
- try (InputStream is = new ByteArrayInputStream(bytes)) {
- try (DataInputStream dis = new DataInputStream(is)) {
- final ShardDataTreeSnapshot ret = AbstractVersionedShardDataTreeSnapshot.deserializePreCarbon(dis);
-
- // Make sure we consume all bytes, otherwise something went very wrong
- final int bytesLeft = dis.available();
- if (bytesLeft != 0) {
- throw new IOException("Deserialization left " + bytesLeft + " in the buffer");
- }
+ try (InputStream is = new ByteArrayInputStream(bytes)) {
+ try (DataInputStream dis = new DataInputStream(is)) {
+ final ShardDataTreeSnapshot ret = AbstractVersionedShardDataTreeSnapshot.deserializePreCarbon(dis);
+
+ // Make sure we consume all bytes, otherwise something went very wrong
+ final int bytesLeft = dis.available();
+ if (bytesLeft != 0) {
+ throw new IOException("Deserialization left " + bytesLeft + " in the buffer");
+ }