@Test public void utf8FixupNull() { Mockito.when(request.getQueryString()).thenReturn("&&=a&=&&a&a=a=a=a"); servlet.utf8Fixup(request, new HashMap<>()); }
void utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params) { if (req.getQueryString() == null) { return; } final String[] paramsInQueryString = req.getQueryString().split("&"); if (paramsInQueryString != null) { for (final String param : paramsInQueryString) { final String[] paramTokens = param.split("=", 2); if (paramTokens.length == 2) { final String name = decodeUtf8(paramTokens[0]); final String value = decodeUtf8(paramTokens[1]); params.put(name, new String[]{value}); } else { s_logger.debug("Invalid parameter in URL found. param: " + param); } } } }
ApiServlet extends HttpServlet { void utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params) { if (req.getQueryString() == null) { return; } final String[] paramsInQueryString = req.getQueryString().split("&"); if (paramsInQueryString != null) { for (final String param : paramsInQueryString) { final String[] paramTokens = param.split("=", 2); if (paramTokens.length == 2) { final String name = decodeUtf8(paramTokens[0]); final String value = decodeUtf8(paramTokens[1]); params.put(name, new String[]{value}); } else { s_logger.debug("Invalid parameter in URL found. param: " + param); } } } } }
ApiServlet extends HttpServlet { void utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params) { if (req.getQueryString() == null) { return; } final String[] paramsInQueryString = req.getQueryString().split("&"); if (paramsInQueryString != null) { for (final String param : paramsInQueryString) { final String[] paramTokens = param.split("=", 2); if (paramTokens.length == 2) { final String name = decodeUtf8(paramTokens[0]); final String value = decodeUtf8(paramTokens[1]); params.put(name, new String[]{value}); } else { s_logger.debug("Invalid parameter in URL found. param: " + param); } } } } ApiServlet(); }
ApiServlet extends HttpServlet { void utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params) { if (req.getQueryString() == null) { return; } final String[] paramsInQueryString = req.getQueryString().split("&"); if (paramsInQueryString != null) { for (final String param : paramsInQueryString) { final String[] paramTokens = param.split("=", 2); if (paramTokens.length == 2) { final String name = decodeUtf8(paramTokens[0]); final String value = decodeUtf8(paramTokens[1]); params.put(name, new String[]{value}); } else { s_logger.debug("Invalid parameter in URL found. param: " + param); } } } } ApiServlet(); @Override void init(final ServletConfig config); }
ApiServlet extends HttpServlet { void utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params) { if (req.getQueryString() == null) { return; } final String[] paramsInQueryString = req.getQueryString().split("&"); if (paramsInQueryString != null) { for (final String param : paramsInQueryString) { final String[] paramTokens = param.split("=", 2); if (paramTokens.length == 2) { final String name = decodeUtf8(paramTokens[0]); final String value = decodeUtf8(paramTokens[1]); params.put(name, new String[]{value}); } else { s_logger.debug("Invalid parameter in URL found. param: " + param); } } } } ApiServlet(); @Override void init(final ServletConfig config); static final Logger s_logger; }