You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2019/06/06 07:29:27 UTC

[GitHub] [sling-org-apache-sling-feature-analyser] karlpauls commented on a change in pull request #14: Zip file extract

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:
users@infra.apache.org


With regards,
Apache Git Services