Skip to content

Commit 11cec9a

Browse files
authored
HDFS-15523. Fix findbugs warnings from HDFS-15520. (#2218)
1 parent 3fd3aeb commit 11cec9a

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/visitor/NamespacePrintVisitor.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
import org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature;
3333
import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot;
3434

35-
import java.io.File;
36-
import java.io.FileWriter;
37-
import java.io.IOException;
38-
import java.io.PrintStream;
3935
import java.io.PrintWriter;
4036
import java.io.StringWriter;
4137

@@ -50,17 +46,10 @@
5046
* \- file3 (INodeFile@78392d6)
5147
* \- z_file4 (INodeFile@45848712)
5248
*/
53-
public class NamespacePrintVisitor implements NamespaceVisitor {
49+
public final class NamespacePrintVisitor implements NamespaceVisitor {
5450
static final String NON_LAST_ITEM = "+-";
5551
static final String LAST_ITEM = "\\-";
5652

57-
/** Print the tree from the given root to a {@link File}. */
58-
public static void print2File(INode root, File f) throws IOException {
59-
try(final PrintWriter out = new PrintWriter(new FileWriter(f), true)) {
60-
new NamespacePrintVisitor(out).print(root);
61-
}
62-
}
63-
6453
/** @return string of the tree in the given {@link FSNamesystem}. */
6554
public static String print2Sting(FSNamesystem ns) {
6655
return print2Sting(ns.getFSDirectory().getRoot());
@@ -73,25 +62,13 @@ public static String print2Sting(INode root) {
7362
return out.getBuffer().toString();
7463
}
7564

76-
/**
77-
* Print the tree in the given {@link FSNamesystem}
78-
* to the given {@link PrintStream}.
79-
*/
80-
public static void print(FSNamesystem ns, PrintStream out) {
81-
new NamespacePrintVisitor(new PrintWriter(out)).print(ns);
82-
}
83-
8465
private final PrintWriter out;
8566
private final StringBuffer prefix = new StringBuffer();
8667

8768
private NamespacePrintVisitor(PrintWriter out) {
8869
this.out = out;
8970
}
9071

91-
private void print(FSNamesystem namesystem) {
92-
print(namesystem.getFSDirectory().getRoot());
93-
}
94-
9572
private void print(INode root) {
9673
root.accept(this, Snapshot.CURRENT_STATE_ID);
9774
}

0 commit comments

Comments
 (0)