From 7c81daeacfeb6dc44e22c97eca36313aa7ddb555 Mon Sep 17 00:00:00 2001 From: Sumapriya Sarvepalli Date: Mon, 10 Sep 2018 12:34:54 +0530 Subject: Sonar major issues This block of commented-out lines of code should be removed Sonar Link: https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AV4-VagH32hFUzlqc5r8&resolved=false&severities=MAJOR Location: src/main/java/com/att/dmf/mr/metrics/publisher/DMaaPCambriaClientFactory.java Line No:L392 L412 Change-Id: Ifa4f01adbcb59f31d3a332b8137fb56b3faa551f Issue-ID: DMAAP-754 Signed-off-by: Sumapriya Sarvepalli --- .../mr/metrics/publisher/DMaaPCambriaClientFactory.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/att/dmf/mr/metrics/publisher/DMaaPCambriaClientFactory.java b/src/main/java/com/att/dmf/mr/metrics/publisher/DMaaPCambriaClientFactory.java index d02438f..9158c96 100644 --- a/src/main/java/com/att/dmf/mr/metrics/publisher/DMaaPCambriaClientFactory.java +++ b/src/main/java/com/att/dmf/mr/metrics/publisher/DMaaPCambriaClientFactory.java @@ -386,12 +386,7 @@ public class DMaaPCambriaClientFactory { * Your API secret * @return an identity manager */ - /* - * public static CambriaIdentityManager createIdentityManager ( - * Collection hostSet, String apiKey, String apiSecret ) { final - * CambriaIdentityManager cim = new CambriaMetaClient ( hostSet ); - * cim.setApiCredentials ( apiKey, apiSecret ); return cim; } - */ + /** * Create a topic manager for working with topics. @@ -405,12 +400,7 @@ public class DMaaPCambriaClientFactory { * Your API secret * @return a topic manager */ - /* - * public static CambriaTopicManager createTopicManager ( Collection - * hostSet, String apiKey, String apiSecret ) { final CambriaMetaClient tmi - * = new CambriaMetaClient ( hostSet ); tmi.setApiCredentials ( apiKey, - * apiSecret ); return tmi; } - */ + /** * Inject a consumer. Used to support unit tests. -- cgit 1.2.3-korg From 0744faefd619e7eddf0aa66ff84aadb205325bf6 Mon Sep 17 00:00:00 2001 From: Sumapriya Sarvepalli Date: Mon, 10 Sep 2018 12:44:43 +0530 Subject: Sonar major issues This block of commented-out lines of code should be removed Sonar Link: https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AV4-Vahb32hFUzlqc5t-&resolved=false&severities=MAJOR Location: src/main/java/com/att/dmf/mr/resources/streamReaders/CambriaJsonStreamReader.java Line No:L84 L128 Change-Id: I013247ca962a79490cc458a6cac6427612de54f3 Issue-ID: DMAAP-755 Signed-off-by: Sumapriya Sarvepalli --- .../dmf/mr/resources/streamReaders/CambriaJsonStreamReader.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/att/dmf/mr/resources/streamReaders/CambriaJsonStreamReader.java b/src/main/java/com/att/dmf/mr/resources/streamReaders/CambriaJsonStreamReader.java index 98ddb50..7a67c92 100644 --- a/src/main/java/com/att/dmf/mr/resources/streamReaders/CambriaJsonStreamReader.java +++ b/src/main/java/com/att/dmf/mr/resources/streamReaders/CambriaJsonStreamReader.java @@ -81,10 +81,7 @@ public class CambriaJsonStreamReader implements reader { final int c = fTokens.next(); - /*if (c ==','){ - fCloseCount++; - System.out.println("fCloseCount=" + fCloseCount +" fCount "+fCount); - }*/ + if (fIsList) { if (c == ']' || (fCount > 0 && c == 10)) return null; @@ -125,7 +122,7 @@ public class CambriaJsonStreamReader implements reader { * * @param o */ - //public msg(JSONObject o){} + public msg(JSONObject o) { -- cgit 1.2.3-korg From cbab66dbbaf971cfb82f3671f175433c69cf2138 Mon Sep 17 00:00:00 2001 From: Sumapriya Sarvepalli Date: Mon, 10 Sep 2018 12:55:19 +0530 Subject: Sonar major issues This block of commented-out lines of code should be removed Sonar Link: https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AWU41WgpwGn37JfbyHt0&resolved=false&severities=MAJOR Location: src/main/java/com/att/dmf/mr/security/DMaaPAAFAuthenticatorImpl.java Line No:L49 L60 L73 Change-Id: Ie1b5bfe9d8741140757355fa92525dd92d677d75 Issue-ID: DMAAP-756 Signed-off-by: Sumapriya Sarvepalli --- .../com/att/dmf/mr/security/DMaaPAAFAuthenticatorImpl.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/att/dmf/mr/security/DMaaPAAFAuthenticatorImpl.java b/src/main/java/com/att/dmf/mr/security/DMaaPAAFAuthenticatorImpl.java index b550373..ed0893d 100644 --- a/src/main/java/com/att/dmf/mr/security/DMaaPAAFAuthenticatorImpl.java +++ b/src/main/java/com/att/dmf/mr/security/DMaaPAAFAuthenticatorImpl.java @@ -46,7 +46,7 @@ public class DMaaPAAFAuthenticatorImpl implements DMaaPAAFAuthenticator { auth = true; } - //System.out.println("role " +role +" user: "+ req.getRemoteUser() +" : auth="+auth); + return auth; } @@ -57,7 +57,7 @@ public class DMaaPAAFAuthenticatorImpl implements DMaaPAAFAuthenticator { String permission = ""; String nameSpace =""; if(topicName.contains(".") && topicName.contains("com.att")) { - //String topic = topicName.substring(topicName.lastIndexOf(".")+1); + nameSpace = topicName.substring(0,topicName.lastIndexOf(".")); } else { @@ -67,12 +67,7 @@ public class DMaaPAAFAuthenticatorImpl implements DMaaPAAFAuthenticator { if(null==nameSpace)nameSpace="com.att.dmaap.mr.ueb"; - /*ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN, - DMaaPResponseCode.TOPIC_NOT_IN_AAF.getResponseCode(), "Topic does not exist in AAF" - , null, Utils.getFormattedDate(new Date()), topicName, - null, null, null, null); - - throw new CambriaApiException(errRes);*/ + } permission = nameSpace+".mr.topic|:topic."+topicName+"|"+action; -- cgit 1.2.3-korg From 11bd9cd49f4580424f0d6a99165d7a55c534bb1d Mon Sep 17 00:00:00 2001 From: Sumapriya Sarvepalli Date: Mon, 10 Sep 2018 13:02:25 +0530 Subject: Sonar major issues This block of commented-out lines of code should be removed Sonar Link: https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AV4-VamI32hFUzlqc5z3&resolved=false&severities=MAJOR Location: src/main/java/com/att/dmf/mr/utils/ConfigurationReader.java Line No:L58 L73 L81 L93 L132 Change-Id: Id5d8bc10162e7e6dab6f8dacfb4f8dc34fb702a5 Issue-ID: DMAAP-757 Signed-off-by: Sumapriya Sarvepalli --- src/main/java/com/att/dmf/mr/utils/ConfigurationReader.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/att/dmf/mr/utils/ConfigurationReader.java b/src/main/java/com/att/dmf/mr/utils/ConfigurationReader.java index dd1e4eb..e56a2e4 100644 --- a/src/main/java/com/att/dmf/mr/utils/ConfigurationReader.java +++ b/src/main/java/com/att/dmf/mr/utils/ConfigurationReader.java @@ -55,7 +55,7 @@ import com.att.nsa.drumlin.till.nv.rrNvReadable.invalidSettingValue; import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting; import com.att.nsa.limits.Blacklist; import com.att.nsa.security.NsaAuthenticatorService; -//import com.att.nsa.security.authenticators.OriginalUebAuthenticator; + import com.att.nsa.security.db.BaseNsaApiDbImpl; import com.att.nsa.security.db.NsaApiDb; import com.att.nsa.security.db.NsaApiDb.KeyExistsException; @@ -70,7 +70,7 @@ import com.att.nsa.security.db.simple.NsaSimpleApiKeyFactory; @Component public class ConfigurationReader { -// private rrNvReadable settings; + private Broker1 fMetaBroker; private ConsumerFactory fConsumerFactory; private Publisher fPublisher; @@ -78,7 +78,7 @@ public class ConfigurationReader { @Autowired private DMaaPCambriaLimiter fRateLimiter; private NsaApiDb fApiKeyDb; - /* private DMaaPTransactionObjDB fTranDb; */ + private DMaaPAuthenticator fSecurityManager; private NsaAuthenticatorService nsaSecurityManager; private static CuratorFramework curator; @@ -90,7 +90,7 @@ public class ConfigurationReader { private Emailer fEmailer; private static final EELFLogger log = EELFManager.getInstance().getLogger(ConfigurationReader.class); - //private static final Logger log = Logger.getLogger(ConfigurationReader.class.toString()); + /** * constructor to initialize all the values @@ -129,7 +129,7 @@ public class ConfigurationReader { @Qualifier("dMaaPAuthenticatorImpl") DMaaPAuthenticator fSecurityManager ) throws missingReqdSetting, invalidSettingValue, ServletException, KafkaConsumerCacheException, ConfigDbException { - //this.settings = settings; + this.fMetrics = fMetrics; this.zk = zk; this.fConfigDb = fConfigDb; -- cgit 1.2.3-korg From e2d27fba681dd20a20099b1f246d0fcc20de9270 Mon Sep 17 00:00:00 2001 From: Sumapriya Sarvepalli Date: Mon, 10 Sep 2018 15:20:45 +0530 Subject: Sonar major issues This block of commented-out lines of code should be removed Sonar Link: https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AWU41WilwGn37JfbyHvv&resolved=false&severities=MAJOR Location: src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java Line No:L30 L53 Change-Id: Id16898c8300929a25c6bc2cc6fddc7e06982d422 Issue-ID: DMAAP-760 Signed-off-by: Sumapriya Sarvepalli --- src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java index 33bc2f4..c8bb073 100644 --- a/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java +++ b/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -//import kafka.common.TopicExistsException; + import org.apache.kafka.common.errors.TopicExistsException; import org.json.JSONArray; import org.json.JSONObject; @@ -50,7 +50,7 @@ import com.att.nsa.security.db.simple.NsaSimpleApiKey; @Service public class UIServiceImpl implements UIService { - //private static final Logger LOGGER = Logger.getLogger(UIServiceImpl.class); + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(UIServiceImpl.class); /** * Returning template of hello page -- cgit 1.2.3-korg From 3ed650dd1999dfcf7a63e42a0feab67c069939e3 Mon Sep 17 00:00:00 2001 From: Sumapriya Sarvepalli Date: Mon, 10 Sep 2018 15:52:55 +0530 Subject: Sonar major issues This block of commented-out lines of code should be removed Sonar Link: https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AWU41WhfwGn37JfbyHvc&resolved=false&severities=MAJOR Location: src/main/java/com/att/dmf/mr/beans/DMaaPCambriaLimiter.java Line No:L172 L310 Change-Id: I36a6c4eed0eede46b8198a4d1f988a53f1737184 Issue-ID: DMAAP-762 Signed-off-by: Sumapriya Sarvepalli --- .../com/att/dmf/mr/beans/DMaaPCambriaLimiter.java | 40 +--------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/src/main/java/com/att/dmf/mr/beans/DMaaPCambriaLimiter.java b/src/main/java/com/att/dmf/mr/beans/DMaaPCambriaLimiter.java index 8315632..8cbf64f 100644 --- a/src/main/java/com/att/dmf/mr/beans/DMaaPCambriaLimiter.java +++ b/src/main/java/com/att/dmf/mr/beans/DMaaPCambriaLimiter.java @@ -169,37 +169,7 @@ public class DMaaPCambriaLimiter { log.info(errRes.toString()); throw new CambriaApiException(errRes); } - /*if (fMaxPollsPerMinute <= 0) { - return; - } - final RateInfoCheck ric = getRateInfoCheck(topic, consumerGroup, clientId); - final double ratevalue = ric.onCall(); - if (ratevalue > fMaxPollsPerMinute) { - try { - log.warn(ri.getLabel() + ": " + rate + " empty replies/minute, limit is " + fMaxEmptyPollsPerMinute - + "."); - if (fSleepMs1 > fMaxPollsPerMinute) { - log.warn(ri.getLabel() + ": " + "Slowing response with " + fSleepMs - + " ms sleep, then responding in error."); - Thread.sleep(fSleepMs1); - ric.reset(); - } else { - log.info(ri.getLabel() + ": " + "No sleep configured, just throwing error."); - } - } catch (InterruptedException e) { - // ignore - } - - - ErrorResponse errRes = new ErrorResponse(HttpStatusCodes.k429_tooManyRequests, - DMaaPResponseCode.TOO_MANY_REQUESTS.getResponseCode(), - "This client is making too many requests " - + ",decrease the number of requests. ","",Utils.getFormattedDate(new Date()),topic,"","",consumerGroup+"/"+clientId,remoteHost); - - log.info(errRes.toString()); - throw new CambriaApiException(errRes); - }*/ } @@ -307,15 +277,7 @@ public class DMaaPCambriaLimiter { } - /* private RateInfoCheck getRateInfoCheck(String topic, String consumerGroup, String clientId) { - final String key = makeKey(topic, consumerGroup, clientId); - RateInfoCheck ri = fRateInfoCheck.get(key); - if (ri == null) { - ri = new RateInfoCheck(key, 1); - fRateInfoCheck.put(key, ri); - } - return ri; - } */ + -- cgit 1.2.3-korg