From 9253f81d14a5217479ca8e59efb198eaa32ec9f0 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 27 Nov 2019 13:32:45 +0000 Subject: Replace getCaononicalName() with getName() in code base Issue-ID: POLICY-1861 Change-Id: Iccbdcbc5b5978305c56ab74c01a52a562697bee1 Signed-off-by: liamfallon --- .../context/impl/schema/AbstractSchemaHelper.java | 4 ++-- .../context/impl/schema/java/JavaSchemaHelper.java | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'context/context-management') diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java index c4b1a0254..ca1fa78f4 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java @@ -123,7 +123,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { return schemaClass.newInstance(); } catch (final Exception e) { final String returnString = userKey.getId() + ": could not create an instance of class \"" - + schemaClass.getCanonicalName() + "\" using the default constructor \"" + + schemaClass.getName() + "\" using the default constructor \"" + schemaClass.getSimpleName() + "()\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString, e); @@ -150,7 +150,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { return stringConstructor.newInstance(stringValue); } catch (final Exception e) { final String returnString = userKey.getId() + ": could not create an instance of class \"" - + schemaClass.getCanonicalName() + "\" using the string constructor \"" + + schemaClass.getName() + "\" using the string constructor \"" + schemaClass.getSimpleName() + "(String)\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString); diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java index a8fedf24a..b36e00899 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,9 +120,9 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { } final String returnString = getUserKey().getId() + ": the object \"" + incomingObject + "\" of type \"" - + incomingObject.getClass().getCanonicalName() - + "\" is not an instance of JsonObject and is not assignable to \"" - + getSchemaClass().getCanonicalName() + "\""; + + incomingObject.getClass().getName() + + "\" is not an instance of JsonObject and is not assignable to \"" + getSchemaClass().getName() + + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -167,8 +168,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { return getGson().toJson(schemaObject); } else { final String returnString = getUserKey().getId() + ": object \"" + schemaObject.toString() - + "\" of class \"" + schemaObject.getClass().getCanonicalName() - + "\" not compatible with class \"" + getSchemaClass().getCanonicalName() + "\""; + + "\" of class \"" + schemaObject.getClass().getName() + "\" not compatible with class \"" + + getSchemaClass().getName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -224,8 +225,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { return stringConstructor.newInstance(object.toString()); } catch (final Exception e) { final String returnString = getUserKey().getId() + ": object \"" + object.toString() + "\" of class \"" - + object.getClass().getCanonicalName() + "\" not compatible with class \"" - + getSchemaClass().getCanonicalName() + "\""; + + object.getClass().getName() + "\" not compatible with class \"" + + getSchemaClass().getName() + "\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString); } @@ -233,7 +234,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { /** * Get a GSON instance that has the correct adaptation included. - * + * * @return the GSON instance */ private Gson getGson() { @@ -244,11 +245,11 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { JavaSchemaHelperParameters javaSchemaHelperParmeters = (JavaSchemaHelperParameters) schemaParameters .getSchemaHelperParameterMap().get("Java"); - + if (javaSchemaHelperParmeters == null) { javaSchemaHelperParmeters = new JavaSchemaHelperParameters(); } - + for (JavaSchemaHelperJsonAdapterParameters jsonAdapterEntry : javaSchemaHelperParmeters.getJsonAdapters() .values()) { -- cgit 1.2.3-korg