summaryrefslogtreecommitdiffstats
path: root/aai-resources/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'aai-resources/src/main/java')
-rw-r--r--aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java3
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java3
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java24
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java24
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java2
5 files changed, 42 insertions, 14 deletions
diff --git a/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java b/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
index a473c2a..9331f2f 100644
--- a/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
+++ b/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
@@ -110,7 +110,8 @@ public class IncreaseNodesTool {
public void run(JanusGraph janusGraph, String[] args)
throws AAIUnknownObjectException, UnsupportedEncodingException {
CommandLineArgs cArgs = new CommandLineArgs();
- JCommander jCommander = new JCommander(cArgs, args);
+ JCommander jCommander = new JCommander(cArgs);
+ jCommander.parse(args);
jCommander.setProgramName(IncreaseNodesTool.class.getSimpleName());
Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
diff --git a/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java b/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java
index 4c92eb2..bc87bfa 100644
--- a/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java
+++ b/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java
@@ -27,6 +27,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.Charset;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
@@ -66,7 +67,7 @@ public class PropertyPasswordConfiguration implements ApplicationContextInitiali
if (passwordStream != null) {
String keystorePassword = null;
- keystorePassword = IOUtils.toString(passwordStream);
+ keystorePassword = IOUtils.toString(passwordStream, Charset.defaultCharset());
if (keystorePassword != null) {
keystorePassword = keystorePassword.trim();
}
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
index 9d90a46..c7f0911 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
@@ -20,12 +20,22 @@
package org.onap.aai.rest;
-import com.google.gson.*;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.google.gson.JsonSyntaxException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
@@ -33,8 +43,13 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.core.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
import org.javatuples.Pair;
import org.onap.aai.config.SpringContextAware;
@@ -237,9 +252,8 @@ public abstract class BulkConsumer extends RESTAPI {
* bodies to be processed.
*/
private JsonArray getTransactions(String content, HttpHeaders headers) throws AAIException, JsonSyntaxException {
- JsonParser parser = new JsonParser();
- JsonObject input = parser.parse(content).getAsJsonObject();
+ JsonObject input = JsonParser.parseString(content).getAsJsonObject();
String module = getModule();
if (!(input.has("transactions"))) {
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java
index cc1e912..1b274b9 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java
@@ -29,11 +29,24 @@ import io.micrometer.core.annotation.Timed;
import java.io.UnsupportedEncodingException;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
import org.javatuples.Pair;
import org.onap.aai.config.SpringContextAware;
@@ -65,7 +78,6 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
private static final Set<String> validOperations =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("put", "patch", "delete")));
- private static final JsonParser parser = new JsonParser();
private int allowedOperationCount = 30;
private static final Logger LOGGER = LoggerFactory.getLogger(BulkSingleTransactionConsumer.class);
@@ -172,8 +184,8 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
for (int i = 0; i < transaction.getOperations().size(); i++) {
if (!Response.Status.Family.familyOf(results.get(i).getValue1().getStatus())
.equals(Response.Status.Family.SUCCESSFUL)) {
- final JsonArray vars = parser.parse(results.get(i).getValue1().getEntity().toString()).getAsJsonObject()
- .getAsJsonObject("requestError").getAsJsonObject("serviceException")
+ final JsonArray vars = JsonParser.parseString(results.get(i).getValue1().getEntity().toString())
+ .getAsJsonObject().getAsJsonObject("requestError").getAsJsonObject("serviceException")
.getAsJsonArray("variables");
StringBuilder sb = new StringBuilder();
for (int j = 2; j < vars.size() - 1; j++) {
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java
index 95a6f2b..bcd6e7c 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java
@@ -71,7 +71,7 @@ public class OperationResponse {
if (s == null) {
this.body = null;
} else {
- this.body = new JsonParser().parse(s.toString()).getAsJsonObject();
+ this.body = JsonParser.parseString(s.toString()).getAsJsonObject();
}
}
}