HADOOP-16556. Fix some alerts raised by LGTM.
Contributed by Malcolm Taylor. Change-Id: Ic60c3f4681dd9d48b3afcba7520bd1e4d3cc4231
This commit is contained in:
parent
d4205dce17
commit
56248f9d87
|
@ -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));
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue