Skip to content

Commit

Permalink
JENKINS-14790 NullPointerException starting Xvfb on remote slave
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoran Regvart committed Sep 9, 2012
1 parent 844caa8 commit 40e566d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/org/jenkinsci/plugins/xvfb/XvfbBuildWrapper.java
Expand Up @@ -141,7 +141,7 @@ public XvfbBuildWrapper(final String installationName, final Integer displayName
}

@Override
public Launcher decorateLauncher(final AbstractBuild build, final Launcher launcher, final BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException {
public Launcher decorateLauncher(@SuppressWarnings("rawtypes") final AbstractBuild build, final Launcher launcher, final BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException {
if (!launcher.isUnix()) {
listener.getLogger().println(Messages.XvfbBuildWrapper_NotUnix());
}
Expand All @@ -162,6 +162,12 @@ public Launcher decorateLauncher(final AbstractBuild build, final Launcher launc
final EnvVars environment = currentComputer.getEnvironment();
final XvfbInstallation installation = getInstallation(environment, currentNode, listener);

if (installation == null) {
listener.error(Messages.XvfbBuildWrapper_NoInstallationsConfigured());

return launcher;
}

final String path = installation.getHome();

final ArgumentListBuilder cmd;
Expand Down Expand Up @@ -241,20 +247,20 @@ public boolean isDebug() {
}

@Override
public void makeBuildVariables(final AbstractBuild build, final Map<String, String> variables) {
public void makeBuildVariables(@SuppressWarnings("rawtypes") final AbstractBuild build, final Map<String, String> variables) {
variables.put("DISPLAY", ":" + displayNameUsed);
}

@Override
public Environment setUp(final AbstractBuild build, final Launcher launcher, final BuildListener listener) throws IOException, InterruptedException {
public Environment setUp(@SuppressWarnings("rawtypes") final AbstractBuild build, final Launcher launcher, final BuildListener listener) throws IOException, InterruptedException {
return new Environment() {
@Override
public void buildEnvVars(final Map<String, String> env) {
env.put("DISPLAY", ":" + displayNameUsed);
}

@Override
public boolean tearDown(final AbstractBuild build, final BuildListener listener) throws IOException, InterruptedException {
public boolean tearDown(@SuppressWarnings("rawtypes") final AbstractBuild build, final BuildListener listener) throws IOException, InterruptedException {
listener.getLogger().println(Messages.XvfbBuildWrapper_Stopping());
process.kill();
frameBufferDir.deleteRecursive();
Expand Down
Expand Up @@ -25,6 +25,7 @@ XvfbBuildWrapper.DisplayName = Start Xvfb before the build, and shut it down aft
XvfbBuildWrapper.NotUnix = System is not Unix, Xvfb will not be started
XvfbBuildWrapper.Starting = Xvfb starting
XvfbBuildWrapper.Stopping = Xvfb stopping
XvfbBuildWrapper.NoInstallationsConfigured = No Xvfb installations defined, please define one in the configuration. Once defined you'll need to choose one under Advanced options for Xvfb plugin job settings and save job configuration.

XvfbInstallation.DisplayName = Xvfb installation
XvfbInstallation.HomeNotDirectory = Home path is not a directory: {0}
Expand Down

0 comments on commit 40e566d

Please sign in to comment.