Skip to content

Commit

Permalink
JENKINS-29421 Resolve NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrowe committed Jul 23, 2015
1 parent 069be26 commit f0857f5
Showing 1 changed file with 8 additions and 9 deletions.
Expand Up @@ -374,11 +374,15 @@ public Environment setUp(final AbstractBuild build, Launcher launcher, BuildList
public void buildEnvVars(Map<String, String> env) {
logger.fine("Creating Sauce environment variables");
List<Browser> browsers = new ArrayList<Browser>();
for (String webDriverBrowser : webDriverBrowsers) {
browsers.add(BROWSER_FACTORY.webDriverBrowserForKey(webDriverBrowser, useLatestVersion));
if (webDriverBrowsers != null) {
for (String webDriverBrowser : webDriverBrowsers) {
browsers.add(BROWSER_FACTORY.webDriverBrowserForKey(webDriverBrowser, useLatestVersion));
}
}
for (String appiumBrowser : appiumBrowsers) {
browsers.add(BROWSER_FACTORY.appiumBrowserForKey(appiumBrowser));
if (appiumBrowsers != null) {
for (String appiumBrowser : appiumBrowsers) {
browsers.add(BROWSER_FACTORY.appiumBrowserForKey(appiumBrowser));
}
}
SauceEnvironmentUtil.outputVariables(env, browsers, getUserName(), getApiKey());
//if any variables have been defined in build variables (ie. by a multi-config project), use them
Expand Down Expand Up @@ -643,10 +647,7 @@ public String getUserName() {
return getCredentials().getUsername();
} else {
PluginImpl p = PluginImpl.get();

return p.getUsername();


}
}

Expand All @@ -658,9 +659,7 @@ public String getApiKey() {
return getCredentials().getApiKey();
} else {
PluginImpl p = PluginImpl.get();

return Secret.toString(p.getApiKey());

}
}

Expand Down

0 comments on commit f0857f5

Please sign in to comment.