aboutsummaryrefslogtreecommitdiffstats
path: root/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterException.java
diff options
context:
space:
mode:
Diffstat (limited to 'common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterException.java')
-rw-r--r--common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterException.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterException.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterException.java
index 0b29a4e6..aa3105ef 100644
--- a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterException.java
+++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterException.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
@@ -20,6 +21,8 @@
package org.onap.policy.common.parameters;
+import lombok.Getter;
+
/**
* Exception thrown oon parameter reading, validation, and check errors.
*
@@ -29,6 +32,7 @@ public class ParameterException extends Exception {
private static final long serialVersionUID = -8507246953751956974L;
// The object on which the exception was thrown
+ @Getter
private final transient Object object;
/**
@@ -84,28 +88,19 @@ public class ParameterException extends Exception {
/**
* Build a cascaded message from an exception and all its nested exceptions.
- *
+ *
* @param throwable the top level exception
* @return cascaded message string
*/
public static String buildCascadedMessage(final Throwable throwable) {
- final StringBuilder builder = new StringBuilder();
+ final var builder = new StringBuilder();
builder.append(throwable.getMessage());
- for (Throwable t = throwable; t != null; t = t.getCause()) {
+ for (var t = throwable; t != null; t = t.getCause()) {
builder.append("\ncaused by: ");
builder.append(t.getMessage());
}
return builder.toString();
}
-
- /**
- * Get the object on which the exception was thrown.
- *
- * @return The object on which the exception was thrown
- */
- public Object getObject() {
- return object;
- }
}