diff --git a/src/main/java/net/authorize/api/controller/base/ApiOperationBase.java b/src/main/java/net/authorize/api/controller/base/ApiOperationBase.java index 52e3d7cc..c59b2c55 100644 --- a/src/main/java/net/authorize/api/controller/base/ApiOperationBase.java +++ b/src/main/java/net/authorize/api/controller/base/ApiOperationBase.java @@ -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 { @@ -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) diff --git a/src/main/java/net/authorize/util/Constants.java b/src/main/java/net/authorize/util/Constants.java index 2a2b42c5..500f920c 100644 --- a/src/main/java/net/authorize/util/Constants.java +++ b/src/main/java/net/authorize/util/Constants.java @@ -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"; }