Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package com.fortify.cli.tool._common.cli.cmd;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fortify.cli.common.json.JsonHelper;
import com.fortify.cli.common.output.cli.cmd.AbstractOutputCommand;
import com.fortify.cli.common.output.cli.cmd.IJsonNodeSupplier;
import com.fortify.cli.tool._common.helper.Tool;
Expand All @@ -34,7 +34,6 @@
* @author Ruud Senden
*/
public abstract class AbstractToolGetCommand extends AbstractOutputCommand implements IJsonNodeSupplier {
private static final ObjectMapper objectMapper = new ObjectMapper();

@Parameters(index = "0", descriptionKey = "fcli.tool.get.version")
private String requestedVersion;
Expand Down Expand Up @@ -63,7 +62,7 @@ public final JsonNode getJsonNode() {
isDefault
);

return objectMapper.valueToTree(outputDescriptor);
return JsonHelper.getObjectMapper().valueToTree(outputDescriptor);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package com.fortify.cli.tool._common.cli.cmd;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fortify.cli.common.json.JsonHelper;
import com.fortify.cli.common.output.cli.cmd.AbstractOutputCommand;
Expand All @@ -27,16 +26,15 @@
import com.fortify.cli.tool.definitions.helper.ToolDefinitionVersionDescriptor;

public abstract class AbstractToolListCommand extends AbstractOutputCommand implements IJsonNodeSupplier {
private static final ObjectMapper objectMapper = new ObjectMapper();

@Override
public final JsonNode getJsonNode() {
var toolName = getTool().getToolName();
ToolInstallations installations = ToolInstallationsResolver.resolve(getTool());
return installations.stream()
.map(record -> createToolOutputDescriptor(toolName, record))
.map(objectMapper::<ObjectNode>valueToTree)
.collect(JsonHelper.arrayNodeCollector());
ToolInstallations installations = ToolInstallationsResolver.resolve(getTool());
return installations.stream()
.map(record -> createToolOutputDescriptor(toolName, record))
.map(JsonHelper.getObjectMapper()::<ObjectNode>valueToTree)
.collect(JsonHelper.arrayNodeCollector());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public Path getBinPath() {
}

public Path getGlobalBinPath() {
return asPath(binDir);
return asPath(globalBinDir);
}

private static final ToolInstallationDescriptor load(Path descriptorPath) {
Expand Down