HADOOP-14915. method name is incorrect in ConfServlet. Contributed by Bharat Viswanadham.

(cherry picked from commit 563dcdfc1d)
This commit is contained in:
Chen Liang 2017-10-02 10:58:19 -07:00 committed by Andrew Wang
parent 0b3e3e4895
commit af52a585f0
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ public class ConfServlet extends HttpServlet {
return; return;
} }
String format = parseAccecptHeader(request); String format = parseAcceptHeader(request);
if (FORMAT_XML.equals(format)) { if (FORMAT_XML.equals(format)) {
response.setContentType("text/xml; charset=utf-8"); response.setContentType("text/xml; charset=utf-8");
} else if (FORMAT_JSON.equals(format)) { } else if (FORMAT_JSON.equals(format)) {
@ -89,7 +89,7 @@ public class ConfServlet extends HttpServlet {
} }
@VisibleForTesting @VisibleForTesting
static String parseAccecptHeader(HttpServletRequest request) { static String parseAcceptHeader(HttpServletRequest request) {
String format = request.getHeader(HttpHeaders.ACCEPT); String format = request.getHeader(HttpHeaders.ACCEPT);
return format != null && format.contains(FORMAT_JSON) ? return format != null && format.contains(FORMAT_JSON) ?
FORMAT_JSON : FORMAT_XML; FORMAT_JSON : FORMAT_XML;

View File

@ -98,7 +98,7 @@ public class TestConfServlet {
Mockito.when(request.getHeader(HttpHeaders.ACCEPT)) Mockito.when(request.getHeader(HttpHeaders.ACCEPT))
.thenReturn(contentTypeExpected); .thenReturn(contentTypeExpected);
assertEquals(contenTypeActual, assertEquals(contenTypeActual,
ConfServlet.parseAccecptHeader(request)); ConfServlet.parseAcceptHeader(request));
} }
} }