ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject ambari git commit: AMBARI-12312. Different file size when downloading zip file on HDFS File View (Erik Bergenholtz via rlevas)
Date Wed, 08 Jul 2015 19:58:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 a0ed51883 -> 98d2d9d1c


AMBARI-12312. Different file size when downloading zip file on HDFS File View (Erik Bergenholtz
via rlevas)


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

Branch: refs/heads/branch-2.1
Commit: 98d2d9d1c173ec4a068caaeafcfd8cbc7aadc434
Parents: a0ed518
Author: Erik Bergenholtz <ebergenholtz@hortonworks.com>
Authored: Wed Jul 8 15:58:26 2015 -0400
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Wed Jul 8 15:58:26 2015 -0400

----------------------------------------------------------------------
 .../org/apache/ambari/view/filebrowser/DownloadService.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/98d2d9d1/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
index 7395f8f..4d45a76 100644
--- a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
+++ b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java
@@ -106,8 +106,11 @@ public class DownloadService extends HdfsService {
       FSDataInputStream in = getApi(context).open(path);
       zip.putNextEntry(new ZipEntry(path.substring(1)));
       byte[] chunk = new byte[1024];
-      while (in.read(chunk) != -1) {
-        zip.write(chunk);
+
+      int readLen = 0;
+      while(readLen != -1) {
+        zip.write(chunk, 0, readLen);
+        readLen = in.read(chunk);
       }
     } catch (IOException ex) {
       logger.error("Error zipping file " + path.substring(1) + " (file ignored): "


Mime
View raw message