Revert "HADOOP-17371. Bump Jetty to the latest version 9.4.34. Contributed by Wei-Chiu Chuang. (#2453)"

This reverts commit 66ee0a6df0.
This commit is contained in:
Wei-Chiu Chuang 2021-01-21 01:14:37 -08:00 committed by GitHub
parent 06fef5ee43
commit 8a70d58a40
7 changed files with 13 additions and 67 deletions

View File

@ -840,18 +840,6 @@
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty:jetty-util-ajax</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty:jetty-server</artifact>
<excludes>
<exclude>jetty-dir.css</exclude>
</excludes>
</filter>
</filters>
<!-- relocate classes from mssql-jdbc -->

View File

@ -193,10 +193,6 @@
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -19,7 +19,6 @@ import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
import org.apache.hadoop.security.authentication.client.AuthenticationException;
import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
import org.apache.hadoop.security.authentication.util.*;
import org.eclipse.jetty.server.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -620,20 +619,11 @@ public class AuthenticationFilter implements Filter {
KerberosAuthenticator.WWW_AUTHENTICATE))) {
errCode = HttpServletResponse.SC_FORBIDDEN;
}
// After Jetty 9.4.21, sendError() no longer allows a custom message.
// use setStatusWithReason() to set a custom message.
String reason;
if (authenticationEx == null) {
reason = "Authentication required";
httpResponse.sendError(errCode, "Authentication required");
} else {
reason = authenticationEx.getMessage();
httpResponse.sendError(errCode, authenticationEx.getMessage());
}
if (httpResponse instanceof Response) {
((Response)httpResponse).setStatusWithReason(errCode, reason);
}
httpResponse.sendError(errCode, reason);
}
}
}

View File

@ -37,7 +37,6 @@ import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
import org.eclipse.jetty.server.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -272,10 +271,6 @@ public class RestCsrfPreventionFilter implements Filter {
@Override
public void sendError(int code, String message) throws IOException {
if (httpResponse instanceof Response) {
((Response)httpResponse).setStatusWithReason(code, message);
}
httpResponse.sendError(code, message);
}
}

View File

@ -28,7 +28,6 @@ import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthentica
import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationHandler;
import org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler;
import org.apache.hadoop.security.token.delegation.web.PseudoDelegationTokenAuthenticationHandler;
import org.eclipse.jetty.server.Response;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@ -114,18 +113,6 @@ public class KMSAuthenticationFilter
public void sendError(int sc, String msg) throws IOException {
statusCode = sc;
this.msg = msg;
ServletResponse response = getResponse();
// After Jetty 9.4.21, sendError() no longer allows a custom message.
// use setStatusWithReason() to set a custom message.
if (response instanceof Response) {
((Response) response).setStatusWithReason(sc, msg);
} else {
KMS.LOG.warn("The wrapped response object is instance of {}" +
", not org.eclipse.jetty.server.Response. Can't set custom error " +
"message", response.getClass());
}
super.sendError(sc, HtmlQuoting.quoteHtmlChars(msg));
}

View File

