summaryrefslogtreecommitdiffstats
path: root/policy-utils/src/main/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-02-19 16:56:06 -0500
committerJim Hahn <jrh3@att.com>2018-02-20 09:59:15 -0500
commita45f8909871dc1ddb75845f067a602951afc8d11 (patch)
treefa72aff7ceede971d4e6922f62a503a8ee8924d5 /policy-utils/src/main/java/org
parent1708e9a45cb88571613c10b68d392811b2b3f0f4 (diff)
Sonar fixes to drools-pdp
Fixed most of the instances of the following sonar issues: Moved array designator Used diamond operator Changed System.out/err to use a logger Changed several Thread.sleep() in test code to a single sleep() Useless assignments Replaced comparison with "" to string.isEmpty() Merged if's Replaced ArrayList with List in method returns Reordered type modifiers Reordered constructor methods Defined constants for literals, or replaced them with method calls Removed "throws Xxx" for subclasses of RuntimeException Combined identical "catch" blocks Re-interrupted the current thread after catching an InterruptedException Removed tests against the literal "false" Fix indentation of new makeTopicOperError() method. Fix exception variable name in new methods, logNoUebEncoder() and logNoDmaapEncoder(). Change-Id: Iddae5210553662f733b67333b372dec8c3fe2c94 Issue-ID: POLICY-336 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-utils/src/main/java/org')
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java40
1 files changed, 13 insertions, 27 deletions
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java
index 99c4566a..d0b451f1 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java
@@ -1,8 +1,8 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
package org.onap.policy.drools.utils;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -98,30 +97,17 @@ public class OrderedServiceImpl<T extends OrderedService>
// Sort the list according to sequence number, and then alphabetically
// according to full class name.
- Collections.sort(tmp, new Comparator<T>()
- {
- @Override
- public int compare(T o1, T o2)
- {
- int s1 = o1.getSequenceNumber();
- int s2 = o2.getSequenceNumber();
- int rval;
- if (s1 < s2)
- {
- rval = -1;
- }
- else if (s1 > s2)
- {
- rval = 1;
- }
- else
- {
- rval = o1.getClass().getName().compareTo
- (o2.getClass().getName());
- }
- return rval;
- }
- });
+ Collections.sort(tmp, (o1, o2) -> {
+ int s1 = o1.getSequenceNumber();
+ int s2 = o2.getSequenceNumber();
+ if (s1 < s2) {
+ return -1;
+ } else if (s1 > s2) {
+ return 1;
+ } else {
+ return o1.getClass().getName().compareTo(o2.getClass().getName());
+ }
+ });
// create an unmodifiable version of this list
implementers = Collections.unmodifiableList(tmp);