static String getBoundedEncodedString(String description, int maxLen) { String encoded = UrlUtil.encodeUrl(description); while (encoded.length() > maxLen) { int lastNewline = description.lastIndexOf('\n'); if (lastNewline == -1) { return ""; } description = description.substring(0, lastNewline); encoded = UrlUtil.encodeUrl(description); } return encoded; }
public static String getBugUrl(String ideaBuildNumber) { final String rawEnvironment = "Java version=" + System.getProperty("java.version") + ", Java vendor=" + System.getProperty("java.vendor") + ", OS name=" + System.getProperty("os.name") + ", OS architecture=" + System.getProperty("os.arch") + ", IDEA build number=" + (ideaBuildNumber != null ? ideaBuildNumber : "unknown") + ", Plugin version=" + VERSION_NAME; final String environment = UrlUtil.encodeUrl(rawEnvironment); return BASE + "?pid=" + PROJECT_ID + "&versions=" + versionCodeForJira + "&issuetype=" + TICKET_TYPE_BUG + "&environment=" + environment; }