YARN-3582. NPE in WebAppProxyServlet. Contributed by Jian He
(cherry picked from commit a583a40693
)
This commit is contained in:
parent
606e4f4940
commit
a0445eae5c
|
@ -271,6 +271,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