Fix error message and minor fixes in loop and if condition

policy-search-9869^2
Pasindu Rupasinghe 2 years ago
parent 014f95bd10
commit c5a7902386

@ -111,7 +111,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
accessTokenInfo = apiApplicationServices.generateAccessTokenFromRegisteredApplication( accessTokenInfo = apiApplicationServices.generateAccessTokenFromRegisteredApplication(
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
} catch (APIServicesException e) { } catch (APIServicesException e) {
String errorMsg = "Error while generating application"; String errorMsg = "Error occurred while generating the API application";
log.error(errorMsg, e); log.error(errorMsg, e);
throw new APIManagerPublisherException(e); throw new APIManagerPublisherException(e);
} }
@ -165,6 +165,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
Constants.EMPTY_STRING))){ Constants.EMPTY_STRING))){
apiFound = true; apiFound = true;
apiIdentifier.setUuid(apiObj.getString("id")); apiIdentifier.setUuid(apiObj.getString("id"));
break;
} }
} }
if (!apiFound) { if (!apiFound) {
@ -387,7 +388,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
JSONArray documentList = (JSONArray) publisherRESTAPIServices.getDocumentations(apiApplicationKey, JSONArray documentList = (JSONArray) publisherRESTAPIServices.getDocumentations(apiApplicationKey,
accessTokenInfo, api.getId()).get("list"); accessTokenInfo, api.getId()).get("list");
if (!(documentList.length() == 0)) { if (documentList.length() > 0) {
for (int i = 0; i < documentList.length(); i++) { for (int i = 0; i < documentList.length(); i++) {
JSONObject existingDoc = documentList.getJSONObject(i); JSONObject existingDoc = documentList.getJSONObject(i);
if (existingDoc.getString("name").equals(apiConfig.getApiDocumentationName()) if (existingDoc.getString("name").equals(apiConfig.getApiDocumentationName())
@ -438,7 +439,7 @@ public class APIPublisherServiceImpl implements APIPublisherService {
accessTokenInfo = apiApplicationServices.generateAccessTokenFromRegisteredApplication( accessTokenInfo = apiApplicationServices.generateAccessTokenFromRegisteredApplication(
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
} catch (APIServicesException e) { } catch (APIServicesException e) {
String errorMsg = "Error while generating application"; String errorMsg = "Error occurred while generating the API application";
log.error(errorMsg, e); log.error(errorMsg, e);
throw new APIManagerPublisherException(e); throw new APIManagerPublisherException(e);
} }

Loading…
Cancel
Save