>,
*
* @param out the writer to write to.
*/
- public void writeXml(String propertyName, Writer out)
+ public void writeXml(@Nullable String propertyName, Writer out)
throws IOException, IllegalArgumentException {
Document doc = asXmlDocument(propertyName);
@@ -3495,7 +3496,7 @@ public class Configuration implements Iterable>,
/**
* Return the XML DOM corresponding to this Configuration.
*/
- private synchronized Document asXmlDocument(String propertyName)
+ private synchronized Document asXmlDocument(@Nullable String propertyName)
throws IOException, IllegalArgumentException {
Document doc;
try {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Groups.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Groups.java
index 63ec9a5d29e..b29278bd207 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Groups.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Groups.java
@@ -375,7 +375,7 @@ public class Groups {
backgroundRefreshException.incrementAndGet();
backgroundRefreshRunning.decrementAndGet();
}
- });
+ }, MoreExecutors.directExecutor());
return listenableFuture;
}
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SemaphoredDelegatingExecutor.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SemaphoredDelegatingExecutor.java
index bcc19e35e85..4ec77e75ba5 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SemaphoredDelegatingExecutor.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SemaphoredDelegatingExecutor.java
@@ -107,7 +107,7 @@ public class SemaphoredDelegatingExecutor extends
queueingPermits.acquire();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- return Futures.immediateFailedCheckedFuture(e);
+ return Futures.immediateFailedFuture(e);
}
return super.submit(new CallableWithPermitRelease<>(task));
}
@@ -118,7 +118,7 @@ public class SemaphoredDelegatingExecutor extends
queueingPermits.acquire();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- return Futures.immediateFailedCheckedFuture(e);
+ return Futures.immediateFailedFuture(e);
}
return super.submit(new RunnableWithPermitRelease(task), result);
}
@@ -129,7 +129,7 @@ public class SemaphoredDelegatingExecutor extends
queueingPermits.acquire();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- return Futures.immediateFailedCheckedFuture(e);
+ return Futures.immediateFailedFuture(e);
}
return super.submit(new RunnableWithPermitRelease(task));
}
@@ -173,10 +173,10 @@ public class SemaphoredDelegatingExecutor extends
public String toString() {
final StringBuilder sb = new StringBuilder(
"SemaphoredDelegatingExecutor{");
- sb.append("permitCount=").append(getPermitCount());
- sb.append(", available=").append(getAvailablePermits());
- sb.append(", waiting=").append(getWaitingCount());
- sb.append('}');
+ sb.append("permitCount=").append(getPermitCount())
+ .append(", available=").append(getAvailablePermits())
+ .append(", waiting=").append(getWaitingCount())
+ .append('}');
return sb.toString();
}
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ZKUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ZKUtil.java
index d23df79d27f..c6f8a959b1c 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ZKUtil.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ZKUtil.java
@@ -172,7 +172,7 @@ public class ZKUtil {
return valInConf;
}
String path = valInConf.substring(1).trim();
- return Files.toString(new File(path), Charsets.UTF_8).trim();
+ return Files.asCharSource(new File(path), Charsets.UTF_8).read().trim();
}
/**
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestTableMapping.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestTableMapping.java
index a93f9ea5e4e..4b8b02f0171 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestTableMapping.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestTableMapping.java
@@ -41,8 +41,8 @@ public class TestTableMapping {
public void testResolve() throws IOException {
File mapFile = File.createTempFile(getClass().getSimpleName() +
".testResolve", ".txt");
- Files.write(hostName1 + " /rack1\n" +
- hostName2 + "\t/rack2\n", mapFile, Charsets.UTF_8);
+ Files.asCharSink(mapFile, Charsets.UTF_8).write(
+ hostName1 + " /rack1\n" + hostName2 + "\t/rack2\n");
mapFile.deleteOnExit();
TableMapping mapping = new TableMapping();
@@ -64,8 +64,8 @@ public class TestTableMapping {
public void testTableCaching() throws IOException {
File mapFile = File.createTempFile(getClass().getSimpleName() +
".testTableCaching", ".txt");
- Files.write(hostName1 + " /rack1\n" +
- hostName2 + "\t/rack2\n", mapFile, Charsets.UTF_8);
+ Files.asCharSink(mapFile, Charsets.UTF_8).write(
+ hostName1 + " /rack1\n" + hostName2 + "\t/rack2\n");
mapFile.deleteOnExit();
TableMapping mapping = new TableMapping();
@@ -128,8 +128,8 @@ public class TestTableMapping {
public void testClearingCachedMappings() throws IOException {
File mapFile = File.createTempFile(getClass().getSimpleName() +
".testClearingCachedMappings", ".txt");
- Files.write(hostName1 + " /rack1\n" +
- hostName2 + "\t/rack2\n", mapFile, Charsets.UTF_8);
+ Files.asCharSink(mapFile, Charsets.UTF_8).write(
+ hostName1 + " /rack1\n" + hostName2 + "\t/rack2\n");
mapFile.deleteOnExit();
TableMapping mapping = new TableMapping();
@@ -147,7 +147,7 @@ public class TestTableMapping {
assertEquals("/rack1", result.get(0));
assertEquals("/rack2", result.get(1));
- Files.write("", mapFile, Charsets.UTF_8);
+ Files.asCharSink(mapFile, Charsets.UTF_8).write("");
mapping.reloadCachedMappings();
@@ -166,7 +166,7 @@ public class TestTableMapping {
public void testBadFile() throws IOException {
File mapFile = File.createTempFile(getClass().getSimpleName() +
".testBadFile", ".txt");
- Files.write("bad contents", mapFile, Charsets.UTF_8);
+ Files.asCharSink(mapFile, Charsets.UTF_8).write("bad contents");
mapFile.deleteOnExit();
TableMapping mapping = new TableMapping();
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java
index f7a7f8b2ddf..016c589ae3a 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java
@@ -434,7 +434,8 @@ public class TestSecurityUtil {
Configuration conf = new Configuration();
File passwordTxtFile = File.createTempFile(
getClass().getSimpleName() + ".testAuthAtPathNotation-", ".txt");
- Files.write(ZK_AUTH_VALUE, passwordTxtFile, StandardCharsets.UTF_8);
+ Files.asCharSink(passwordTxtFile, StandardCharsets.UTF_8)
+ .write(ZK_AUTH_VALUE);
try {
conf.set(CommonConfigurationKeys.ZK_AUTH,
"@" + passwordTxtFile.getAbsolutePath());
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestZKUtil.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestZKUtil.java
index 0e39ca94dea..3d985e40fb8 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestZKUtil.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestZKUtil.java
@@ -131,7 +131,7 @@ public class TestZKUtil {
assertEquals("x", ZKUtil.resolveConfIndirection("x"));
TEST_FILE.getParentFile().mkdirs();
- Files.write("hello world", TEST_FILE, Charsets.UTF_8);
+ Files.asCharSink(TEST_FILE, Charsets.UTF_8).write("hello world");
assertEquals("hello world", ZKUtil.resolveConfIndirection(
"@" + TEST_FILE.getAbsolutePath()));
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java
index afc49c76f09..11c5cea215a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/LocalResolver.java
@@ -196,7 +196,7 @@ public class LocalResolver extends RouterResolver {
try {
String nsId = nn.getNameserviceId();
String rpcAddress = nn.getRpcAddress();
- String hostname = HostAndPort.fromString(rpcAddress).getHostText();
+ String hostname = HostAndPort.fromString(rpcAddress).getHost();
ret.put(hostname, nsId);
if (hostname.equals(localHostname)) {
ret.put(localIp, nsId);
diff --git a/hadoop-hdfs-project/hadoop-hdfs/dev-support/findbugsExcludeFile.xml b/hadoop-hdfs-project/hadoop-hdfs/dev-support/findbugsExcludeFile.xml
index f9d834ee434..746df6908f8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/dev-support/findbugsExcludeFile.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/dev-support/findbugsExcludeFile.xml
@@ -192,6 +192,12 @@