List of usage examples for com.intellij.openapi.diagnostic IdeaLoggingEvent toString
@Override
public String toString()
From source file:com.intellij.diagnostic.ITNReporter.java
License:Apache License
private SubmittedReportInfo doSubmit(IdeaLoggingEvent[] ideaLoggingEvents, String addInfo, Component component) {/*w w w . ja v a 2s. co m*/ final DataContext dataContext = DataManager.getInstance().getDataContext(component); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final IdeaLoggingEvent ideaLoggingEvent = ideaLoggingEvents[0]; final String throwableText = ideaLoggingEvent.getThrowableText(); String description = throwableText.substring(0, Math.min(Math.max(80, throwableText.length()), 80)); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") Integer signature = ideaLoggingEvent.getThrowable().getStackTrace()[0].hashCode(); String existing = findExisting(signature); if (existing != null) { final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + existing, existing, DUPLICATE); popupResultInfo(reportInfo, project); return reportInfo; } @NonNls StringBuilder descBuilder = new StringBuilder(); descBuilder.append("Build: ").append(ApplicationInfo.getInstance().getBuild()).append('\n'); descBuilder.append("OS: ").append(SystemInfo.OS_NAME).append(" ").append(SystemInfo.OS_ARCH).append(" ") .append(SystemInfo.OS_VERSION).append('\n'); descBuilder.append("Java Vendor: ").append(SystemProperties.getJavaVmVendor()).append('\n'); descBuilder.append("Java Version: ").append(SystemInfo.JAVA_VERSION).append('\n'); descBuilder.append("Java Arch: ").append(SystemInfo.ARCH_DATA_MODEL).append('\n'); descBuilder.append("Java Runtime Version: ").append(SystemInfo.JAVA_RUNTIME_VERSION).append('\n'); String affectedVersion = null; Throwable t = ideaLoggingEvent.getThrowable(); final PluginId pluginId = IdeErrorsDialog.findPluginId(t); if (pluginId != null) { final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId); if (ideaPluginDescriptor != null) { descBuilder.append("Plugin ").append(ideaPluginDescriptor.getName()).append(" version: ") .append(ideaPluginDescriptor.getVersion()).append("\n"); affectedVersion = ideaPluginDescriptor.getVersion(); } } if (addInfo == null) { addInfo = "<none>"; } descBuilder.append("Description: ").append(addInfo); for (IdeaLoggingEvent e : ideaLoggingEvents) { descBuilder.append("\n\n").append(e.toString()); } String result = submit(description, descBuilder.toString(), affectedVersion); LOGGER.info("Error submitted, response: " + result); if (result == null) { return new SubmittedReportInfo(SERVER_ISSUE_URL, "", FAILED); } String ResultString = null; try { Pattern regex = Pattern.compile("id=\"([^\"]+)\"", Pattern.DOTALL | Pattern.MULTILINE); Matcher regexMatcher = regex.matcher(result); if (regexMatcher.find()) { ResultString = regexMatcher.group(1); } } catch (PatternSyntaxException ex) { // Syntax error in the regular expression } SubmittedReportInfo.SubmissionStatus status = NEW_ISSUE; if (ResultString == null) { return new SubmittedReportInfo(SERVER_ISSUE_URL, "", FAILED); } final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + ResultString, ResultString, status); /* Now try to set the autosubmit user using a custom command */ /* if (user != null) { runCommand(ResultString, "Autosubmit User " + user); } */ if (signature != 0) { runCommand(ResultString, "Exception Signature " + signature); } popupResultInfo(reportInfo, project); return reportInfo; }
From source file:com.perl5.errorHandler.YoutrackErrorHandler.java
License:Apache License
private SubmittedReportInfo doSubmit(IdeaLoggingEvent[] ideaLoggingEvents, String addInfo, Component component) {// w w w .j av a 2 s .c o m final DataContext dataContext = DataManager.getInstance().getDataContext(component); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final IdeaLoggingEvent ideaLoggingEvent = ideaLoggingEvents[0]; final String throwableText = ideaLoggingEvent.getThrowableText(); String description = throwableText.substring(0, Math.min(Math.max(80, throwableText.length()), 80)); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") Integer signature = ideaLoggingEvent.getThrowable().getStackTrace()[0].hashCode(); String existing = findExisting(signature); if (existing != null) { final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + existing, existing, DUPLICATE); popupResultInfo(reportInfo, project); return reportInfo; } @NonNls StringBuilder descBuilder = new StringBuilder(); descBuilder.append("Build: ").append(ApplicationInfo.getInstance().getBuild()).append('\n'); descBuilder.append("OS: ").append(SystemInfo.OS_NAME).append(" ").append(SystemInfo.OS_ARCH).append(" ") .append(SystemInfo.OS_VERSION).append('\n'); descBuilder.append("Java Vendor: ").append(SystemProperties.getJavaVmVendor()).append('\n'); descBuilder.append("Java Version: ").append(SystemInfo.JAVA_VERSION).append('\n'); descBuilder.append("Java Arch: ").append(SystemInfo.ARCH_DATA_MODEL).append('\n'); descBuilder.append("Java Runtime Version: ").append(SystemInfo.JAVA_RUNTIME_VERSION).append('\n'); String affectedVersion = null; Throwable t = ideaLoggingEvent.getThrowable(); final PluginId pluginId = IdeErrorsDialog.findPluginId(t); if (pluginId != null) { final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId); if (ideaPluginDescriptor != null) { descBuilder.append("Plugin Version: ").append(ideaPluginDescriptor.getVersion()).append("\n"); affectedVersion = ideaPluginDescriptor.getVersion(); } } if (addInfo == null) { addInfo = "<none>"; } descBuilder.append("Description: ").append(addInfo); for (IdeaLoggingEvent e : ideaLoggingEvents) { descBuilder.append("\n\n").append(e.toString()); } String result = submit(description, descBuilder.toString(), affectedVersion); LOGGER.info("Error submitted, response: " + result); if (result == null) { return new SubmittedReportInfo(SERVER_ISSUE_URL, "", FAILED); } String ResultString = null; try { Pattern regex = Pattern.compile("id=\"([^\"]+)\"", Pattern.DOTALL | Pattern.MULTILINE); Matcher regexMatcher = regex.matcher(result); if (regexMatcher.find()) { ResultString = regexMatcher.group(1); } } catch (PatternSyntaxException ex) { // Syntax error in the regular expression } SubmittedReportInfo.SubmissionStatus status = NEW_ISSUE; if (ResultString == null) { return new SubmittedReportInfo(SERVER_ISSUE_URL, "", FAILED); } final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + ResultString, ResultString, status); /* Now try to set the autosubmit user using a custom command */ /* if (user != null) { runCommand(ResultString, "Autosubmit User " + user); } */ if (signature != 0) { runCommand(ResultString, "Exception Signature " + signature); } popupResultInfo(reportInfo, project); return reportInfo; }
From source file:com.sylvanaar.idea.errorreporting.BugzReport.java
License:Apache License
private SubmittedReportInfo submit(IdeaLoggingEvent[] ideaLoggingEvents, String description, String user, Component component) {//from w ww .ja v a2s . c o m this.description = ideaLoggingEvents[0].getThrowableText(); this.email = user; if (user == null) user = "<none>"; if (description == null) description = "<none>"; this.extraInformation = "\n\nDescription: " + description + "\n\n" + "User: " + user; for (IdeaLoggingEvent e : ideaLoggingEvents) this.extraInformation += "\n\n" + e.toString(); String result = submit(); log.info("Error submitted, response: " + result); String resultType = null; String resultText = null; try { Pattern regex = Pattern.compile("<([A-Z][A-Z0-9]*)[^>]*>(.*?)</\\1>", Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); Matcher regexMatcher = regex.matcher(result); if (regexMatcher.find()) { resultType = regexMatcher.group(1); resultText = regexMatcher.group(2); } } catch (PatternSyntaxException ex) { // Syntax error in the regular expression } SubmittedReportInfo.SubmissionStatus status = NEW_ISSUE; if (resultType.equals("Error")) status = FAILED; else { if (resultText.trim().length() > 0) status = DUPLICATE; } return new SubmittedReportInfo(SERVER_URL, resultText, status); }
From source file:com.sylvanaar.idea.errorreporting.YouTrackBugReporter.java
License:Apache License
private boolean submit(IdeaLoggingEvent[] ideaLoggingEvents, String description, String user, Component component, Consumer<SubmittedReportInfo> consumer) { final DataManager dataManager = DataManager.getInstance(); final DataContext dataContext = dataManager != null ? dataManager.getDataContext(component) : null; final Project project; if (dataContext != null) { project = PlatformDataKeys.PROJECT.getData(dataContext); } else {/*w w w . j a v a 2 s . c o m*/ return false; } final IdeaLoggingEvent ideaLoggingEvent = ideaLoggingEvents[0]; final String throwableText = ideaLoggingEvent.getThrowableText(); this.description = throwableText.substring(0, Math.min(Math.max(80, throwableText.length()), 80)); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") Integer signature = ideaLoggingEvent.getThrowable().getStackTrace()[0].hashCode(); String existing = findExisting(signature); if (existing != null) { final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + existing, existing, DUPLICATE); popupResultInfo(reportInfo, project); consumer.consume(reportInfo); return true; } @NonNls StringBuilder descBuilder = new StringBuilder(); String platformBuild = ApplicationInfo.getInstance().getBuild().asString(); descBuilder.append("Platform Version: ").append(platformBuild).append('\n'); Throwable t = ideaLoggingEvent.getThrowable(); if (t != null) { final PluginId pluginId = IdeErrorsDialog.findPluginId(t); if (pluginId != null) { final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId); if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { descBuilder.append("Plugin ").append(ideaPluginDescriptor.getName()).append(" version: ") .append(ideaPluginDescriptor.getVersion()).append("\n"); this.affectedVersion = ideaPluginDescriptor.getVersion(); } } } if (description == null) { description = "<none>"; } descBuilder.append("\n\nDescription: ").append(description); for (IdeaLoggingEvent e : ideaLoggingEvents) { descBuilder.append("\n\n").append(e.toString()); } this.extraInformation = descBuilder.toString(); String result = submit(); log.info("Error submitted, response: " + result); if (result == null) { return false; } String ResultString = null; try { Pattern regex = Pattern.compile("id=\"([^\"]+)\"", Pattern.DOTALL | Pattern.MULTILINE); Matcher regexMatcher = regex.matcher(result); if (regexMatcher.find()) { ResultString = regexMatcher.group(1); } } catch (PatternSyntaxException ex) { // Syntax error in the regular expression } SubmittedReportInfo.SubmissionStatus status = NEW_ISSUE; if (ResultString == null) { return false; } final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + ResultString, ResultString, status); /* Now try to set the autosubmit user using a custom command */ if (user != null) { runCommand(ResultString, "Autosubmit User " + user); } if (signature != 0) { runCommand(ResultString, "Exception Signature " + signature); } popupResultInfo(reportInfo, project); consumer.consume(reportInfo); return true; }
From source file:de.halirutan.mathematica.errorreporting.YouTrackBugReporter.java
License:Open Source License
private SubmittedReportInfo submit(IdeaLoggingEvent[] ideaLoggingEvents, String description, String user, Component component) {/* w ww. j a va 2 s .co m*/ final DataContext dataContext = DataManager.getInstance().getDataContext(component); final Project project = PlatformDataKeys.PROJECT.getData(dataContext); final IdeaLoggingEvent ideaLoggingEvent = ideaLoggingEvents[0]; final String throwableText = ideaLoggingEvent.getThrowableText(); this.myDescription = throwableText.substring(0, Math.min(Math.max(80, throwableText.length()), 80)); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") Integer signature = ideaLoggingEvent.getThrowable().getStackTrace()[0].hashCode(); String existing = findExisting(signature); if (existing != null) { final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + existing, existing, DUPLICATE); popupResultInfo(reportInfo, project); return reportInfo; } @NonNls StringBuilder descBuilder = new StringBuilder(); String platformBuild = ApplicationInfo.getInstance().getBuild().asString(); descBuilder.append("Platform Version: ").append(platformBuild).append('\n'); Throwable t = ideaLoggingEvent.getThrowable(); if (t != null) { final PluginId pluginId = IdeErrorsDialog.findPluginId(t); if (pluginId != null) { final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId); if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { descBuilder.append("Plugin ").append(ideaPluginDescriptor.getName()).append(" version: ") .append(ideaPluginDescriptor.getVersion()).append("\n"); this.myAffectedVersion = ideaPluginDescriptor.getVersion(); } } } if (description == null) { description = "<none>"; } descBuilder.append("\n\nDescription: ").append(description); for (IdeaLoggingEvent e : ideaLoggingEvents) { descBuilder.append("\n\n").append(e.toString()); } this.myExtraInformation = descBuilder.toString(); String result = submit(); log.info("Error submitted, response: " + result); if (result == null) { return new SubmittedReportInfo(SERVER_ISSUE_URL, "", FAILED); } String resultString = null; try { Pattern regex = Pattern.compile("id=\"([^\"]+)\"", Pattern.DOTALL | Pattern.MULTILINE); Matcher regexMatcher = regex.matcher(result); if (regexMatcher.find()) { resultString = regexMatcher.group(1); } } catch (PatternSyntaxException ex) { // Syntax error in the regular expression } SubmissionStatus status = NEW_ISSUE; if (resultString == null) { return new SubmittedReportInfo(SERVER_ISSUE_URL, "", FAILED); } final SubmittedReportInfo reportInfo = new SubmittedReportInfo(SERVER_URL + "issue/" + resultString, resultString, status); /* Now try to set the autosubmit user using a custom command */ if (user != null) { runCommand(resultString, "Autosubmit User " + user); } if (signature != 0) { runCommand(resultString, "Exception Signature " + signature); } popupResultInfo(reportInfo, project); return reportInfo; }