From cb5e4574f96838565b0179588bf5d11df034fd33 Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Wed, 3 Aug 2011 11:24:20 -0700 Subject: [PATCH] bug 10946: Add default buffer length for compressed request Then it can support 2.2.8 system vm connection. status 10946: resolved fixed --- core/src/com/cloud/agent/transport/Request.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/com/cloud/agent/transport/Request.java b/core/src/com/cloud/agent/transport/Request.java index b222790a554..27fe9c548a0 100755 --- a/core/src/com/cloud/agent/transport/Request.java +++ b/core/src/com/cloud/agent/transport/Request.java @@ -259,6 +259,11 @@ public class Request { public static ByteBuffer doDecompress(ByteBuffer buffer, int length) { byte[] byteArrayIn = new byte[1024]; + int allocLength = length; + /* Add default length to support 2.2.8 */ + if (allocLength < 65535) { + allocLength = 65535; + } ByteArrayInputStream byteIn; if (buffer.hasArray()) { byteIn = new ByteArrayInputStream(buffer.array(), @@ -269,7 +274,7 @@ public class Request { buffer.get(array); byteIn = new ByteArrayInputStream(array); } - ByteBuffer retBuff = ByteBuffer.allocate(length); + ByteBuffer retBuff = ByteBuffer.allocate(allocLength); int len = 0; try { GZIPInputStream in = new GZIPInputStream(byteIn);