diff options
Diffstat (limited to 'UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service')
3 files changed, 7 insertions, 5 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(); } } }); |