Change getCanonicalName() to getName() in common

Per javadocs, getName() should generally be used instead of
Class.getCanonicalName().
This change only applies to classes; it does not apply to File
objects.

Change-Id: Iea0995d1167f4837607f194d35f0193eeedeacd7
Issue-ID: POLICY-1646
Signed-off-by: Jim Hahn <jrh3@att.com>
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
index 3dc0129..ad2eb69 100644
--- a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
+++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
@@ -339,7 +339,7 @@
         if (parameterGroup != null) {
             result.append(parameterGroup.getName());
             result.append("\" type \"");
-            result.append(parameterGroup.getClass().getCanonicalName());
+            result.append(parameterGroup.getClass().getName());
         } else {
             result.append("UNDEFINED");
         }
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java
index 2c367a3..3583737 100644
--- a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java
+++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java
@@ -163,7 +163,7 @@
         validationResultBuilder.append("field \"");
         validationResultBuilder.append(getName());
         validationResultBuilder.append("\" type \"");
-        validationResultBuilder.append(field.getType().getCanonicalName());
+        validationResultBuilder.append(field.getType().getName());
         validationResultBuilder.append("\" value \"");
         validationResultBuilder.append(parameterValue);
         validationResultBuilder.append("\" ");
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
index 2b41d0f..5144054 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
@@ -37,7 +37,7 @@
     private static final String A_CONSTANT = "A Constant";
 
     private int l00IntField = 0;
-    private String l00StringField = "Legal " + this.getClass().getCanonicalName();
+    private String l00StringField = "Legal " + this.getClass().getName();
     private TestParametersL10 l00L10Nested = new TestParametersL10("l00L10Nested");
     private TestParametersLGeneric l00LGenericNested = new TestParametersLGeneric("l00LGenericNested");
     private Map<String, TestParametersLGeneric> l00LGenericNestedMap = new LinkedHashMap<>();
