diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java index 42067e8ccc4..027dc84d072 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/factory/providers/RpcFactoryProvider.java @@ -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); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java index cf78818ede5..c46b50ea02a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java @@ -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