summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gson/src/main/java/org/onap/policy/common/gson/MapDoubleAdapterFactory.java4
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java4
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/validation/Version.java40
3 files changed, 24 insertions, 24 deletions
diff --git a/gson/src/main/java/org/onap/policy/common/gson/MapDoubleAdapterFactory.java b/gson/src/main/java/org/onap/policy/common/gson/MapDoubleAdapterFactory.java
index 3892a07f..e56f9dd3 100644
--- a/gson/src/main/java/org/onap/policy/common/gson/MapDoubleAdapterFactory.java
+++ b/gson/src/main/java/org/onap/policy/common/gson/MapDoubleAdapterFactory.java
@@ -55,7 +55,7 @@ public class MapDoubleAdapterFactory implements TypeAdapterFactory {
TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
- return new MapAdapter<T>(delegate);
+ return new MapAdapter<>(delegate);
}
/**
@@ -134,7 +134,7 @@ public class MapDoubleAdapterFactory implements TypeAdapterFactory {
Double num = (Double) obj;
long longval = num.longValue();
- if (num.doubleValue() == longval) {
+ if (Double.compare(num.doubleValue(), longval) == 0) {
// it's integral - determine if it's an integer or a long
int intval = (int) longval;
diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java b/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
index 13cd6de8..5c8c01df 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
@@ -98,7 +98,7 @@ public class ServiceManager implements Startable {
throw new IllegalStateException(name + " is already running; cannot add " + stepName);
}
- items.add(new Service(stepName, () -> service.start(), () -> service.stop()));
+ items.add(new Service(stepName, service::start, service::stop));
return this;
}
@@ -173,7 +173,7 @@ public class ServiceManager implements Startable {
* @param running services that are running, in the order they were started
* @throws ServiceManagerException if a service fails to stop
*/
- private void rewind(Deque<Service> running) throws ServiceManagerException {
+ private void rewind(Deque<Service> running) {
Exception ex = null;
logger.info("{} stopping", name);
diff --git a/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java b/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java
index d8106ec6..41ff832a 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java
@@ -51,6 +51,26 @@ public class Version implements Comparable<Version> {
/**
+ * String constructor.
+ *
+ * @param versionString the version string
+ */
+ public Version(@NonNull final String versionString) {
+ Version newVersion = makeVersion("String", "constructor", versionString);
+
+ if (newVersion != null) {
+ this.major = newVersion.major;
+ this.minor = newVersion.minor;
+ this.patch = newVersion.patch;
+ }
+ else {
+ this.major = 0;
+ this.minor = 0;
+ this.patch = 0;
+ }
+ }
+
+ /**
* Creates a version object.
*
* @param type type of object with which the version is associated, used when logging
@@ -84,26 +104,6 @@ public class Version implements Comparable<Version> {
}
/**
- * String constructor.
- *
- * @param versionString the version string
- */
- public Version(@NonNull final String versionString) {
- Version newVersion = makeVersion("String", "constructor", versionString);
-
- if (newVersion != null) {
- this.major = newVersion.major;
- this.minor = newVersion.minor;
- this.patch = newVersion.patch;
- }
- else {
- this.major = 0;
- this.minor = 0;
- this.patch = 0;
- }
- }
-
- /**
* Generates a new version from a string.
*
* @return a new version, of the form major.0.0, where "major" is one more than "this" version's major number