summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-common-lib
diff options
context:
space:
mode:
authorVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-09-07 14:37:51 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-07 14:37:51 +0000
commit75c572279398dc2be7652263843c8802a9406c4f (patch)
tree6b4fb827b0f1f731efcdaf6e40a62814bc1e9928 /openecomp-be/lib/openecomp-common-lib
parentd8b91a969d1631793761cf1fdc17d52d4f82ca95 (diff)
parentb7375b2488df93ba9df57ad13ec628bbff663819 (diff)
Merge "Fixed a few static analysis violations"
Diffstat (limited to 'openecomp-be/lib/openecomp-common-lib')
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
index 07322c626b..f4d6209eec 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
@@ -59,26 +59,24 @@ public class CommonUtil {
private static FileContentHandler getFileContentMapFromOrchestrationCandidateZipAndValidateNoFolders(
byte[] uploadFileData)
throws IOException {
- ZipEntry zipEntry;
+
List<String> folderList = new ArrayList<>();
FileContentHandler mapFileContent = new FileContentHandler();
- try {
- ZipInputStream inputZipStream;
- byte[] fileByteContent;
+ try (ZipInputStream inputZipStream = new ZipInputStream(new ByteArrayInputStream(uploadFileData))) {
+
String currentEntryName;
- inputZipStream = new ZipInputStream(new ByteArrayInputStream(uploadFileData));
+ ZipEntry zipEntry;
while ((zipEntry = inputZipStream.getNextEntry()) != null) {
- currentEntryName = zipEntry.getName();
- // else, get the file content (as byte array) and save it in a map.
- fileByteContent = FileUtils.toByteArray(inputZipStream);
+ currentEntryName = zipEntry.getName();
int index = lastIndexFileSeparatorIndex(currentEntryName);
if (index != -1) { //todo ?
folderList.add(currentEntryName);
} else {
- mapFileContent.addFile(currentEntryName, fileByteContent);
+ // else, get the file content (as byte array) and save it in a map.
+ mapFileContent.addFile(currentEntryName, FileUtils.toByteArray(inputZipStream));
}
}