Fix #4522 - override write method in LoggingStream (#4531)
* Fix #4522 - override write method in LoggingStream
Signed-off-by: tvallin <thibault.vallin@oracle.com>
diff --git a/core-common/src/main/java/org/glassfish/jersey/logging/LoggingInterceptor.java b/core-common/src/main/java/org/glassfish/jersey/logging/LoggingInterceptor.java
index 5863c7b..c90d8b6 100644
--- a/core-common/src/main/java/org/glassfish/jersey/logging/LoggingInterceptor.java
+++ b/core-common/src/main/java/org/glassfish/jersey/logging/LoggingInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -285,6 +285,17 @@
}
out.write(i);
}
+
+ @Override
+ public void write(byte[] ba, int off, int len) throws IOException {
+ if ((off | len | ba.length - (len + off) | off + len) < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ if ((baos.size() + len) <= maxEntitySize) {
+ baos.write(ba, off, len);
+ }
+ out.write(ba, off, len);
+ }
}
}