@@ -150,27 +150,39 @@ private List<String> getRawResults(SecurityTest securityTest) throws DefectDojoP
150150 }
151151
152152 private List <String > getGenericResults (SecurityTest securityTest ) {
153- final String CSV_HEADER = "date,title,cweid,url,severity,description,mitigation,impact,references,active,verified,falsepositive,duplicate" ;
153+ final String CSV_HEADER = "date,title,cweid,url,severity,description,mitigation,impact,references,active," +
154+ "verified,falsepositive,duplicate" ;
154155
155156 List <Finding > findings = securityTest .getReport ().getFindings ();
156157
157158 String genericFindingsCsv = Stream .concat (
158159 Stream .of (CSV_HEADER ),
159- findings .stream ().map (finding -> MessageFormat .format (
160- "{0},{1},,{2},{3},{4},,,,,,{5},{6}" ,
161- currentDate (),
162- finding .getName ().replace ("," , " " ),
163- finding .getLocation ().replace ("," , " " ),
164- finding .getSeverity (),
165- finding .getDescription ().replace ("," , " " ),
166- finding .isFalsePositive (),
167- "false"
168- ))
160+ findings .stream ()
161+ .map (finding -> checkIfNameOrDescriptionIsNotNull (finding ))
162+ .map (finding -> MessageFormat .format (
163+ "{0},{1},,{2},{3},{4},,,,,,{5},{6}" ,
164+ currentDate (),
165+ finding .getName ().replace ("," , " " ),
166+ finding .getLocation ().replace ("," , " " ),
167+ finding .getSeverity (),
168+ finding .getDescription ().replace ("," , " " ),
169+ finding .isFalsePositive (),
170+ "false"
171+ ))
169172 ).collect (Collectors .joining ("\n " ));
170173
171174 return Collections .singletonList (genericFindingsCsv );
172175 }
173176
177+ private Finding checkIfNameOrDescriptionIsNotNull (Finding finding ) {
178+ if (null == finding .getName ()) {
179+ finding .setName ("" );
180+ } else if (null == finding .getDescription ()) {
181+ finding .setDescription ("" );
182+ }
183+ return finding ;
184+ }
185+
174186 private EngagementResponse createEngagement (SecurityTest securityTest ) {
175187 EngagementPayload engagementPayload = new EngagementPayload ();
176188 engagementPayload .setProduct (defectDojoService .retrieveProductId (securityTest .getContext ()));
0 commit comments