Skip to content

Commit

Permalink
[JENKINS-44891] Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Jun 14, 2017
1 parent 9d15020 commit db4c727
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/main/java/jenkins/scm/api/SCMSource.java
Expand Up @@ -151,7 +151,7 @@ protected SCMSource() {
* Note this is a <strong>one-shot</strong> setter. If {@link #getId()} is called first, then its value will stick,
* otherwise the first call to {@link #setId(String)} will stick.
*
* @param id the ID.
* @param id the ID, this is an opaque token expected to be unique within any one {@link SCMSourceOwner}.
* @see #hasId()
* @see #getId()
* @since 2.2.0
Expand All @@ -160,6 +160,8 @@ protected SCMSource() {
public final synchronized void setId(@CheckForNull String id) {
if (this.id == null) {
this.id = id;
} else if (!this.id.equals(id)) {
throw new IllegalStateException("The ID cannot be changed after it has been set.");
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/test/java/jenkins/scm/impl/mock/MockSCMSource.java
Expand Up @@ -77,7 +77,6 @@ public class MockSCMSource extends SCMSource {

@DataBoundConstructor
public MockSCMSource(String controllerId, String repository, List<SCMSourceTrait> traits) {
super();
this.controllerId = controllerId;
this.repository = repository;
this.traits = new ArrayList<SCMSourceTrait>(traits);
Expand All @@ -88,7 +87,6 @@ public MockSCMSource(String controllerId, String repository, SCMSourceTrait... t
}

public MockSCMSource(MockSCMController controller, String repository, List<SCMSourceTrait> traits) {
super();
this.controllerId = controller.getId();
this.controller = controller;
this.repository = repository;
Expand Down
Expand Up @@ -62,9 +62,7 @@ public MockSCMSource build() {
MockSCMSource source = controller == null
? new MockSCMSource(controllerId, repository, traits())
: new MockSCMSource(controller, repository, traits());
if (id != null) {
source.setId(id());
}
source.setId(id());
return source;
}
}

0 comments on commit db4c727

Please sign in to comment.