Merge "Modelloader: base image update"
[aai/model-loader.git] / src / main / java / org / onap / aai / modelloader / extraction / VnfCatalogExtractor.java
index 3dbdfcc..2e16333 100644 (file)
@@ -38,6 +38,7 @@ import org.onap.aai.modelloader.entity.Artifact;
 import org.onap.aai.modelloader.entity.ArtifactType;
 import org.onap.aai.modelloader.entity.catalog.VnfCatalogArtifact;
 import org.onap.aai.modelloader.service.ModelLoaderMsgs;
 import org.onap.aai.modelloader.entity.ArtifactType;
 import org.onap.aai.modelloader.entity.catalog.VnfCatalogArtifact;
 import org.onap.aai.modelloader.service.ModelLoaderMsgs;
+import org.springframework.stereotype.Component;
 
 
 /**
 
 
 /**
@@ -47,6 +48,7 @@ import org.onap.aai.modelloader.service.ModelLoaderMsgs;
  * A .csar file is a compressed archive like a zip file and this class will treat the byte array as it if were a zip
  * file.
  */
  * A .csar file is a compressed archive like a zip file and this class will treat the byte array as it if were a zip
  * file.
  */
+@Component
 public class VnfCatalogExtractor {
     private static final Logger logger = LoggerFactory.getInstance().getLogger(VnfCatalogExtractor.class.getName());
 
 public class VnfCatalogExtractor {
     private static final Logger logger = LoggerFactory.getInstance().getLogger(VnfCatalogExtractor.class.getName());
 
@@ -72,7 +74,7 @@ public class VnfCatalogExtractor {
 
         List<Artifact> vnfcFiles = new ArrayList<>();
         try (SeekableInMemoryByteChannel inMemoryByteChannel = new SeekableInMemoryByteChannel(archive);
 
         List<Artifact> vnfcFiles = new ArrayList<>();
         try (SeekableInMemoryByteChannel inMemoryByteChannel = new SeekableInMemoryByteChannel(archive);
-                ZipFile zipFile = new ZipFile(inMemoryByteChannel)) {
+                ZipFile zipFile = ZipFile.builder().setSeekableByteChannel(inMemoryByteChannel).get()) {
             for (Enumeration<ZipArchiveEntry> enumeration = zipFile.getEntries(); enumeration.hasMoreElements();) {
                 ZipArchiveEntry entry = enumeration.nextElement();
                 if (fileShouldBeExtracted(entry)) {
             for (Enumeration<ZipArchiveEntry> enumeration = zipFile.getEntries(); enumeration.hasMoreElements();) {
                 ZipArchiveEntry entry = enumeration.nextElement();
                 if (fileShouldBeExtracted(entry)) {
@@ -106,4 +108,3 @@ public class VnfCatalogExtractor {
         return extractFile;
     }
 }
         return extractFile;
     }
 }
-