Using isBlank from Apache Commons
@@ -2,13 +2,12 @@ package org.shipkit.internal.gradle.versionupgrade;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
-import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils;
import org.shipkit.internal.util.GitHubApi;
import org.shipkit.internal.util.IncubatingWarning;
import java.io.IOException;
-import static org.gradle.internal.impldep.org.apache.commons.lang.StringUtils.isBlank;
+import static org.apache.commons.lang.StringUtils.isBlank;
class CreatePullRequest {
@@ -30,11 +29,11 @@ class CreatePullRequest {
IncubatingWarning.warn("creating pull requests");
LOG.lifecycle(" Creating a pull request of title '{}' in repository '{}' between base = '{}' and head = '{}'.",
- getTitle(task), task.getUpstreamRepositoryName(), task.getVersionUpgrade().getBaseBranch(), headBranch);
+ task.getPullRequestTitle() , task.getUpstreamRepositoryName(), task.getVersionUpgrade().getBaseBranch(), headBranch);
String body = "{" +
- " \"title\": \"" + getTitle(task) + "\"," +
- " \"body\": \"" + getMessage(task) + "\"," +
+ " \"title\": \"" + task.getPullRequestTitle() + "\"," +
+ " \"body\": \"" + task.getPullRequestDescription() + "\"," +
" \"head\": \"" + headBranch + "\"," +
" \"base\": \"" + task.getVersionUpgrade().getBaseBranch() + "\"," +
" \"maintainer_can_modify\": true" +
@@ -44,23 +43,15 @@ class CreatePullRequest {
}
private void checkPullRequestMetadata(CreatePullRequestTask task) {
- if (isBlank(getTitle(task))) {
+ if (isBlank(task.getPullRequestTitle())) {
throw new IllegalArgumentException("Cannot create pull request for empty pull request title. Set it with git.pullRequestTitle property in configuration.");
}
- if (isBlank(getMessage(task))) {
+ if (isBlank(task.getPullRequestDescription())) {
throw new IllegalArgumentException("Cannot create pull request for empty pull request description. Set it with git.pullRequestDescription property in configuration.");
}
}
- private String getMessage(CreatePullRequestTask task) {
- return task.getPullRequestDescription();
- }
-
- private String getTitle(CreatePullRequestTask task) {
- return task.getPullRequestTitle();
- }
-
private String getHeadBranch(String forkRepositoryName, String headBranch) {
return getUserOfForkRepo(forkRepositoryName) + ":" + headBranch;
}
