Skip to content

Commit

Permalink
[FIXED JENKINS-19037] Ugly stack trace when saving configuration with…
Browse files Browse the repository at this point in the history
… a missing repository URL.
  • Loading branch information
jglick committed Sep 21, 2013
1 parent c78bfce commit 42f15d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -1103,14 +1103,18 @@ public static List<RemoteConfig> createRepositoryConfigurations(String[] urls,

if (names != null) {
for (int i = 0; i < names.length; i++) {
String url = urls[i];
if (url == null) {
continue;
}
String name = names[i];
name = name.replace(' ', '_');

if (isBlank(refs[i])) {
refs[i] = "+refs/heads/*:refs/remotes/" + name + "/*";
}

repoConfig.setString("remote", name, "url", urls[i]);
repoConfig.setString("remote", name, "url", url);
repoConfig.setStringList("remote", name, "fetch", new ArrayList<String>(Arrays.asList(refs[i].split("\\s+"))));
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/hudson/plugins/git/GitSCMTest.java
Expand Up @@ -594,6 +594,12 @@ public void testMultipleBranchBuild() throws Exception {
assertFalse("scm polling should not detect any more changes after last build", project.poll(listener).hasChanges());
}

@Bug(19037)
@SuppressWarnings("ResultOfObjectAllocationIgnored")
public void testBlankRepositoryName() throws Exception {
new GitSCM(null);
}

@Bug(10060)
public void testSubmoduleFixup() throws Exception {
File repo = createTmpDir();
Expand Down

0 comments on commit 42f15d8

Please sign in to comment.