YARN-3582. NPE in WebAppProxyServlet. Contributed by Jian He
This commit is contained in:
parent
90b3845648
commit
a583a40693
|
@ -316,6 +316,8 @@ Release 2.8.0 - UNRELEASED
|
|||
YARN-3343. Increased TestCapacitySchedulerNodeLabelUpdate#testNodeUpdate
|
||||
timeout. (Rohith Sharmaks via jianhe)
|
||||
|
||||
YARN-3582. NPE in WebAppProxyServlet. (jian he via xgong)
|
||||
|
||||
Release 2.7.1 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -248,8 +248,11 @@ public class WebAppProxyServlet extends HttpServlet {
|
|||
final String remoteUser = req.getRemoteUser();
|
||||
final String pathInfo = req.getPathInfo();
|
||||
|
||||
String[] parts = pathInfo.split("/", 3);
|
||||
if(parts.length < 2) {
|
||||
String[] parts = null;
|
||||
if (pathInfo != null) {
|
||||
parts = pathInfo.split("/", 3);
|
||||
}
|
||||
if(parts == null || parts.length < 2) {
|
||||
LOG.warn("{} gave an invalid proxy path {}", remoteUser, pathInfo);
|
||||
notFound(resp, "Your path appears to be formatted incorrectly.");
|
||||
return;
|
||||
|
|
|
@ -131,6 +131,13 @@ public class TestWebAppProxyServlet {
|
|||
|
||||
// wrong url
|
||||
try {
|
||||
// wrong url without app ID
|
||||
URL emptyUrl = new URL("http://localhost:" + proxyPort + "/proxy");
|
||||
HttpURLConnection emptyProxyConn = (HttpURLConnection) emptyUrl
|
||||
.openConnection();
|
||||
emptyProxyConn.connect();;
|
||||
assertEquals(HttpURLConnection.HTTP_NOT_FOUND, emptyProxyConn.getResponseCode());
|
||||
|
||||
// wrong url. Set wrong app ID
|
||||
URL wrongUrl = new URL("http://localhost:" + proxyPort + "/proxy/app");
|
||||
HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl
|
||||
|
|
Loading…
Reference in New Issue