@@ -60,6 +60,8 @@ public final class TestSuiteXmlParser extends DefaultHandler {
6060
6161 private boolean valid ;
6262
63+ private boolean parseContent ;
64+
6365 public TestSuiteXmlParser (ConsoleLogger consoleLogger ) {
6466 this .consoleLogger = consoleLogger ;
6567 }
@@ -157,12 +159,14 @@ public void startElement(String uri, String localName, String qName, Attributes
157159 break ;
158160 case "failure" :
159161 currentElement = new StringBuilder ();
162+ parseContent = true ;
160163
161164 testCase .setFailure (attributes .getValue ("message" ), attributes .getValue ("type" ));
162165 currentSuite .incrementNumberOfFailures ();
163166 break ;
164167 case "error" :
165168 currentElement = new StringBuilder ();
169+ parseContent = true ;
166170
167171 testCase .setError (attributes .getValue ("message" ), attributes .getValue ("type" ));
168172 currentSuite .incrementNumberOfErrors ();
@@ -181,6 +185,7 @@ public void startElement(String uri, String localName, String qName, Attributes
181185 break ;
182186 case "time" :
183187 currentElement = new StringBuilder ();
188+ parseContent = true ;
184189 break ;
185190 default :
186191 break ;
@@ -215,6 +220,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
215220 default :
216221 break ;
217222 }
223+ parseContent = false ;
218224 // TODO extract real skipped reasons
219225 }
220226
@@ -225,7 +231,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
225231 public void characters (char [] ch , int start , int length ) {
226232 assert start >= 0 ;
227233 assert length >= 0 ;
228- if (valid && isNotBlank (start , length , ch )) {
234+ if (valid && parseContent && isNotBlank (start , length , ch )) {
229235 currentElement .append (ch , start , length );
230236 }
231237 }
0 commit comments