Fix possible NPE in GerritJsonServlet
getMethodClass() may return null. Change-Id: Ic596400c94515056ff64919d15f4b27e1eaf9588 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
parent
fb83532cb3
commit
9774d2a331
@ -166,14 +166,18 @@ final class GerritJsonServlet extends JsonServlet<GerritJsonServlet.GerritCall>
|
||||
}
|
||||
|
||||
private String extractWhat(final Audit note, final GerritCall call) {
|
||||
String methodClass = call.getMethodClass().getName();
|
||||
methodClass = methodClass.substring(methodClass.lastIndexOf(".")+1);
|
||||
Class<?> methodClass = call.getMethodClass();
|
||||
String methodClassName = methodClass != null
|
||||
? methodClass.getName()
|
||||
: "<UNKNOWN_CLASS>";
|
||||
methodClassName =
|
||||
methodClassName.substring(methodClassName.lastIndexOf(".") + 1);
|
||||
String what = note.action();
|
||||
if (what.length() == 0) {
|
||||
what = call.getMethod().getName();
|
||||
}
|
||||
|
||||
return methodClass + "." + what;
|
||||
return methodClassName + "." + what;
|
||||
}
|
||||
|
||||
static class GerritCall extends ActiveCall {
|
||||
|
Loading…
Reference in New Issue
Block a user