aboutsummaryrefslogtreecommitdiffstats
path: root/model/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'model/utilities')
-rw-r--r--model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java15
-rw-r--r--model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java9
2 files changed, 21 insertions, 3 deletions
diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java
index a3ecccebe..02a91a72c 100644
--- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java
+++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java
@@ -20,6 +20,9 @@
package org.onap.policy.apex.model.utilities;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
/**
* The Class Assertions is a template class that is used as a shorthand for assertions in the source code.
*
@@ -27,6 +30,9 @@ package org.onap.policy.apex.model.utilities;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class Assertions {
+ // Logger for this class
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(Assertions.class);
+
/**
* Private constructor used to prevent sub class instantiation.
*/
@@ -46,8 +52,13 @@ public final class Assertions {
try {
validateStringParameter(parameterName, parameterValue, pattern);
} catch (IllegalArgumentException e) {
- // This will cause a SONAR error but eliminates all SONAR messages in callers
- return e.getMessage();
+ String message = "parameter " + parameterName + " with value " + parameterValue
+ + " does not match regular expression " + pattern;
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(message, e);
+ }
+
+ return message;
}
return null;
diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java
index ffebc405f..2e6e96d0b 100644
--- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java
+++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java
@@ -24,6 +24,9 @@ import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
//CHECKSTYLE:OFF: checkstyle:IllegalImport
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
//CHECKSTYLE:ON: checkstyle:IllegalImport
@@ -38,6 +41,9 @@ import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
*/
@SuppressWarnings("restriction")
public class ClassBuilder {
+ // Logger for this class
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(ClassBuilder.class);
+
private final Class<?> clazz;
private final List<ClassBuilder> parameters = new ArrayList<>();
@@ -62,7 +68,8 @@ public class ClassBuilder {
} catch (ClassNotFoundException e) {
try {
return new ClassBuilder(Class.forName("java.lang." + className));
- } catch (Exception ignore) {
+ } catch (Exception classFindException) {
+ LOGGER.warn("class nout found", classFindException);
throw new IllegalArgumentException("Class '" + className
+ "' not found. Also looked for a class called 'java.lang." + className + "'", e);
}