aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-distribution-client/src/main/java/org/onap/sdc/utils/GeneralUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-distribution-client/src/main/java/org/onap/sdc/utils/GeneralUtils.java')
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/utils/GeneralUtils.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/GeneralUtils.java b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/GeneralUtils.java
index d550b74..ff5d201 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/GeneralUtils.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/GeneralUtils.java
@@ -21,22 +21,21 @@
package org.onap.sdc.utils;
-import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
+import fj.data.Either;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientResultImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.regex.Pattern;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.impl.DistributionClientResultImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import fj.data.Either;
-
public class GeneralUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(GeneralUtils.class.getName());
private static final int STRING_LENGTH_DIVIDER = 4;
@@ -45,7 +44,7 @@ public class GeneralUtils {
}
public static String calculateMD5(String data) {
- String calculatedMd5 = Hashing.md5().hashString(data, Charsets.UTF_8).toString();
+ String calculatedMd5 = Hashing.md5().hashString(data, StandardCharsets.UTF_8).toString();
// encode base-64 result
byte[] encodeBase64 = Base64.getEncoder().encode(calculatedMd5.getBytes());
return new String(encodeBase64);
@@ -61,7 +60,7 @@ public class GeneralUtils {
boolean isEncoded = false;
try {
// If no exception is caught, then it is possibly a base64 encoded string
- byte[] data = Base64.getDecoder().decode(str);
+ Base64.getDecoder().decode(str);
// checks if the string was properly padded to the
isEncoded = ((str.length() % STRING_LENGTH_DIVIDER == 0) && (Pattern.matches("\\A[a-zA-Z0-9/+]+={1,2}\\z", str)));