@@ -121,10 +121,10 @@ private TestCaseResult parseCheckmarxVulnerability(Node query, Node result) {
121
121
return null ;
122
122
}
123
123
124
- //Output xml file from Checkmarx (depends on version) sometimes does not
125
- //contain attribute on the node "query" named SeverityIndex
124
+ //Output xml file from Checkmarx (depends on version) sometimes does not contain attribute on the node "query" named SeverityIndex
126
125
String SeverityIndex = getAttributeValue ( "SeverityIndex" , result );
127
- if (SeverityIndex != null && !SeverityIndex .equals ("" )) {
126
+ boolean isGeneratedByCxWebClient = SeverityIndex != null && !SeverityIndex .equals ("" );
127
+ if (isGeneratedByCxWebClient ) {
128
128
tcr .setConfidence ( Integer .parseInt ( getAttributeValue ( "SeverityIndex" , result ) ) );
129
129
}
130
130
@@ -148,9 +148,14 @@ private TestCaseResult parseCheckmarxVulnerability(Node query, Node result) {
148
148
149
149
//If the result starts in a BenchmarkTest file
150
150
String testcase = getAttributeValue ("FileName" , result );
151
- //A change was made in the following line due to the paths in the xml outputs file, they are windows based '\\'
152
- testcase = testcase .substring ( testcase .lastIndexOf ('\\' ) +1 );
153
- if ( testcase .startsWith ( "BenchmarkTest" ) ) {
151
+ //Output xml file from Checkmarx (depends on version) may use windows based '\\' or unix based '/' delimiters for path
152
+ if (isGeneratedByCxWebClient ) {
153
+ testcase = testcase .substring ( testcase .lastIndexOf ('/' ) +1 );
154
+ }
155
+ else {
156
+ testcase = testcase .substring ( testcase .lastIndexOf ('\\' ) +1 );
157
+ }
158
+ if ( testcase .startsWith ( "BenchmarkTest" ) ) {
154
159
String testno = testcase .substring ( "BenchmarkTest" .length (), testcase .length () -5 );
155
160
try {
156
161
tcr .setNumber ( Integer .parseInt ( testno ) );
@@ -161,15 +166,21 @@ private TestCaseResult parseCheckmarxVulnerability(Node query, Node result) {
161
166
}
162
167
//If not, then the last PastNode must end in a FileName that startsWith BenchmarkTest file
163
168
else {
164
- String testcase2 = fileNameNode .getFirstChild ().getNodeValue ();
165
- testcase2 = testcase2 .substring ( testcase2 .lastIndexOf ('\\' ) +1 );
166
- if ( testcase2 .startsWith ( "BenchmarkTest" ) ) {
167
- String testno2 = testcase2 .substring ( "BenchmarkTest" .length (), testcase2 .length () -5 );
168
- try {
169
- tcr .setNumber ( Integer .parseInt ( testno2 ) );
170
- } catch ( NumberFormatException e ) {
171
- e .printStackTrace ();
172
- }
169
+ String testcase2 = fileNameNode .getFirstChild ().getNodeValue ();
170
+ //Output xml file from Checkmarx (depends on version) may use windows based '\\' or unix based '/' delimiters for path
171
+ if (isGeneratedByCxWebClient ) {
172
+ testcase2 = testcase2 .substring ( testcase2 .lastIndexOf ('/' ) +1 );
173
+ }
174
+ else {
175
+ testcase2 = testcase2 .substring ( testcase2 .lastIndexOf ('\\' ) +1 );
176
+ }
177
+ if ( testcase2 .startsWith ( "BenchmarkTest" ) ) {
178
+ String testno2 = testcase2 .substring ( "BenchmarkTest" .length (), testcase2 .length () -5 );
179
+ try {
180
+ tcr .setNumber ( Integer .parseInt ( testno2 ) );
181
+ } catch ( NumberFormatException e ) {
182
+ e .printStackTrace ();
183
+ }
173
184
return tcr ;
174
185
}
175
186
}
0 commit comments