diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-09-28 02:54:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-28 02:54:50 +0000 |
commit | 42a97a461ab3287e30cf60e6236da5813bc421a2 (patch) | |
tree | c6bc1f744e3adc8152e3b7fdb362eac608c3c2fa /controlloop/common/model-impl | |
parent | 72d5a239ff15617b2d218d3b8f3f8a2099007142 (diff) | |
parent | 1253af9756e8a7027fade727da68b38dff2d5159 (diff) |
Merge "Fix more sonar issues"
Diffstat (limited to 'controlloop/common/model-impl')
10 files changed, 62 insertions, 65 deletions
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java index eb4271b5c..038e3f88b 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java @@ -133,7 +133,7 @@ public class AaiNqResponseWrapper implements Serializable { * Walk the items looking for VF modules, allocating the list only when an item is * found. */ - List<AaiNqInventoryResponseItem> vfModuleItems = new ArrayList<>(itemList.size());; + List<AaiNqInventoryResponseItem> vfModuleItems = new ArrayList<>(itemList.size()); for (AaiNqInventoryResponseItem inventoryResponseItem : itemList) { AaiNqVfModule vfmod = inventoryResponseItem.getVfModule(); diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java index 2c8263467..5b504c09c 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * 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. @@ -25,9 +25,9 @@ import com.google.gson.GsonBuilder; public final class Serialization { - private Serialization() {} - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - // .registerTypeAdapter(AAIQueryParameters.class, new notificationTypeAdapter()) .create(); + + private Serialization() {} + } diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java index 3e16f2943..d8a397dca 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java @@ -40,6 +40,13 @@ import org.slf4j.LoggerFactory; public final class Serialization { public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); + public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) + .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) + // .registerTypeAdapter(CommonHeader1607.class, new gsonCommonHeaderInstance()) + // .registerTypeAdapter(ResponseStatus1607.class, new gsonResponseStatus()) + .create(); + private Serialization() {} public static class GsonUtcAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> { @@ -75,11 +82,4 @@ public final class Serialization { } - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - // .registerTypeAdapter(CommonHeader1607.class, new gsonCommonHeaderInstance()) - // .registerTypeAdapter(ResponseStatus1607.class, new gsonResponseStatus()) - .create(); - } diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java index 944d56846..ee2d28094 100644 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java +++ b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * appc * ================================================================================ - * 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. @@ -37,6 +37,16 @@ import org.onap.policy.appclcm.LcmRequest; import org.onap.policy.appclcm.LcmResponse; public final class Serialization { + public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); + + public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(LcmRequest.class, new RequestAdapter()) + .registerTypeAdapter(LcmResponse.class, new ResponseAdapter()).create(); + + public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); + private Serialization() {} public static class RequestAdapter implements JsonSerializer<LcmRequest>, JsonDeserializer<LcmRequest> { @@ -100,14 +110,4 @@ public final class Serialization { } - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); - - public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(LcmRequest.class, new RequestAdapter()) - .registerTypeAdapter(LcmResponse.class, new ResponseAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); - } diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java index 4cae5ca5d..9cb85ae7f 100644 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java +++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java @@ -32,8 +32,5 @@ public class PhysicalControlLoopEvent extends ControlLoopEvent { */ public PhysicalControlLoopEvent(PhysicalControlLoopEvent event) { super(event); - if (event == null) { - return; - } } } diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java index 5dbc7f498..0b5db3a1f 100644 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java +++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java @@ -32,9 +32,6 @@ public class PhysicalControlLoopNotification extends ControlLoopNotification { */ public PhysicalControlLoopNotification(PhysicalControlLoopEvent event) { super(event); - if (event == null) { - return; - } } } diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java index 864b31726..4bbab7a50 100644 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java +++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java @@ -40,6 +40,24 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class Serialization { + public static final Gson gson = + new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) + .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) + .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) + .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); + + + public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) + .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) + .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) + .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); + + public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) + .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) + .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); + private Serialization() {} public static class NotificationTypeAdapter @@ -104,22 +122,4 @@ public final class Serialization { } - public static final Gson gson = - new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - } diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java index dc75334a2..3e52d4f10 100644 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java +++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java @@ -31,10 +31,6 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; public class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { public static final String METHOD_NAME = "DELETE"; - public String getMethod() { - return METHOD_NAME; - } - public HttpDeleteWithBody(final String uri) { super(); setURI(URI.create(uri)); @@ -48,4 +44,9 @@ public class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { public HttpDeleteWithBody() { super(); } + + public String getMethod() { + return METHOD_NAME; + } + } diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java index 0208884ce..3a116d741 100644 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java +++ b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java @@ -3,6 +3,7 @@ * sdnr * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -38,6 +39,16 @@ import org.onap.policy.sdnr.PciResponse; public final class Serialization { + public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); + + public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(PciRequest.class, new RequestAdapter()) + .registerTypeAdapter(PciResponse.class, new ResponseAdapter()).create(); + + public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() + .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); + private Serialization() {} public static class RequestAdapter implements JsonSerializer<PciRequest>, JsonDeserializer<PciRequest> { @@ -101,14 +112,4 @@ public final class Serialization { } - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); - - public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(PciRequest.class, new RequestAdapter()) - .registerTypeAdapter(PciResponse.class, new ResponseAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); - } diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java index 2259296d2..19aca3aae 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. + * Copyright (C) 2017-2018 Intel Corp. All rights reserved. + * Modifications Copyright (C) 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. @@ -22,11 +23,11 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; public final class Serialization { - private Serialization() { - } - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() .setPrettyPrinting() .create(); + private Serialization() { + } + } |