From 3d5085595286c0231f66543d1509247ad4bb5739 Mon Sep 17 00:00:00 2001 From: Xiaoyu Yao Date: Wed, 14 Oct 2015 13:22:58 -0700 Subject: [PATCH] HDFS-9210. Fix some misuse of %n in VolumeScanner#printStats. Contributed by Xiaoyu Yao. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../apache/hadoop/hdfs/server/datanode/VolumeScanner.java | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 127cb0d2300..3c66951a805 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -2060,6 +2060,8 @@ Release 2.8.0 - UNRELEASED HDFS-9187. Fix null pointer error in Globber when FS was not constructed via FileSystem#createFileSystem (cmccabe) + HDFS-9210. Fix some misuse of %n in VolumeScanner#printStats. (xyao) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java index 212e13b369d..d6700f00035 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java @@ -216,9 +216,8 @@ public class VolumeScanner extends Thread { } public void printStats(StringBuilder p) { - p.append("Block scanner information for volume " + - volume.getStorageID() + " with base path " + volume.getBasePath() + - "%n"); + p.append(String.format("Block scanner information for volume %s with base" + + " path %s%n" + volume.getStorageID(), volume.getBasePath())); synchronized (stats) { p.append(String.format("Bytes verified in last hour : %57d%n", stats.bytesScannedInPastHour)); @@ -245,7 +244,7 @@ public class VolumeScanner extends Thread { stats.lastBlockScanned.toString()))); p.append(String.format("More blocks to scan in period : %57s%n", !stats.eof)); - p.append("%n"); + p.append(String.format("%n")); } }