YARN-4366. Fix Lint Warnings in YARN Common (templedf via rkanter)

(cherry picked from commit bf6f4a3b98)
This commit is contained in:
Robert Kanter 2016-07-12 15:12:25 -07:00
parent 1f96baf4ad
commit 7aaf82d469
2 changed files with 5 additions and 10 deletions

View File

@ -59,16 +59,11 @@ public class RpcFactoryProvider {
private static Object getFactoryClassInstance(String factoryClassName) {
try {
Class<?> clazz = Class.forName(factoryClassName);
Method method = clazz.getMethod("get", null);
Method method = clazz.getMethod("get");
method.setAccessible(true);
return method.invoke(null, null);
} catch (ClassNotFoundException e) {
throw new YarnRuntimeException(e);
} catch (NoSuchMethodException e) {
throw new YarnRuntimeException(e);
} catch (InvocationTargetException e) {
throw new YarnRuntimeException(e);
} catch (IllegalAccessException e) {
return method.invoke(null);
} catch (ClassNotFoundException | NoSuchMethodException |
InvocationTargetException | IllegalAccessException e) {
throw new YarnRuntimeException(e);
}
}

View File

@ -97,7 +97,7 @@ class Router {
// Note: this does not distinguish methods with the same signature
// but different return types.
// TODO: We may want to deal with methods that take parameters in the future
Method method = cls.getMethod(action, null);
Method method = cls.getMethod(action);
Dest dest = routes.get(path);
if (dest == null) {
method.setAccessible(true); // avoid any runtime checks