Skip to content

Commit

Permalink
Inline references to hudson.Functions, trying to resolve [JENKINS-21520]
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed Jul 10, 2015
1 parent 3745d56 commit 9369a12
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/main/java/hudson/plugins/git/util/BuildData.java
@@ -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;
Expand Down Expand Up @@ -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() {
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/hudson/plugins/git/AbstractGitRepository.java
Expand Up @@ -12,7 +12,6 @@
import org.junit.Before;

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

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -94,4 +93,9 @@ protected List<UserRemoteConfig> remoteConfigs() throws IOException {
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==';';
}
}
8 changes: 6 additions & 2 deletions src/test/java/hudson/plugins/git/AbstractGitTestCase.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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==';';
}
}
8 changes: 6 additions & 2 deletions src/test/java/hudson/plugins/git/GitPublisherTest.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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==';';
}
}
7 changes: 5 additions & 2 deletions src/test/java/hudson/plugins/git/SCMTriggerTest.java
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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.