summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-04-24 16:19:05 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-04-27 21:48:51 -0400
commitefb0b6d9d10458635193195764efac48d825441f (patch)
treed227658910bcb6fe6796c04ec96b6f3be0b53d18
parent0151f5c120f7d325a337efd522f7b46b0f027a1f (diff)
Update encoding library used
Update encoding library used Issue-ID: SO-2830 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ifc5099f10c15fc6ef8bac367211320d61c20ca43
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java9
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java9
2 files changed, 14 insertions, 4 deletions
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<Networks> request = neutronClient.networks().list().queryParam("id", id)