Skip to content

[JENKINS-75091] Fix null pointer exception when title is missing#169

Merged
MarkEWaite merged 1 commit into
jenkinsci:masterfrom
MarkEWaite:fix-pipeline-npe
Feb 17, 2025
Merged

[JENKINS-75091] Fix null pointer exception when title is missing#169
MarkEWaite merged 1 commit into
jenkinsci:masterfrom
MarkEWaite:fix-pipeline-npe

Conversation

@MarkEWaite

Copy link
Copy Markdown
Contributor

[JENKINS-75091] Fix null pointer exception when title is missing

JENKINS-75091 provides a sample Pipeline that throws a null pointer exception when viewing plots after a few executions of the job.

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'
            }
        }
    }
}

Testing done

Created a Pipeline with that script before the change and confirmed that it reports a null pointer exception. Used the same Pipeline after the fix and confirmed that the plugin is drawn correctly.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

https://issues.jenkins.io/browse/JENKINS-75091 provides a sample Pipeline
that throws a null pointer exception when viewing plots after a few
executions of the job.

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'
            }
        }
    }
}
@MarkEWaite MarkEWaite added the bug Bug fix label Feb 17, 2025
@MarkEWaite
MarkEWaite requested a review from a team as a code owner February 17, 2025 23:15
@MarkEWaite
MarkEWaite merged commit da41f6b into jenkinsci:master Feb 17, 2025
@MarkEWaite
MarkEWaite deleted the fix-pipeline-npe branch February 17, 2025 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant