Skip to content

Commit b5b063a

Browse files
author
rathnapandi
committed
- Fix issue #473
1 parent 6f7a53e commit b5b063a

File tree

1 file changed

+7
-6
lines changed
  • modules/apim-adapter/src/main/java/com/axway/apim/lib/utils

1 file changed

+7
-6
lines changed

modules/apim-adapter/src/main/java/com/axway/apim/lib/utils/Utils.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class Utils {
4747

4848
private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
4949
public static final String MASKED_VALUE = "********";
50+
public static final String FILE_SEPARATOR = "/";
5051

5152
public enum FedKeyType {
5253
FilterCircuit("<key type='FilterCircuit'>"), OAuthAppProfile("<key type='OAuthAppProfile'>"), OAuthTokenProfile("<key type='AccessTokenPersist'>");
@@ -171,7 +172,7 @@ public static File getStageConfig(String stage, String stageConfig, File baseCon
171172
} else {
172173
if (!stage.equals("NOT_SET")) {
173174
File stageFile = new File(baseConfig.substring(0, baseConfig.lastIndexOf(".") + 1) + stage + baseConfig.substring(baseConfig.lastIndexOf(".")));
174-
File subDirStageFile = new File(stageFile.getParentFile() + "/" + stage + "/" + stageFile.getName());
175+
File subDirStageFile = new File(stageFile.getParentFile() + File.separator + stage + File.separator + stageFile.getName());
175176
if (stageFile.exists()) {
176177
return stageFile;
177178
} else if (subDirStageFile.exists()) {
@@ -288,9 +289,9 @@ public static void addCustomPropertiesForEntity(List<? extends CustomPropertiesE
288289
String apiId = node.get("id").asText();
289290
entityAsJsonMappedWithId.put(apiId, node);
290291
}
291-
Map<String, String> customProperties = new LinkedHashMap<>();
292292
// Iterate over all APIs (at this point not yet having the custom-properties serialized)
293293
for (CustomPropertiesEntity entity : entities) {
294+
Map<String, String> customProperties = new LinkedHashMap<>();
294295
// Get the original JSON-Payload for the current API fetched from API-Manager
295296
JsonNode node = entityAsJsonMappedWithId.get(entity.getId());
296297
// Iterate over all requested Custom-Properties that should be returned
@@ -344,15 +345,15 @@ public static String handleOpenAPIServerUrl(String serverUrl, String backendBase
344345
if (isHttpUri(serverUrl)) {
345346
URL openApiUrl = new URL(serverUrl);
346347
String path = openApiUrl.getPath();
347-
if (backendBasePath.endsWith("/")) {
348+
if (backendBasePath.endsWith(FILE_SEPARATOR)) {
348349
newBackendBasePath = backendBasePath.substring(0, backendBasePath.length() - 1) + path;
349350
} else newBackendBasePath = backendBasePath + path;
350351
} else {
351-
if (serverUrl.startsWith("/") && !backendBasePath.endsWith("/"))
352+
if (serverUrl.startsWith(FILE_SEPARATOR) && !backendBasePath.endsWith(FILE_SEPARATOR))
352353
newBackendBasePath = backendBasePath + serverUrl;
353-
else if (backendBasePath.endsWith("/"))
354+
else if (backendBasePath.endsWith(FILE_SEPARATOR))
354355
newBackendBasePath = backendBasePath.substring(0, backendBasePath.length() - 1) + serverUrl;
355-
else newBackendBasePath = backendBasePath + "/" + serverUrl;
356+
else newBackendBasePath = backendBasePath + FILE_SEPARATOR + serverUrl;
356357
}
357358
return newBackendBasePath;
358359
}

0 commit comments

Comments
 (0)