File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/main/java/org/owasp/benchmark/score/parsers Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ public static boolean isShiftLeftScanReport(final String content) {
35
35
}
36
36
37
37
public TestSuiteResults parse (final String content ) throws Exception {
38
- int startOfSecondJson = content .indexOf ( " \n { \n " );
38
+ String [] lines = content .split ( " \n " );
39
39
40
- JSONObject javaSourceAnalyzer = new JSONObject (content . substring ( 0 , startOfSecondJson ) );
41
- JSONObject classFileAnalyzer = new JSONObject (content . substring ( startOfSecondJson ) );
40
+ JSONObject javaSourceAnalyzer = new JSONObject (lines [ 0 ] );
41
+ JSONObject classFileAnalyzer = new JSONObject (lines [ 1 ] );
42
42
43
43
// false indicates this is an open source/free tool.
44
44
TestSuiteResults tr =
@@ -47,9 +47,19 @@ public TestSuiteResults parse(final String content) throws Exception {
47
47
parseAndAddResults (tr , javaSourceAnalyzer );
48
48
parseAndAddResults (tr , classFileAnalyzer );
49
49
50
+ tr .setToolVersion (readVersion (javaSourceAnalyzer ));
51
+
50
52
return tr ;
51
53
}
52
54
55
+ private String readVersion (JSONObject javaSourceAnalyzer ) {
56
+ return javaSourceAnalyzer
57
+ .getJSONObject ("tool" )
58
+ .getJSONObject ("driver" )
59
+ .getString ("version" )
60
+ .replace ("-scan" , "" );
61
+ }
62
+
53
63
private void parseAndAddResults (TestSuiteResults tr , JSONObject analyzerResults ) {
54
64
JSONArray arr = analyzerResults .getJSONArray ("results" );
55
65
You can’t perform that action at this time.
0 commit comments