roczei commented on PR #8357:
URL: https://github.com/apache/hadoop/pull/8357#issuecomment-4100860987
Found another bug. The issue isn't just with multiple parameters. If the
toFetch.getQuery() doesn't have a path , it throws a
java.lang.NullPointerException. I was able to reproduce it with this:
```
$ git diff
diff --git
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/TestWebAppProxyServlet.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/TestWebAppProxyServlet.java
index d59beecd91..92456bcfbc 100644
---
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/TestWebAppProxyServlet.java
+++
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/TestWebAppProxyServlet.java
@@ -373,6 +373,9 @@ void testRedirectFlagProxyServlet() throws IOException,
ServletException {
appReportFetcher.answer = 9;
servlet.doGet(request, response);
+ appReportFetcher.answer = 10;
+ servlet.doGet(request, response);
+
ArgumentCaptor<Integer> statusCaptor =
ArgumentCaptor.forClass(Integer.class);
Mockito.verify(response,
Mockito.times(3)).setStatus(statusCaptor.capture());
assertEquals(HttpServletResponse.SC_OK,
statusCaptor.getAllValues().get(0));
@@ -711,6 +714,11 @@ public FetchedAppReport
getApplicationReport(ApplicationId appId)
result.getApplicationReport().setOriginalTrackingUrl("localhost:"
+ originalPort +
"/foo/bar?parameter1=true&yarn_knox_proxy=true&doAs=user");
return result;
+ } if (answer == 10) {
+ FetchedAppReport result = getDefaultApplicationReport(appId);
+ result.getApplicationReport().setOriginalTrackingUrl("localhost:"
+ + originalPort);
+ return result;
}
return null;
}
$
```
```
2026-03-20 21:32:20,957 [main] INFO webproxy.WebAppProxyServlet
(WebAppProxyServlet.java:methodAction(519)) - dr.who is accessing unchecked
http://localhost:60879 which is the app master GUI of application_00_0 owned by
dr.who
java.lang.NullPointerException: Cannot invoke
"String.contains(java.lang.CharSequence)" because the return value of
"java.net.URI.getQuery()" is null
at
org.apache.hadoop.yarn.server.webproxy.WebAppProxyServlet.methodAction(WebAppProxyServlet.java:556)
at
org.apache.hadoop.yarn.server.webproxy.WebAppProxyServlet.doGet(WebAppProxyServlet.java:375)
at
org.apache.hadoop.yarn.server.webproxy.TestWebAppProxyServlet.testRedirectFlagProxyServlet(TestWebAppProxyServlet.java:377)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
```
Related line: WebAppProxyServlet.java:556
```
if (!redirectFlagName.isBlank() &&
toFetch.getQuery().contains(redirectFlagName + "=true")) {
```
I'll fix it in this PR and update the Jira ticket too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]