Skip to content

Commit

Permalink
Fixing Error when getting Choreo Connect Runtime Artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
HiranyaKavishani committed Aug 15, 2024
1 parent 70478e7 commit 3c320c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15320,7 +15320,6 @@ public List<APIProductResource> getProductMappingsForAPI(API api) throws APIMana
APIProductResource productMapping = new APIProductResource();
productMapping.setProductIdentifier(apiProductIdentifier);
productMapping.setUriTemplate(uriTemplate);

productMappings.add(productMapping);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ public RuntimeArtifactDto generateGatewayArtifact(List<APIRuntimeArtifactDto> ap
// adding env_properties.json
Map<String, Map<String, Environment>> environmentSpecificAPIProperties =
getEnvironmentSpecificAPIProperties(apiRuntimeArtifactDtoList);
String environmentSpecificAPIPropertyFile = Paths.get(tempDirectory.getAbsolutePath(),
APIConstants.GatewayArtifactConstants.ENVIRONMENT_SPECIFIC_API_PROPERTY_FILE).toString();
CommonUtil.writeDtoToFile(environmentSpecificAPIPropertyFile, ExportFormat.JSON,
APIConstants.GatewayArtifactConstants.ENVIRONMENT_SPECIFIC_API_PROPERTY_FILE,
APIConstants.GatewayArtifactConstants.ENVIRONMENT_SPECIFIC_API_PROPERTY_KEY_NAME,
environmentSpecificAPIProperties);

if (environmentSpecificAPIProperties != null) {
String environmentSpecificAPIPropertyFile = Paths.get(tempDirectory.getAbsolutePath(),
APIConstants.GatewayArtifactConstants.ENVIRONMENT_SPECIFIC_API_PROPERTY_FILE).toString();
CommonUtil.writeDtoToFile(environmentSpecificAPIPropertyFile, ExportFormat.JSON,
APIConstants.GatewayArtifactConstants.ENVIRONMENT_SPECIFIC_API_PROPERTY_FILE,
APIConstants.GatewayArtifactConstants.ENVIRONMENT_SPECIFIC_API_PROPERTY_KEY_NAME,
environmentSpecificAPIProperties);
}
CommonUtil.archiveDirectory(tempDirectory.getAbsolutePath());
FileUtils.deleteQuietly(tempDirectory);
RuntimeArtifactDto runtimeArtifactDto = new RuntimeArtifactDto();
Expand Down Expand Up @@ -150,7 +152,10 @@ private Map<String, Map<String, Environment>> getEnvironmentSpecificAPIPropertie
List<String> apiIds = apiRuntimeArtifactDtoList.stream()
.map(APIRuntimeArtifactDto::getApiId)
.collect(Collectors.toList());
return environmentSpecificAPIPropertyDao.getEnvironmentSpecificAPIPropertiesOfAPIs(apiIds);
if (!apiIds.isEmpty()) {
return environmentSpecificAPIPropertyDao.getEnvironmentSpecificAPIPropertiesOfAPIs(apiIds);
}
return null;
}

@Override
Expand Down

0 comments on commit 3c320c6

Please sign in to comment.