Skip to content

Commit 1164ac1

Browse files
committed
Update ObjectMappers in code base to also register modules
Signed-off-by: Jannik Hollenbach <jannik.hollenbach@iteratec.com>
1 parent c98078d commit 1164ac1

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎hooks/persistence-defectdojo/hook/src/main/java/io/securecodebox/persistence/mapping/SecureCodeBoxFindingsToDefectDojoMapper.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class SecureCodeBoxFindingsToDefectDojoMapper {
2626
private static final Logger LOG = LoggerFactory.getLogger(SecureCodeBoxFindingsToDefectDojoMapper.class);
2727
private static final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
28-
private static final ObjectWriter prettyJSONPrinter = new ObjectMapper().writerWithDefaultPrettyPrinter();
28+
private static final ObjectWriter prettyJSONPrinter = new ObjectMapper().findAndRegisterModules().writerWithDefaultPrettyPrinter();
2929

3030
/**
3131
* Converts a SecureCodeBox Findings JSON String to a DefectDojo Findings JSON String.
@@ -36,7 +36,9 @@ public class SecureCodeBoxFindingsToDefectDojoMapper {
3636
*/
3737
public static String fromSecureCodeboxFindingsJson(String scbFindingsJson) throws IOException {
3838
LOG.debug("Converting SecureCodeBox Findings to DefectDojo Findings");
39-
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
39+
ObjectMapper mapper = new ObjectMapper()
40+
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
41+
.findAndRegisterModules();
4042
List<DefectDojoImportFinding> DefectDojoImportFindings = new ArrayList<>();
4143
List<SecureCodeBoxFinding> secureCodeBoxFindings = mapper.readValue(scbFindingsJson, new TypeReference<>() {
4244
});

‎hooks/persistence-defectdojo/hook/src/main/java/io/securecodebox/persistence/service/S3Service.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class S3Service {
1919
private static final Logger LOG = LoggerFactory.getLogger(S3Service.class);
2020

2121
public void overwriteFindings(String url, List<SecureCodeBoxFinding> secureCodeBoxFindings) throws IOException, InterruptedException {
22-
ObjectMapper mapper = new ObjectMapper();
22+
ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
2323
var findingJson = mapper.writeValueAsString(secureCodeBoxFindings);
2424

2525
LOG.info("Uploading Findings to S3");

0 commit comments

Comments
 (0)