JENKINS-50487# Fix for java.util.NoSuchElementException error (#1703)
This commit is contained in:
parent
e7de3f1b8d
commit
b34008946c
|
@ -76,11 +76,11 @@ public class GitReadSaveService extends ScmContentProvider {
|
|||
public String getApiUrl(@Nonnull Item item) {
|
||||
if (item instanceof org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) {
|
||||
MultiBranchProject<?,?> mbp = (MultiBranchProject<?,?>)item;
|
||||
SCMSource s = mbp.getSCMSources().iterator().next();
|
||||
if (s instanceof GitSCMSource) {
|
||||
String remote = ((GitSCMSource)s).getRemote();
|
||||
return remote;
|
||||
}
|
||||
return mbp.getSCMSources().stream()
|
||||
.filter(s->s instanceof GitSCMSource)
|
||||
.map(s -> ((GitSCMSource)s).getRemote())
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue