aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/DMaapService.java6
-rw-r--r--UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java3
-rw-r--r--UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VesService.java3
-rw-r--r--UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java16
-rw-r--r--snmpmapper/src/main/java/org/onap/dcaegen2/services/mapper/snmpmapper/service/MappingFileServiceImpl.java3
5 files changed, 20 insertions, 11 deletions
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/DMaapService.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/DMaapService.java
index d07dd04..49d68be 100644
--- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/DMaapService.java
+++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/DMaapService.java
@@ -66,16 +66,16 @@ public class DMaapService {
}
- if (list.size() == 0) {
+ if (list.isEmpty()) {
Thread.sleep(pollingInternalInt);
}
LOGGER.debug("number of messages to be converted :{}", list.size());
- if (list.size() != 0) {
+ if (!list.isEmpty()) {
String val = ((LinkedList<String>) list).removeFirst();
List<String> messages = new ArrayList<>();
String vesEvent = processReceivedJson(val);
- if (!(vesEvent.isEmpty() || vesEvent.equals(null) || vesEvent.equals(""))) {
+ if (vesEvent!=null && (!(vesEvent.isEmpty() || vesEvent.equals("")))) {
messages.add(vesEvent);
publisher.publish(messages);
LOGGER.info("Message successfully published to DMaaP Topic");
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java
index 2cb4b8f..3895421 100644
--- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java
+++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java
@@ -29,6 +29,7 @@ import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.codec.binary.Hex;
@@ -243,7 +244,7 @@ public class VESAdapterInitializer implements CommandLineRunner, Ordered {
pstmt11.executeUpdate();
LOGGER.info("CREATE TABLE IF NOT EXISTS executed successfully....");
- if ((bytesArray.length > 0) && (!bytesArray.toString().equals(""))) {
+ if ((bytesArray.length > 0) && (!Arrays.toString(bytesArray).equals(""))) {
LOGGER.debug("2Connection object:" + con.toString());
try (PreparedStatement pstmt = con.prepareStatement("INSERT INTO "
+ MappingFileTableName
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VesService.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VesService.java
index ed590a8..e9e2023 100644
--- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VesService.java
+++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VesService.java
@@ -65,7 +65,8 @@ public class VesService {
LOGGER.debug("starting subscriber & publisher thread:{}", Thread.currentThread().getName());
dmaapService.fetchAndPublishInDMaaP(subcriber, publisher, creator);
} catch (InterruptedException e) {
- e.printStackTrace();
+ LOGGER.error("Exception in starting of subscriber & publisher thread:{}",e);
+ Thread.currentThread().interrupt();
}
}
});
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java
index 3d1907a..2161497 100644
--- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java
+++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java
@@ -43,7 +43,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
*/
public class MapperConfigUtils {
- private final Logger LOGGER = LoggerFactory.getLogger(MapperConfigUtils.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(MapperConfigUtils.class);
private static Set<Entry> entries = new TreeSet<>((o1, o2) -> o1.getPriority().compareTo(o2.getPriority()));
private enum JoinOperator {
@@ -163,8 +163,7 @@ public class MapperConfigUtils {
readMapperConfigFile(mappingFile);
checkIncomingJsonForMatchingDomain(incomingJsonString);
} catch (MapperConfigException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.error("Exception in mapperConfigFile reading:{}",e);
}
}
@@ -216,7 +215,7 @@ public class MapperConfigUtils {
throw new MapperConfigException("Unable to read config file for reason...\n " + exception.getMessage(),
exception);
}
- System.out.println("Read config file content into :" + config);
+ LOGGER.debug("Read config file content into :{}",config);
if (null != config) {
entries.addAll(config.getEntries());
@@ -272,48 +271,57 @@ public class MapperConfigUtils {
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().equals(evaluation.getValue());
+ break;
case DOUBLE:
if (null != actualObj.get(field))
return actualObj.get(field).asDouble() == Double
.valueOf(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
case STARTSWITH:
if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) {
switch (DataType.valueOf(evaluation.getDatatype())) {
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().startsWith(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
case ENDSWITH:
if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) {
switch (DataType.valueOf(evaluation.getDatatype())) {
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().endsWith(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
case CONTAINS:
if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) {
switch (DataType.valueOf(evaluation.getDatatype())) {
case STRING:
if (null != actualObj.get(field))
return actualObj.get(field).asText().contains(evaluation.getValue());
+ break;
default:
return false;
}
} else
return false;
+ break;
default:
return false;
}
diff --git a/snmpmapper/src/main/java/org/onap/dcaegen2/services/mapper/snmpmapper/service/MappingFileServiceImpl.java b/snmpmapper/src/main/java/org/onap/dcaegen2/services/mapper/snmpmapper/service/MappingFileServiceImpl.java
index e5ca3a8..b0e8821 100644
--- a/snmpmapper/src/main/java/org/onap/dcaegen2/services/mapper/snmpmapper/service/MappingFileServiceImpl.java
+++ b/snmpmapper/src/main/java/org/onap/dcaegen2/services/mapper/snmpmapper/service/MappingFileServiceImpl.java
@@ -52,7 +52,7 @@ public class MappingFileServiceImpl implements MappingFileService {
LOGGER.debug("EnterPrise ID recieved:{}",enterpriseid);
- if ((mappingfile != null) && (mappingfile.length > 0) && (!mappingfile.equals(""))) {
+ if ((mappingfile != null) && (mappingfile.length > 0)) {
for (MultipartFile aFile : mappingfile) {
if(aFile.isEmpty()) {
continue;
@@ -77,7 +77,6 @@ public class MappingFileServiceImpl implements MappingFileService {
LOGGER.error("IOException occured:{}",e.getCause());
return "failed";
} catch (SQLException e) {
- // TODO Auto-generated catch block
LOGGER.error("SQLException occured:{}",e.getCause());
return "failed";
}