diff options
-rw-r--r-- | config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java | 5 | ||||
-rw-r--r-- | jrt/src/com/yahoo/jrt/DataValue.java | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java index 441ceb428af..4575368cc6a 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java @@ -15,6 +15,7 @@ import com.yahoo.vespa.config.util.ConfigUtils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; +import java.util.Arrays; import java.util.Optional; import java.util.logging.Logger; @@ -104,7 +105,9 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { if (buf.hasArray() && buf.remaining() == buf.array().length) { request.returnValues().add(new DataValue(buf.array())); } else { - request.returnValues().add(new DataValue(buf)); + byte [] dst = new byte[buf.remaining()]; + buf.get(dst); + request.returnValues().add(new DataValue(dst)); } } else { request.returnValues().add(new DataValue(new byte[0])); diff --git a/jrt/src/com/yahoo/jrt/DataValue.java b/jrt/src/com/yahoo/jrt/DataValue.java index 17a1f374a88..8739e4b3817 100644 --- a/jrt/src/com/yahoo/jrt/DataValue.java +++ b/jrt/src/com/yahoo/jrt/DataValue.java @@ -24,7 +24,7 @@ public class DataValue extends Value * * @param src buffer where the value is stored **/ - public DataValue(ByteBuffer src) { + DataValue(ByteBuffer src) { int size = src.getInt(); value = new byte[size]; src.get(value); |