summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java/org
diff options
context:
space:
mode:
authorKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-07-29 12:54:01 +0200
committerKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-07-29 17:51:25 +0200
commit15edb7791ddb8cc75421274fab812558219ddaf7 (patch)
treeba412f8f325db8eb95831b4d1dfafdcbae11b11e /mso-api-handlers/mso-api-handler-infra/src/main/java/org
parent852b16f2d60356becf222d2360ac85c977601b8c (diff)
Bug fix - SO GR Api sends wrong reposnse after service instantiation
Issue-ID: SO-2836 Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com> Change-Id: Ib37b7972a939cd353a6cbb0370aed126534315d4
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
index c806e9fc1b..fec512ac44 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -163,12 +163,14 @@ public abstract class AbstractRestHandler {
try {
URL aUrl = new URL(url);
String aPath = aUrl.getPath();
- if (aPath.indexOf("/v") == -1) {
- version = aPath.substring(aPath.indexOf("/V"), aPath.indexOf("/V") + 4);
- } else {
- version = aPath.substring(aPath.indexOf("/v"), aPath.indexOf("/v") + 4);
- }
- String selfLinkPath = Constants.ORCHESTRATION_REQUESTS_PATH.concat(version).concat(requestId);
+ int indexOfVersion = Math.max(aPath.indexOf("/V"), aPath.indexOf("/v"));
+ version = aPath.substring(indexOfVersion, indexOfVersion + 4);
+
+ String pathWithSOAction = aPath.substring(0, indexOfVersion);
+ String pathWithoutSOAction = pathWithSOAction.substring(0, pathWithSOAction.lastIndexOf("/"));
+
+ String selfLinkPath =
+ pathWithoutSOAction.concat(Constants.ORCHESTRATION_REQUESTS_PATH).concat(version).concat(requestId);
selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath));
} catch (Exception e) {
selfLinkUrl = Optional.empty(); // ignore