Repository: ambari Updated Branches: refs/heads/trunk 37cfa697b -> cb54d4778
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/cb54d477 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cb54d477 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cb54d477 Branch: refs/heads/trunk Commit: cb54d4778cfc009705f84fbfdfb3f9d758463e84 Parents: 37cfa69 Author: tbeerbower <[email protected]> Authored: Thu Oct 30 19:29:09 2014 -0400 Committer: tbeerbower <[email protected]> Committed: Thu Oct 30 19:30: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/cb54d477/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(); } }
