Browse Source

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

(cherry picked from commit bf6f4a3b980a07d0b268eeb984a649a362877734)
Robert Kanter 9 năm trước cách đây
mục cha
commit
7aaf82d469

+ 4 - 9
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);
     }
   }

+ 1 - 1
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