Skip to content

Commit

Permalink
[FIXED JENKINS-9143] Removed empty Repository URL from List.
Browse files Browse the repository at this point in the history
  • Loading branch information
sogabe committed Mar 29, 2011
1 parent 4a16877 commit 7678503
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/main/java/hudson/scm/SubversionSCM.java
Expand Up @@ -278,7 +278,8 @@ public SubversionSCM(List<ModuleLocation> locations, WorkspaceUpdater workspaceU
String includedRegions) {
for (Iterator<ModuleLocation> itr = locations.iterator(); itr.hasNext();) {
ModuleLocation ml = itr.next();
if(ml.remote==null) itr.remove();
String remote = Util.fixEmptyAndTrim(ml.remote);
if(remote==null) itr.remove();
}
this.locations = locations.toArray(new ModuleLocation[locations.size()]);

Expand Down Expand Up @@ -1741,12 +1742,9 @@ protected void onSuccess(String realm, Credential cred) {
*/
public FormValidation doCheckRemote(StaplerRequest req, @AncestorInPath AbstractProject context, @QueryParameter String value) {
// syntax check first
String url = Util.nullify(value);
String url = Util.fixEmptyAndTrim(value);
if (url == null)
return FormValidation.ok();

// remove unneeded whitespaces
url = url.trim();
return FormValidation.error(Messages.SubversionSCM_doCheckRemote_required());

if(isValidateRemoteUpToVar()) {
url = (url.indexOf('$') != -1) ? url.substring(0, url.indexOf('$')) : url;
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/hudson/scm/subversion/Messages.properties
@@ -1,6 +1,6 @@
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Yahoo! Inc.
# Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Yahoo! Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,6 +39,7 @@ SubversionSCM.doCheckRemote.invalidRevision=\
Invalid revision. Revision may either be a number or a <a \
href="http://svnbook.red-bean.com/en/1.5/svn.tour.revs.specifiers.html" \
target="_blank">Revision Keyword or Date</a>.
SubversionSCM.doCheckRemote.required=Repository URL is required.
SubversionSCM.excludedRevprop.notSupported=\
The remote location {0} does not support retrieving custom revision properties with svn log. \
Commits with revision properties will trigger builds.
Expand Down
@@ -1,6 +1,6 @@
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Yahoo! Inc.
# Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe, Yahoo! Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -32,8 +32,9 @@ SubversionSCM.doCheckRemote.exceptionMsg2=\
(<a href="{0}" target="_blank">\u8a8d\u8a3c\u3092\u5165\u529b</a>\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093)
SubversionSCM.doCheckRemote.invalidUrl=\
URL\u5f62\u5f0f\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3059\u3002\
\u6b63\u3057\u3044URL\u5f62\u5f0f\u306f\u3001See <a href="http://svnbook.red-bean.com/en/1.2/svn-book.html#svn.basic.in-action.wc.tbl-1" target="_blank">\u3053\u3061\u3089</a>\u3092\
\u6b63\u3057\u3044URL\u5f62\u5f0f\u306f<a href="http://svnbook.red-bean.com/en/1.2/svn-book.html#svn.basic.in-action.wc.tbl-1" target="_blank">\u3053\u3061\u3089</a>\u3092\
\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002
SubversionSCM.doCheckRemote.required=Repository URL\u306f\u5fc5\u9808\u3067\u3059\u3002
SubversionSCM.pollChanges.remoteRevisionAt=\
{0} \u306f\u30ea\u30d3\u30b8\u30e7\u30f3{1}
SubversionSCM.pollChanges.changedFrom=\
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/hudson/scm/SubversionSCMTest.java
Expand Up @@ -487,6 +487,25 @@ public void testConfigRoundtrip2() throws Exception {
verify(scm,(SubversionSCM)p.getScm());
}

@Bug(9143)
public void testCheckEmptyRemoteRemved() throws Exception {
FreeStyleProject p = createFreeStyleProject();

List<ModuleLocation> locs = new ArrayList<ModuleLocation>();
locs.add(new ModuleLocation("https://svn.java.net/svn/hudson~svn/trunk/hudson/test-projects/testSubversionExclusion", "c"));
locs.add(new ModuleLocation("", "d"));
locs.add(new ModuleLocation(" ", "e"));

SubversionSCM scm = new SubversionSCM(
locs,
true, new Sventon(new URL("http://www.sun.com/"), "test"), "exclude", "user", "revprop", "excludeMessage");
p.setScm(scm);
submit(new WebClient().getPage(p, "configure").getFormByName("config"));
ModuleLocation[] ml = ((SubversionSCM) p.getScm()).getLocations();
assertEquals(1, ml.length);
assertEquals("https://svn.java.net/svn/hudson~svn/trunk/hudson/test-projects/testSubversionExclusion", ml[0].remote);
}

@Bug(5684)
public void testDoCheckExcludedUsers() throws Exception {
String[] validUsernames = new String[] {
Expand Down

0 comments on commit 7678503

Please sign in to comment.