Skip to content
Permalink
Browse files
JENKINS-14790 NullPointerException starting Xvfb on remote slave
  • Loading branch information
Zoran Regvart committed Sep 9, 2012
1 parent 844caa8 commit 40e566d37f2cafb78b659693fcc416d79fe7dfa6
Showing with 11 additions and 4 deletions.
  1. +10 −4 src/main/java/org/jenkinsci/plugins/xvfb/XvfbBuildWrapper.java
  2. +1 −0 src/main/resources/org/jenkinsci/plugins/xvfb/Messages.properties
@@ -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());
}
@@ -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;
@@ -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();
@@ -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}

0 comments on commit 40e566d

Please sign in to comment.