You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/07/13 18:17:12 UTC
[2/2] incubator-ignite git commit: # ignite-1099: self-review
# ignite-1099: self-review
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/222eedbb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/222eedbb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/222eedbb
Branch: refs/heads/ignite-1099
Commit: 222eedbb3c679cb0e599f0990bdfd9d7e2adfe7e
Parents: 9f69135
Author: ashutak <as...@gridgain.com>
Authored: Mon Jul 13 19:16:58 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Mon Jul 13 19:16:58 2015 +0300
----------------------------------------------------------------------
.../tools/jirabranches/JiraBranchesToHtml.java | 40 ++++++++------------
1 file changed, 15 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/222eedbb/modules/tools/src/main/java/org/apache/ignite/tools/jirabranches/JiraBranchesToHtml.java
----------------------------------------------------------------------
diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/jirabranches/JiraBranchesToHtml.java b/modules/tools/src/main/java/org/apache/ignite/tools/jirabranches/JiraBranchesToHtml.java
index 66526c7..a33a77e 100644
--- a/modules/tools/src/main/java/org/apache/ignite/tools/jirabranches/JiraBranchesToHtml.java
+++ b/modules/tools/src/main/java/org/apache/ignite/tools/jirabranches/JiraBranchesToHtml.java
@@ -40,6 +40,9 @@ public class JiraBranchesToHtml {
public static final String SCRIPT_PATH = U.getIgniteHome() + "/scripts/jira-branches.sh";
/** */
+ private static final String JIRA_URL = "https://issues.apache.org/jira";
+
+ /** */
public static final String INPUT_FILE = U.getIgniteHome() + "/scripts/jira-branches.js";
/** */
@@ -71,6 +74,8 @@ public class JiraBranchesToHtml {
* @throws Exception If failed.
*/
public static void main(String[] args) throws Exception {
+ Credentials cred = askForJiraCredentials(JIRA_URL);
+
System.out.print("Report 'Closed' issues only [y/N]: ");
BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
@@ -79,8 +84,6 @@ public class JiraBranchesToHtml {
List<String> branches = getBranches();
- Credentials cred = askForJiraCredentials("https://issues.apache.org/jira");
-
List<Result> res = new ArrayList<>();
try (JiraRestClient restClient = new AsynchronousJiraRestClientFactory().
@@ -121,7 +124,7 @@ public class JiraBranchesToHtml {
/**
* @param jiraUrl Jira URL.
- * @return Credentials/
+ * @return Credentials.
* @throws Exception If failed.
*/
public static Credentials askForJiraCredentials(String jiraUrl) throws Exception{
@@ -197,7 +200,7 @@ public class JiraBranchesToHtml {
/**
* @param restClient Rest client.
* @param branchName Branch name.
- * @param jiraUrl
+ * @param jiraUrl Jira URL.
* @return Result.
*/
public static Result result(JiraRestClient restClient, String branchName, String jiraUrl) {
@@ -211,29 +214,16 @@ public class JiraBranchesToHtml {
int lastJiraKeyIdx = branchName.indexOf(digits) + digits.length();
- if (lastJiraKeyIdx + 1 == branchName.length()) {
- // For branches like "IGNITE-xxx"
- try {
- Issue issue = restClient.getIssueClient().getIssue(branchName).claim();
-
- return new Result(branchName, issue, null, jiraUrl);
- }
- catch (RestClientException e) {
- return new Result(branchName, null, e.getMessage(), jiraUrl);
- }
- }
- else {
- // For branches like "IGNITE-xxx-<description>".
- try {
- String jiraKey = branchName.substring(0, lastJiraKeyIdx);
+ try {
+ // It will work for both branch patterns: "IGNITE-xxx" and "IGNITE-xxx-<description>".
+ String jiraKey = branchName.substring(0, lastJiraKeyIdx);
- Issue issue = restClient.getIssueClient().getIssue(jiraKey).claim();
+ Issue issue = restClient.getIssueClient().getIssue(jiraKey).claim();
- return new Result(branchName, issue, null, jiraUrl);
- }
- catch (RestClientException e) {
- return new Result(branchName, null, e.getMessage(), jiraUrl);
- }
+ return new Result(branchName, issue, null, jiraUrl);
+ }
+ catch (RestClientException e) {
+ return new Result(branchName, null, e.getMessage(), jiraUrl);
}
}