diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-16 10:02:12 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-16 10:02:12 +0100 |
commit | 9774527d9e469c6590beb4cc4042e48a41f51b81 (patch) | |
tree | 8a23a2b2d7a8d423f4a266d4287c6c80c9660815 /server/sonar-server | |
parent | b86cbb539986c2e2e70b09c608008367fae81a89 (diff) | |
download | sonarqube-9774527d9e469c6590beb4cc4042e48a41f51b81.tar.gz sonarqube-9774527d9e469c6590beb4cc4042e48a41f51b81.zip |
Decrease complexity of org.sonar.server.projectlink.ws.SearchAction
Minor change on null conditions when using protobuf builders.
Diffstat (limited to 'server/sonar-server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java index 726b74bf409..2e041d135d4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java @@ -35,6 +35,7 @@ import org.sonarqube.ws.WsProjectLinks.Link; import org.sonarqube.ws.WsProjectLinks.SearchWsResponse; import org.sonarqube.ws.client.projectlinks.SearchWsRequest; +import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; @@ -111,12 +112,8 @@ public class SearchAction implements ProjectLinksWsAction { Link.Builder builder = Link.newBuilder() .setId(String.valueOf(link.getId())) .setUrl(link.getHref()); - if (link.getName() != null) { - builder.setName(link.getName()); - } - if (link.getType() != null) { - builder.setType(link.getType()); - } + setNullable(link.getName(), builder::setName); + setNullable(link.getType(), builder::setType); return builder.build(); } |