You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2015/07/08 21:56:02 UTC
ambari git commit: AMBARI-12312. Different file size when downloading
zip file on HDFS File View (Erik Bergenholtz via rlevas)
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 <eb...@hortonworks.com>
Authored: Wed Jul 8 15:55:44 2015 -0400
Committer: Robert Levas <rl...@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): "