From 471f7586730b9275a605dab91ee3ee52869c9ac3 Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Thu, 22 Mar 2018 09:21:52 -0700 Subject: [PATCH] HDFS-13318. RBF: Fix FindBugs in hadoop-hdfs-rbf. Contributed by Ekanth S. (cherry picked from commit 3d0ee8b80438bfbdf7e5af853b9044a63bd1352c) --- .../federation/resolver/NamenodePriorityComparator.java | 5 ++++- .../hadoop/hdfs/server/federation/router/RemoteMethod.java | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/NamenodePriorityComparator.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/NamenodePriorityComparator.java index fe82f29fbaa..e9724a3dee7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/NamenodePriorityComparator.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/NamenodePriorityComparator.java @@ -17,6 +17,7 @@ */ package org.apache.hadoop.hdfs.server.federation.resolver; +import java.io.Serializable; import java.util.Comparator; /** @@ -31,7 +32,9 @@ import java.util.Comparator; * breaker, newest has priority. Expired NNs are excluded. */ public class NamenodePriorityComparator - implements Comparator { + implements Comparator, Serializable { + + private static final long serialVersionUID = 2304924292036293331L; @Override public int compare(FederationNamenodeContext o1, diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RemoteMethod.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RemoteMethod.java index cd57d457798..7978105584e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RemoteMethod.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RemoteMethod.java @@ -76,7 +76,7 @@ public class RemoteMethod { } this.params = pParams; - this.types = pTypes; + this.types = Arrays.copyOf(pTypes, pTypes.length); this.methodName = method; } @@ -111,7 +111,7 @@ public class RemoteMethod { * @return An array of calling types. */ public Class[] getTypes() { - return this.types; + return Arrays.copyOf(this.types, this.types.length); } /**