junit-plugin icon indicating copy to clipboard operation
junit-plugin copied to clipboard

Showing content, of unparsable file, in error message

Open tomasbjerre opened this issue 6 years ago • 6 comments

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.

tomasbjerre avatar Jul 14 '17 15:07 tomasbjerre

I do not like the idea of attaching possibly megabytes of data to Exception message. Especially, when the file has 39323 lines.

olivergondza avatar Aug 04 '17 07:08 olivergondza

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?

daniel-beck avatar Aug 10 '17 00:08 daniel-beck

Updated to read only last 100 bytes.

tomasbjerre avatar Aug 11 '17 12:08 tomasbjerre

@tomasbjerre, looks good to me. Does it still point out the problem you have experienced?

olivergondza avatar Aug 11 '17 18:08 olivergondza

Yes it does! Thanks for all your feedback =)

tomasbjerre avatar Aug 11 '17 18:08 tomasbjerre

Indents fixed.

tomasbjerre avatar Nov 09 '17 18:11 tomasbjerre