Skip to content

Commit 316d4e3

Browse files
authored
Fix NPE in buffering request (#68)
* Fix NPE in buffering request Signed-off-by: Pavol Loffay <[email protected]> * Fix changes in the SB app Signed-off-by: Pavol Loffay <[email protected]>
1 parent b673c01 commit 316d4e3

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

instrumentation/servlet/servlet-3.0/src/main/java/io/opentelemetry/instrumentation/hypertrace/servlet/v3_0/BufferingHttpServletRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public BufferedReader getReader() throws IOException {
181181
if (reader == null) {
182182
reader = super.getReader();
183183
if (shouldReadContent()) {
184-
reader = new BufferedReaderWrapper(reader, this.charBufferData);
184+
reader = new BufferedReaderWrapper(reader, this.getCharBuffer());
185185
}
186186
}
187187
return reader;

instrumentation/servlet/servlet-3.1/src/main/java/io/opentelemetry/instrumentation/hypertrace/servlet/v3_1/BufferingHttpServletRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public BufferedReader getReader() throws IOException {
182182
if (reader == null) {
183183
reader = super.getReader();
184184
if (shouldReadContent()) {
185-
reader = new BufferedReaderWrapper(reader, this.charBufferData);
185+
reader = new BufferedReaderWrapper(reader, this.getCharBuffer());
186186
}
187187
}
188188
return reader;

smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDisabledBodyCaptureTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ public void springBootSmokeTest() throws IOException {
7272
Assertions.assertEquals(response.body().string(), "Hi!");
7373
Assertions.assertEquals(1, countSpansByName(traces, "/greeting"));
7474
Assertions.assertEquals(1, countSpansByName(traces, "webcontroller.greeting"));
75-
Assertions.assertEquals(1, countSpansByName(traces, "webcontroller.withspan"));
7675
Assertions.assertEquals(
77-
3,
76+
2,
7877
getSpanStream(traces)
7978
.flatMap(s -> s.getAttributesList().stream())
8079
.filter(a -> a.getKey().equals(OTEL_LIBRARY_VERSION_ATTRIBUTE))

smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ public void springBootSmokeTest() throws IOException {
7373
Assertions.assertEquals(response.body().string(), "Hi!");
7474
Assertions.assertEquals(1, countSpansByName(traces, "/greeting"));
7575
Assertions.assertEquals(1, countSpansByName(traces, "webcontroller.greeting"));
76-
Assertions.assertEquals(1, countSpansByName(traces, "webcontroller.withspan"));
7776
Assertions.assertEquals(
78-
3,
77+
2,
7978
getSpanStream(traces)
8079
.flatMap(s -> s.getAttributesList().stream())
8180
.filter(a -> a.getKey().equals(OTEL_LIBRARY_VERSION_ATTRIBUTE))

0 commit comments

Comments
 (0)