hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iwasak...@apache.org
Subject hadoop git commit: HADOOP-13017. Implementations of InputStream.read(buffer, offset, bytes) to exit 0 if bytes==0. Contributed by Steve Loughran.
Date Thu, 27 Oct 2016 06:56:12 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8 a7684f651 -> 6d9b6fac8


HADOOP-13017. Implementations of InputStream.read(buffer, offset, bytes) to exit 0 if bytes==0.
Contributed by Steve Loughran.

(cherry picked from commit 0bdd263d82a4510f16df49238d57c9f78ac28ae7)


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

Branch: refs/heads/branch-2.8
Commit: 6d9b6fac86cf067890ca2e5f6d5c00056235c5ea
Parents: a7684f6
Author: Masatake Iwasaki <iwasakims@apache.org>
Authored: Thu Oct 27 15:44:49 2016 +0900
Committer: Masatake Iwasaki <iwasakims@apache.org>
Committed: Thu Oct 27 15:55:35 2016 +0900

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/fs/HarFileSystem.java       | 3 +++
 .../main/java/org/apache/hadoop/security/SaslInputStream.java   | 5 ++++-
 .../src/main/java/org/apache/hadoop/security/SaslRpcClient.java | 3 +++
 .../src/main/java/org/apache/hadoop/util/LimitInputStream.java  | 3 +++
 .../main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java | 3 +++
 .../java/org/apache/hadoop/tools/util/ThrottledInputStream.java | 3 +++
 .../apache/hadoop/fs/swift/http/HttpInputStreamWithRelease.java | 3 +++
 .../apache/hadoop/fs/swift/snative/SwiftNativeInputStream.java  | 3 +++
 8 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java
index 3a2da26..9b17404 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java
@@ -968,6 +968,9 @@ public class HarFileSystem extends FileSystem {
       @Override
       public synchronized int read(byte[] b, int offset, int len) 
         throws IOException {
+        if (len == 0) {
+          return 0;
+        }
         int newlen = len;
         int ret = -1;
         if (position + len > end) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslInputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslInputStream.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslInputStream.java
index 7ee4523..a3d66b9 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslInputStream.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslInputStream.java
@@ -246,6 +246,9 @@ public class SaslInputStream extends InputStream implements ReadableByteChannel
    */
   @Override
   public int read(byte[] b, int off, int len) throws IOException {
+    if (len == 0) {
+      return 0;
+    }
     if (!useWrap) {
       return inStream.read(b, off, len);
     }
@@ -378,4 +381,4 @@ public class SaslInputStream extends InputStream implements ReadableByteChannel
     }
     return bytesRead;
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java
index 41fd2d5..bef877c 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java
@@ -569,6 +569,9 @@ public class SaslRpcClient {
 
     @Override
     public synchronized int read(byte[] buf, int off, int len) throws IOException {
+      if (len == 0) {
+        return 0;
+      }
       // fill the buffer with the next RPC message
       if (unwrappedRpcBuffer.remaining() == 0) {
         readNextRpcPacket();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/LimitInputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/LimitInputStream.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/LimitInputStream.java
index c94a517..bd646e0 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/LimitInputStream.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/LimitInputStream.java
@@ -74,6 +74,9 @@ public final class LimitInputStream extends FilterInputStream {
 
   @Override
   public int read(byte[] b, int off, int len) throws IOException {
+    if (len == 0) {
+      return 0;
+    }
     if (left == 0) {
       return -1;
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
index d696081..8c6718e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
@@ -1795,6 +1795,9 @@ public class WebHdfsFileSystem extends FileSystem
       if (runnerState == RunnerState.CLOSED) {
         throw new IOException("Stream closed");
       }
+      if (len == 0) {
+        return 0;
+      }
 
       // Before the first read, pos and fileLength will be 0 and readBuffer
       // will all be null. They will be initialized once the first connection

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/ThrottledInputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/ThrottledInputStream.java
b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/ThrottledInputStream.java
index 0d374e9..a0fa0c8 100644
--- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/ThrottledInputStream.java
+++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/ThrottledInputStream.java
@@ -84,6 +84,9 @@ public class ThrottledInputStream extends InputStream {
   /** {@inheritDoc} */
   @Override
   public int read(byte[] b, int off, int len) throws IOException {
+    if (len == 0) {
+      return 0;
+    }
     throttle();
     int readLen = rawStream.read(b, off, len);
     if (readLen != -1) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/http/HttpInputStreamWithRelease.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/http/HttpInputStreamWithRelease.java
b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/http/HttpInputStreamWithRelease.java
index c75759e..627792c 100644
--- a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/http/HttpInputStreamWithRelease.java
+++ b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/http/HttpInputStreamWithRelease.java
@@ -187,6 +187,9 @@ public class HttpInputStreamWithRelease extends InputStream {
   @Override
   public int read(byte[] b, int off, int len) throws IOException {
     SwiftUtils.validateReadArgs(b, off, len);
+    if (len == 0) {
+      return 0;
+    }
     //if the stream is already closed, then report an exception.
     assumeNotReleased();
     //now read in a buffer, reacting differently to different operations

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6d9b6fac/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeInputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeInputStream.java
b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeInputStream.java
index 3fd3702..23d8c09 100644
--- a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeInputStream.java
+++ b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeInputStream.java
@@ -161,6 +161,9 @@ class SwiftNativeInputStream extends FSInputStream {
   public synchronized int read(byte[] b, int off, int len) throws IOException {
     SwiftUtils.debug(LOG, "read(buffer, %d, %d)", off, len);
     SwiftUtils.validateReadArgs(b, off, len);
+    if (len == 0) {
+      return 0;
+    }
     int result = -1;
     try {
       verifyOpen();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message