@ -42,7 +42,6 @@ import org.apache.hadoop.ha.HAServiceProtocol;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtilClient;
import org.apache.hadoop.security.SecurityUtil;
import org.eclipse.jetty.server.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.classification.InterfaceAudience;
@ -120,7 +119,7 @@ public class ImageServlet extends HttpServlet {
if (nnImage == null) {
String errorMsg = "NameNode initialization not yet complete. "
+ "FSImage has not been set in the NameNode.";
sendError(response, HttpServletResponse.SC_FORBIDDEN, errorMsg);
response.sendError(HttpServletResponse.SC_FORBIDDEN, errorMsg);
throw new IOException(errorMsg);
}
return nnImage;
@ -219,7 +218,7 @@ public class ImageServlet extends HttpServlet {
} catch (Throwable t) {
String errMsg = "GetImage failed. " + StringUtils.stringifyException(t);
sendError(response, HttpServletResponse.SC_GONE, errMsg);
response.sendError(HttpServletResponse.SC_GONE, errMsg);
throw new IOException(errMsg);
} finally {
response.getOutputStream().close();
@ -235,7 +234,7 @@ public class ImageServlet extends HttpServlet {
conf)) {
String errorMsg = "Only Namenode, Secondary Namenode, and administrators may access "
+ "this servlet";
sendError(response, HttpServletResponse.SC_FORBIDDEN, errorMsg);
response.sendError(HttpServletResponse.SC_FORBIDDEN, errorMsg);
LOG.warn("Received non-NN/SNN/administrator request for image or edits from "
+ request.getUserPrincipal().getName()
+ " at "
@ -248,7 +247,7 @@ public class ImageServlet extends HttpServlet {
&& !myStorageInfoString.equals(theirStorageInfoString)) {
String errorMsg = "This namenode has storage info " + myStorageInfoString
+ " but the secondary expected " + theirStorageInfoString;
sendError(response, HttpServletResponse.SC_FORBIDDEN, errorMsg);
response.sendError(HttpServletResponse.SC_FORBIDDEN, errorMsg);
LOG.warn("Received an invalid request file transfer request "
+ "from a secondary with storage info " + theirStorageInfoString);
throw new IOException(errorMsg);
@ -579,7 +578,7 @@ public class ImageServlet extends HttpServlet {
// we need a different response type here so the client can differentiate this
// from the failure to upload due to (1) security, or (2) other checkpoints already
// present
sendError(response, HttpServletResponse.SC_EXPECTATION_FAILED,
response.sendError(HttpServletResponse.SC_EXPECTATION_FAILED,
"Nameode "+request.getLocalAddr()+" is currently not in a state which can "
+ "accept uploads of new fsimages. State: "+state);
return null;
@ -594,7 +593,7 @@ public class ImageServlet extends HttpServlet {
// if the node is attempting to upload an older transaction, we ignore it
SortedSet<ImageUploadRequest> larger = currentlyDownloadingCheckpoints.tailSet(imageRequest);
if (larger.size() > 0) {
sendError(response, HttpServletResponse.SC_CONFLICT,
response.sendError(HttpServletResponse.SC_CONFLICT,
"Another checkpointer is already in the process of uploading a" +
" checkpoint made up to transaction ID " + larger.last());
return null;
@ -602,7 +601,7 @@ public class ImageServlet extends HttpServlet {
//make sure no one else has started uploading one
if (!currentlyDownloadingCheckpoints.add(imageRequest)) {
sendError(response, HttpServletResponse.SC_CONFLICT,
response.sendError(HttpServletResponse.SC_CONFLICT,
"Either current namenode is checkpointing or another"
+ " checkpointer is already in the process of "
+ "uploading a checkpoint made at transaction ID "
@ -649,7 +648,7 @@ public class ImageServlet extends HttpServlet {
(txid - lastCheckpointTxid) + " expecting at least "
+ checkpointTxnCount;
LOG.info(message);
sendError(response, HttpServletResponse.SC_CONFLICT, message);
response.sendError(HttpServletResponse.SC_CONFLICT, message);
return null;
}
@ -659,7 +658,7 @@ public class ImageServlet extends HttpServlet {
+ "another checkpointer already uploaded an "
+ "checkpoint for txid " + txid;
LOG.info(message);
sendError(response, HttpServletResponse.SC_CONFLICT, message);
response.sendError(HttpServletResponse.SC_CONFLICT, message);
return null;
}
@ -696,20 +695,11 @@ public class ImageServlet extends HttpServlet {
});
} catch (Throwable t) {
String errMsg = "PutImage failed. " + StringUtils.stringifyException(t);
sendError(response, HttpServletResponse.SC_GONE, errMsg);
response.sendError(HttpServletResponse.SC_GONE, errMsg);
throw new IOException(errMsg);
}
}
private void sendError(HttpServletResponse response, int code, String message)
throws IOException {
if (response instanceof Response) {
((Response)response).setStatusWithReason(code, message);
}
response.sendError(code, message);
}
/*
* Params required to handle put image request
*/

View File

@ -37,7 +37,7 @@
<!--Whether to proceed to next module if any test failures exist-->
<ignoreTestFailure>true</ignoreTestFailure>
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
<jetty.version>9.4.35.v20201120</jetty.version>
<jetty.version>9.4.20.v20190813</jetty.version>
<test.exclude>_</test.exclude>
<test.exclude.pattern>_</test.exclude.pattern>