aboutsummaryrefslogtreecommitdiffstats
path: root/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main
diff options
context:
space:
mode:
authorWojciech Sliwka <wojciech.sliwka@nokia.com>2018-05-22 08:36:40 +0200
committerTal Gitelman <tg851x@intl.att.com>2018-07-24 14:21:26 +0000
commitd0f8678bfa7f06f06c9f1dd3cad862b1b99c3a03 (patch)
tree277b0775e7a520242708e0866eb0f3bf67259661 /common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main
parent4c9bc0204405fc840cac190fb9e0de946f3899ff (diff)
Fix sonar violations
Fix major sonar violations in ConfigurationUtils,ConfigurationImpl, PropertyType Issue-ID: SDC-1353 Change-Id: Ic3959ba174f0a9fcd3976c9d12c6425dc4353e72 Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com>
Diffstat (limited to 'common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-test/src/main')
-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);
+ }
}