jenkinsci/git-changelog-plugin

ParseException: Unexpected End Of File

Closed this issue · 4 comments

At least since 3.5 we encounter the following error message with most repositories:

net.minidev.json.parser.ParseException: Unexpected End Of File position : null

A downgrade to 3.2 resolved the issue. Didn't try with versions 3.3 and 3.4 that might also work.

Version report

Jenkins and plugins versions report:

Jenkins: 2.297
OS: Windows Server 2016 - 10.0

ace-editor:1.1
active-directory:2.24
all-changes:1.5
ansicolor:1.0.0
ant:1.11
antisamy-markup-formatter:2.1
apache-httpcomponents-client-4-api:4.5.13-1.0
authentication-tokens:1.4
aws-credentials:1.29
aws-java-sdk:1.11.995
badge:1.8
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.24.7
blueocean-commons:1.24.7
blueocean-config:1.24.7
blueocean-core-js:1.24.7
blueocean-dashboard:1.24.7
blueocean-display-url:2.4.1
blueocean-events:1.24.7
blueocean-git-pipeline:1.24.7
blueocean-github-pipeline:1.24.7
blueocean-i18n:1.24.7
blueocean-jira:1.24.7
blueocean-jwt:1.24.7
blueocean-personalization:1.24.7
blueocean-pipeline-api-impl:1.24.7
blueocean-pipeline-editor:1.24.7
blueocean-pipeline-scm-api:1.24.7
blueocean-rest-impl:1.24.7
blueocean-rest:1.24.7
blueocean-web:1.24.7
blueocean:1.24.7
bootstrap4-api:4.6.0-3
bootstrap5-api:5.0.1-2
bouncycastle-api:2.20
branch-api:2.6.4
build-pipeline-plugin:1.5.8
build-timeout:1.20
build-user-vars-plugin:1.7
caffeine-api:2.9.1-23.v51c4e2c879c8
checks-api:1.7.0
cloudbees-bitbucket-branch-source:2.9.9
cloudbees-folder:6.15
command-launcher:1.6
conditional-buildstep:1.4.1
config-file-provider:3.8.0
convert-to-pipeline:1.0
copyartifact:1.46.1
credentials-binding:1.25
credentials:2.5
dashboard-view:2.17
display-url-api:2.3.5
docker-commons:1.17
docker-workflow:1.26
durable-task:1.37
echarts-api:5.1.2-2
email-ext:2.83
emailext-template:1.2
external-monitor-job:1.7
favorite:2.3.3
font-awesome-api:5.15.3-3
git-changelog:3.2
git-client:3.7.2
git-parameter:0.9.13
git-server:1.9
git:4.7.2
github-api:1.123
github-branch-source:2.11.1
github:1.33.1
gitlab-plugin:1.5.20
global-build-stats:1.5
groovy-postbuild:2.5
h2-api:1.4.199
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.25
http_request:1.9.0
jackson2-api:2.12.3
jacoco:3.2.0
javadoc:1.6
jaxb:2.3.0.1
jdk-tool:1.5
jenkins-design-language:1.24.7
jira-steps:1.6.0
jira:3.3
jjwt-api:0.11.2-9.c8b45b8bb173
jobcacher:1.0
jquery-detached:1.2.1
jquery:1.12.4-1
jquery3-api:3.6.0-1
jsch:0.1.55.2
junit-attachments:1.6
junit:1.50
last-changes:2.7.10
ldap:2.7
lockable-resources:2.11
mailer:1.34
mapdb-api:1.0.9.0
matrix-auth:2.6.7
matrix-project:1.19
maven-plugin:3.11
mercurial:2.15
momentjs:1.1.1
okhttp-api:3.14.9
pam-auth:1.6
parameterized-trigger:2.41
pipeline-build-step:2.13
pipeline-github-lib:1.0
pipeline-graph-analysis:1.11
pipeline-input-step:2.12
pipeline-maven:3.10.0
pipeline-milestone-step:1.3.2
pipeline-model-api:1.8.5
pipeline-model-definition:1.8.5
pipeline-model-extensions:1.8.5
pipeline-rest-api:2.19
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.8.5
pipeline-stage-view:2.19
plain-credentials:1.7
plugin-util-api:2.3.0
popper-api:1.16.1-2
popper2-api:2.5.4-2
pubsub-light:1.15
resource-disposer:0.16
run-condition:1.5
saml:2.0.6
scm-api:2.6.4
script-security:1.77
skip-certificate-check:1.0
snakeyaml-api:1.29.1
sonar:2.13.1
sse-gateway:1.24
ssh-credentials:1.19
ssh-slaves:1.32.0
sshd:3.0.3
structs:1.23
subversion:2.14.3
timestamper:1.13
token-macro:2.15
trilead-api:1.0.13
variant:1.4
windows-slaves:1.8
workflow-aggregator:2.6
workflow-api:2.44
workflow-basic-steps:2.23
workflow-cps-global-lib:2.19
workflow-cps:2.92
workflow-durable-task-step:2.39
workflow-job:2.41
workflow-multibranch:2.24
workflow-remote-loader:1.5
workflow-scm-step:2.12
workflow-step-api:2.23
workflow-support:3.8
ws-cleanup:0.39
xray-for-jira-connector:1.3.0

