Skip to content

Commit 894a7e8

Browse files
sarutakdongjoon-hyun
authored andcommitted
[SPARK-54400][SQL] Replace HtmlUtils.parseQueryString in ThriftHttpServlet.java with HttpServletRequest.getQueryString
### What changes were proposed in this pull request? This PR aims to replace `HtmlUtils.parseQueryString` in `ThriftHttpServlet.java` with `HttpServletRequest.getQueryString` ### Why are the changes needed? `HttpUtils` was deprecated in Servlet 5.0 and removed in 6.0. https://jakarta.ee/specifications/servlet/5.0/apidocs/jakarta/servlet/http/httputils This change is necessary for upgrading Jetty to 12 in #53116 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? GA. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53119 from sarutak/replace-http-utils. Authored-by: Kousuke Saruta <sarutak@amazon.co.jp> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent 13fea4f commit 894a7e8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
157157
SessionManager.setUserName(clientUserName);
158158

159159
// find proxy user if any from query param
160-
String doAsQueryParam = getDoAsQueryParam(request.getQueryString());
160+
String doAsQueryParam = getDoAsQueryParam(request);
161161
if (doAsQueryParam != null) {
162162
SessionManager.setProxyUserName(doAsQueryParam);
163163
}
@@ -546,14 +546,15 @@ private boolean isKerberosAuthMode(String authType) {
546546
return authType.equalsIgnoreCase(HiveAuthFactory.AuthTypes.KERBEROS.toString());
547547
}
548548

549-
private static String getDoAsQueryParam(String queryString) {
549+
private static String getDoAsQueryParam(HttpServletRequest request) {
550+
String queryString = request.getQueryString();
550551
if (LOG.isDebugEnabled()) {
551552
LOG.debug("URL query string:" + queryString);
552553
}
553554
if (queryString == null) {
554555
return null;
555556
}
556-
Map<String, String[]> params = jakarta.servlet.http.HttpUtils.parseQueryString( queryString );
557+
Map<String, String[]> params = request.getParameterMap();
557558
Set<String> keySet = params.keySet();
558559
for (String key: keySet) {
559560
if (key.equalsIgnoreCase("doAs")) {

0 commit comments

Comments
 (0)