diff options
14 files changed, 146 insertions, 125 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java index b88477c0..fa9bcf02 100644 --- a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java +++ b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java @@ -186,20 +186,8 @@ public class OnapCommandResult { return noOfRecords; } - /** - * Helps to print the result based on the type. - * - * @return string - * @throws OnapCommandOutputFormatNotsupported - * excpetion - * @throws OnapCommandOutputPrintingFailed - * exception - */ - public String print() throws OnapCommandException { - if (this.getType().equals(OnapCommandResultType.TEXT)) { - return this.getOutput().toString(); - } + public OnapCommandPrint createAndLoadPrint() { OnapCommandPrint print = new OnapCommandPrint(); print.setPrintTitle(this.isIncludeTitle()); print.setDirection(this.printDirection); @@ -232,6 +220,24 @@ public class OnapCommandResult { print.addColumn(val.getName(), val.getValues()); } } + return print; + } + + /** + * Helps to print the result based on the type. + * + * @return string + * @throws OnapCommandOutputFormatNotsupported + * excpetion + * @throws OnapCommandOutputPrintingFailed + * exception + */ + public String print() throws OnapCommandException { + if (this.getType().equals(OnapCommandResultType.TEXT)) { + return this.getOutput().toString(); + } + + OnapCommandPrint print = createAndLoadPrint(); if (this.getType().equals(OnapCommandResultType.JSON)) { return print.printJson(); diff --git a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java index d2bc98be..14e37c3c 100644 --- a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java +++ b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java @@ -98,6 +98,21 @@ public class OnapCommandPrint { return max; } + public List<List<Object>> addTitle(List<List<Object>> rows, boolean isNormalize){ + if (this.isPrintTitle()) { + List<Object> list = new ArrayList<>(); + for (String key : this.data.keySet()) { + if (isNormalize && key != null && key.length() > MAX_COLUMN_LENGTH) { + list.add(splitIntoList(key, MAX_COLUMN_LENGTH)); + } else { + list.add(key); + } + } + rows.add(list); + } + return rows; + } + /** * Helps to form the rows from columns. * @@ -112,17 +127,7 @@ public class OnapCommandPrint { List<List<Object>> rows = new ArrayList<>(); // add title - if (this.isPrintTitle()) { - List<Object> list = new ArrayList<>(); - for (String key : this.data.keySet()) { - if (isNormalize && key != null && key.length() > MAX_COLUMN_LENGTH) { - list.add(splitIntoList(key, MAX_COLUMN_LENGTH)); - } else { - list.add(key); - } - } - rows.add(list); - } + rows = addTitle(rows, isNormalize); // form row for (int i = 0; i < this.findMaxRows(); i++) { @@ -166,7 +171,7 @@ public class OnapCommandPrint { } // new line is converted to space char if (inp.contains("\n")) { - inp = inp.replaceAll("\n", ""); + inp = inp.replace("\n", ""); } StringTokenizer tok = new StringTokenizer(inp, " "); @@ -243,15 +248,20 @@ public class OnapCommandPrint { } } + public JSONObject printPortrait(List<List<Object>> rows){ + JSONObject result = new JSONObject(); + for (int i=1; i<rows.size(); i++) { + if (rows.get(i).get(1) != null) + result.put(rows.get(i).get(0).toString(), this.getJsonNodeOrString(rows.get(i).get(1).toString())); + } + return result; + } + public String printJson() { List<List<Object>> rows = this.formRows(false); if (this.direction.equals(OnapCommandPrintDirection.PORTRAIT)) { - JSONObject result = new JSONObject(); - for (int i=1; i<rows.size(); i++) { - if (rows.get(i).get(1) != null) - result.put(rows.get(i).get(0).toString(), this.getJsonNodeOrString(rows.get(i).get(1).toString())); - } + JSONObject result = printPortrait(rows); return result.toJSONString(); } else { JSONArray array = new JSONArray(); diff --git a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java index 28344def..912ea23d 100644 --- a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java +++ b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java @@ -17,6 +17,7 @@ package org.onap.cli.fw.registrar; import java.io.IOException; +import java.nio.charset.Charset; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -332,7 +333,7 @@ public class OnapCommandRegistrar { String versionInfo = ""; try { - versionInfo = IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(OnapCommandConstants.VERSION_INFO)); + versionInfo = IOUtils.toString((this.getClass().getClassLoader().getResourceAsStream(OnapCommandConstants.VERSION_INFO)), (Charset) null); } catch (IOException e) { // NOSONAR //Never occurs } diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java index e051d5dd..71a189e5 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java @@ -183,7 +183,7 @@ public class OnapCommandSchemaLoader { List<String> longOptions = new ArrayList<>(); if (validate) { - OnapCommandUtils.validateTags(exceptionList, (Map<String, Object>) values, OnapCommandConfig.getCommaSeparatedList(TOP_LEVEL_PARAMS_LIST), + OnapCommandUtils.validateTags(exceptionList, values, OnapCommandConfig.getCommaSeparatedList(TOP_LEVEL_PARAMS_LIST), OnapCommandConfig.getCommaSeparatedList(TOP_LEVEL_MANDATORY_LIST), "root level"); } diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java index 0712603a..7e0d40ee 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java @@ -51,6 +51,29 @@ public class OnapCommandSchemaMerger { } + public static void mergeWithExistingValue(Object yamlValue, Object existingValue, String key, Map<String, Object> mergedResult){ + if (yamlValue instanceof Map) { + if (existingValue instanceof Map) { + mergeYamlMap((Map<String, Object>) existingValue, (Map<String, Object>) yamlValue); + } else if (existingValue instanceof String) { + throw new IllegalArgumentException("Cannot merge complex element into a simple element: "+key); + } else { + throw unknownValueType(key, yamlValue); + } + } else if (yamlValue instanceof List) { + mergeYamlLists(mergedResult, key, yamlValue); + + } else if (yamlValue instanceof String + || yamlValue instanceof Boolean + || yamlValue instanceof Double + || yamlValue instanceof Integer) { + mergedResult.put(key, yamlValue); + + } else { + throw unknownValueType(key, yamlValue); + } + } + public static void mergeYamlMap(Map<String, Object> mergedResult, Map<String, Object> yamlContents) { if (yamlContents == null) return; @@ -64,27 +87,7 @@ public class OnapCommandSchemaMerger { Object existingValue = mergedResult.get(key); if (existingValue != null) { - if (yamlValue instanceof Map) { - if (existingValue instanceof Map) { - mergeYamlMap((Map<String, Object>) existingValue, (Map<String, Object>) yamlValue); - } else if (existingValue instanceof String) { - throw new IllegalArgumentException("Cannot merge complex element into a simple element: "+key); - } else { - throw unknownValueType(key, yamlValue); - } - } else if (yamlValue instanceof List) { - mergeYamlLists(mergedResult, key, yamlValue); - - } else if (yamlValue instanceof String - || yamlValue instanceof Boolean - || yamlValue instanceof Double - || yamlValue instanceof Integer) { - mergedResult.put(key, yamlValue); - - } else { - throw unknownValueType(key, yamlValue); - } - + mergeWithExistingValue(yamlValue, existingValue, key, mergedResult); } else { if (yamlValue instanceof Map || yamlValue instanceof List @@ -105,6 +108,30 @@ public class OnapCommandSchemaMerger { return new IllegalArgumentException(msg); } + private static void compareWithExistingNames(String nameN, List<Object> originalList, Map<String, Object> oN, Object o){ + if (nameN != null) { + + boolean existing = false; + for (Object e: originalList) { + Map<String, Object> oE = (Map) e; + String nameE = (String)oE.getOrDefault(OnapCommandConstants.NAME, null); + + //Name should be existing in the map, otherwise continue as don't know how to compare + if (nameN.equals(nameE)) { + for (Entry<String, Object> oNe : oN.entrySet()) { + oE.put(oNe.getKey(), oNe.getValue()); + } + existing = true; + break; + } + } + + if (!existing) { + originalList.add(o); + } + } + } + @SuppressWarnings("unchecked") private static void mergeYamlLists(Map<String, Object> mergedResult, String key, Object yamlValue) { if (! (yamlValue instanceof List && mergedResult.get(key) instanceof List)) { @@ -118,27 +145,7 @@ public class OnapCommandSchemaMerger { String nameN = (String)oN.getOrDefault(OnapCommandConstants.NAME, null); //Name should be existing in the map, otherwise continue as don't know how to compare - if (nameN != null) { - - boolean existing = false; - for (Object e: originalList) { - Map<String, Object> oE = (Map) e; - String nameE = (String)oE.getOrDefault(OnapCommandConstants.NAME, null); - - //Name should be existing in the map, otherwise continue as don't know how to compare - if (nameN.equals(nameE)) { - for (Entry<String, Object> oNe : oN.entrySet()) { - oE.put(oNe.getKey(), oNe.getValue()); - } - existing = true; - break; - } - } - - if (!existing) { - originalList.add(o); - } - } + compareWithExistingNames(nameN, originalList, oN, o); } } } diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java index 32ececfa..3b6e7853 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java @@ -18,6 +18,7 @@ package org.onap.cli.fw.store; import java.io.File; import java.io.IOException; +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.security.MessageDigest; @@ -184,7 +185,7 @@ public class OnapCommandArtifactStore { artifact.setCreateAt(dateFormatter.format(new Date())); artifact.setLastUpdatedAt(artifact.getCreateAt()); - FileUtils.writeStringToFile(new File(storePath), gson.toJson(artifact)); + FileUtils.writeStringToFile(new File(storePath), gson.toJson(artifact), (Charset) null); } catch (Exception e) { // NOSONAR //It is expected that this never occurs log.error("Failed to store the artifact at {}", storePath); @@ -201,7 +202,7 @@ public class OnapCommandArtifactStore { } try { - return gson.fromJson(FileUtils.readFileToString(aFile), Artifact.class); + return gson.fromJson(FileUtils.readFileToString(aFile, (Charset) null), Artifact.class); } catch (Exception e) { // NOSONAR //It is expected that this never occurs log.error("Failed to retrieve the artifact at {}", storePath); @@ -232,12 +233,7 @@ public class OnapCommandArtifactStore { final String SP = searchPattern; //NOSONAR - for (File file: new File(getBasePath()).listFiles(/*new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.matches(SP); - } - }*/)) { + for (File file: new File(getBasePath()).listFiles()) { try (JsonReader jsonReader = new JsonReader(new FileReader(file))){ artifacts.add(gson.fromJson(jsonReader, Artifact.class)); } catch (Exception e) { // NOSONAR @@ -263,6 +259,37 @@ public class OnapCommandArtifactStore { } } + public Artifact setArtifact(Artifact artifact, Artifact existing) throws OnapCommandArtifactNotFound, OnapCommandArtifactContentNotExist, OnapCommandArtifactAlreadyExist, IOException, NoSuchAlgorithmException { + if (artifact.getName() == null) { + artifact.setName(existing.getName()); + } + + if (artifact.getDescription() == null) { + artifact.setDescription(existing.getDescription()); + } + + if (artifact.getCategoty() == null) { + artifact.setCategoty(existing.getCategoty()); + } + + if (artifact.getPath()!= null) { + if (!new File(artifact.getPath()).exists()) { + throw new OnapCommandArtifactContentNotExist(artifact.getPath()); + } + String actual = this.getChecksum(artifact.getPath()); + if (!existing.getChecksum().equals(actual)) { + artifact.setChecksum(actual); + artifact.setSize(new File(artifact.getPath()).length() / 1024); + } + } else { + artifact.setPath(existing.getPath()); + } + + artifact.setCreateAt(existing.getCreateAt()); + artifact.setLastUpdatedAt(dateFormatter.format(new Date())); + return artifact; + } + public Artifact updateArtifact(String name, String category, Artifact artifact) throws OnapCommandArtifactNotFound, OnapCommandArtifactContentNotExist, OnapCommandArtifactAlreadyExist { Artifact existing = this.getArtifact(name, category); String existingStorePath = getArtifactPath(name, category); @@ -273,33 +300,7 @@ public class OnapCommandArtifactStore { } try { - if (artifact.getName() == null) { - artifact.setName(existing.getName()); - } - - if (artifact.getDescription() == null) { - artifact.setDescription(existing.getDescription()); - } - - if (artifact.getCategoty() == null) { - artifact.setCategoty(existing.getCategoty()); - } - - if (artifact.getPath()!= null) { - if (!new File(artifact.getPath()).exists()) { - throw new OnapCommandArtifactContentNotExist(artifact.getPath()); - } - String actual = this.getChecksum(artifact.getPath()); - if (!existing.getChecksum().equals(actual)) { - artifact.setChecksum(actual); - artifact.setSize(new File(artifact.getPath()).length() / 1024); - } - } else { - artifact.setPath(existing.getPath()); - } - - artifact.setCreateAt(existing.getCreateAt()); - artifact.setLastUpdatedAt(dateFormatter.format(new Date())); + artifact = setArtifact(artifact, existing); if (artifact.getMetadata().size() > 0) { //update to existing one for (Map.Entry<String, String> entry: artifact.getMetadata().entrySet()) { @@ -312,7 +313,7 @@ public class OnapCommandArtifactStore { artifact.setMetadata(existing.getMetadata()); } - FileUtils.writeStringToFile(new File(newStorePath), gson.toJson(artifact)); + FileUtils.writeStringToFile(new File(newStorePath), gson.toJson(artifact), (Charset) null); if (!newStorePath.equalsIgnoreCase(existingStorePath)) { this.deleteArtifact(name, category); diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java index 5cbdf86b..7365447b 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java @@ -73,7 +73,6 @@ public class OnapCommandProfileStore { single = new OnapCommandProfileStore(); } - //single.load(); return single; } @@ -190,8 +189,6 @@ public class OnapCommandProfileStore { OnapCommandParamEntity[] list = gson.fromJson(jsonReader, OnapCommandParamEntity[].class); params.addAll(Arrays.asList(list)); -// } else { -// throw new OnapCommandProfileNotFound(profileName); } catch (Exception e) { // NOSONAR throw new OnapCommandProfileLoadFailed(e); } diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java index dab6669c..acf44a9b 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java @@ -22,6 +22,7 @@ import static org.onap.cli.fw.conf.OnapCommandConstants.IS_INCLUDE; import java.io.File; import java.io.IOException; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -270,7 +271,7 @@ public class OnapCommandUtils { //start to read after file:filepath String fileName = splEntry.substring(5); try { - value = FileUtils.readFileToString(new File(fileName)); + value = FileUtils.readFileToString((new File(fileName)), (Charset) null); } catch (IOException e) { //when file is not found, assign the same file:FILE_PATH //so that it will given hit to user that FILE_PATH to be diff --git a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java index 13d2f97e..e3a81e50 100644 --- a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java +++ b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java @@ -88,7 +88,6 @@ public class OpenInterfaceGrpcClient { result = blockingStub.withDeadlineAfter(timeout, TimeUnit.MILLISECONDS).invoke(input); } catch (StatusRuntimeException e) { logger.warn("RPC failed: {}", e.getStatus()); - //Status{code=DEADLINE_EXCEEDED} throw new OpenInterfaceGrpcTimeoutExecption(e.getMessage()); } logger.info("Output: {}", result); @@ -103,7 +102,6 @@ public class OpenInterfaceGrpcClient { result = blockingStub.withDeadlineAfter(timeout, TimeUnit.MILLISECONDS).remoteCli(args); } catch (StatusRuntimeException e) { logger.warn("RPC failed: {}", e.getStatus()); - //Status{code=DEADLINE_EXCEEDED} throw new OpenInterfaceGrpcTimeoutExecption(e.getMessage()); } diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java index ee9c7b33..08ef640f 100644 --- a/main/src/main/java/org/onap/cli/main/OnapCli.java +++ b/main/src/main/java/org/onap/cli/main/OnapCli.java @@ -17,6 +17,7 @@ package org.onap.cli.main; import java.io.IOException; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -189,7 +190,7 @@ public class OnapCli { public void handleHelp() { try { if (this.printHelp) { - this.print(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("oclip-readme.txt"))); + this.print(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("oclip-readme.txt") , (Charset) null)); String help = OnapCommandRegistrar.getRegistrar().getHelp(); this.print(help); this.exitSuccessfully(); diff --git a/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java b/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java index d0885def..123521bf 100644 --- a/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java +++ b/main/src/main/java/org/onap/cli/main/utils/OnapCliArgsParser.java @@ -19,6 +19,7 @@ package org.onap.cli.main.utils; import java.io.File; import java.io.IOException; import java.net.URL; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -167,8 +168,6 @@ public class OnapCliArgsParser { "it should be in the form of <key>=<value>"); } - //Make sure to read values from file, in case file path is given. - //map.put(argArr[0], readTextStringFromUrl(argArr[1], paramMap.get(paramName).getName())); map.put(argArr[0], argArr[1]); paramMap.get(paramName).setValue(map); i++; @@ -224,7 +223,7 @@ public class OnapCliArgsParser { try { File file = new File(input); if (file.isFile()) { - return FileUtils.readFileToString(file); + return FileUtils.readFileToString(file, (Charset) null); } else { return input; } @@ -238,7 +237,7 @@ public class OnapCliArgsParser { try { File file = new File(input); if (file.isFile()) { - String value = FileUtils.readFileToString(file); + String value = FileUtils.readFileToString(file, (Charset) null); YamlReader reader = new YamlReader(value); value = (String) reader.read(); return value; diff --git a/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java b/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java index 632142af..95ffb9f2 100644 --- a/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java +++ b/profiles/command/src/main/java/org/onap/cli/fw/cmd/cmd/OpenCommandShellCmd.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -255,7 +256,7 @@ public class OpenCommandShellCmd extends OnapCommand { outputValue = pr.getError(); } else { - //remove ${tmp: and closing } + //remove $(tmp: and closing ) String tmpName = this.output.substring(7, this.output.length()-1); String tmpFile = tmpFiles.get("tmp:" + tmpName); if (tmpFile != null) { @@ -328,7 +329,7 @@ public class OpenCommandShellCmd extends OnapCommand { try { FileUtils.touch(new File(tmpFilePath)); FileUtils.writeStringToFile(new File(tmpFilePath), - this.getParametersMap().get(paramName).getValue().toString()); + this.getParametersMap().get(paramName).getValue().toString(), (Charset) null); } catch (IOException e) { // NO SONAR } diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java b/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java index e17f8615..b4654cc8 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/cmd/OnapHttpCommand.java @@ -254,7 +254,6 @@ public class OnapHttpCommand extends OnapCommand { } Map<String, List<String>> results = OnapCommandHttpUtils.populateOutputs(this.getResultMap(), output); - //results = OnapCommandUtils.populateOutputsFromInputParameters(results, this.getParametersMap()); for (OnapCommandResultAttribute attr : this.getResult().getRecords()) { attr.setValues(results.get(attr.getName())); diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java index a539ae16..1ed2d600 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java @@ -140,7 +140,7 @@ public class OnapCommandSchemaHttpLoader { Map<String, String> partMap = (Map<String, String>) part; partO.setName(partMap.get("name")); partO.setContent(partMap.get("content")); - if (partMap.get("type") != null && ((String)partMap.get("type")).equalsIgnoreCase("file")) { + if (partMap.get("type") != null && (partMap.get("type")).equalsIgnoreCase("file")) { partO.setBinary(true); } |