aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
index 2febd5ce0a..ab7642d49d 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
@@ -102,7 +102,9 @@ public class OtpOutputStream extends ByteArrayOutputStream {
*/
public void trimToSize() {
if (super.count < super.buf.length) {
- super.buf = Arrays.copyOf(super.buf, super.count);
+ final byte[] tmp = new byte[super.count];
+ System.arraycopy(super.buf, 0, tmp, 0, super.count);
+ super.buf = tmp;
}
}