jenkinsci / jenkinsci/junit-plugin

[JENKINS-3849] Improve Error handling of junit test result report, when encounter invalid file

Open
#834 2 comments 0 reactions 0 assignees View on GitHub
component:junit-plugin enhancement imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
87
Forks
351
Avg merge
1d 19h
Merged PRs (30d)
2

Description

When we configure a job, one user entered a wrong regular expression to 'Public

Junit test result report' - 'Test report XMLs' section to include some files

which are not junit test result files and not xml format either. Then job

throws excpetion with the trace, which is coped at the bottom.

It would be nice that hudson can handle the non-junit files more gracefully –

can give user friendly error msg instead of displaying trace file.

======================================================

BUILD SUCCESSFUL

Total time: 955 minutes 11 seconds

Archiving artifacts

Recording test results

ERROR: Failed to archive JUnit reports

hudson.util.IOException2: remote file operation failed

at hudson.FilePath.act(FilePath.java:596)

at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)

at

hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)

at

hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)

at hudson.model.Build$RunnerImpl.post2(Build.java:183)

at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)

at hudson.model.Run.run(Run.java:943)

at hudson.model.Build.run(Build.java:112)

at hudson.model.ResourceController.execute(ResourceController.java:93)

at hudson.model.Executor.run(Executor.java:119)

Caused by: hudson.util.IOException2: Failed to read

/export/home/tester/hudson/data/workspace/BR_INT_KNL_TC6_GroupA/BR_INT_KNL_TC6/anet/search-test/caches/anet-index/beef/_0.cfs

Is this really a JUnit report file? Your configuration must be matching too many

files

at hudson.tasks.junit.TestResult.parse(TestResult.java:168)

at hudson.tasks.junit.TestResult.parse(TestResult.java:118)

at hudson.tasks.junit.TestResult.(TestResult.java:95)

at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)

at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)

at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)

at hudson.remoting.UserRequest.perform(UserRequest.java:97)

at hudson.remoting.UserRequest.perform(UserRequest.java:46)

at hudson.remoting.Request$2.run(Request.java:236)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)

at java.util.concurrent.FutureTask.run(FutureTask.java:123)

at

java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)

at java.lang.Thread.run(Thread.java:595)

Caused by: org.dom4j.DocumentException: Error on line 1 of document

file:///export/home/tester/hudson/data/workspace/BR_INT_KNL_TC6_GroupA/BR_INT_KNL_TC6/anet/search-test/caches/anet-index/beef/_0.cfs

: Content is not allowed in prolog. Nested exception: Content is not allowed in

prolog.

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:89)

at hudson.tasks.junit.TestResult.parse(TestResult.java:162)

... 14 more

Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.

at

com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)

at

com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)

at

com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)

at

com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)

at

com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)

at

com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899)

at

com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)

at

com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)

at

com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)

at

com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)

at org.dom4j.io.SAXReader.read(SAXReader.java:465)

... 17 more

Sending e-mails to: xxxx@​xxx.com

---
Originally reported by echeng, imported from: Improve Error handling of junit test result report, when encounter invalid file


  • status: Open
  • priority: Major
  • component(s): junit-plugin
  • resolution: Unresolved
  • votes: 2
  • watchers: 2
  • imported: 2025-11-26

Raw content of original issue

When we configure a job, one user entered a wrong regular expression to 'Public
Junit test result report' - 'Test report XMLs' section to include some files
which are not junit test result files and not xml format either. Then job
throws excpetion with the trace, which is coped at the bottom.

It would be nice that hudson can handle the non-junit files more gracefully –
can give user friendly error msg instead of displaying trace file.

======================================================
BUILD SUCCESSFUL
Total time: 955 minutes 11 seconds
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.util.IOException2: Failed to read
/export/home/tester/hudson/data/workspace/BR_INT_KNL_TC6_GroupA/BR_INT_KNL_TC6/anet/search-test/caches/anet-index/beef/_0.cfs
Is this really a JUnit report file? Your configuration must be matching too many
files
at hudson.tasks.junit.TestResult.parse(TestResult.java:168)
at hudson.tasks.junit.TestResult.parse(TestResult.java:118)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:97)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.dom4j.DocumentException: Error on line 1 of document
file:///export/home/tester/hudson/data/workspace/BR_INT_KNL_TC6_GroupA/BR_INT_KNL_TC6/anet/search-test/caches/anet-index/beef/_0.cfs
: Content is not allowed in prolog. Nested exception: Content is not allowed in
prolog.
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:89)
at hudson.tasks.junit.TestResult.parse(TestResult.java:162)
... 14 more
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
... 17 more
Sending e-mails to: xxxx@xxx.com

  • environment: Platform: All, OS: All

Contributor guide

Open the contributing guide

Research direction

Start with JUnitResultArchiver.perform and follow the parsing flow through TestResult.parse and SuiteResult.parse, using the reported stack trace as the entry point. Reproduce the case where the report pattern matches a non-JUnit file such as _0.cfs. Done means the job handles the invalid report with a user-friendly error instead of exposing the parser trace.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.