File tree 1 file changed +14
-2
lines changed
src/main/java/io/securecodebox/persistence/defectdojo/service
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 17
17
*/
18
18
package io .securecodebox .persistence .defectdojo .service ;
19
19
20
+ import java .util .ArrayList ;
21
+ import java .util .List ;
22
+
20
23
import com .fasterxml .jackson .core .JsonProcessingException ;
21
24
import com .fasterxml .jackson .core .type .TypeReference ;
25
+
22
26
import io .securecodebox .persistence .defectdojo .config .DefectDojoConfig ;
23
27
import io .securecodebox .persistence .defectdojo .models .DefectDojoResponse ;
24
28
import io .securecodebox .persistence .defectdojo .models .UserProfile ;
@@ -41,7 +45,15 @@ protected Class<UserProfile> getModelClass() {
41
45
42
46
@ Override
43
47
protected DefectDojoResponse <UserProfile > deserializeList (String response ) throws JsonProcessingException {
44
- return this .objectMapper .readValue (response , new TypeReference <>() {});
48
+ // GenericDefectDojoService expects that the response from the defectdojo api is a list
49
+ // This endpoint returns a single object though, to not break the code this response gets converted to a defectdojo response
50
+ UserProfile userProfile = this .objectMapper .readValue (response , new TypeReference <>() {});
51
+ List <UserProfile > userProfileList = new ArrayList <>();
52
+ userProfileList .add (userProfile );
53
+
54
+ DefectDojoResponse <UserProfile > fakeResult = new DefectDojoResponse <>();
55
+ fakeResult .setResults (userProfileList );
56
+ fakeResult .setCount (1 );
57
+ return fakeResult ;
45
58
}
46
-
47
59
}
You can’t perform that action at this time.
0 commit comments