karlpauls commented on a change in pull request #14: Zip file extract
URL: 
https://github.com/apache/sling-org-apache-sling-feature-analyser/pull/14#discussion_r291050799
 
 

 ##########
 File path: 
src/main/java/org/apache/sling/feature/scanner/impl/ContentPackageScanner.java
 ##########
 @@ -82,117 +83,120 @@ private void extractContentPackage(final 
ContentPackageDescriptor cp,
             toDir.mkdirs();
 
             final List<File> toProcess = new ArrayList<>();
-
-            try (final ZipInputStream zis = new ZipInputStream(new 
FileInputStream(archive)) ) {
-                boolean done = false;
-                while ( !done ) {
-                    final ZipEntry entry = zis.getNextEntry();
-                    if ( entry == null ) {
-                        done = true;
-                    } else {
-                        final String entryName = entry.getName();
-                        if ( !entryName.endsWith("/") && 
entryName.startsWith("jcr_root/") ) {
-                            final String contentPath = entryName.substring(8);
-
-                            FileType fileType = null;
-
-                            if ( entryName.endsWith(".zip") ) {
-                                // embedded content package
-                                fileType = FileType.PACKAGE;
-
-                                // check for libs or apps
-                            } else if ( entryName.startsWith("jcr_root/libs/") 
|| entryName.startsWith("jcr_root/apps/") ) {
-
-                                // check if this is an install folder (I)
-                                // install folders are either named:
-                                // "install" or
-                                // "install.{runmode}"
-                                boolean isInstall = 
entryName.indexOf("/install/") != -1;
+            
+            ZipFile zipFile = null;
+            try {
 
 Review comment:
   I think you can use ZipFile in a try (ZipFile zipfile = ...)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to