Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64261

NPE in BaseFileContent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • support-core-plugin
    • None
    • support-core:2.70

      Noticed the following exceptions in a support bundle recently where we can see that the BaseFileContent initizlization fails with a FileNotFoundException (which could be better handled I guess) but more importantly that it leaves a null reference of an InputStream that results in a NullPointerException:

      2020-11-12 08:02:13.405+0000 [id=478625]    WARNING c.c.j.s.a.UnfilteredFileContent#lambda$createBaseFileContent$0: Error opening file /var/jenkins_home/slow-requests/20200930-065237.799.txt
      java.io.FileNotFoundException: /var/jenkins_home/slow-requests/20200930-065237.799.txt (No such file or directory)
          at java.io.FileInputStream.open0(Native Method)
          at java.io.FileInputStream.open(FileInputStream.java:195)
          at java.io.FileInputStream.<init>(FileInputStream.java:138)
          at com.cloudbees.jenkins.support.api.UnfilteredFileContent.getInputStream(UnfilteredFileContent.java:85)
          at com.cloudbees.jenkins.support.api.UnfilteredFileContent.lambda$createBaseFileContent$0(UnfilteredFileContent.java:91)
          at com.cloudbees.jenkins.support.api.BaseFileContent.writeTo(BaseFileContent.java:77)
          at com.cloudbees.jenkins.support.api.UnfilteredFileContent.writeTo(UnfilteredFileContent.java:71)
          at com.cloudbees.jenkins.support.SupportPlugin.writeBundle(SupportPlugin.java:351)
          at com.cloudbees.jenkins.support.SupportPlugin.writeBundle(SupportPlugin.java:298)
          at com.cloudbees.jenkins.plugins.advisor.BundleUpload.generateBundle(BundleUpload.java:94)
          at com.cloudbees.jenkins.plugins.advisor.BundleUpload.execute(BundleUpload.java:72)
          at hudson.model.AsyncPeriodicWork.lambda$doRun$0(AsyncPeriodicWork.java:100)
          at java.lang.Thread.run(Thread.java:748)
      2020-11-12 08:02:13.408+0000 [id=478625]    WARNING c.c.j.support.SupportPlugin#writeBundle: Could not attach ''slow-requests/20200930-065237.799.txt'' to support bundle
      java.lang.NullPointerException
          at java.io.FilterInputStream.read(FilterInputStream.java:133)
          at com.cloudbees.jenkins.support.api.BaseFileContent$TruncatedInputStream.read(BaseFileContent.java:205)
          at java.io.FilterInputStream.read(FilterInputStream.java:107)
          at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2314)
          at org.apache.commons.io.IOUtils.copy(IOUtils.java:2270)
          at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2291)
          at org.apache.commons.io.IOUtils.copy(IOUtils.java:2246)
          at com.cloudbees.jenkins.support.api.BaseFileContent.writeTo(BaseFileContent.java:81)
          at com.cloudbees.jenkins.support.api.UnfilteredFileContent.writeTo(UnfilteredFileContent.java:71)
          at com.cloudbees.jenkins.support.SupportPlugin.writeBundle(SupportPlugin.java:351)
          at com.cloudbees.jenkins.support.SupportPlugin.writeBundle(SupportPlugin.java:298)
          at com.cloudbees.jenkins.plugins.advisor.BundleUpload.generateBundle(BundleUpload.java:94)
          at com.cloudbees.jenkins.plugins.advisor.BundleUpload.execute(BundleUpload.java:72)
          at hudson.model.AsyncPeriodicWork.lambda$doRun$0(AsyncPeriodicWork.java:100)
          at java.lang.Thread.run(Thread.java:748)
      

      This NPE can definitely be avoided. If we know that a file could not be found, there is no point trying to copy anything.

            allan_burdajewicz Allan BURDAJEWICZ
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: