Skip to content

Commit 9705fc8

Browse files
authored
Merge pull request #1293 from andrejpk/andrejpk/mockmvc-error
Resolve NullPointer exception when running under test with MockMvc
2 parents aabde3d + f5bd187 commit 9705fc8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
# Version 2.6.2-BETA.3
4+
* Fixed NullPointer when testing with MockMvc ([#1281](https://github.com/microsoft/ApplicationInsights-Java/issues/1281))
5+
36
# Version 2.6.2-BETA.2
47
* Fixed retry transmission on client side exception
58
([#1282](https://github.com/microsoft/ApplicationInsights-Java/issues/1282)).

web/src/main/java/com/microsoft/applicationinsights/web/internal/WebRequestTrackingFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public final class WebRequestTrackingFilter implements Filter {
117117
* @throws ServletException Exception that can be thrown from invoking the filters chain.
118118
*/
119119
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
120-
if (req instanceof HttpServletRequest && res instanceof HttpServletResponse) {
120+
if (handler != null && req instanceof HttpServletRequest && res instanceof HttpServletResponse) {
121121
HttpServletRequest httpRequest = (HttpServletRequest) req;
122122
HttpServletResponse httpResponse = (HttpServletResponse) res;
123123
boolean hasAlreadyBeenFiltered = httpRequest.getAttribute(ALREADY_FILTERED) != null;

0 commit comments

Comments
 (0)