summaryrefslogtreecommitdiffstats
path: root/clustercontroller-utils
diff options
context:
space:
mode:
authorgjoranv <gv@yahooinc.com>2023-07-17 14:08:51 +0200
committergjoranv <gv@yahooinc.com>2023-07-17 14:12:45 +0200
commitcd7ceae8684dfc83d2856dd42b6d5ec009d64359 (patch)
treefc52135556e7732060698eda22fd07c0291c88e2 /clustercontroller-utils
parentdab95e8297ce1ddedcd64b57606ad03bfa36dce7 (diff)
jdk21: Avoid calling superclass methods from subclass ctors
Diffstat (limited to 'clustercontroller-utils')
-rw-r--r--clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidContentException.java4
-rw-r--r--clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidOptionValueException.java7
-rw-r--r--clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/MissingUnitException.java4
-rw-r--r--clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/OperationNotSupportedForUnitException.java4
-rw-r--r--clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/StateRestApiException.java20
5 files changed, 11 insertions, 28 deletions
diff --git a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidContentException.java b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidContentException.java
index 4363b895779..0f288b9cc5d 100644
--- a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidContentException.java
+++ b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidContentException.java
@@ -4,9 +4,7 @@ package com.yahoo.vespa.clustercontroller.utils.staterestapi.errors;
public class InvalidContentException extends StateRestApiException {
public InvalidContentException(String description) {
- super(description);
- setHtmlCode(400);
- setHtmlStatus("Content of HTTP request had invalid data");
+ super(description, 400, "Content of HTTP request had invalid data");
}
}
diff --git a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidOptionValueException.java b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidOptionValueException.java
index c30744a6a50..33fb0085c0f 100644
--- a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidOptionValueException.java
+++ b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/InvalidOptionValueException.java
@@ -4,9 +4,10 @@ package com.yahoo.vespa.clustercontroller.utils.staterestapi.errors;
public class InvalidOptionValueException extends StateRestApiException {
public InvalidOptionValueException(String option, String value, String description) {
- super("Option '" + option + "' have invalid value '" + value + "': " + description);
- setHtmlCode(400);
- setHtmlStatus("Option '" + option + "' have invalid value '" + value + "'");
+ super("Option '" + option + "' have invalid value '" + value + "': " + description,
+ 400,
+ "Option '" + option + "' have invalid value '" + value + "'");
+
}
}
diff --git a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/MissingUnitException.java b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/MissingUnitException.java
index 58a862f4878..51e5f400ea2 100644
--- a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/MissingUnitException.java
+++ b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/MissingUnitException.java
@@ -16,9 +16,7 @@ public class MissingUnitException extends StateRestApiException {
}
public MissingUnitException(List<String> path, int level) {
- super(createMessage(path, level));
- setHtmlCode(404);
- setHtmlStatus(getMessage());
+ super(createMessage(path, level), 404, null);
}
}
diff --git a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/OperationNotSupportedForUnitException.java b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/OperationNotSupportedForUnitException.java
index ffe43878839..5b097e3b899 100644
--- a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/OperationNotSupportedForUnitException.java
+++ b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/OperationNotSupportedForUnitException.java
@@ -11,9 +11,7 @@ public class OperationNotSupportedForUnitException extends StateRestApiException
}
public OperationNotSupportedForUnitException(List<String> path, String description) {
- super(createMessage(path, description));
- setHtmlCode(405);
- setHtmlStatus("Operation not supported for resource");
+ super(createMessage(path, description), 405, "Operation not supported for resource");
}
}
diff --git a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/StateRestApiException.java b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/StateRestApiException.java
index d168841b063..0efc14766bb 100644
--- a/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/StateRestApiException.java
+++ b/clustercontroller-utils/src/main/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/errors/StateRestApiException.java
@@ -10,22 +10,10 @@ public abstract class StateRestApiException extends Exception {
super(description);
}
- /**
- * If given, this HTML code is set in the response. If not given, a value will
- * be autogenerated to fit.
- */
- public StateRestApiException setHtmlCode(int code) {
- htmlCode = code;
- return this;
- }
-
- /**
- * If given, this HTML status string is set in the response. If not given, a value will
- * be autogenerated to fit.
- */
- public StateRestApiException setHtmlStatus(String status) {
- htmlStatus = status;
- return this;
+ public StateRestApiException(String message, Integer htmlCode, String htmlStatus) {
+ super(message);
+ this.htmlCode = htmlCode;
+ this.htmlStatus = htmlStatus != null ? htmlStatus : message;
}
public Integer getCode() { return htmlCode; }