From f67bc2db9676c54192a019852594a29f33816534 Mon Sep 17 00:00:00 2001 From: amshegokar Date: Tue, 11 Sep 2018 20:20:27 +0530 Subject: Security vulnerabilities identified in CLM scan Mapper: security vulnerabilities identified in CLM scan Change-Id: I2b977e99e4ad6d1aae24e0d441da6002c28ab0ac Issue-ID: DCAEGEN2-769 Signed-off-by: amshegokar --- .../service/VESAdapterInitializer.java | 35 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'UniversalVesAdapter/src/main/java/org/onap') 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 f92511e..ca1bcc9 100644 --- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java @@ -79,11 +79,40 @@ public class VESAdapterInitializer implements CommandLineRunner, Ordered { } else { - - LOGGER.info(">>>Static configuration to be used"); - + final String url = "http://localhost:8085/start"; + final String USER_AGENT = "Mozilla/5.0"; + + try { + URL obj = new URL(url); + HttpURLConnection httpURLConnection = (HttpURLConnection) obj.openConnection(); + + // optional default is GET + httpURLConnection.setRequestMethod("GET"); + + // add request header + httpURLConnection.setRequestProperty("User-Agent", USER_AGENT); + int responseCode = httpURLConnection.getResponseCode(); + LOGGER.info("Sending 'GET' request to URL : " + url); + LOGGER.info("Response Code : " + responseCode); + BufferedReader in = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + + // print result + LOGGER.info("The result is :" + response.toString()); + + } catch (Exception e) { + LOGGER.error("Error occured due to :" + e.getMessage()); + e.printStackTrace(); + } + } } -- cgit 1.2.3-korg