Skip to content

Commit

Permalink
[JENKINS-29211] foreach cycle with break would be more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
recena committed Jul 4, 2015
1 parent 73c3c5c commit 7b7b165
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main/java/hudson/scm/PerJobCredentialStore.java
Expand Up @@ -115,16 +115,13 @@ private Object writeReplace() {
CredentialsStore store = CredentialsProvider.lookupStores(project).iterator().next();
for (Map.Entry<String, Credential> e : credentials.entrySet()) {
StandardCredentials credential = descriptor.migrateCredentials(store, e.getKey(), e.getValue());
int i = 0;
boolean found = false;
ModuleLocation[] locations = ((SubversionSCM) project.getScm()).getLocations();
while (i < locations.length && !found) {
for (int i = 0; i < locations.length; i++) {
try {
if (e.getKey().contains(locations[i].getSVNURL().getHost())) {
locations[i].setCredentialsId(credential.getId());
found = true;
break;
}
i++;
} catch (SVNException ex) {
// Should not happen, but...
LOGGER.log(WARNING, "Repository location with a malformed URL: " + locations[i].remote, ex);
Expand Down

0 comments on commit 7b7b165

Please sign in to comment.