Commit 763e9f4
#36 Use Map instead of MultiValueMap as options type
During the last refactorings we wondered why MultiValueMaps are used for options.
The original developer has no clue, why he used it.
First we encountered the problem that the value generic type was untyped
Object, which is bad due to type confusion bugs. So we changed it to
String, since all values are somehow converted to Strings in the end (its HTTP).
This resulted in a compile error, when adding these options to the request
body because of type erasure problems (Type<String> is not the same as
Type<Object>).
So we changed the addition of options to the request body by looping over the
options and add them explicitly. This change resulted in a runtime error on
HTTP request:
org.springframework.http.converter.HttpMessageNotWritableException:
Could not write request: no suitable HttpMessageConverter found for request
type [java.util.ArrayList]
The reason for this is that values in a MultiValueMap may be a single value or
multiple values (which will be a List of values). Before our change this worked
by accident because nobody added multiple values. That's my assumption
Since we do not need multiple values under the same key I change the API to
a simple Map<String,String>.
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>1 parent 51b50a9 commit 763e9f4
File tree
2 files changed
+13
-11
lines changed- src/main/java/io/securecodebox/persistence/defectdojo/service
2 files changed
+13
-11
lines changedLines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
66 | | - | |
| 66 | + | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
73 | | - | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
0 commit comments