java.lang.NullPointerException

Jenkins JIRA | Jos Backus | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    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}

    Jenkins JIRA | 1 year ago | Jos Backus
    java.lang.NullPointerException
  2. 0

    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}

    Jenkins JIRA | 1 year ago | Jos Backus
    java.lang.NullPointerException
  3. 0

    Getting a nullpointer exception when switching displayables in J2ME

    Stack Overflow | 6 years ago | Pallinder
    java.lang.NullPointerException: 0 at javax.microedition.lcdui.Display$ChameleonTunnel.callScreenListener(), bci=46 at com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(), bci=74 at com.sun.midp.chameleon.layers.SoftButtonLayer.soft1(), bci=37 at com.sun.midp.chameleon.layers.SoftButtonLayer.keyInput(), bci=36 at com.sun.midp.chameleon.CWindow.keyInput(), bci=38 at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=17 at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277 at com.sun.midp.events.EventQueue.run(), bci=179
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    J2ME (Java) - Null Pointer Exception caught in Display Class

    Stack Overflow | 6 years ago | Tom
    java.lang.NullPointerException: 0 at javax.microedition.lcdui.Display$ChameleonTunnel.callScreenListener(), bci=46 at com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(), bci=74 at com.sun.midp.chameleon.layers.SoftButtonLayer.soft1(), bci=37 at com.sun.midp.chameleon.layers.SoftButtonLayer.keyInput(), bci=36 at com.sun.midp.chameleon.CWindow.keyInput(), bci=38 at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=17 at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277 at com.sun.midp.events.EventQueue.run(), bci=179
  6. 0

    Cloud Foundry v2 in Grails

    Stack Overflow | 3 years ago | angelo087
    java.lang.NullPointerException: Cannot invoke method getAt() on null object

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at hudson.plugins.s3.S3BucketPublisher.perform()
    2. hudson.plugins.s3
      S3BucketPublisher.perform
      1. hudson.plugins.s3.S3BucketPublisher.perform(S3BucketPublisher.java:124)
      1 frame
    3. org.jenkinsci.plugins
      AbstractSynchronousNonBlockingStepExecution$1$1.call
      1. org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:68)
      2. org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59)
      3. org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49)
      3 frames
    4. Hudson
      ACL.impersonate
      1. hudson.security.ACL.impersonate(ACL.java:213)
      1 frame
    5. org.jenkinsci.plugins
      AbstractSynchronousNonBlockingStepExecution$1.run
      1. org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47)
      1 frame
    6. Java RT
      Thread.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      2. java.util.concurrent.FutureTask.run(FutureTask.java:266)
      3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      5. java.lang.Thread.run(Thread.java:745)
      5 frames