@@ -132,7 +132,7 @@
 
         switch (triggerStatus) {
             case CLEAN:
-                l00StringField = "Legal " + this.getClass().getCanonicalName();
+                l00StringField = "Legal " + this.getClass().getName();
                 l00IntField = 0;
                 break;
             case OBSERVATION:
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
index e1642be..7276b50 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
@@ -35,7 +35,7 @@
     private static final String L10_STRING_FIELD = "l10StringField";
 
     private int l10IntField = 0;
-    private String l10StringField = "Legal " + this.getClass().getCanonicalName();
+    private String l10StringField = "Legal " + this.getClass().getName();
     private TestParametersLGeneric l10LGenericNested0 = new TestParametersLGeneric("l10LGenericNested0");
     private TestParametersLGeneric l10LGenericNested1 = new TestParametersLGeneric("l10LGenericNested1");
     private Map<String, TestParametersLGeneric> l10LGenericNestedMap = new LinkedHashMap<>();
@@ -116,7 +116,7 @@
 
         switch (triggerStatus) {
             case CLEAN:
-                l10StringField = "Legal " + this.getClass().getCanonicalName();
+                l10StringField = "Legal " + this.getClass().getName();
                 l10IntField = 0;
                 break;
             case OBSERVATION:
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
index 44ec713..f9d6cdc 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
@@ -34,7 +34,7 @@
     private int lgenericIntField = 0;
 
     @NotNull @NotBlank
-    private String lgenericStringField = "Legal " + this.getClass().getCanonicalName();
+    private String lgenericStringField = "Legal " + this.getClass().getName();
 
     /**
      * Default constructor.
@@ -80,7 +80,7 @@
 
         switch (triggerStatus) {
             case CLEAN:
-                lgenericStringField = "Legal " + this.getClass().getCanonicalName();
+                lgenericStringField = "Legal " + this.getClass().getName();
                 lgenericIntField = 0;
                 break;
             case OBSERVATION:
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
index 58c2ada..45ccb06 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
@@ -238,13 +238,13 @@
 
     @Override
     public void setAafAuthentication(String filterPath) {
-        this.addFilterClass(filterPath, CadiFilter.class.getCanonicalName());
+        this.addFilterClass(filterPath, CadiFilter.class.getName());
     }
 
     @Override
     public boolean isAaf() {
         for (FilterHolder filter : context.getServletHandler().getFilters()) {
-            if (CadiFilter.class.getCanonicalName().equals(filter.getClassName())) {
+            if (CadiFilter.class.getName().equals(filter.getClassName())) {
                 return true;
             }
         }
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
index 4f7a5a9..d214d23 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
@@ -118,10 +118,10 @@
                 HttpServletServer.factory.build("echo", true, LOCALHOST, 6667, "/", false, true);
         echoServerAuth.setBasicAuthentication("x", "y", null);
         echoServerAuth.addServletPackage("/*", HttpClientTest.class.getPackage().getName());
-        echoServerAuth.addFilterClass("/*", TestFilter.class.getCanonicalName());
-        echoServerAuth.addFilterClass("/*", TestAuthorizationFilter.class.getCanonicalName());
-        echoServerAuth.addFilterClass("/*", TestAafAuthFilter.class.getCanonicalName());
-        echoServerAuth.addFilterClass("/*", TestAafGranularAuthFilter.class.getCanonicalName());
+        echoServerAuth.addFilterClass("/*", TestFilter.class.getName());
+        echoServerAuth.addFilterClass("/*", TestAuthorizationFilter.class.getName());
+        echoServerAuth.addFilterClass("/*", TestAafAuthFilter.class.getName());
+        echoServerAuth.addFilterClass("/*", TestAafGranularAuthFilter.class.getName());
         echoServerAuth.waitedStart(5000);
 
         if (!NetworkUtil.isTcpPortOpen(LOCALHOST, echoServerAuth.getPort(), 5, 10000L)) {
@@ -259,7 +259,7 @@
         final HttpClient client = HttpClient.factory.build(BusTopicParams.builder().clientName(TEST_HTTP_AUTH_CLIENT)
                         .useHttps(true).allowSelfSignedCerts(true).hostname(LOCALHOST).port(6667)
                         .basePath(JUNIT_ECHO).userName("x").password("y").managed(true)
-                        .serializationProvider(MyJacksonProvider.class.getCanonicalName()).build());
+                        .serializationProvider(MyJacksonProvider.class.getName()).build());
 
         Entity<MyEntity> entity = Entity.entity(new MyEntity(MY_VALUE), MediaType.APPLICATION_JSON);
         final Response response = client.put(HELLO, entity, Collections.emptyMap());
@@ -278,7 +278,7 @@
         final HttpClient client = HttpClient.factory.build(BusTopicParams.builder().clientName(TEST_HTTP_AUTH_CLIENT)
                         .useHttps(true).allowSelfSignedCerts(true).hostname(LOCALHOST).port(6667)
                         .basePath(JUNIT_ECHO).userName("x").password("y").managed(true)
-                        .serializationProvider(MyGsonProvider.class.getCanonicalName()).build());
+                        .serializationProvider(MyGsonProvider.class.getName()).build());
 
         Entity<MyEntity> entity = Entity.entity(new MyEntity(MY_VALUE), MediaType.APPLICATION_JSON);
         final Response response = client.put(HELLO, entity, Collections.emptyMap());
@@ -410,7 +410,7 @@
         httpProperties.setProperty(
                         PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
                                         + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
-                        MyGsonProvider.class.getCanonicalName());
+                        MyGsonProvider.class.getName());
 
         httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
                         + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, LOCALHOST);
@@ -425,7 +425,7 @@
         httpProperties.setProperty(
                         PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
                                         + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
-                        MyJacksonProvider.class.getCanonicalName());
+                        MyJacksonProvider.class.getName());
 
         final List<HttpClient> clients = HttpClient.factory.build(httpProperties);
         assertEquals(2, clients.size());
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
index 34e35a2..41ad212 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
@@ -95,7 +95,7 @@
 
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
         server.addServletPackage("/*", this.getClass().getPackage().getName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.addFilterClass("/*", TestFilter.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -115,9 +115,9 @@
 
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
 
-        server.setSerializationProvider(MyJacksonProvider.class.getCanonicalName());
+        server.setSerializationProvider(MyJacksonProvider.class.getName());
         server.addServletPackage("/*", this.getClass().getPackage().getName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.addFilterClass("/*", TestFilter.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -143,9 +143,9 @@
 
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
 
-        server.setSerializationProvider(MyGsonProvider.class.getCanonicalName());
+        server.setSerializationProvider(MyGsonProvider.class.getName());
         server.addServletPackage("/*", this.getClass().getPackage().getName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.addFilterClass("/*", TestFilter.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -170,8 +170,8 @@
         logger.info("-- testDefaultClassServer() --");
 
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
-        server.addServletClass("/*", RestEchoService.class.getCanonicalName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.addServletClass("/*", RestEchoService.class.getName());
+        server.addFilterClass("/*", TestFilter.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -190,9 +190,9 @@
         logger.info("-- testJacksonClassServer() --");
 
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
-        server.setSerializationProvider(MyJacksonProvider.class.getCanonicalName());
-        server.addServletClass("/*", RestEchoService.class.getCanonicalName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.setSerializationProvider(MyJacksonProvider.class.getName());
+        server.addServletClass("/*", RestEchoService.class.getName());
+        server.addFilterClass("/*", TestFilter.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -217,9 +217,9 @@
         logger.info("-- testGsonClassServer() --");
 
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
-        server.setSerializationProvider(MyGsonProvider.class.getCanonicalName());
-        server.addServletClass("/*", RestEchoService.class.getCanonicalName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.setSerializationProvider(MyGsonProvider.class.getName());
+        server.addServletClass("/*", RestEchoService.class.getName());
+        server.addFilterClass("/*", TestFilter.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -243,7 +243,7 @@
     public void testSerialize() {
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
         server.addServletPackage("/*", this.getClass().getPackage().getName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.addFilterClass("/*", TestFilter.class.getName());
 
         // ensure we can serialize the server
         new GsonTestUtils().compareGson(server, HttpServerTest.class);
@@ -255,7 +255,7 @@
 
         HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
         server.addServletPackage("/*", this.getClass().getPackage().getName());
-        server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+        server.addFilterClass("/*", TestFilter.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -351,7 +351,7 @@
         String randomName = UUID.randomUUID().toString();
 
         HttpServletServer server = HttpServletServer.factory.build(randomName, LOCALHOST, port, "/", false, true);
-        server.addServletClass("/*", RestEchoService.class.getCanonicalName());
+        server.addServletClass("/*", RestEchoService.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -370,8 +370,8 @@
         String randomName = UUID.randomUUID().toString();
 
         HttpServletServer server = HttpServletServer.factory.build(randomName, LOCALHOST, port, "/", false, true);
-        server.addServletClass("/*", RestEchoService.class.getCanonicalName());
-        server.addServletClass("/*", RestEndpoints.class.getCanonicalName());
+        server.addServletClass("/*", RestEchoService.class.getName());
+        server.addServletClass("/*", RestEndpoints.class.getName());
         server.waitedStart(5000);
 
         assertTrue(HttpServletServer.factory.get(port).isAlive());
diff --git a/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java b/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java
index 19a2529..047989e 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 2019 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.
@@ -167,8 +168,8 @@
      */
     public static <T> void instanceOf(final Object objectInstance, final Class<T> requiredClass) {
         if (!requiredClass.isAssignableFrom(objectInstance.getClass())) {
-            throw new IllegalArgumentException(objectInstance.getClass().getCanonicalName() + " is not an instance of "
-                            + requiredClass.getCanonicalName());
+            throw new IllegalArgumentException(objectInstance.getClass().getName() + " is not an instance of "
+                            + requiredClass.getName());
         }
     }
 
@@ -183,8 +184,8 @@
      */
     public static <T> void assignableFrom(final Class<?> checkClass, final Class<T> requiredClass) {
         if (!requiredClass.isAssignableFrom(checkClass)) {
-            throw new IllegalArgumentException(checkClass.getCanonicalName() + " is not an instance of "
-                            + requiredClass.getCanonicalName());
+            throw new IllegalArgumentException(checkClass.getName() + " is not an instance of "
+                            + requiredClass.getName());
         }
     }
 }