Skip to content

Commit

Permalink
sdk-java issue : "Environment not set. Set environment using setter o…
Browse files Browse the repository at this point in the history
…r use overloaded method to pass appropriate environment #163" Changed 'nullEnvironmentErrorMessage' as a constant to avoid confusion.
  • Loading branch information
shalin-shaji committed Sep 23, 2024
1 parent 866bd82 commit c796604
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ public S executeWithApiResponse(Environment environment) {
return this.getApiResponse();
}

final String nullEnvironmentErrorMessage = "Environment not set. Set environment using setter or use overloaded method to pass appropriate environment";

public void execute() {
if ( null == ApiOperationBase.getEnvironment())
{
throw new InvalidParameterException(nullEnvironmentErrorMessage);
throw new InvalidParameterException(Constants.NULL_ENVIRONMENT_ERROR_MESSAGE);
}
else
{
Expand All @@ -139,7 +138,7 @@ public void execute(Environment environment) {

logger.debug(String.format("Executing Request:'%s'", this.getApiRequest()));

if ( null == environment) throw new InvalidParameterException(nullEnvironmentErrorMessage);
if ( null == environment) throw new InvalidParameterException(Constants.NULL_ENVIRONMENT_ERROR_MESSAGE);

ANetApiResponse httpApiResponse = HttpUtility.postData(environment, this.getApiRequest(), this.responseClass);
if ( null != httpApiResponse)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/authorize/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ public final class Constants {
public static final int HTTP_READ_TIME_OUT_DEFAULT_VALUE = 30000;

public static final String CLIENT_ID = "sdk-java-2.0.3";
public static final String NULL_ENVIRONMENT_ERROR_MESSAGE = "Environment not set. Set environment using setter or use overloaded method to pass appropriate environment";
}

0 comments on commit c796604

Please sign in to comment.