From c288db9f3687e5452bf814ce4f6aeb9884b4e37f Mon Sep 17 00:00:00 2001 From: Maciej Kwidzinski Date: Mon, 1 Jul 2024 15:42:38 +0200 Subject: [PATCH] Remove the shared `MetadataEvent` buffer --- .../jmc/flightrecorder/testutils/parser/MetadataEvent.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/org/openjdk/jmc/flightrecorder/testutils/parser/MetadataEvent.java b/src/main/java/org/openjdk/jmc/flightrecorder/testutils/parser/MetadataEvent.java index 9408b81..7701323 100644 --- a/src/main/java/org/openjdk/jmc/flightrecorder/testutils/parser/MetadataEvent.java +++ b/src/main/java/org/openjdk/jmc/flightrecorder/testutils/parser/MetadataEvent.java @@ -52,9 +52,6 @@ */ public final class MetadataEvent { - // TODO WTF! this is not even that MetadataEvent instances are not thread-safe, the whole class itself is not thread-safe - private static final byte[] COMMON_BUFFER = new byte[4096]; // reusable byte buffer - public final int size; public final long startTime; public final long duration; @@ -179,7 +176,7 @@ private String readUTF8(RecordingStream stream) throws IOException { return ""; } else if (id == 3) { int size = stream.readVarint(); - byte[] content = size <= COMMON_BUFFER.length ? COMMON_BUFFER : new byte[size]; + byte[] content = new byte[size]; stream.read(content, 0, size); return new String(content, 0, size, StandardCharsets.UTF_8); } else if (id == 4) {