You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wh...@apache.org on 2014/12/10 05:47:10 UTC

hadoop git commit: HADOOP-11381. Fix findbugs warnings in hadoop-distcp, hadoop-aws, hadoop-azure, and hadoop-openstack. Contributed by Li Lu.

Repository: hadoop
Updated Branches:
  refs/heads/branch-2 c2514aaa8 -> a1e4a12dc


HADOOP-11381. Fix findbugs warnings in hadoop-distcp, hadoop-aws, hadoop-azure, and hadoop-openstack. Contributed by Li Lu.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a1e4a12d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a1e4a12d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a1e4a12d

Branch: refs/heads/branch-2
Commit: a1e4a12dc07fd6541c4d22318d0cc3070fc1d2dc
Parents: c2514aa
Author: Haohui Mai <wh...@apache.org>
Authored: Tue Dec 9 20:45:21 2014 -0800
Committer: Haohui Mai <wh...@apache.org>
Committed: Tue Dec 9 20:46:44 2014 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt               | 2 ++
 .../src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java | 4 ++++
 .../java/org/apache/hadoop/tools/FileBasedCopyListing.java    | 4 +++-
 .../hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java   | 7 ++++---
 .../java/org/apache/hadoop/fs/swift/util/SwiftTestUtils.java  | 4 ++--
 5 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a1e4a12d/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index a5cb164..d02a1e0 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -189,6 +189,8 @@ Release 2.7.0 - UNRELEASED
     HADOOP-11349. RawLocalFileSystem leaks file descriptor while creating a
     file if creat succeeds but chmod fails. (Varun Saxena via Colin P. McCabe)
 
+    HADOOP-11381. Fix findbugs warnings in hadoop-distcp, hadoop-aws,
+    hadoop-azure, and hadoop-openstack. (Li Lu via wheat9)
 
 Release 2.6.0 - 2014-11-18
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a1e4a12d/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
index 6bdd233..457351d 100644
--- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
+++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java
@@ -875,6 +875,8 @@ public class S3AFileSystem extends FileSystem {
           case ProgressEvent.PART_COMPLETED_EVENT_CODE:
             statistics.incrementWriteOps(1);
             break;
+          default:
+            break;
         }
       }
     };
@@ -933,6 +935,8 @@ public class S3AFileSystem extends FileSystem {
           case ProgressEvent.PART_COMPLETED_EVENT_CODE:
             statistics.incrementWriteOps(1);
             break;
+          default:
+            break;
         }
       }
     };

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a1e4a12d/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/FileBasedCopyListing.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/FileBasedCopyListing.java b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/FileBasedCopyListing.java
index 0fe93c2..2bc343e 100644
--- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/FileBasedCopyListing.java
+++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/FileBasedCopyListing.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.security.Credentials;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -74,7 +75,8 @@ public class FileBasedCopyListing extends CopyListing {
     FileSystem fs = sourceListing.getFileSystem(getConf());
     BufferedReader input = null;
     try {
-      input = new BufferedReader(new InputStreamReader(fs.open(sourceListing)));
+      input = new BufferedReader(new InputStreamReader(fs.open(sourceListing),
+          Charset.forName("UTF-8")));
       String line = input.readLine();
       while (line != null) {
         result.add(new Path(line));

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a1e4a12d/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java
index b3e6b94..0138eae 100644
--- a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java
+++ b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java
@@ -45,6 +45,7 @@ import java.io.InputStream;
 import java.io.InterruptedIOException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.nio.charset.Charset;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -352,8 +353,8 @@ public class SwiftNativeFileSystemStore {
     final CollectionType collectionType = JSONUtil.getJsonMapper().getTypeFactory().
             constructCollectionType(List.class, SwiftObjectFileStatus.class);
 
-    final List<SwiftObjectFileStatus> fileStatusList =
-            JSONUtil.toObject(new String(bytes), collectionType);
+    final List<SwiftObjectFileStatus> fileStatusList = JSONUtil.toObject(
+        new String(bytes, Charset.forName("UTF-8")), collectionType);
 
     //this can happen if user lists file /data/files/file
     //in this case swift will return empty array
@@ -447,7 +448,7 @@ public class SwiftNativeFileSystemStore {
       //no object location, return an empty list
       return new LinkedList<URI>();
     }
-    return extractUris(new String(objectLocation), path);
+    return extractUris(new String(objectLocation, Charset.forName("UTF-8")), path);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a1e4a12d/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftTestUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftTestUtils.java b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftTestUtils.java
index 7e850e7..c9e26ac 100644
--- a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftTestUtils.java
+++ b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/SwiftTestUtils.java
@@ -219,9 +219,9 @@ public class SwiftTestUtils extends org.junit.Assert {
         byte actual = dest[i];
         byte expected = src[i];
         String letter = toChar(actual);
-        String line = String.format("[%04d] %2x %s\n", i, actual, letter);
+        String line = String.format("[%04d] %2x %s%n", i, actual, letter);
         if (expected != actual) {
-          line = String.format("[%04d] %2x %s -expected %2x %s\n",
+          line = String.format("[%04d] %2x %s -expected %2x %s%n",
                                i,
                                actual,
                                letter,