use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class HaskellCabalLibraryJsonProtoParser method extractAddDependencies.
private void extractAddDependencies(String jsonProtoString, List<NameVersion> dependencies, ResultItem result) throws DetectableException {
if (result == null || result.getTarget() == null) {
throw new DetectableException(String.format("Unable to parse target from result inJSON proto string: %s", jsonProtoString));
}
Target target = result.getTarget();
if ("RULE".equals(target.getType())) {
if (target.getRule() == null || target.getRule().getAttribute() == null) {
throw new DetectableException(String.format("Unable to parse attributes from rule inJSON proto string: %s", jsonProtoString));
}
List<AttributeItem> attributes = target.getRule().getAttribute();
NameVersion dependency = extractDependency(attributes);
logger.debug("Adding dependency {}/{}}", dependency.getName(), dependency.getVersion());
dependencies.add(dependency);
}
}
use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class LocatorNugetInspectorResolver method resolveNugetInspector.
@Override
public NugetInspector resolveNugetInspector() throws DetectableException {
try {
if (!hasResolvedInspector) {
hasResolvedInspector = true;
resolvedNugetInspector = install();
}
return resolvedNugetInspector;
} catch (Exception e) {
throw new DetectableException(e);
}
}
use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class LocatorNugetInspectorResolver method findInspector.
private NugetInspector findInspector(File nupkgFolder, String inspectorName, Function<String, NugetInspector> inspectorInitializer) throws DetectableException {
logger.debug("Searching for: " + inspectorName);
File toolsFolder = new File(nupkgFolder, "tools");
logger.debug("Searching in: " + toolsFolder.getAbsolutePath());
File foundExecutable = fileFinder.findFiles(toolsFolder, inspectorName, false, 3).stream().findFirst().filter(File::exists).orElseThrow(() -> new DetectableException(String.format("Unable to find nuget inspector, looking for %s in %s", inspectorName, toolsFolder)));
String inspectorExecutable = foundExecutable.getAbsolutePath();
logger.debug("Found nuget inspector: {}", inspectorExecutable);
return inspectorInitializer.apply(inspectorExecutable);
}
use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class DotNetRuntimeFinder method listAvailableRuntimes.
public List<String> listAvailableRuntimes() throws DetectableException {
try {
ExecutableOutput runtimesOutput = dotnetListRuntimes();
List<String> foundRuntimes = runtimesOutput.getStandardOutputAsList().stream().map(StringUtils::trimToEmpty).filter(StringUtils::isNotBlank).collect(Collectors.toList());
logger.info("Found {} available dotnet runtimes", foundRuntimes.size());
if (foundRuntimes.isEmpty()) {
throw new DetectableException("No available dotnet runtimes");
}
return foundRuntimes;
} catch (ExecutableRunnerException e) {
throw new DetectableException("Could not determine available dotnet runtimes", e);
}
}
Aggregations