diff --git a/src/main/java/io/securecodebox/persistence/defectdojo/exception/ConfigException.java b/src/main/java/io/securecodebox/persistence/defectdojo/exception/ConfigException.java index 38b159ba..764993a8 100644 --- a/src/main/java/io/securecodebox/persistence/defectdojo/exception/ConfigException.java +++ b/src/main/java/io/securecodebox/persistence/defectdojo/exception/ConfigException.java @@ -6,9 +6,9 @@ package io.securecodebox.persistence.defectdojo.exception; /** - * Indicates a missing {@link io.securecodebox.persistence.defectdojo.config.Config config property} + * Indicates a missing/bad {@link io.securecodebox.persistence.defectdojo.config.Config config property} */ -public final class ConfigException extends RuntimeException { +public final class ConfigException extends PersistenceException { public ConfigException(final String message) { super(message); } diff --git a/src/main/java/io/securecodebox/persistence/defectdojo/exception/LoopException.java b/src/main/java/io/securecodebox/persistence/defectdojo/exception/LoopException.java deleted file mode 100644 index 5bebd374..00000000 --- a/src/main/java/io/securecodebox/persistence/defectdojo/exception/LoopException.java +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-FileCopyrightText: the secureCodeBox authors -// -// SPDX-License-Identifier: Apache-2.0 - -package io.securecodebox.persistence.defectdojo.exception; - -public final class LoopException extends RuntimeException { - public LoopException(String message) { - super(message); - } - - public LoopException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/src/main/java/io/securecodebox/persistence/defectdojo/exception/PersistenceException.java b/src/main/java/io/securecodebox/persistence/defectdojo/exception/PersistenceException.java index b480c094..e890c4c0 100644 --- a/src/main/java/io/securecodebox/persistence/defectdojo/exception/PersistenceException.java +++ b/src/main/java/io/securecodebox/persistence/defectdojo/exception/PersistenceException.java @@ -4,7 +4,10 @@ package io.securecodebox.persistence.defectdojo.exception; -public final class PersistenceException extends RuntimeException { +/** + * Generic exception which is thrown for any unforeseen error at runtime + */ +public class PersistenceException extends RuntimeException { public PersistenceException(String message) { super(message); } diff --git a/src/main/java/io/securecodebox/persistence/defectdojo/exception/TooManyResponsesException.java b/src/main/java/io/securecodebox/persistence/defectdojo/exception/TooManyResponsesException.java new file mode 100644 index 00000000..0b2d3170 --- /dev/null +++ b/src/main/java/io/securecodebox/persistence/defectdojo/exception/TooManyResponsesException.java @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: the secureCodeBox authors +// +// SPDX-License-Identifier: Apache-2.0 + +package io.securecodebox.persistence.defectdojo.exception; + +import io.securecodebox.persistence.defectdojo.config.Config; + +/** + * Thrown if we receive more objects than {@link Config#getMaxPageCountForGets() configured} + */ +public final class TooManyResponsesException extends PersistenceException { + public TooManyResponsesException(String message) { + super(message); + } +} diff --git a/src/main/java/io/securecodebox/persistence/defectdojo/service/GenericDefectDojoService.java b/src/main/java/io/securecodebox/persistence/defectdojo/service/GenericDefectDojoService.java index 1dca8eb2..23a71956 100644 --- a/src/main/java/io/securecodebox/persistence/defectdojo/service/GenericDefectDojoService.java +++ b/src/main/java/io/securecodebox/persistence/defectdojo/service/GenericDefectDojoService.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.databind.cfg.CoercionAction; import com.fasterxml.jackson.databind.cfg.CoercionInputShape; import io.securecodebox.persistence.defectdojo.config.Config; -import io.securecodebox.persistence.defectdojo.exception.LoopException; +import io.securecodebox.persistence.defectdojo.exception.TooManyResponsesException; import io.securecodebox.persistence.defectdojo.http.Foo; import io.securecodebox.persistence.defectdojo.http.ProxyConfigFactory; import io.securecodebox.persistence.defectdojo.model.Engagement; @@ -142,7 +142,7 @@ public List search(Map queryParams) throws URISyntaxException hasNext = response.getNext() != null; if (page > this.config.getMaxPageCountForGets()) { - throw new LoopException("Found too many response object. Quitting after " + (page - 1) + " paginated API pages of " + DEFECT_DOJO_OBJET_LIMIT + " each."); + throw new TooManyResponsesException("Found too many response object. Quitting after " + (page - 1) + " paginated API pages of " + DEFECT_DOJO_OBJET_LIMIT + " each."); } } while (hasNext);