Update response handling logic in ResponseValidator

Refined the condition for exception handling based on 'emptyResultThrowsException' to clarify when exceptions are triggered versus returning empty results. Updated Javadoc output files to reflect the latest documentation changes.
This commit is contained in:
2025-04-26 17:46:36 +02:00
parent 25855078f8
commit 3efbe1eaae
54 changed files with 195 additions and 130 deletions
@@ -69,10 +69,13 @@ public class CfDnsClient extends CfBasicHttpClient {
/**
* Constructs a new instance of {@code CfDnsClient}.
*
* @param emptyResultThrowsException a boolean value indicating whether an exception should be
* thrown when the result is empty
* @param authEmail the authentication email required for API access
* @param authKey the authentication key required for API access
* @param emptyResultThrowsException A boolean value indicating whether an exception should be
* thrown when the result is empty, it's valid for 'list
* requests' only. Default is true.
* @param authEmail The email address associated with the Cloudflare account,
* used for authentication.
* @param authKey The API key of the Cloudflare account, used as part of the
* authentication process.
*/
public CfDnsClient(boolean emptyResultThrowsException, String authEmail, String authKey) {
this(emptyResultThrowsException, DEFAULT_BASEURL, authEmail, authKey);
@@ -81,8 +84,9 @@ public class CfDnsClient extends CfBasicHttpClient {
/**
* Constructs a new instance of {@code CfDnsClient}.
*
* @param emptyResultThrowsException Specifies if an exception should be thrown when the API
* response is empty. Default is true.
* @param emptyResultThrowsException A boolean value indicating whether an exception should be
* thrown when the result is empty, it's valid for 'list
* requests' only. Default is true.
* @param baseUrl The base URL for the Cloudflare API endpoint.
* @param authEmail The email associated with the Cloudflare account for
* authentication.
@@ -15,8 +15,8 @@ import java.util.stream.Collectors;
* metadata. If the response indicates failure, an exception is thrown with descriptive error
* messages.
* <li>If a {@link RecordMultipleResponse} is used, it validates the number of results in the API
* response payload to detect unexpected counts. Depending on the configuration,
* discrepancies in the result count or an empty result may trigger exceptions.
* response payload to detect unexpected counts. Depending on the parameter
* 'emptyResultThrowsException', an exception will be triggered or an empty result will be returned.
* </ul>
*/
class ResponseValidator {