From 43a1a1714aa08bf632faffd72f1791d59f02e59c Mon Sep 17 00:00:00 2001 From: Francis Toth Date: Fri, 24 Apr 2020 10:31:36 -0400 Subject: Refactor CsarUtils::createCsar Signed-off-by: Francis Toth Change-Id: I41994c98515844030eed1d6f2756c9779e864cff Issue-ID: SDC-2812 --- .../src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'catalog-be') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java index 6ecb51810e..85d0c78727 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java @@ -202,13 +202,12 @@ public class CsarUtils { final String toscaBlock0 = createToscaBlock0(TOSCA_META_VERSION, CSAR_VERSION, createdBy, fileName); byte[] toscaBlock0Byte = toscaBlock0.getBytes(); - Either generateCsarZipResponse = generateCsarZip(csarBlock0Byte, toscaBlock0Byte, component, getFromCS, isInCertificationRequest); - - if (generateCsarZipResponse.isRight()) { - return Either.right(generateCsarZipResponse.right().value()); - } - loggerSupportability.log(LoggerSupportabilityActions.GENERATE_CSAR, StatusCode.COMPLETE,"Ended create Csar for component {} ",component.getName()); - return Either.left(generateCsarZipResponse.left().value()); + return generateCsarZip(csarBlock0Byte, toscaBlock0Byte, component, getFromCS, isInCertificationRequest) + .left().map(responseFormat -> { + loggerSupportability.log(LoggerSupportabilityActions.GENERATE_CSAR, StatusCode.COMPLETE, + "Ended create Csar for component {} ", component.getName()); + return responseFormat; + }); } private Either generateCsarZip(byte[] csarBlock0Byte, byte[] toscaBlock0Byte, Component component, boolean getFromCS, boolean isInCertificationRequest) { -- cgit 1.2.3-korg