java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Stacktrace: {code} java.lang.NullPointerException at hudson.plugins.s3.S3BucketPublisher.perform(S3BucketPublisher.java:124) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:68) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49) at hudson.security.ACL.impersonate(ACL.java:213) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 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 java.lang.Thread.run(Thread.java:745) {code} Pipeline code snippet that triggers the NPE: {code} step([$class: 'S3BucketPublisher', entries: [[bucket: bucket, flatten: true, noUploadOnFailure: true, selectedRegion: region, sourceFile: target, storageClass: 'STANDARD', uploadFromSlave: true, useServerSideEncryption: false]], profileName: profile, userMetadata: []]) {code} Issue looks to be that {{run.getResult()}} can return {{null}}. Workaround: {code} --- a/src/main/java/hudson/plugins/s3/S3BucketPublisher.java +++ b/src/main/java/hudson/plugins/s3/S3BucketPublisher.java @@ -121,7 +121,10 @@ public final class S3BucketPublisher extends Recorder implements SimpleBuildStep public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException { - final boolean buildFailed = run.getResult().equals(Result.FAILURE); + final boolean buildFailed = Result.FAILURE.equals(run.getResult()); + if (buildFailed) { + log(listener.getLogger(), "Run failed."); + } final S3Profile profile = getProfile(); if (profile == null) { {code}
    via by Jos Backus,
  • Stacktrace: {code} java.lang.NullPointerException at hudson.plugins.s3.S3BucketPublisher.perform(S3BucketPublisher.java:124) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:68) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49) at hudson.security.ACL.impersonate(ACL.java:213) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 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 java.lang.Thread.run(Thread.java:745) {code} Pipeline code snippet that triggers the NPE: {code} step([$class: 'S3BucketPublisher', entries: [[bucket: bucket, flatten: true, noUploadOnFailure: true, selectedRegion: region, sourceFile: target, storageClass: 'STANDARD', uploadFromSlave: true, useServerSideEncryption: false]], profileName: profile, userMetadata: []]) {code} Issue looks to be that {{run.getResult()}} can return {{null}}. Workaround: {code} --- a/src/main/java/hudson/plugins/s3/S3BucketPublisher.java +++ b/src/main/java/hudson/plugins/s3/S3BucketPublisher.java @@ -121,7 +121,10 @@ public final class S3BucketPublisher extends Recorder implements SimpleBuildStep public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException { - final boolean buildFailed = run.getResult().equals(Result.FAILURE); + final boolean buildFailed = Result.FAILURE.equals(run.getResult()); + if (buildFailed) { + log(listener.getLogger(), "Run failed."); + } final S3Profile profile = getProfile(); if (profile == null) { {code}
    via by Jos Backus,
    • java.lang.NullPointerException at hudson.plugins.s3.S3BucketPublisher.perform(S3BucketPublisher.java:124) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:68) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49) at hudson.security.ACL.impersonate(ACL.java:213) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 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 java.lang.Thread.run(Thread.java:745)
    No Bugmate found.