From e77fe5804f3623e7c04d930b347883c511e8dd7a Mon Sep 17 00:00:00 2001 From: AlexisDrogoul Date: Thu, 22 Feb 2024 10:34:30 +0700 Subject: [PATCH] Fixes the serialisation problem appearing in tests --- .../serialize/implementations/BinarySerialisation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gama.extension.serialize/src/gama/extension/serialize/implementations/BinarySerialisation.java b/gama.extension.serialize/src/gama/extension/serialize/implementations/BinarySerialisation.java index 8e303b759a..b29606bd2c 100644 --- a/gama.extension.serialize/src/gama/extension/serialize/implementations/BinarySerialisation.java +++ b/gama.extension.serialize/src/gama/extension/serialize/implementations/BinarySerialisation.java @@ -99,8 +99,8 @@ public static Object createFromBytes(final IScope scope, final byte[] bytes) { byte type = bytes[0]; if (type != GAMA_OBJECT_IDENTIFIER && type != GAMA_AGENT_IDENTIFIER) throw GamaRuntimeException.error("Not a GAMA serialisation record", scope); - boolean zip = bytes[2] == COMPRESSED; - byte[] some = Arrays.copyOfRange(bytes, 3, bytes.length); + boolean zip = bytes[1] == COMPRESSED; + byte[] some = Arrays.copyOfRange(bytes, 2, bytes.length); if (zip) { some = ByteArrayZipper.unzip(some); } return type == GAMA_OBJECT_IDENTIFIER ? PROCESSOR.createObjectFromBytes(scope, some) : PROCESSOR.createAgentFromBytes(scope, some);