HDFS-6162. Format strings should use platform independent line separator. Contributed by Suresh Srinivas.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1582181 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2014-03-27 04:25:09 +00:00
parent fd3d5ab792
commit 21d225af4d
5 changed files with 11 additions and 8 deletions

View File

@ -278,6 +278,9 @@ Release 2.5.0 - UNRELEASED
HDFS-3087. Decomissioning on NN restart can complete without blocks being
replicated. (Rushabh S Shah via kihwal)
HDFS-6162. Format strings should use platform independent line separator.
(suresh)
Release 2.4.0 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -801,7 +801,7 @@ private int readWithStrategy(ReaderStrategy strategy, int off, int len) throws I
// got a EOS from reader though we expect more data on it.
throw new IOException("Unexpected EOS from the reader");
}
if (dfsClient.stats != null && result != -1) {
if (dfsClient.stats != null) {
dfsClient.stats.incrementBytesRead(result);
}
return result;

View File

@ -4997,7 +4997,7 @@ String getTurnOffTip() {
if (blockSafe < blockThreshold) {
msg += String.format(
"The reported blocks %d needs additional %d"
+ " blocks to reach the threshold %.4f of total blocks %d.\n",
+ " blocks to reach the threshold %.4f of total blocks %d.%n",
blockSafe, (blockThreshold - blockSafe) + 1, threshold, blockTotal);
thresholdsMet = false;
} else {
@ -5007,7 +5007,7 @@ String getTurnOffTip() {
if (numLive < datanodeThreshold) {
msg += String.format(
"The number of live datanodes %d needs an additional %d live "
+ "datanodes to reach the minimum number %d.\n",
+ "datanodes to reach the minimum number %d.%n",
numLive, (datanodeThreshold - numLive), datanodeThreshold);
thresholdsMet = false;
} else {

View File

@ -583,7 +583,7 @@ public int run(Configuration conf, List<String> args) throws IOException {
tableListing.addRow(row.toArray(new String[0]));
numEntries++;
}
System.out.print(String.format("Found %d entr%s\n",
System.out.print(String.format("Found %d entr%s%n",
numEntries, numEntries == 1 ? "y" : "ies"));
if (numEntries > 0) {
System.out.print(tableListing);
@ -968,7 +968,7 @@ public int run(Configuration conf, List<String> args) throws IOException {
System.err.println(prettifyException(e));
return 2;
}
System.out.print(String.format("Found %d result%s.\n", numResults,
System.out.print(String.format("Found %d result%s.%n", numResults,
(numResults == 1 ? "" : "s")));
if (numResults > 0) {
System.out.print(listing);

View File

@ -159,7 +159,7 @@ private void listINode(String parent, INode inode) {
INodeFile f = inode.getFile();
PermissionStatus p = FSImageFormatPBINode.Loader.loadPermission(
f.getPermission(), stringTable);
out.print(String.format("-%s %2s %8s %10s %10s %10d %s%s\n", p
out.print(String.format("-%s %2s %8s %10s %10s %10d %s%s%n", p
.getPermission().toString(), f.getReplication(), p.getUserName(), p
.getGroupName(), f.getModificationTime(), getFileSize(f), parent,
inode.getName().toStringUtf8()));
@ -169,7 +169,7 @@ private void listINode(String parent, INode inode) {
INodeDirectory d = inode.getDirectory();
PermissionStatus p = FSImageFormatPBINode.Loader.loadPermission(
d.getPermission(), stringTable);
out.print(String.format("d%s - %8s %10s %10s %10d %s%s\n", p
out.print(String.format("d%s - %8s %10s %10s %10d %s%s%n", p
.getPermission().toString(), p.getUserName(), p.getGroupName(), d
.getModificationTime(), 0, parent, inode.getName().toStringUtf8()));
}
@ -178,7 +178,7 @@ private void listINode(String parent, INode inode) {
INodeSymlink d = inode.getSymlink();
PermissionStatus p = FSImageFormatPBINode.Loader.loadPermission(
d.getPermission(), stringTable);
out.print(String.format("-%s - %8s %10s %10s %10d %s%s -> %s\n", p
out.print(String.format("-%s - %8s %10s %10s %10d %s%s -> %s%n", p
.getPermission().toString(), p.getUserName(), p.getGroupName(), d
.getModificationTime(), 0, parent, inode.getName().toStringUtf8(),
d.getTarget().toStringUtf8()));