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:56:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk aee137f1c -> 85f7a3f9f


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/85f7a3f9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/85f7a3f9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/85f7a3f9

Branch: refs/heads/trunk
Commit: 85f7a3f9f47c5c49d87d2d700218377a47b30dff
Parents: aee137f
Author: Erik Bergenholtz <ebergenholtz@hortonworks.com>
Authored: Wed Jul 8 15:55:44 2015 -0400
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Wed Jul 8 15:55:44 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/85f7a3f9/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