Skip to content

Commit 64a3645

Browse files
committed
check for null before setting a tag
1 parent c5c7ca6 commit 64a3645

File tree

1 file changed

+4
-2
lines changed
  • dd-java-agent/instrumentation/jsp-2.3/src/main/java/datadog/trace/instrumentation/jsp

1 file changed

+4
-2
lines changed

dd-java-agent/instrumentation/jsp-2.3/src/main/java/datadog/trace/instrumentation/jsp/JSPDecorator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ public void onRender(final AgentSpan span, final HttpServletRequest req) {
6767
try {
6868
// note: getRequestURL is supposed to always be nonnull - however servlet wrapping can happen
6969
// and we never know if ever this can happen
70-
span.setTag(
71-
"jsp.requestURL", (new URI(req.getRequestURL().toString())).normalize().toString());
70+
final StringBuffer requestURL = req.getRequestURL();
71+
if (requestURL != null) {
72+
span.setTag("jsp.requestURL", (new URI(requestURL.toString())).normalize().toString());
73+
}
7274
} catch (final Throwable ignored) {
7375
// logging here will be too verbose
7476
}

0 commit comments

Comments
 (0)