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
|
YARN-3343. Increased TestCapacitySchedulerNodeLabelUpdate#testNodeUpdate
|
||||||
timeout. (Rohith Sharmaks via jianhe)
|
timeout. (Rohith Sharmaks via jianhe)
|
||||||
|
|
||||||
|
YARN-3582. NPE in WebAppProxyServlet. (jian he via xgong)
|
||||||
|
|
||||||
Release 2.7.1 - UNRELEASED
|
Release 2.7.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -248,8 +248,11 @@ public class WebAppProxyServlet extends HttpServlet {
|
||||||
final String remoteUser = req.getRemoteUser();
|
final String remoteUser = req.getRemoteUser();
|
||||||
final String pathInfo = req.getPathInfo();
|
final String pathInfo = req.getPathInfo();
|
||||||
|
|
||||||
String[] parts = pathInfo.split("/", 3);
|
String[] parts = null;
|
||||||
if(parts.length < 2) {
|
if (pathInfo != null) {
|
||||||
|
parts = pathInfo.split("/", 3);
|
||||||
|
}
|
||||||
|
if(parts == null || parts.length < 2) {
|
||||||
LOG.warn("{} gave an invalid proxy path {}", remoteUser, pathInfo);
|
LOG.warn("{} gave an invalid proxy path {}", remoteUser, pathInfo);
|
||||||
notFound(resp, "Your path appears to be formatted incorrectly.");
|
notFound(resp, "Your path appears to be formatted incorrectly.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -131,6 +131,13 @@ public class TestWebAppProxyServlet {
|
||||||
|
|
||||||
// wrong url
|
// wrong url
|
||||||
try {
|
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
|
// wrong url. Set wrong app ID
|
||||||
URL wrongUrl = new URL("http://localhost:" + proxyPort + "/proxy/app");
|
URL wrongUrl = new URL("http://localhost:" + proxyPort + "/proxy/app");
|
||||||
HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl
|
HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl
|
||||||
|
|
Loading…
Reference in New Issue