aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-app-server/src/main/java
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-09-25 15:16:23 +0200
committerpwielebs <piotr.wielebski@nokia.com>2018-09-28 10:21:01 +0200
commite23e0182650a654e1f32bfb164a95e8b63219ee5 (patch)
tree3b0074c0dbe8401e26740f64bc58ed4b09790949 /datafile-app-server/src/main/java
parent263d1a481bd5378e59b804425bc8a9bdc9bebb9a (diff)
Fixing Sonar issues
Change-Id: I67360cd501630adad8166c9278e9955c6be7758f Issue-ID: DCAEGEN2-835 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'datafile-app-server/src/main/java')
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java2
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java16
2 files changed, 10 insertions, 8 deletions
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java
index 512a2178..c42749cf 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java
@@ -44,7 +44,7 @@ public class SchedulerConfig extends DatafileAppConfig {
private static final int SCHEDULING_DELAY_FOR_DATAFILE_COLLECTOR_TASKS = 10;
private static final int SCHEDULING_REQUEST_FOR_CONFIGURATION_DELAY = 5;
- private static volatile List<ScheduledFuture> scheduledFutureList = new ArrayList<ScheduledFuture>();
+ private static volatile List<ScheduledFuture> scheduledFutureList = new ArrayList<>();
private final TaskScheduler taskScheduler;
private final ScheduledTasks scheduledTask;
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
index 7226dfa8..619ccc11 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
@@ -167,19 +167,17 @@ public class DmaapConsumerJsonParser {
private boolean isNotificationFieldsHeaderNotEmpty(String changeIdentifier, String changeType,
String notificationFieldsVersion) {
- return ((changeIdentifier != null && !changeIdentifier.isEmpty())
- && (changeType != null && !changeType.isEmpty())
- && (notificationFieldsVersion != null && !notificationFieldsVersion.isEmpty()));
+ return isStringIsNotNullAndNotEmpty(changeIdentifier) && isStringIsNotNullAndNotEmpty(changeType)
+ && isStringIsNotNullAndNotEmpty(notificationFieldsVersion);
}
private boolean isFileFormatFieldsNotEmpty(String fileFormatVersion, String fileFormatType) {
- return ((fileFormatVersion != null && !fileFormatVersion.isEmpty())
- && (fileFormatType != null && !fileFormatType.isEmpty()));
+ return isStringIsNotNullAndNotEmpty(fileFormatVersion) && isStringIsNotNullAndNotEmpty(fileFormatType);
}
private boolean isNameAndLocationAndCompressionNotEmpty(String name, String location, String compression) {
- return (name != null && !name.isEmpty()) && (location != null && !location.isEmpty())
- && (compression != null && !compression.isEmpty());
+ return isStringIsNotNullAndNotEmpty(name) && isStringIsNotNullAndNotEmpty(location) &&
+ isStringIsNotNullAndNotEmpty(compression);
}
private boolean containsHeader(JsonObject jsonObject) {
@@ -189,4 +187,8 @@ public class DmaapConsumerJsonParser {
private boolean containsHeader(JsonObject jsonObject, String topHeader, String header) {
return jsonObject.has(topHeader) && jsonObject.getAsJsonObject(topHeader).has(header);
}
+
+ private boolean isStringIsNotNullAndNotEmpty(String string) {
+ return string != null && !string.isEmpty();
+ }
}