@@ -87,7 +87,7 @@ protected RestTemplate createRestTemplate() {
87
87
/*
88
88
* Before version 1.5.4. testName (in DefectDojo _test_type_) must be defectDojoScanName, afterward, you can have something else.
89
89
*/
90
- protected ImportScanResponse createFindings (ScanFile scanFile , String endpoint , long lead , String currentDate , ScanType scanType , long testType , MultiValueMap <String , Object > options ) {
90
+ protected ImportScanResponse createFindings (ScanFile scanFile , String endpoint , long lead , String currentDate , ScanType scanType , long testType , MultiValueMap <String , String > options ) {
91
91
var restTemplate = this .createRestTemplate ();
92
92
HttpHeaders headers = createDefectDojoAuthorizationHeaders ();
93
93
headers .setContentType (MediaType .MULTIPART_FORM_DATA );
@@ -110,7 +110,10 @@ protected ImportScanResponse createFindings(ScanFile scanFile, String endpoint,
110
110
body .remove (optionName );
111
111
}
112
112
113
- body .addAll (options );
113
+ // FIXME: Workaround due to type incompatibility of MultiValueMap<String, String> and MultiValueMap<String, Object>.
114
+ for (final var option : options .entrySet ()) {
115
+ body .add (option .getKey (), option .getValue ());
116
+ }
114
117
115
118
try {
116
119
ByteArrayResource contentsAsResource = new ByteArrayResource (scanFile .getContent ().getBytes (StandardCharsets .UTF_8 )) {
@@ -133,26 +136,26 @@ public String getFilename() {
133
136
}
134
137
135
138
public ImportScanResponse importScan (ScanFile scanFile , long engagementId , long lead , String currentDate , ScanType scanType , long testType ) {
136
- final var options = new LinkedMultiValueMap <String , Object >();
139
+ final var options = new LinkedMultiValueMap <String , String >();
137
140
options .add ("engagement" , Long .toString (engagementId )); // FIXME Seems to be duplicated bc it is done again in the overloaded method.
138
141
139
142
return this .importScan (scanFile , engagementId , lead , currentDate , scanType , testType , options );
140
143
}
141
144
142
- public ImportScanResponse importScan (ScanFile scanFile , long engagementId , long lead , String currentDate , ScanType scanType , long testType , MultiValueMap <String , Object > options ) {
145
+ public ImportScanResponse importScan (ScanFile scanFile , long engagementId , long lead , String currentDate , ScanType scanType , long testType , MultiValueMap <String , String > options ) {
143
146
options .add ("engagement" , Long .toString (engagementId ));
144
147
145
148
return this .createFindings (scanFile , "import-scan" , lead , currentDate , scanType , testType , options );
146
149
}
147
150
148
151
public ImportScanResponse reimportScan (ScanFile scanFile , long testId , long lead , String currentDate , ScanType scanType , long testType ) {
149
- final var options = new LinkedMultiValueMap <String , Object >();
152
+ final var options = new LinkedMultiValueMap <String , String >();
150
153
options .add ("test" , Long .toString (testId )); // FIXME Seems to be duplicated bc it is done again in the overloaded method.
151
154
152
155
return this .reimportScan (scanFile , testId , lead , currentDate , scanType , testType , options );
153
156
}
154
157
155
- public ImportScanResponse reimportScan (ScanFile scanFile , long testId , long lead , String currentDate , ScanType scanType , long testType , MultiValueMap <String , Object > options ) {
158
+ public ImportScanResponse reimportScan (ScanFile scanFile , long testId , long lead , String currentDate , ScanType scanType , long testType , MultiValueMap <String , String > options ) {
156
159
options .add ("test" , Long .toString (testId ));
157
160
158
161
return this .createFindings (scanFile , "reimport-scan" , lead , currentDate , scanType , testType , options );
0 commit comments