Repository: ambari Updated Branches: refs/heads/branch-1.7.0 c640f6945 -> 4b80b73b4
AMBARI-8053 - Views : Add Debug logging for view extraction. (tbeerbower) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4b80b73b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4b80b73b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4b80b73b Branch: refs/heads/branch-1.7.0 Commit: 4b80b73b44564f2920f59bb45c90fb9a4ec9fb7f Parents: c640f69 Author: tbeerbower <[email protected]> Authored: Thu Oct 30 19:29:09 2014 -0400 Committer: tbeerbower <[email protected]> Committed: Thu Oct 30 19:29:09 2014 -0400 ---------------------------------------------------------------------- .../apache/ambari/server/view/ViewExtractor.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4b80b73b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java index 368e92c..cd17404 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java @@ -95,9 +95,14 @@ public class ViewExtractor { JarEntry jarEntry = (JarEntry) enumeration.nextElement(); String entryPath = archivePath + File.separator + jarEntry.getName(); + LOG.debug("Extracting " + entryPath); + File entryFile = archiveUtility.getFile(entryPath); if (jarEntry.isDirectory()) { + + LOG.debug("Making directory " + entryPath); + if (!entryFile.mkdir()) { msg = "Could not create archive entry directory " + entryPath + "."; @@ -106,17 +111,29 @@ public class ViewExtractor { throw new ExtractionException(msg); } } else { + + LOG.debug("Getting input stream for " + jarEntry.getName()); + InputStream is = viewJarFile.getInputStream(jarEntry); try { + LOG.debug("Getting output stream for " + entryPath); + FileOutputStream fos = archiveUtility.getFileOutputStream(entryFile); try { + LOG.debug("Begin copying from " + jarEntry.getName() + " to "+ entryPath); + while (is.available() > 0) { fos.write(is.read()); } + + LOG.debug("Finish copying from " + jarEntry.getName() + " to "+ entryPath); + } finally { + LOG.debug("Closing output stream for " + entryPath); fos.close(); } } finally { + LOG.debug("Closing input stream for " + jarEntry.getName()); is.close(); } }
