From 4970625eaa858c0ab84d04e0306882fb8c8ba743 Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Fri, 14 Apr 2017 13:28:20 -0700 Subject: Replace FileUtils.toByteArray() with IOUtils The in-house implementation of FileUtils.toByteArray() appears to be a literal copy-and-paste of IOUtils.toByteArray(). This change replaces the in-house implementation with a call to IOUtils. Change-Id: Ib33b64c4c0050acb0787915dd9df190e284b8cda Signed-off-by: Gary Wu --- .../sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'openecomp-be/lib/openecomp-tosca-lib/src') diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java index b518057e35..9a3ed8e73f 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.tosca.services.impl; +import org.apache.commons.io.IOUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.common.errors.CoreException; @@ -176,6 +177,8 @@ public class ToscaFileOutputServiceCsarImpl implements ToscaFileOutputService { } private void writeBytesToZip(ZipOutputStream zos, InputStream is) throws IOException { - FileUtils.copy(is, zos); + if(is != null){ + IOUtils.copy(is, zos); + } } } -- cgit 1.2.3-korg