Skip to content

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

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

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