Skip to content

Commit

Permalink
Merge pull request #7 from mathieu-pousse/master
Browse files Browse the repository at this point in the history
[FIXED JENKINS-27678] Fix NullPointerException when nonProxyHost is not set
  • Loading branch information
olamy committed Mar 31, 2015
2 parents cf7a86b + f2d3fa2 commit a75b5e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Expand Up @@ -148,6 +148,9 @@ private void addProxySelectorIfNecessary(DefaultRepositorySystemSession reposito
}

public String convertHudsonNonProxyToJavaNonProxy(String hudsonNonProxy) {
if (StringUtils.isEmpty(hudsonNonProxy)) {
return "";
}
String[] nonProxyArray = hudsonNonProxy.split("[ \t\n,|]+");
String nonProxyOneLine = StringUtils.join(nonProxyArray, '|');
return nonProxyOneLine;
Expand Down
@@ -1,18 +1,9 @@
package org.jvnet.hudson.plugins.repositoryconnector.aether;

import hudson.model.Cause;
import hudson.model.FreeStyleProject;
import hudson.model.Result;
import hudson.tasks.Shell;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
import org.jvnet.hudson.plugins.repositoryconnector.Artifact;
import org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver;

import java.io.File;
import java.io.PrintStream;
import java.util.Collections;

import static org.junit.Assert.assertEquals;

Expand All @@ -21,9 +12,8 @@ public class AetherTest {
private Aether sut;

@Before
public void setup()
{
sut = new Aether( new File("jenkinstest"), System.out, false );
public void setup() {
sut = new Aether(new File("jenkinstest"), System.out, false);
}

@Test
Expand All @@ -33,4 +23,9 @@ public void convertGivenNonHttpProxySettings() throws Exception {

assertEquals("New lines should be replaced", result, "localhost|*.google.com|apple.com");
}

@Test
public void convertGivenNullNonHttpProxySettings() throws Exception {
assertEquals("New lines should be replaced", sut.convertHudsonNonProxyToJavaNonProxy(null), "");
}
}

0 comments on commit a75b5e6

Please sign in to comment.