Copy/paste here....
  • What Operating System are you using (both controller, and any agents involved in the problem)?

Windows Server 2016

Reproduction steps

def getChangeLogHTML(def gitRepoUrl, def gitRepoName, def gitTargetDir, def logType, def logFrom, def logTo, boolean updateIssues) {
    def stageName = this.stageName.capitalize()
    def result = ''
    try {
        withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'user',
                        usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
            def changelogContext = gitChangelog returnType: 'CONTEXT', repo: gitTargetDir,
                                                from: [type: logType, value: logFrom ],
                                                to: [type: logType, value: logTo ],
                                                jira: [
                                                    issuePattern: '\\b[a-zA-Z]([a-zA-Z]+)-([0-9]+)\\b', 
                                                    server: this.JIRA_BASE_URL, 
                                                    username: env.USERNAME, 
                                                    password: env.PASSWORD
                                                ]

Results

Expected result:

Changelog from Git Repository

Actual result:

net.minidev.json.parser.ParseException: Unexpected End Of File position 639: null

Does it work if you remove the Jira configuration?

I tried with Jenkins 2.277.4. And plugin version 3.8. Pipeline below. Works for me.

This pipeline:

node {
 deleteDir()
 sh """
 git clone git@github.com:jenkinsci/git-changelog-plugin.git .
 """

 def changelogContext = gitChangelog returnType: 'CONTEXT',
  from: [type: 'REF', value: 'git-changelog-1.50'],
  to: [type: 'REF', value: 'master'],
  jira: [issuePattern: 'JENKINS-([0-9]+)\\b', password: '', server: '', username: '']

 Set<String> issueIdentifiers = new TreeSet<>()
 changelogContext.issues.each { issue ->
  if (issue.name == 'Jira') {
   issueIdentifiers.add(issue.issue)
  }
 }
 currentBuild.description = "http://jira.com/issues/?jql=key%20in%20%28${issueIdentifiers.join(',')}%29"
}

I can confirm that the issue is linked to the Jira configuration - if I remove it it's working.
I also managed to get a better stacktrace that should help fixing the problem:

net.minidev.json.parser.ParseException: Unexpected End Of File position 696: null
[com.jayway.jsonpath.spi.json.JsonSmartJsonProvider.parse(JsonSmartJsonProvider.java:64), com.jayway.jsonpath.internal.ParseContextImpl.parse(ParseContextImpl.java:37), com.jayway.jsonpath.JsonPath.read(JsonPath.java:498), se.bjurr.gitchangelog.internal.integrations.jira.JiraClient.toJiraIssue(JiraClient.java:38), se.bjurr.gitchangelog.internal.integrations.jira.DefaultJiraClient.getIssue(DefaultJiraClient.java:40), se.bjurr.gitchangelog.internal.issues.IssueParser.createParsedIssue(IssueParser.java:225), se.bjurr.gitchangelog.internal.issues.IssueParser.parseForIssues(IssueParser.java:82), se.bjurr.gitchangelog.api.GitChangelogApi.getChangelog(GitChangelogApi.java:585), se.bjurr.gitchangelog.api.GitChangelogApi.getChangelog(GitChangelogApi.java:83), se.bjurr.gitchangelog.api.GitChangelogApi.getChangelog(GitChangelogApi.java:77), org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.perform(GitChangelogStep.java:446), org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.access$000(GitChangelogStep.java:45), org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1$1.call(GitChangelogStep.java:354), hudson.FilePath.act(FilePath.java:1260), org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1.run(GitChangelogStep.java:358), org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47), java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515), java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264), java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128), java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628), java.base/java.lang.Thread.run(Thread.java:834)]

Thank you

Try 3.9. It should include the unparsable json in the exception thrown.

Cannot reproduce the issue with 3.9. Thank you!