From efb0b6d9d10458635193195764efac48d825441f Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Fri, 24 Apr 2020 16:19:05 -0400 Subject: Update encoding library used Update encoding library used Issue-ID: SO-2830 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Ifc5099f10c15fc6ef8bac367211320d61c20ca43 --- .../main/java/org/onap/so/openstack/utils/GlanceClientImpl.java | 9 +++++++-- .../main/java/org/onap/so/openstack/utils/NeutronClientImpl.java | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'adapters/mso-adapter-utils') diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java index b98811c490..740eb778b0 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java @@ -20,13 +20,14 @@ package org.onap.so.openstack.utils; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import org.onap.so.cloud.authentication.KeystoneAuthHolder; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import org.springframework.web.util.UriUtils; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.glance.Glance; import com.woorea.openstack.glance.model.Images; @@ -72,7 +73,11 @@ public class GlanceClientImpl extends MsoCommonUtils { try { String encodedName = null; if (name != null) { - encodedName = UriUtils.encodeQueryParam(name, "UTF-8"); + try { + encodedName = URLEncoder.encode(name, "UTF-8"); + } catch (UnsupportedEncodingException e) { + logger.error("error encoding query parameter: {}", encodedName); + } } Glance glanceClient = getGlanceClient(cloudSiteId, tenantId); // list is set to false, otherwise an invalid URL is appended diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java index 27ff86d7f7..96ed408c80 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java @@ -20,13 +20,14 @@ package org.onap.so.openstack.utils; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import org.onap.so.cloud.authentication.KeystoneAuthHolder; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import org.springframework.web.util.UriUtils; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.quantum.Quantum; import com.woorea.openstack.quantum.model.Networks; @@ -76,7 +77,11 @@ public class NeutronClientImpl extends MsoCommonUtils { try { String encodedName = null; if (name != null) { - encodedName = UriUtils.encodeQueryParam(name, "UTF-8"); + try { + encodedName = URLEncoder.encode(name, "UTF-8"); + } catch (UnsupportedEncodingException e) { + logger.error("error encoding query parameter: {}", encodedName); + } } Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId); OpenStackRequest request = neutronClient.networks().list().queryParam("id", id) -- cgit 1.2.3-korg