Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Kondaka <[email protected]>
  • Loading branch information
kkondaka committed Feb 7, 2025
1 parent a44f909 commit 1a2e88c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data-prepper-plugins/otel-proto-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

test {
jvmArgs '-Xmx4g'
jvmArgs '-Xmx512m'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public void parse(InputStream inputStream, Instant timeReceivedMs, Consumer<Reco
// Each request is written in a separate S3 object, so, no legth preceeding the actual data
// Same with Kafka exporter too. Each message is written as a separate message to Kafka
if (!lengthPrefixedEncoding) {
if (inputStream.available() > MAX_REQUEST_LEN) {
throw new IOException("buffer length exceeds max allowed buffer length of "+ MAX_REQUEST_LEN);
int available = inputStream.available();
if (available > MAX_REQUEST_LEN) {
throw new IOException("buffer length " + available + " exceeds max allowed buffer length of "+ MAX_REQUEST_LEN);
}
byte[] buffer = inputStream.readAllBytes();
parseRequest(buffer, timeReceivedMs, eventConsumer);
Expand All @@ -65,7 +66,7 @@ public void parse(InputStream inputStream, Instant timeReceivedMs, Consumer<Reco
ByteBuffer lengthBuffer = ByteBuffer.wrap(lenBytes);
int len = lengthBuffer.getInt();
if (len > MAX_REQUEST_LEN) {
throw new IOException("buffer length exceeds max allowed buffer length of "+ MAX_REQUEST_LEN);
throw new IOException("buffer length " + len + " exceeds max allowed buffer length of "+ MAX_REQUEST_LEN);
}
byte[] buffer = new byte[len];
if (inputStream.read(buffer, 0, len) != len) {
Expand Down

0 comments on commit 1a2e88c

Please sign in to comment.