@Override protected void onDisconnect() { while (!isConnected()) { try { reconnect(); joinChannel("#jenkins"); } catch (Exception e) { e.printStackTrace(); try { Thread.sleep(3000); } catch (InterruptedException _) { return; // abort } } } }
/** * Creates an issue tracker component. */ private void setDefaultAssignee(String channel, String sender, String subcomponent, String owner) { if (!isSenderAuthorized(channel,sender)) { insufficientPermissionError(channel); return; } sendMessage(channel,String.format("Changing default assignee of subcomponent %s to %s",subcomponent,owner)); try { JiraScraper js = new JiraScraper(); js.setDefaultAssignee("JENKINS", subcomponent, AssigneeType.COMPONENT_LEAD, owner); sendMessage(channel,"Default assignee set to " + owner); } catch (Exception e) { sendMessage(channel,"Failed to set default assignee: "+e.getMessage()); e.printStackTrace(); } }
/** * Creates an issue tracker component. */ private void createComponent(String channel, String sender, String subcomponent, String owner) { if (!isSenderAuthorized(channel,sender)) { insufficientPermissionError(channel); return; } sendMessage(channel,String.format("Adding a new subcomponent %s to the bug tracker, owned by %s",subcomponent,owner)); try { JiraScraper js = new JiraScraper(); js.createComponent("JENKINS", subcomponent, owner, AssigneeType.COMPONENT_LEAD); sendMessage(channel,"New component created"); } catch (Exception e) { sendMessage(channel,"Failed to create a new component: "+e.getMessage()); e.printStackTrace(); } }
private void replyBugStatus(String channel, String number) { Long time = (Long)recentIssues.get(number); recentIssues.put(number,System.currentTimeMillis()); if (time!=null) { if (System.currentTimeMillis()-time < 60*1000) { return; // already mentioned recently. don't repeat } } try { sendMessage(channel, getSummary(number)); } catch (Exception e) { e.printStackTrace(); } }