From 676c9bde96cfac2ca05a982740ed4467b1649adb Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Mon, 22 May 2023 19:06:39 +0200 Subject: [PATCH] fix SAX bug --- .../plugins/surefire/report/TestSuiteXmlParser.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java index 83ccc0619d..481434b289 100644 --- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java +++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java @@ -131,8 +131,6 @@ public void startElement(String uri, String localName, String qName, Attributes classesToSuitesIndex.put(defaultSuite.getFullClassName(), suites.size() - 1); break; case "testcase": - currentElement = new StringBuilder(); - testCase = new ReportTestCase().setName(attributes.getValue("name")); String fullClassName = attributes.getValue("classname"); @@ -162,10 +160,14 @@ public void startElement(String uri, String localName, String qName, Attributes } break; case "failure": + currentElement = new StringBuilder(); + testCase.setFailure(attributes.getValue("message"), attributes.getValue("type")); currentSuite.incrementNumberOfFailures(); break; case "error": + currentElement = new StringBuilder(); + testCase.setError(attributes.getValue("message"), attributes.getValue("type")); currentSuite.incrementNumberOfErrors(); break; @@ -181,6 +183,9 @@ public void startElement(String uri, String localName, String qName, Attributes case "failsafe-summary": valid = false; break; + case "time": + currentElement = new StringBuilder(); + break; default: break; }