HADOOP-16556. Fix some alerts raised by LGTM.

Contributed by Malcolm Taylor.

Change-Id: Ic60c3f4681dd9d48b3afcba7520bd1e4d3cc4231
This commit is contained in:
Malcolm Taylor 2019-09-19 15:57:54 +01:00 committed by Steve Loughran
parent d4205dce17
commit 56248f9d87
No known key found for this signature in database
GPG Key ID: D22CF846DBB162A0
4 changed files with 3 additions and 5 deletions

View File

@ -281,7 +281,7 @@ public class KerberosName {
if (paramNum != null) { if (paramNum != null) {
try { try {
int num = Integer.parseInt(paramNum); int num = Integer.parseInt(paramNum);
if (num < 0 || num > params.length) { if (num < 0 || num >= params.length) {
throw new BadFormatString("index " + num + " from " + format + throw new BadFormatString("index " + num + " from " + format +
" is outside of the valid range 0 to " + " is outside of the valid range 0 to " +
(params.length - 1)); (params.length - 1));

View File

@ -926,7 +926,7 @@ public class RegistrySecurity extends AbstractService {
UserGroupInformation realUser = currentUser.getRealUser(); UserGroupInformation realUser = currentUser.getRealUser();
LOG.info("Real User = {}" , realUser); LOG.info("Real User = {}" , realUser);
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failed to get current user {}, {}", e); LOG.warn("Failed to get current user, {}", e);
} }
} }

View File

@ -92,7 +92,7 @@ public class HttpFSExceptionProvider extends ExceptionProvider {
String path = MDC.get("path"); String path = MDC.get("path");
String message = getOneLineMessage(throwable); String message = getOneLineMessage(throwable);
AUDIT_LOG.warn("FAILED [{}:{}] response [{}] {}", new Object[]{method, path, status, message}); 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);
} }
} }

View File

@ -87,8 +87,6 @@ public class GenericExceptionHandler implements ExceptionMapper<Exception> {
s = Response.Status.BAD_REQUEST; s = Response.Status.BAD_REQUEST;
} else if (e instanceof IllegalArgumentException) { } else if (e instanceof IllegalArgumentException) {
s = Response.Status.BAD_REQUEST; s = Response.Status.BAD_REQUEST;
} else if (e instanceof NumberFormatException) {
s = Response.Status.BAD_REQUEST;
} else if (e instanceof BadRequestException) { } else if (e instanceof BadRequestException) {
s = Response.Status.BAD_REQUEST; s = Response.Status.BAD_REQUEST;
} else if (e instanceof WebApplicationException } else if (e instanceof WebApplicationException