Skip to content

Commit

Permalink
Return empty list on error for listRepos()
Browse files Browse the repository at this point in the history
JENKINS-45420
  • Loading branch information
p4paul committed Jul 11, 2017
1 parent 768cb40 commit 26e810a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java
Expand Up @@ -1003,11 +1003,15 @@ public int getClientHead() throws Exception {
/**
* List of Graph Repos within the client's view
*
* @return A list of Graph Repos
* @throws Exception push up stack
* @return A list of Graph Repos, empty list on error.
*/
public List<IRepo> listRepos() throws Exception {
List<IRepo> repos = iclient.getRepos();
public List<IRepo> listRepos() {
List<IRepo> repos = new ArrayList<>();
try {
repos = iclient.getRepos();
} catch (Exception e) {
logger.fine("No repos found: " + e.getMessage());
}
return repos;
}

Expand Down
@@ -1,6 +1,5 @@
package org.jenkinsci.plugins.p4.scm;

import edu.umd.cs.findbugs.annotations.NonNull;
import jenkins.scm.api.SCMHead;
import jenkins.scm.api.mixin.ChangeRequestSCMHead;

Expand All @@ -19,7 +18,6 @@ public class P4ChangeRequestSCMHead extends P4Head implements ChangeRequestSCMHe
this.review = review;
}

@NonNull
@Override
public String getId() {
return getName();
Expand All @@ -34,7 +32,6 @@ public String getReview() {
*
* @return a “target” or “base” branch
*/
@NonNull
@Override
public SCMHead getTarget() {
return target;
Expand Down

0 comments on commit 26e810a

Please sign in to comment.