use of com.mercedesbenz.sechub.sarif.model.ArtifactLocation in project sechub by mercedes-benz.
the class SarifV1JSONImporter method callStackListFromLocations.
private List<SerecoCodeCallStackElement> callStackListFromLocations(List<Location> locations) {
List<SerecoCodeCallStackElement> callstack = new ArrayList<>();
if (locations == null) {
return callstack;
}
locations.forEach(location -> {
PhysicalLocation physicalLocation = location.getPhysicalLocation();
if (physicalLocation != null) {
SerecoCodeCallStackElement subCode = new SerecoCodeCallStackElement();
ArtifactLocation artifactLocation = physicalLocation.getArtifactLocation();
if (artifactLocation != null) {
subCode.setLocation(artifactLocation.getUri());
}
Region region = physicalLocation.getRegion();
if (region != null) {
subCode.setLine(region.getStartLine());
subCode.setColumn(region.getStartColumn());
ArtifactContent snippet = region.getSnippet();
if (snippet != null) {
String text = snippet.getText();
if (text != null) {
text = text.trim();
}
subCode.setSource(text);
}
}
callstack.add(subCode);
}
});
return callstack;
}
Aggregations