Catch NumberFormatException on invalid request
This prevents NumberFormatException in RestApiServlet on queries like: GET /gerrit/changes/?n=25&O=815%20oR%209%3D9%20%2B%201 Which results with ERROR| RestApiServlet | Error in GET /gerrit/changes/?n=25&O=815%20oR%209%3D9%20%2B%201 java.lang.NumberFormatException: For input string: "815 oR 9=9 + 1" plus the stack trace without this patch. Change-Id: I631c51e768095998f87d861fd09d0394f23c81c1 Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
This commit is contained in:
@@ -66,7 +66,7 @@ class ParameterParser {
|
||||
CmdLineParser clp = parserFactory.create(param);
|
||||
try {
|
||||
clp.parseOptionMap(in);
|
||||
} catch (CmdLineException e) {
|
||||
} catch (CmdLineException | NumberFormatException e) {
|
||||
if (!clp.wasHelpRequestedByOption()) {
|
||||
replyError(req, res, SC_BAD_REQUEST, e.getMessage(), e);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user