summaryrefslogtreecommitdiffstats
path: root/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test
diff options
context:
space:
mode:
Diffstat (limited to 'common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test')
-rw-r--r--common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main/java/org/onap/sdc/generator/SampleJUnitTest.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main/java/org/onap/sdc/generator/SampleJUnitTest.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main/java/org/onap/sdc/generator/SampleJUnitTest.java
index 6b59e2ebfa..24946567b8 100644
--- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main/java/org/onap/sdc/generator/SampleJUnitTest.java
+++ b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main/java/org/onap/sdc/generator/SampleJUnitTest.java
@@ -1555,14 +1555,15 @@ public class SampleJUnitTest extends TestCase {
public static void readPayload(List<Artifact> inputArtifacts,InputStream fis, String fileName) throws IOException {
byte[] payload = new byte[fis.available()];
- fis.read(payload);
- String checksum = GeneratorUtil.checkSum(payload);
- byte[] encodedPayload = GeneratorUtil.encode(payload);
- Artifact artifact = new Artifact(AAI_ARTIFACT_TYPE, AAI_ARTIFACT_GROUP_TYPE, checksum, encodedPayload);
- artifact.setName(fileName);
- artifact.setLabel(fileName);
- artifact.setDescription(fileName);
- inputArtifacts.add(artifact);
+ if (fis.read(payload) > 0) {
+ String checksum = GeneratorUtil.checkSum(payload);
+ byte[] encodedPayload = GeneratorUtil.encode(payload);
+ Artifact artifact = new Artifact(AAI_ARTIFACT_TYPE, AAI_ARTIFACT_GROUP_TYPE, checksum, encodedPayload);
+ artifact.setName(fileName);
+ artifact.setLabel(fileName);
+ artifact.setDescription(fileName);
+ inputArtifacts.add(artifact);
+ }
}