镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

NullPointerException is thrown unless isRunning() is called first #268

Closed

Description

@bane73

Forgive me if I have missed some config detail that this would resolve, I also did scan through current issues and am not finding anything about this (which is curious to me).

v0.3.7

public static void main(String[] args) {
  
    JenkinsServer jks = new JenkinsServer("https://jenkins.mydomain.com", "username", "token");
    
    // SAD PATH
    try {
             jks.getVersion(); 
    } catch(Exception e) {
             /* java.lang.NullPointerException
	      * at com.offbytwo.jenkins.JenkinsServer.getVersion(JenkinsServer.java:104)
              */
    }

    // HAPPY PATH
    jks.isRunning();
    jks.getVersion();
    
}

Activity

  1. khmarbaise commented on Jul 20, 2017

    @khmarbaise
    Member

    Yeah unfortunately you are right...The point is to get the version there must be at least a single communication happen with the Jenkins server otherwise this information is not set...so this needs to be fixed...Simplest solution would be to call isRunning() inside getVersion()...

  2. added this to the Release 0.3.8 milestone on Jul 20, 2017
  3. added a commit that references this issue on Jul 20, 2017
    196a94e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions