Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlakyTestResult: catch NullPointerException #4

Merged
merged 1 commit into from Jun 27, 2016

Conversation

scpeters
Copy link
Contributor

@scpeters scpeters commented Apr 8, 2016

FlakyTestResult(TestResult) should catch NullPointerException since File(String) will throw that exception if the input is null (see File.java:275-277).

I've been encountering this repeatedly in some of our builds:

The context and backtrace are:

Recording test results
ERROR: Build step failed with exception
java.lang.NullPointerException
    at java.io.File.<init>(File.java:277)
    at com.google.jenkins.flakyTestHandler.junit.FlakyTestResult.<init>(FlakyTestResult.java:120)
    at com.google.jenkins.flakyTestHandler.plugin.FlakyTestResultCollector.call(FlakyTestResultCollector.java:15)
    at com.google.jenkins.flakyTestHandler.plugin.FlakyTestResultCollector.call(FlakyTestResultCollector.java:7)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at hudson.remoting.Engine$1$1.run(Engine.java:62)
    at java.lang.Thread.run(Thread.java:745)
    at ......remote call to t1000.yosemite(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
    at hudson.remoting.Channel.call(Channel.java:781)
    at com.google.jenkins.flakyTestHandler.plugin.JUnitFlakyTestDataPublisher.getTestData(JUnitFlakyTestDataPublisher.java:49)
    at hudson.tasks.junit.TestDataPublisher.contributeTestData(TestDataPublisher.java:62)
    at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:178)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:75)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
    at hudson.model.Build$BuildExecution.post2(Build.java:185)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
    at hudson.model.Run.execute(Run.java:1766)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:408)
Build step 'Publish JUnit test result report' marked build as failure

There is probably a bug somewhere else, but catching this exception will help with failing more gracefully. The only clue I have to the source of the problem is that is happens with the following set of junit result files:
flaky_test_results.zip

Two of those junit files are over 200kb, but I don't know why that would be a problem. Thanks for your time.

FlakyTestResult(TestResult) should catch NullPointerException
since File(String) will throw that exception if the input is null.
@jenkinsadmin
Copy link
Member

Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests.

@scpeters
Copy link
Contributor Author

After some further testing, I've discovered that this exception is caused when trying to parse empty files using the flaky test handler plugin. The normal test result publisher appends .[empty] and gives a message that the file was length 0 (example here).

@scpeters scpeters merged commit b0d58ca into jenkinsci:master Jun 27, 2016
@scpeters scpeters deleted the patch-1 branch June 27, 2016 22:13
@vtintillier vtintillier added this to the 1.0.5 milestone Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants