diff --git a/jira_automation/src/main/java/io/dockstore/jira/MilestoneResolver.java b/jira_automation/src/main/java/io/dockstore/jira/MilestoneResolver.java index d418c877..aa1a7d26 100644 --- a/jira_automation/src/main/java/io/dockstore/jira/MilestoneResolver.java +++ b/jira_automation/src/main/java/io/dockstore/jira/MilestoneResolver.java @@ -73,7 +73,7 @@ public static void main(String[] args) throws IOException { // There's a JIRA fix version, but no GitHub milestone, set the GitHub milestone updateGitHubMilestone(gitHubIssue.getNumber(), fixVersions[0].name()); } else { - LOG.info("The fix version and milestone mismatch must be resolved manually for: {}}", getJiraIssueUrl(issue.jiraIssueId)); + LOG.info("The fix version and milestone mismatch must be resolved manually for: {}", getJiraIssueUrl(issue.jiraIssueId)); } } catch (URISyntaxException | IOException | InterruptedException e) { LOG.error("Error resolving %s".formatted(issue), e); @@ -146,12 +146,6 @@ private static boolean milestoneAndFixVersionMismatch(final GHIssue ghIssue) { } } - private static String generateJiraIssuesUrl(final List issues) { - return "https://ucsc-cgl.atlassian.net/issues/?jql=project=DOCK AND " - + issues.stream().map(issue -> "key=\"" + issue.jiraIssueId() + "\"") - .collect(Collectors.joining(" or ")); - } - private static String getJiraIssueUrl(String issueNumber) { return "https://ucsc-cgl.atlassian.net/browse/%s".formatted(issueNumber); } diff --git a/jira_automation/src/main/java/io/dockstore/jira/Utils.java b/jira_automation/src/main/java/io/dockstore/jira/Utils.java index 520ac751..e4a7d3db 100644 --- a/jira_automation/src/main/java/io/dockstore/jira/Utils.java +++ b/jira_automation/src/main/java/io/dockstore/jira/Utils.java @@ -11,6 +11,7 @@ import java.net.http.HttpRequest.Builder; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; +import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.List; import java.util.Optional; @@ -67,7 +68,7 @@ public static boolean updateJiraFixVersion(String issueId, String gitHubMileston final URI uri = getJiraIssueRestUri(issueId); final UpdateJiraIssue updateJiraIssue = new UpdateJiraIssue(new UpdateFields( jiraFixVersionFromGitHubMilestone(gitHubMilestone))); - final String json = new Gson().toJson(updateJiraIssue); + final String json = GSON.toJson(updateJiraIssue); final HttpRequest httpRequest = authorizedRequestBuilder() .uri(uri) .PUT(BodyPublishers.ofString(json)) @@ -94,13 +95,12 @@ public static boolean updateGitHubMilestone(int number, String jiraFixVersion) .filter(ghMilestone -> ghMilestoneDesc.equals(ghMilestone.getTitle())) .findFirst(); if (milestone.isEmpty()) { - System.err.println("Could not find GitHub milestone for %s".formatted(jiraFixVersion)); + LOG.error("Could not find GitHub milestone for {}", jiraFixVersion); return false; } issue.setMilestone(milestone.get()); } catch (IOException e) { LOG.error("Error setting milestone on issue %s".formatted(number), e); - System.err.println("Error updating milestone for GitHub issue %s".formatted(number)); return false; } return true; @@ -141,7 +141,8 @@ private static String getAuthHeaderValue() { final String username = System.getenv(JIRA_USERNAME); final String jiraToken = System.getenv(JIRA_TOKEN); return "Basic %s".formatted( - Base64.getEncoder().encodeToString((username + ':' + jiraToken).getBytes())); + Base64.getEncoder().encodeToString((username + ':' + jiraToken).getBytes( + StandardCharsets.UTF_8))); } /** @@ -168,7 +169,7 @@ private static String jiraVersionToGitHubMilestone(String jiraVersion) { } else if (JIRA_OPEN_ENDED_RESEARCH_TASKS.equals(jiraVersion)) { return GITHUB_OPEN_ENDED_RESEARCH_TASKS; } - System.err.println("Unexpected jiraVersion: %s".formatted(jiraVersion)); + LOG.error("Unexpected jiraVersion: {}", jiraVersion); return jiraVersion; }