/** * Fill method for the Issue Priorities select box * * @param siteName the {@link JIRASite} name to get the priorities from * @return the possible priorities * @throws FormException in case of errors */ public ListBoxModel doFillIssuePriorityItems( @QueryParameter(PARAMETER_PREFIX + "siteName") String siteName) throws FormException { ListBoxModel model = new ListBoxModel(); if (StringUtils.isBlank(siteName)) { return model; } JIRAClient client = null; try { client = JIRASite.getSite(siteName).createClient(); for (Map.Entry<String, String> priority : client.getPriorities().entrySet()) { model.add(priority.getValue(), priority.getKey()); } } catch (RemoteException e) { LOGGER.log(Level.SEVERE, "Failed to get the JIRA Projects", e); throw new FormException( "Failed to get JIRA Project Keys", e, PARAMETER_PREFIX + "projectKey"); } catch (MalformedURLException e) { throw new FormException("Invalid JIRA URL provided", e, PARAMETER_PREFIX + "projectKey"); } catch (ServiceException e) { LOGGER.log(Level.SEVERE, "Failed to get the JIRA Projects", e); throw new FormException( "Failed to get JIRA Project Keys", e, PARAMETER_PREFIX + "projectKey"); } finally { if (client != null) { client.logout(); } } return model; }