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

Plot plugin throws null pointer exception in Pipeline if title not provided

      The plot plugin provides a Pipeline step but the Pipeline step implementation has multiple issues. One of those issues is that a null pointer exception is reported if the plot title is not provided. When a freestyle project leaves the plot title empty, the plot title is not displayed. If a title argument is not provided in the Pipeline step, a null pointer exception is reported.

      The Pipeline that I used to show the problem is

      pipeline {
          agent {
              label 'linux'
          }
      
          stages {
              stage('Hello') {
                  steps {
                      echo 'Hello World'
                      sh '''#!/bin/bash
      [ ! -f plot-a.csv ] && echo "Line-A,Line-B" > plot-a.csv
      let "OTHER_VAR=2*BUILD_ID+1"
      echo $BUILD_ID,$OTHER_VAR >> plot-a.csv
                      '''
                      plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-55894c27e904.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                      plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-111111111111.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                  }
              }
          }
      }
      

      Run the Pipeline a few times, then click the "Plot" link in the sidepanel and it will report a null pointer exception

          [JENKINS-75091] Plot plugin throws null pointer exception in Pipeline if title not provided

          Mark Waite created issue -
          Mark Waite made changes -
          Assignee Original: Veaceslav Gaidarji [ vgaidarji ]
          Mark Waite made changes -
          Description Original: The plot plugin provides a Pipeline step but the Pipeline step implementation has multiple issues. One of those issues is that a null pointer exception is reported if the plot title is not provided. When a freestyle project leaves the plot title empty, the plot title is not displayed. If a title argument is not provided in the Pipeline step, a null pointer exception is reported.

          The Pipeline that I used to show the problem is

          {code}
          pipeline {
              agent {
                  label 'linux'
              }

              stages {
                  stage('Hello') {
                      steps {
                          echo 'Hello World'
                          sh '''#!/bin/bash
          [ ! -f plot-a.csv ] && echo "Line-A,Line-B" > plot-a.csv
          let "OTHER_VAR=2*BUILD_ID+1"
          echo $BUILD_ID,$OTHER_VAR >> plot-a.csv
                          '''
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-55894c27e904.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-111111111111.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                      }
                  }
              }
          }
          {code}
          New: The plot plugin provides a Pipeline step but the Pipeline step implementation has multiple issues. One of those issues is that a null pointer exception is reported if the plot title is not provided. When a freestyle project leaves the plot title empty, the plot title is not displayed. If a title argument is not provided in the Pipeline step, a null pointer exception is reported.

          The Pipeline that I used to show the problem is

          {code}
          pipeline {
              agent {
                  label 'linux'
              }

              stages {
                  stage('Hello') {
                      steps {
                          echo 'Hello World'
                          sh '''#!/bin/bash
          [ ! -f plot-a.csv ] && echo "Line-A,Line-B" > plot-a.csv
          let "OTHER_VAR=2*BUILD_ID+1"
          echo $BUILD_ID,$OTHER_VAR >> plot-a.csv
                          '''
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-55894c27e904.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-111111111111.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                      }
                  }
              }
          }
          {code}

          Run the Pipeline a few times, then click the "Plot" link in the sidepanel and it will report a segmentation violation
          Mark Waite made changes -
          Description Original: The plot plugin provides a Pipeline step but the Pipeline step implementation has multiple issues. One of those issues is that a null pointer exception is reported if the plot title is not provided. When a freestyle project leaves the plot title empty, the plot title is not displayed. If a title argument is not provided in the Pipeline step, a null pointer exception is reported.

          The Pipeline that I used to show the problem is

          {code}
          pipeline {
              agent {
                  label 'linux'
              }

              stages {
                  stage('Hello') {
                      steps {
                          echo 'Hello World'
                          sh '''#!/bin/bash
          [ ! -f plot-a.csv ] && echo "Line-A,Line-B" > plot-a.csv
          let "OTHER_VAR=2*BUILD_ID+1"
          echo $BUILD_ID,$OTHER_VAR >> plot-a.csv
                          '''
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-55894c27e904.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-111111111111.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                      }
                  }
              }
          }
          {code}

          Run the Pipeline a few times, then click the "Plot" link in the sidepanel and it will report a segmentation violation
          New: The plot plugin provides a Pipeline step but the Pipeline step implementation has multiple issues. One of those issues is that a null pointer exception is reported if the plot title is not provided. When a freestyle project leaves the plot title empty, the plot title is not displayed. If a title argument is not provided in the Pipeline step, a null pointer exception is reported.

          The Pipeline that I used to show the problem is

          {code}
          pipeline {
              agent {
                  label 'linux'
              }

              stages {
                  stage('Hello') {
                      steps {
                          echo 'Hello World'
                          sh '''#!/bin/bash
          [ ! -f plot-a.csv ] && echo "Line-A,Line-B" > plot-a.csv
          let "OTHER_VAR=2*BUILD_ID+1"
          echo $BUILD_ID,$OTHER_VAR >> plot-a.csv
                          '''
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-55894c27e904.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                          plot csvFileName: 'plot-923ffed9-0b83-4a7d-93eb-111111111111.csv', csvSeries: [[file: 'plot-a.csv']], group: 'Z-group', style: 'line'
                      }
                  }
              }
          }
          {code}

          Run the Pipeline a few times, then click the "Plot" link in the sidepanel and it will report a null pointer exception
          Mark Waite made changes -
          Summary Original: Pipeline support in plot plugin null pointer exception if title not provided New: Plot plugin throws null pointer exception in Pipeline if title not provided
          Mark Waite made changes -
          Remote Link New: This issue links to "PR-169 fix the null pointer exception (Web Link)" [ 30542 ]
          Mark Waite made changes -
          Released As New: https://plugins.jenkins.io/plot/releases/#version_2.4.0
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            Unassigned Unassigned
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: