HADOOP-18917. Addendum. Fix deprecation issues after commons-io upgrade. (#6228). Contributed by PJ Fanning.
This commit is contained in:
parent
7c6af6a5f6
commit
a079f6261d
@ -257,7 +257,7 @@ public void testOfflineImageViewer() throws Exception {
|
||||
FSImageTestUtil.getFSImage(
|
||||
cluster.getNameNode()).getStorage().getStorageDir(0));
|
||||
assertNotNull("Didn't generate or can't find fsimage", originalFsimage);
|
||||
PrintStream o = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM);
|
||||
PrintStream o = new PrintStream(NullOutputStream.INSTANCE);
|
||||
PBImageXmlWriter v = new PBImageXmlWriter(new Configuration(), o);
|
||||
v.visit(new RandomAccessFile(originalFsimage, "r"));
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ private static FileStatus pathToFileEntry(FileSystem hdfs, String file)
|
||||
@Test(expected = IOException.class)
|
||||
public void testTruncatedFSImage() throws IOException {
|
||||
File truncatedFile = new File(tempDir, "truncatedFsImage");
|
||||
PrintStream output = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM);
|
||||
PrintStream output = new PrintStream(NullOutputStream.INSTANCE);
|
||||
copyPartOfFile(originalFsimage, truncatedFile);
|
||||
try (RandomAccessFile r = new RandomAccessFile(truncatedFile, "r")) {
|
||||
new FileDistributionCalculator(new Configuration(), 0, 0, false, output)
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -505,7 +506,10 @@ void generateScript(File localScript) throws IOException {
|
||||
String classpath = halrJarPath + File.pathSeparator + harJarPath;
|
||||
FileWriterWithEncoding fw = null;
|
||||
try {
|
||||
fw = new FileWriterWithEncoding(localScript, "UTF-8");
|
||||
fw = FileWriterWithEncoding.builder()
|
||||
.setFile(localScript)
|
||||
.setCharset(StandardCharsets.UTF_8)
|
||||
.get();
|
||||
fw.write("#!/bin/bash\nset -e\nset -x\n");
|
||||
int containerCount = 1;
|
||||
for (AppInfo context : eligibleApplications) {
|
||||
|
@ -32,6 +32,7 @@
|
||||
import java.io.PrintStream;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -783,7 +784,10 @@ public static void readAcontainerLogs(DataInputStream valueStream,
|
||||
OutputStream os = null;
|
||||
PrintStream ps = null;
|
||||
try {
|
||||
os = new WriterOutputStream(writer, Charset.forName("UTF-8"));
|
||||
os = WriterOutputStream.builder()
|
||||
.setWriter(writer)
|
||||
.setCharset(StandardCharsets.UTF_8)
|
||||
.get();
|
||||
ps = new PrintStream(os);
|
||||
while (true) {
|
||||
try {
|
||||
|
@ -496,8 +496,9 @@ void testLevelDbRepair() throws IOException {
|
||||
store.init(conf);
|
||||
Mockito.verify(factory, Mockito.times(1))
|
||||
.repair(Mockito.any(File.class), Mockito.any(Options.class));
|
||||
FileFilter fileFilter = new WildcardFileFilter(
|
||||
"*" + LeveldbTimelineStore.BACKUP_EXT + "*");
|
||||
FileFilter fileFilter = WildcardFileFilter.builder()
|
||||
.setWildcards("*" + LeveldbTimelineStore.BACKUP_EXT +"*")
|
||||
.get();
|
||||
assertTrue(path.listFiles(fileFilter).length > 0);
|
||||
} finally {
|
||||
store.close();
|
||||
|
@ -444,8 +444,9 @@ void testLevelDbRepair() throws IOException {
|
||||
store.init(conf);
|
||||
Mockito.verify(factory, Mockito.times(1))
|
||||
.repair(Mockito.any(File.class), Mockito.any(Options.class));
|
||||
FilenameFilter fileFilter =
|
||||
new WildcardFileFilter("*" + RollingLevelDBTimelineStore.BACKUP_EXT + "*");
|
||||
FilenameFilter fileFilter = WildcardFileFilter.builder()
|
||||
.setWildcards("*" + RollingLevelDBTimelineStore.BACKUP_EXT + "*")
|
||||
.get();
|
||||
assertTrue(new File(path.getAbsolutePath(), RollingLevelDBTimelineStore.FILENAME)
|
||||
.list(fileFilter).length > 0);
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user