Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit 5e023fb

Browse files
authored
chore: Cleanup code that is no longer used. (#150)
1 parent fd1136d commit 5e023fb

File tree

3 files changed

+1
-65
lines changed

3 files changed

+1
-65
lines changed

src/main/java/org/jenkinsci/backend/ircbot/IrcBotConfig.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ public class IrcBotConfig {
6060

6161
// Github
6262
static String GITHUB_ORGANIZATION = System.getProperty(varPrefix+"github.organization", "jenkinsci");
63-
static String GITHUB_INFRA_ORGANIZATION = System.getProperty(varPrefix+"github.infraOrganization", "jenkins-infra");
64-
static String GITHUB_UPLOAD_PERMISSIONS_REPO = System.getProperty(varPrefix+".github.uploadPermissionRepo", "repository-permissions-updater");
6563
static String GITHUB_POST_COMMIT_HOOK_EMAIL = System.getProperty(varPrefix+"github.postCommitHookEmail", "[email protected]");
6664

6765
static {

src/main/java/org/jenkinsci/backend/ircbot/IrcListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ private void setDefaultAssignee(Channel channel, User sender, String subcomponen
540540
new ComponentInput(null, null, owner != null ? owner : "", AssigneeType.COMPONENT_LEAD));
541541
JiraHelper.wait(updateComponent);
542542
out.message(owner != null ? "Default assignee set to " + owner : "Default assignee has been removed");
543-
} catch (Exception e) {
543+
} catch (Throwable e) {
544544
out.message("Failed to set default assignee: "+e.getMessage());
545545
e.printStackTrace();
546546
} finally {

src/main/java/org/jenkinsci/backend/ircbot/JiraHelper.java

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@
5151
*/
5252
public class JiraHelper {
5353

54-
public static final String FORK_TO_JIRA_FIELD = "customfield_10321";
55-
public static final String FORK_FROM_JIRA_FIELD = "customfield_10320";
56-
public static final String USER_LIST_JIRA_FIELD = "customfield_10323";
57-
public static final String ISSUE_TRACKER_JIRA_FIELD = "customfield_11320";
58-
public static final String DONE_JIRA_RESOLUTION_NAME = "Done";
59-
6054
/**
6155
* Creates JIRA client using settings from {@link ConnectionInfo} and {@link IrcBotConfig}.
6256
* @return Created client with configured authentication settings.
@@ -85,13 +79,6 @@ static <T> T wait(Promise<T> promise)
8579
return promise.get(IrcBotConfig.JIRA_TIMEOUT_SEC, TimeUnit.SECONDS);
8680
}
8781

88-
@Nonnull
89-
static Issue getIssue(JiraRestClient client, String ticket)
90-
throws ExecutionException, TimeoutException, InterruptedException {
91-
return client.getIssueClient().getIssue(ticket).get(IrcBotConfig.JIRA_TIMEOUT_SEC, TimeUnit.SECONDS);
92-
}
93-
94-
9582
static boolean close(JiraRestClient client) {
9683
try {
9784
if (client != null) {
@@ -140,53 +127,4 @@ static String getSummary(String ticket) throws IOException, ExecutionException,
140127
close(client);
141128
return result;
142129
}
143-
144-
@CheckForNull
145-
static String getFieldValue(@Nonnull Issue issue, @Nonnull String fieldId) {
146-
return getFieldValueOrDefault(issue, fieldId, null);
147-
}
148-
149-
@Nullable
150-
public static String getFieldValueOrDefault(@Nonnull Issue issue, @Nonnull String fieldId, @CheckForNull String defaultValue) {
151-
String res = defaultValue;
152-
for (IssueField val : issue.getFields()) {
153-
String thisFieldId = val.getId();
154-
if (thisFieldId.equalsIgnoreCase(fieldId)) {
155-
Object _value = val.getValue();
156-
if (_value != null) {
157-
if(_value instanceof String) {
158-
res = (String) _value;
159-
break;
160-
} else if (_value instanceof JSONObject) {
161-
JSONObject _jsonValue = (JSONObject)_value;
162-
if(_jsonValue.has("value")) {
163-
try {
164-
res = _jsonValue.getString("value");
165-
break;
166-
} catch(JSONException e) {
167-
// we should log this?
168-
res = defaultValue;
169-
}
170-
}
171-
}
172-
}
173-
}
174-
}
175-
return res;
176-
}
177-
178-
static Iterable<Transition> getTransitions(@Nonnull Issue issue) throws IOException, ExecutionException, TimeoutException, InterruptedException {
179-
JiraRestClient client = createJiraClient();
180-
return client.getIssueClient().getTransitions(issue).get(IrcBotConfig.JIRA_TIMEOUT_SEC, TimeUnit.SECONDS);
181-
}
182-
183-
@CheckForNull
184-
static Transition getTransitionByName(@Nonnull Iterable<Transition> transitions, String name) {
185-
for (Transition transition : transitions) {
186-
if (transition.getName().equalsIgnoreCase(name)) {
187-
return transition;
188-
}
189-
}
190-
return null;
191-
}
192130
}

0 commit comments

Comments
 (0)