Permalink
Browse files

Inline references to hudson.Functions, trying to resolve [JENKINS-21520]

  • Loading branch information...
MarkEWaite committed Jul 10, 2015
1 parent 3745d56 commit 9369a12c7bc4cdee6cea399029f302533727595a
@@ -1,7 +1,6 @@
package hudson.plugins.git.util;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import hudson.Functions;
import hudson.model.AbstractBuild;
import hudson.model.Action;
import hudson.model.Api;
@@ -83,7 +82,7 @@ public String getDisplayName() {
}

public String getIconFileName() {
return Functions.getResourcePath()+"/plugin/git/icons/git-32x32.png";
return jenkins.model.Jenkins.RESOURCE_PATH+"/plugin/git/icons/git-32x32.png";
}

public String getUrlName() {
@@ -12,7 +12,6 @@
import org.junit.Before;

import hudson.EnvVars;
import hudson.Functions;
import hudson.model.TaskListener;
import hudson.util.StreamTaskListener;

@@ -48,7 +47,7 @@ public void createGitRepository() throws IOException, InterruptedException {

@After
public void removeGitRepository() throws IOException, InterruptedException {
if (Functions.isWindows()) {
if (isWindows()) {
System.gc(); // Reduce Windows file busy exceptions cleaning up temp dirs
}

@@ -94,4 +93,9 @@ protected void commitNewFile(final String fileName) throws GitException, Interru
list.add(new UserRemoteConfig(testGitDir.getAbsolutePath(), "origin", "", null));
return list;
}

/** inline ${@link hudson.Functions#isWindows()} to prevent a transient remote classloader issue */
private boolean isWindows() {
return File.pathSeparatorChar==';';
}
}
@@ -3,7 +3,6 @@
import static org.apache.commons.lang.StringUtils.isBlank;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Functions;
import hudson.Launcher;
import hudson.matrix.MatrixBuild;
import hudson.matrix.MatrixProject;
@@ -82,7 +81,7 @@ protected void tearDown() throws Exception {
try { //Avoid test failures due to failed cleanup tasks
super.tearDown();
} catch (Exception e) {
if (e instanceof IOException && Functions.isWindows()) {
if (e instanceof IOException && isWindows()) {
return;
}
e.printStackTrace();
@@ -297,4 +296,9 @@ public void showRepo(TestGitRepo repo, String msg) throws Exception {
System.out.println(out.toString());
out.close();
}

/** inline ${@link hudson.Functions#isWindows()} to prevent a transient remote classloader issue */
private boolean isWindows() {
return File.pathSeparatorChar==';';
}
}
@@ -24,7 +24,6 @@
package hudson.plugins.git;

import hudson.FilePath;
import hudson.Functions;
import hudson.Launcher;
import hudson.matrix.Axis;
import hudson.matrix.AxisList;
@@ -557,7 +556,7 @@ public void testMergeAndPushWithCharacteristicEnvVar() throws Exception {
public void testMergeAndPushWithSystemEnvVar() throws Exception {
FreeStyleProject project = setupSimpleProject("master");

String envName = Functions.isWindows() ? "COMPUTERNAME" : "LOGNAME";
String envName = isWindows() ? "COMPUTERNAME" : "LOGNAME";
String envValue = System.getenv().get(envName);
assertNotNull("Env " + envName + " not set", envValue);
assertFalse("Env " + envName + " empty", envValue.isEmpty());
@@ -661,4 +660,9 @@ private boolean hasBranch(String branchName) throws GitException, InterruptedExc
}
return false;
}

/** inline ${@link hudson.Functions#isWindows()} to prevent a transient remote classloader issue */
private boolean isWindows() {
return java.io.File.pathSeparatorChar==';';
}
}
@@ -9,7 +9,6 @@
import hudson.triggers.SCMTrigger;
import hudson.util.IOUtils;
import hudson.util.RunList;
import hudson.Functions;
import hudson.model.TaskListener;
import hudson.util.StreamTaskListener;

@@ -53,7 +52,7 @@ public void tearDown() throws Exception
tempAllocator.dispose();
}
catch (Exception e) {
if (e instanceof IOException && Functions.isWindows()) {
if (e instanceof IOException && isWindows()) {
return;
}
e.printStackTrace();
@@ -324,4 +323,8 @@ private void extract(ZipFile zipFile, File outputDir) throws IOException
}
}

/** inline ${@link hudson.Functions#isWindows()} to prevent a transient remote classloader issue */
private boolean isWindows() {
return File.pathSeparatorChar==';';
}
}

0 comments on commit 9369a12

Please sign in to comment.