Advertisement
Guest User

123

a guest
Apr 9th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. private static boolean skipByJIRA(String task) {
  2. ApplicationManager ap = ApplicationManager.getInstance();
  3. URL jiraURL = null;
  4. HttpURLConnection connection = null;
  5. try {
  6. jiraURL = new URL(ap.getProperty("jira.url").concat("/rest/api/2/issue/").concat(task));
  7. if (auth == null) {
  8. String user = ap.getProperty("jira.login");
  9. String pass = ap.getProperty("jira.pass");
  10. if (user == null || user.isEmpty() || pass == null || pass.isEmpty()) return false;
  11. auth = user.concat(":").concat(pass);
  12. auth = "Basic ".concat(Base64.getEncoder().encodeToString(auth.getBytes()));
  13. }
  14.  
  15. connection = (HttpURLConnection) jiraURL.openConnection();
  16. connection.setRequestProperty("Authorization", auth);
  17. connection.setRequestMethod("GET");
  18. connection.setRequestProperty("Content-Type", "application/json");
  19.  
  20. // connection.connect();
  21. } catch (Exception ignored) {
  22. ignored.printStackTrace();
  23. } finally {
  24. if (connection != null) connection.disconnect();
  25. return false;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement