diff options
author | Simon Rettberg | 2023-02-24 14:02:56 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-02-24 14:02:56 +0100 |
commit | ac26185b987727fcf6ae79ffdc59c10f424f8547 (patch) | |
tree | ef5693822160ce72cc8e5f0c949e6be44dfabcb2 | |
parent | Add thrift json/http listener (diff) | |
download | masterserver-ac26185b987727fcf6ae79ffdc59c10f424f8547.tar.gz masterserver-ac26185b987727fcf6ae79ffdc59c10f424f8547.tar.xz masterserver-ac26185b987727fcf6ae79ffdc59c10f424f8547.zip |
[thrift] JSONHTTP: Fix handling large output
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java b/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java index f130989..b56f64e 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java +++ b/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java @@ -1,6 +1,7 @@ package org.openslx.imagemaster.thrift.server; import java.io.IOException; +import java.util.Arrays; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -62,8 +63,7 @@ public class HttpListener extends NanoHTTPD processor.process( inprotocol, outprotocol ); - buffer = new byte[ outbuffer.length() ]; - outbuffer.readAll( buffer, 0, buffer.length ); + buffer = Arrays.copyOf( outbuffer.getArray(), outbuffer.length() ); Response response = new Response( Response.Status.OK, "application/json", buffer ); addCorsHeaders( response ); |