junit-plugin
junit-plugin copied to clipboard
Showing content, of unparsable file, in error message
When using this plugin I got an error with the following message:
Failed to read test report file /opt/cm/jenkins/workspace/app-branch-11.0.0-SNAPSHOT/proj/target/surefire-reports/TEST-TestSuite.xml
org.dom4j.DocumentException: Error on line 39323 of document file:///opt/cm/jenkins/workspace/app-branch-11.0.0-SNAPSHOT/proj/target/surefire-reports/TEST-TestSuite.xml : XML document structures must start and end within the same entity. Nested exception: XML document structures must start and end within the same entity.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:264)
at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:126)
at hudson.tasks.junit.TestResult.parse(TestResult.java:301)
With this commit I would save a lot of time when trying to figure out why.
I do not like the idea of attaching possibly megabytes of data to Exception message. Especially, when the file has 39323 lines.
If this might be binary nonsense, I'd be much more comfortable with a fixed number of bytes (50-100) than "five lines". How does the reverse line reader handle 1 billion 0x00
bytes?
Updated to read only last 100 bytes.
@tomasbjerre, looks good to me. Does it still point out the problem you have experienced?
Yes it does! Thanks for all your feedback =)
Indents fixed.