List of usage examples for com.intellij.openapi.diagnostic SubmittedReportInfo SubmittedReportInfo
public SubmittedReportInfo(@Nullable String url, @Nullable String linkText, @NotNull SubmissionStatus status)
From source file:bazaar4idea.util.BzrErrorReportSubmitter.java
License:Apache License
/** * @noinspection ThrowablePrintStackTrace,ThrowableResultOfMethodCallIgnored */// ww w . ja va2 s. c o m private static SubmittedReportInfo sendError(IdeaLoggingEvent event, Component parentComponent) { NotifierBean notifierBean = new NotifierBean(); ErrorBean errorBean = new ErrorBean(); errorBean.autoInit(); // errorBean.setLastAction(IdeaLogger.ourLastActionId); int threadId = 0; SubmittedReportInfo.SubmissionStatus submissionStatus = SubmittedReportInfo.SubmissionStatus.FAILED; final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); Project project = PlatformDataKeys.PROJECT.getData(dataContext); String description = ""; do { // prepare try { ErrorReportSender sender = ErrorReportSender.getInstance(); // sender.prepareError(project, event.getThrowable()); // BzrSendErrorForm dlg = new BzrSendErrorForm(); dlg.setErrorDescription(description); dlg.show(); BzrErrorReportConfigurable reportConf = BzrErrorReportConfigurable.getInstance(); @NonNls String senderEmail = reportConf.EMAIL_ADDRESS; @NonNls String smtpServer = reportConf.SMTP_SERVER; @NonNls String itnLogin = reportConf.AUTH_USERNAME; @NonNls String itnPassword = reportConf.getPlainItnPassword(); notifierBean.setEmailAddress(senderEmail); notifierBean.setSmtpServer(smtpServer); notifierBean.setItnLogin(itnLogin); notifierBean.setItnPassword(itnPassword); // description = dlg.getErrorDescription(); String message = event.getMessage(); // @NonNls StringBuilder descBuilder = new StringBuilder(); if (description.length() > 0) { descBuilder.append("User description: ").append(description).append("\n"); } if (message != null) { descBuilder.append("Error message: ").append(message).append("\n"); } Throwable t = event.getThrowable(); if (t != null) { // final PluginId pluginId = IdeErrorsDialog.findPluginId(t); // if (pluginId != null) { // final IdeaPluginDescriptor ideaPluginDescriptor = ApplicationManager.getApplication().getPlugin(pluginId); // if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { // descBuilder.append("Plugin version: ").append(ideaPluginDescriptor.getVersion()).append("\n"); // } // } } if (previousExceptionThreadId != 0) { descBuilder.append("Previous exception is: ").append(URL_HEADER) .append(previousExceptionThreadId).append("\n"); } if (wasException) { descBuilder.append("There was at least one exception before this one.\n"); } errorBean.setDescription(descBuilder.toString()); if (dlg.isShouldSend()) { threadId = sender.sendError(notifierBean, errorBean); previousExceptionThreadId = threadId; wasException = true; submissionStatus = SubmittedReportInfo.SubmissionStatus.NEW_ISSUE; Messages.showInfoMessage(parentComponent, BzrBundle.message("error.report.confirmation"), ERROR_REPORT); break; } else { break; } // } catch (NoSuchEAPUserException e) { // if (Messages.showYesNoDialog(parentComponent, DiagnosticBundle.message("error.report.authentication.failed"), // ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { // break; // } // } catch (InternalEAPException e) { // if (Messages.showYesNoDialog(parentComponent, DiagnosticBundle.message("error.report.posting.failed", e.getMessage()), // ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { // break; // } // } catch (IOException e) { // if (!IOExceptionDialog.showErrorDialog(BzrVcsMessages.message("error.report.exception.title"), // BzrVcsMessages.message("error.report.failure.message"))) { // break; // } // } catch (NewBuildException e) { // Messages.showMessageDialog(parentComponent, // DiagnosticBundle.message("error.report.new.eap.build.message", e.getMessage()), CommonBundle.getWarningTitle(), // Messages.getWarningIcon()); // break; } catch (Exception e) { LOG.info(e); if (Messages.showYesNoDialog(JOptionPane.getRootFrame(), BzrBundle.message("error.report.sending.failure"), ERROR_REPORT, Messages.getErrorIcon()) != 0) { break; } } } while (true); return new SubmittedReportInfo( submissionStatus != SubmittedReportInfo.SubmissionStatus.FAILED ? URL_HEADER + threadId : null, String.valueOf(threadId), submissionStatus); }
From source file:com.android.tools.idea.diagnostics.error.ErrorReporter.java
License:Apache License
@Override public SubmittedReportInfo submit(IdeaLoggingEvent[] events, Component parentComponent) { // obsolete API return new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED); }
From source file:com.android.tools.idea.diagnostics.error.ErrorReporter.java
License:Apache License
private static boolean doSubmit(final IdeaLoggingEvent event, final Component parentComponent, final Consumer<SubmittedReportInfo> callback, final ErrorBean bean, final String description) { final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); bean.setDescription(description);/* ww w. java 2 s. c om*/ bean.setMessage(event.getMessage()); Throwable t = event.getThrowable(); if (t != null) { final PluginId pluginId = IdeErrorsDialog.findPluginId(t); if (pluginId != null) { final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId); if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { bean.setPluginName(ideaPluginDescriptor.getName()); bean.setPluginVersion(ideaPluginDescriptor.getVersion()); } } } Object data = event.getData(); if (data instanceof LogMessageEx) { bean.setAttachments(((LogMessageEx) data).getAttachments()); } List<Pair<String, String>> kv = IdeaITNProxy.getKeyValuePairs(null, null, bean, IdeaLogger.getOurCompilationTimestamp(), ApplicationManager.getApplication(), (ApplicationInfoEx) ApplicationInfo.getInstance(), ApplicationNamesInfo.getInstance(), UpdateSettings.getInstance()); final Project project = PlatformDataKeys.PROJECT.getData(dataContext); Consumer<String> successCallback = new Consumer<String>() { @Override public void consume(String token) { final SubmittedReportInfo reportInfo = new SubmittedReportInfo(null, "Issue " + token, SubmittedReportInfo.SubmissionStatus.NEW_ISSUE); callback.consume(reportInfo); ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, "Submitted", NotificationType.INFORMATION, null).setImportant(false).notify(project); } }; Consumer<Exception> errorCallback = new Consumer<Exception>() { @Override public void consume(Exception e) { // TODO: check for updates String message = AndroidBundle.message("error.report.at.b.android", e.getMessage()); NotificationListener listener = new NotificationListener.UrlOpeningListener(true); ReportMessages.GROUP .createNotification(ReportMessages.ERROR_REPORT, message, NotificationType.ERROR, listener) .setImportant(false).notify(project); } }; AnonymousFeedbackTask task = new AnonymousFeedbackTask(project, "Submitting error report", true, t, pair2map(kv), bean.getMessage(), bean.getDescription(), ApplicationInfo.getInstance().getFullVersion(), successCallback, errorCallback); if (project == null) { task.run(new EmptyProgressIndicator()); } else { ProgressManager.getInstance().run(task); } return true; }
From source file:com.atlassian.theplugin.idea.BlameAtlassian.java
License:Apache License
public SubmittedReportInfo submit(IdeaLoggingEvent[] ideaLoggingEvents, Component component) { StringBuilder description = new StringBuilder(); for (IdeaLoggingEvent ideaLoggingEvent : ideaLoggingEvents) { description.append(ideaLoggingEvent.getMessage()); description.append("\n"); description.append(ideaLoggingEvent.getThrowableText()); description.append("\n"); }//from w ww .ja va 2s .c om // there is no getBuild().asString() in IDEA 8.0 and older, so we need to use // deprecated getBuildNumber() method here... @SuppressWarnings("deprecation") String buildNumber = ApplicationInfo.getInstance().getBuildNumber(); BrowserUtil.launchBrowser(BugReporting.getBugWithDescriptionUrl(buildNumber, description.toString())); return new SubmittedReportInfo(null, "JIRA ticket", SubmittedReportInfo.SubmissionStatus.NEW_ISSUE); }
From source file:com.google.cloud.tools.intellij.feedback.GoogleFeedbackErrorReporter.java
License:Apache License
private static boolean doSubmit(final IdeaLoggingEvent event, final Component parentComponent, final Consumer<SubmittedReportInfo> callback, final ErrorBean error, final String description) { error.setDescription(description);/*from www.j a va 2 s.c o m*/ error.setMessage(event.getMessage()); configureErrorFromEvent(event, error); ApplicationNamesInfo intelliJAppNameInfo = ApplicationNamesInfo.getInstance(); ApplicationInfoEx intelliJAppExtendedInfo = ApplicationInfoEx.getInstanceEx(); Map<String, String> params = buildKeyValuesMap(error, intelliJAppNameInfo, intelliJAppExtendedInfo, ApplicationManager.getApplication()); DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); final Project project = CommonDataKeys.PROJECT.getData(dataContext); Consumer<String> successCallback = new Consumer<String>() { @Override public void consume(String token) { final SubmittedReportInfo reportInfo = new SubmittedReportInfo(null, "Issue " + token, SubmittedReportInfo.SubmissionStatus.NEW_ISSUE); callback.consume(reportInfo); ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, "Submitted", NotificationType.INFORMATION, null).setImportant(false).notify(project); } }; Consumer<Exception> errorCallback = new Consumer<Exception>() { @Override public void consume(Exception ex) { String message = ErrorReporterBundle.message("error.googlefeedback.error", ex.getMessage()); ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, message, NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER).setImportant(false) .notify(project); } }; GoogleAnonymousFeedbackTask task = new GoogleAnonymousFeedbackTask(project, "Submitting error report", true, event.getThrowable(), params, error.getMessage(), error.getDescription(), ApplicationInfo.getInstance().getFullVersion(), successCallback, errorCallback); if (project == null) { task.run(new EmptyProgressIndicator()); } else { ProgressManager.getInstance().run(task); } return true; }
From source file:com.intellij.diagnostic.ITNReporter.java
License:Apache License
@Override public SubmittedReportInfo submit(IdeaLoggingEvent[] ideaLoggingEvents, Component component) { return new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED); }
From source file:com.intellij.diagnostic.ITNReporter.java
License:Apache License
private SubmittedReportInfo doSubmit(IdeaLoggingEvent[] ideaLoggingEvents, String addInfo, Component component) {//from w ww .ja va2 s .com 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.intellij.diagnostic.ITNReporter2.java
License:Apache License
public SubmittedReportInfo submit(IdeaLoggingEvent[] events, Component parentComponent) { // obsolete API return new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED); }
From source file:com.intellij.diagnostic.ITNReporter2.java
License:Apache License
private static boolean doSubmit(final IdeaLoggingEvent event, final Component parentComponent, final Consumer<SubmittedReportInfo> callback, final ErrorBean errorBean, final String description) { final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final ErrorReportConfigurable errorReportConfigurable = ErrorReportConfigurable.getInstance(); if (!errorReportConfigurable.KEEP_ITN_PASSWORD && !StringUtil.isEmpty(errorReportConfigurable.ITN_LOGIN) && StringUtil.isEmpty(errorReportConfigurable.getPlainItnPassword())) { final JetBrainsAccountDialog dlg = new JetBrainsAccountDialog(parentComponent); dlg.show();//from w ww . java 2 s . c o m if (!dlg.isOK()) { return false; } } errorBean.setDescription(description); errorBean.setMessage(event.getMessage()); if (previousExceptionThreadId != 0) { errorBean.setPreviousException(previousExceptionThreadId); } Throwable t = event.getThrowable(); if (t != null) { final PluginId pluginId = IdeErrorsDialog.findPluginId(t); if (pluginId != null) { final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId); if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { errorBean.setPluginName(ideaPluginDescriptor.getName()); errorBean.setPluginVersion(ideaPluginDescriptor.getVersion()); } } } Object data = event.getData(); if (data instanceof AbstractMessage) { errorBean.setAssigneeId(((AbstractMessage) data).getAssigneeId()); } if (data instanceof LogMessageEx) { errorBean.setAttachments(((LogMessageEx) data).getAttachments()); } @NonNls String login = errorReportConfigurable.ITN_LOGIN; @NonNls String password = errorReportConfigurable.getPlainItnPassword(); if (login.trim().length() == 0 && password.trim().length() == 0) { login = "idea_anonymous"; password = "guest"; } ErrorReportSender.sendError(project, login, password, errorBean, new Consumer<Integer>() { @SuppressWarnings({ "AssignmentToStaticFieldFromInstanceMethod" }) @Override public void consume(Integer threadId) { previousExceptionThreadId = threadId; wasException = true; final SubmittedReportInfo reportInfo = new SubmittedReportInfo(URL_HEADER + threadId, String.valueOf(threadId), SubmittedReportInfo.SubmissionStatus.NEW_ISSUE); callback.consume(reportInfo); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { StringBuilder text = new StringBuilder(); final String url = IdeErrorsDialog.getUrl(reportInfo, true); IdeErrorsDialog.appendSubmissionInformation(reportInfo, text, url); text.append("."); if (reportInfo.getStatus() != SubmittedReportInfo.SubmissionStatus.FAILED) { text.append("<br/>").append(DiagnosticBundle.message("error.report.gratitude")); } NotificationType type = reportInfo .getStatus() == SubmittedReportInfo.SubmissionStatus.FAILED ? NotificationType.ERROR : NotificationType.INFORMATION; NotificationListener listener = url != null ? new NotificationListener.UrlOpeningListener(true) : null; ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, XmlStringUtil.wrapInHtml(text), type, listener).setImportant(false).notify(project); } }); } }, new Consumer<Exception>() { @Override public void consume(final Exception e) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { String msg; if (e instanceof NoSuchEAPUserException) { msg = DiagnosticBundle.message("error.report.authentication.failed"); } else if (e instanceof InternalEAPException) { msg = DiagnosticBundle.message("error.report.posting.failed", e.getMessage()); } else { msg = DiagnosticBundle.message("error.report.sending.failure"); } if (e instanceof UpdateAvailableException) { String message = DiagnosticBundle.message("error.report.new.eap.build.message", e.getMessage()); showMessageDialog(parentComponent, project, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon()); callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED)); } else if (showYesNoDialog(parentComponent, project, msg, ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED)); } else { if (e instanceof NoSuchEAPUserException) { final JetBrainsAccountDialog dialog; if (parentComponent.isShowing()) { dialog = new JetBrainsAccountDialog(parentComponent); } else { dialog = new JetBrainsAccountDialog(project); } dialog.show(); } ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { doSubmit(event, parentComponent, callback, errorBean, description); } }); } } }); } }); return true; }
From source file:com.perl5.errorHandler.YoutrackErrorHandler.java
License:Apache License
private SubmittedReportInfo doSubmit(IdeaLoggingEvent[] ideaLoggingEvents, String addInfo, Component component) {//from ww w . j a va 2 s .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 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; }