EnvInject plugin can add null to global env

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When setting the checkbox "Envronment Variables" in global configuration without adding list of variables - `buildEnvironment` in `Computer` and many other actions starts throwing null pointer exception.

       

      I think the problem is in here:

       

       

      // Computer.java
      for (NodeProperty nodeProperty: Jenkins.getInstance().getGlobalNodeProperties()) {
      nodeProperty.buildEnvVars(env,listener);
      }
      
      // EnvironmentVariablesNodeProperty.java
      @Override 
      public void buildEnvVars(EnvVars env, TaskListener listener) throws IOException, InterruptedException {
           env.putAll(envVars);
      } 

       

      getGlobalProperties returns NodeProperty with `envVars` that is null.

       

      I think we should either remove the checkbox on save when no variable was added or think of a better UI for it. 

      Also in server side we should add protection against this issue as this completely blocked all my builds until I figured out what was the problem

       

       

       

            Assignee:
            Unassigned
            Reporter:
            Or Shachar
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: