ahgittin commented on code in PR #1372:
URL: https://github.com/apache/brooklyn-server/pull/1372#discussion_r1035785506


##########
core/src/test/java/org/apache/brooklyn/util/core/file/ArchiveUtilsTest.java:
##########
@@ -159,4 +149,19 @@ private void assertSubFilesEqual(File parentDir, 
Map<String, String> files) thro
             assertEquals(Joiner.on("\n").join(Files.readLines(subFile, 
Charsets.UTF_8)), entry.getValue());
         }
     }
+
+    private void doTestUnzip(String url)  {
+        File tempZipFile = null;
+        InputStream evilZip = 
ResourceUtils.create(this).getResourceFromUrl(url);
+        try {
+            tempZipFile = File.createTempFile("test-zip", null);
+            tempZipFile.deleteOnExit();
+            java.nio.file.Files.write(tempZipFile.toPath(), 
ByteStreams.toByteArray(evilZip), StandardOpenOption.TRUNCATE_EXISTING);
+            ArchiveUtils.extractZip(new ZipFile(tempZipFile), 
destDir.getAbsolutePath());
+        } catch (Exception e) {
+            throw new RuntimeException(e);

Review Comment:
   `throw Exceptions.propagate(e)` is slightly nicer; it handles wrapping if 
and only if necessary and some special edge cases



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to