Skip to content

Commit 8f09356

Browse files
committed
spotless apply
1 parent d9c7a76 commit 8f09356

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

instrumentation/servlet/servlet-5.0/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/servlet/v5_0/Servlet50AndFilterInstrumentation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ public static void exit(
187187

188188
if (!request.isAsyncStarted()) {
189189
if (instrumentationConfig.httpHeaders().response()) {
190-
httpResponse.flushBuffer();
190+
if (throwable == null && !httpResponse.isCommitted()) {
191+
httpResponse.flushBuffer();
192+
}
191193
for (String headerName : httpResponse.getHeaderNames()) {
192194
String headerValue = httpResponse.getHeader(headerName);
193195
currentSpan.setAttribute(
@@ -217,8 +219,8 @@ public static void exit(
217219
urlEncodedMapContextStore);
218220
}
219221
}
220-
} catch (IOException ignored) {}
221-
finally {
222+
} catch (IOException ignored) {
223+
} finally {
222224
Throwable tmp = throwable;
223225
while (tmp != null) { // loop in case our exception is nested (eg. springframework)
224226
if (tmp instanceof HypertraceEvaluationException) {

0 commit comments

Comments
 (0)