Package com.intellij.openapi.diagnostic

Examples of com.intellij.openapi.diagnostic.SubmittedReportInfo


    @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
    }

    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);



View Full Code Here


        String localPluginVersion = getPluginDescriptor().getVersion();
        String repositoryPluginVersion = DatabaseNavigator.getInstance().getRepositoryPluginVersion();

        if (repositoryPluginVersion != null && repositoryPluginVersion.compareTo(localPluginVersion) > 0) {
            NotificationUtil.sendWarningNotification(project, Constants.DBN_TITLE_PREFIX + "New Plugin Version Available", "A newer version of Database Navigator plugin is available in repository" + ". Error report not sent.");
            return new SubmittedReportInfo(ISSUE_URL, "", FAILED);
        }

        IdeaLoggingEvent firstEvent = events[0];
        String firstEventText = firstEvent.getThrowableText();
        String summary = firstEventText.substring(0, Math.min(Math.max(80, firstEventText.length()), 80));

/*
        Throwable t = firstEvent.getThrowable();
        if (t != null) {
            PluginId pluginId = IdeErrorsDialog.findPluginId(t);
            if (pluginId != null) {
                IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
                if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
                    localPluginVersion = ideaPluginDescriptor.getVersion();
                }
            }
        }
*/
        String platformBuild = ApplicationInfo.getInstance().getBuild().asString();

        @NonNls StringBuilder description = new StringBuilder();
        description.append("Java Version: ").append(System.getProperty("java.version")).append('\n');
        description.append("Operating System: ").append(System.getProperty("os.name")).append('\n');
        description.append("IDE Version: ").append(platformBuild).append('\n');
        description.append("DBN Version: ").append(localPluginVersion).append("\n");

        for (IdeaLoggingEvent event : events) {
            LogMessage logMessage = (LogMessage) event.getData();
            String additionalInfo = logMessage == null ? null : logMessage.getAdditionalInfo();
            if (StringUtil.isNotEmpty(additionalInfo)) {
                description.append("\n\nUser Message:");
                description.append("\n__________________________________________________________________\n");
                description.append(additionalInfo);
                description.append("\n__________________________________________________________________");
            }
            description.append("\n\n").append(event.toString());
        }


        String result = submit(localPluginVersion, summary, description.toString());

        LOGGER.info("Error report submitted, response: " + result);

        if (result == null) {
            NotificationUtil.sendErrorNotification(project, Constants.DBN_TITLE_PREFIX + "Error Reporting", "Failed to send error report");
            return new SubmittedReportInfo(ISSUE_URL, "", FAILED);
        }

        String ticketId = null;
        try {
            Pattern regex = Pattern.compile("id=\"([^\"]+)\"", Pattern.DOTALL | Pattern.MULTILINE);
            Matcher regexMatcher = regex.matcher(result);
            if (regexMatcher.find()) {
                ticketId = regexMatcher.group(1);
            }
        } catch (PatternSyntaxException ex) {
        }

        if (ticketId == null) {
            NotificationUtil.sendErrorNotification(project, Constants.DBN_TITLE_PREFIX + "Error Reporting", "Failed to send error report");
            return new SubmittedReportInfo(ISSUE_URL, "", FAILED);
        }

        String ticketUrl = URL + "issue/" + ticketId;
        NotificationUtil.sendInfoNotification(project, Constants.DBN_TITLE_PREFIX + "Error Reporting",
                "<html>Error report successfully sent. Ticket <a href='" + ticketUrl + "'>" + ticketId + "</a> created.</html>");

        return new SubmittedReportInfo(ticketUrl, ticketId, NEW_ISSUE);
    }
View Full Code Here

    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",
View Full Code Here

    }

    @Override
    public SubmittedReportInfo submit(IdeaLoggingEvent[] events, Component parentComponent) {
        // obsolete API -> see com.intellij.diagnostic.ITNReporter
        return new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED);
    }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.diagnostic.SubmittedReportInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.