Skip to content

Commit

Permalink
HADOOP-16556. Fix some alerts raised by LGTM.
Browse files Browse the repository at this point in the history
Contributed by Malcolm Taylor.

Change-Id: Ic60c3f4681dd9d48b3afcba7520bd1e4d3cc4231
  • Loading branch information
malcolmtaylor authored and steveloughran committed Sep 19, 2019
1 parent d4205dc commit 56248f9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static String replaceParameters(String format,
if (paramNum != null) {
try {
int num = Integer.parseInt(paramNum);
if (num < 0 || num > params.length) {
if (num < 0 || num >= params.length) {
throw new BadFormatString("index " + num + " from " + format +
" is outside of the valid range 0 to " +
(params.length - 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ public void logCurrentHadoopUser() {
UserGroupInformation realUser = currentUser.getRealUser();
LOG.info("Real User = {}" , realUser);
} catch (IOException e) {
LOG.warn("Failed to get current user {}, {}", e);
LOG.warn("Failed to get current user, {}", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected void log(Response.Status status, Throwable throwable) {
String path = MDC.get("path");
String message = getOneLineMessage(throwable);
AUDIT_LOG.warn("FAILED [{}:{}] response [{}] {}", new Object[]{method, path, status, message});
LOG.warn("[{}:{}] response [{}] {}", new Object[]{method, path, status, message}, throwable);
LOG.warn("[{}:{}] response [{}] {}", method, path, status, message, throwable);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public Response toResponse(Exception e) {
s = Response.Status.BAD_REQUEST;
} else if (e instanceof IllegalArgumentException) {
s = Response.Status.BAD_REQUEST;
} else if (e instanceof NumberFormatException) {
s = Response.Status.BAD_REQUEST;
} else if (e instanceof BadRequestException) {
s = Response.Status.BAD_REQUEST;
} else if (e instanceof WebApplicationException
Expand Down

0 comments on commit 56248f9

Please sign in to comment.