java.lang.NullPointerException

Google Groups | stephen...@java.net (JIRA) | 3 months ago
  1. 0

    Some properties of a credential may need to be resolved at point of use rather than being stored in the credential itself. Observed the following as an example stacktraces: With JGit as the client: {code} java.lang.NullPointerException at jenkins.security.ConfidentialStore.get(ConfidentialStore.java:65) at jenkins.security.ConfidentialKey.load(ConfidentialKey.java:46) at jenkins.security.CryptoConfidentialKey.getKey(CryptoConfidentialKey.java:32) at jenkins.security.CryptoConfidentialKey.decrypt(CryptoConfidentialKey.java:67) at hudson.util.Secret.decrypt(Secret.java:151) at hudson.util.Secret.fromString(Secret.java:200) at REDACTED.getPassword(REDACTED.java:136) at org.jenkinsci.plugins.gitclient.trilead.SmartCredentialsProvider.get(SmartCredentialsProvider.java:132) at org.eclipse.jgit.transport.HttpAuthMethod.authorize(HttpAuthMethod.java:219) at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:502) at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:309) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130) at org.jenkinsci.plugins.gitclient.JGitAPIImpl$5.execute(JGitAPIImpl.java:1448) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145) at hudson.remoting.UserRequest.perform(UserRequest.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:332) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 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) at ......remote call to mac-os(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416) at hudson.remoting.UserResponse.retrieve(UserRequest.java:253) at hudson.remoting.Channel.call(Channel.java:781) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131) at com.sun.proxy.$Proxy133.execute(Unknown Source) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1046) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1086) at hudson.scm.SCM.checkout(SCM.java:495) at hudson.model.AbstractProject.checkout(AbstractProject.java:1269) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1741) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) {code} with CLI Git as the client {code} FATAL: null java.lang.NullPointerException at jenkins.security.ConfidentialStore.get(ConfidentialStore.java:65) at jenkins.security.ConfidentialKey.load(ConfidentialKey.java:46) at jenkins.security.CryptoConfidentialKey.getKey(CryptoConfidentialKey.java:32) at jenkins.security.CryptoConfidentialKey.decrypt(CryptoConfidentialKey.java:67) at hudson.util.Secret.decrypt(Secret.java:151) at hudson.util.Secret.fromString(Secret.java:200) at REDACTED.getPassword(REDACTED.java:136) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getGitCredentialsURL(CliGitAPIImpl.java:2635) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1383) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:506) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145) at hudson.remoting.UserRequest.perform(UserRequest.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:332) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 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) at ......remote call to mac-os(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416) at hudson.remoting.UserResponse.retrieve(UserRequest.java:253) at hudson.remoting.Channel.call(Channel.java:781) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131) at com.sun.proxy.$Proxy133.execute(Unknown Source) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1046) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1086) at hudson.scm.SCM.checkout(SCM.java:495) at hudson.model.AbstractProject.checkout(AbstractProject.java:1269) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1741) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Finished: FAILURE {code} In this case the REDACTED class was attempting to make a call to retrieve the password from an external password store... but that call cannot take place when working on a remote system... so in that case it returns {{null}} as the password string that then has to be encrypted into a Secret... Now there seems to be another issues here also... Namely a remote agent can *never* decrypt a {{Secret}} so that is a set-up for failure... So I think what should be happening is that the {{SmartCredentialsProvider}} should be {{Channel.exported()}} rather than transferred over the wire... that way it will access the credentials on the master and perform the password decryption on the one node that can decrypt a secret... then the plain text can be sent to the remote node (of course for security you want to ensure you are using either SSH agents or JNLP protocol 3/4+)... that removes the need to {{CredentialsProvider.snapshot()}} and should fix issues. Similarly {{CliGitAPIImpl.getGitCredentialsURL}} seems to have the same broken assumption. I suspect also that I have hit upon the root cause as to Password protected SSH Keys not working with the Git on remote agents... namely that the getPassword().getPlainText() is being called on the remote agent and not on the master... and hence the password cannot be decrypted and hence the ssh key cannot be used.

    Jenkins JIRA | 3 months ago | stephenconnolly
    java.lang.NullPointerException
  2. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    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 jenkins.security.ConfidentialStore.get()
    2. jenkins.security
      CryptoConfidentialKey.decrypt
      1. jenkins.security.ConfidentialStore.get(ConfidentialStore.java:65)
      2. jenkins.security.ConfidentialKey.load(ConfidentialKey.java:46)
      3. jenkins.security.CryptoConfidentialKey.getKey(CryptoConfidentialKey.java:32)
      4. jenkins.security.CryptoConfidentialKey.decrypt(CryptoConfidentialKey.java:67)
      4 frames
    3. Hudson
      Secret.fromString
      1. hudson.util.Secret.decrypt(Secret.java:151)
      2. hudson.util.Secret.fromString(Secret.java:200)
      2 frames
    4. Unknown
      REDACTED.getPassword
      1. REDACTED.getPassword(REDACTED.java:136)
      1 frame
    5. org.jenkinsci.plugins
      SmartCredentialsProvider.get
      1. org.jenkinsci.plugins.gitclient.trilead.SmartCredentialsProvider.get(SmartCredentialsProvider.java:132)
      1 frame
    6. JGit - Core
      FetchCommand.call
      1. org.eclipse.jgit.transport.HttpAuthMethod.authorize(HttpAuthMethod.java:219)
      2. org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:502)
      3. org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:309)
      4. org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
      5. org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
      6. org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
      7. org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
      7 frames
    7. org.jenkinsci.plugins
      RemoteGitImpl$CommandInvocationHandler$1.call
      1. org.jenkinsci.plugins.gitclient.JGitAPIImpl$5.execute(JGitAPIImpl.java:1448)
      2. org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
      3. org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
      3 frames
    8. Hudson :: Remoting Layer
      InterceptingExecutorService$1.call
      1. hudson.remoting.UserRequest.perform(UserRequest.java:153)
      2. hudson.remoting.UserRequest.perform(UserRequest.java:50)
      3. hudson.remoting.Request$2.run(Request.java:332)
      4. hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      4 frames
    9. Java RT
      ThreadPoolExecutor$Worker.run
      1. java.util.concurrent.FutureTask.run(FutureTask.java:266)
      2. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      3. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      3 frames