当前位置: 首页>>代码示例>>Java>>正文


Java IdeaLoggingEvent.getThrowable方法代码示例

本文整理汇总了Java中com.intellij.openapi.diagnostic.IdeaLoggingEvent.getThrowable方法的典型用法代码示例。如果您正苦于以下问题:Java IdeaLoggingEvent.getThrowable方法的具体用法?Java IdeaLoggingEvent.getThrowable怎么用?Java IdeaLoggingEvent.getThrowable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.diagnostic.IdeaLoggingEvent的用法示例。


在下文中一共展示了IdeaLoggingEvent.getThrowable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: log

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
private void log(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo) {
  IdeaLoggingEvent ideaEvent = events[0];
  if (ideaEvent.getThrowable() == null) {
    return;
  }
  LinkedHashMap<String, Object> customData = new LinkedHashMap<>();
  customData.put(TAG_PLATFORM_VERSION, ApplicationInfo.getInstance().getBuild().asString());
  customData.put(TAG_OS, SystemInfo.OS_NAME);
  customData.put(TAG_OS_VERSION, SystemInfo.OS_VERSION);
  customData.put(TAG_OS_ARCH, SystemInfo.OS_ARCH);
  customData.put(TAG_JAVA_VERSION, SystemInfo.JAVA_VERSION);
  customData.put(TAG_JAVA_RUNTIME_VERSION, SystemInfo.JAVA_RUNTIME_VERSION);
  if (additionalInfo != null) {
    customData.put(EXTRA_ADDITIONAL_INFO, additionalInfo);
  }
  if (events.length > 1) {
    customData.put(EXTRA_MORE_EVENTS,
        Stream.of(events).map(Object::toString).collect(Collectors.joining("\n")));
  }
  rollbar.codeVersion(getPluginVersion()).log(ideaEvent.getThrowable(), customData);
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:22,代码来源:RollbarErrorReportSubmitter.java

示例2: createEvent

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
@NotNull
private EventBuilder createEvent(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo) {
    IdeaLoggingEvent ideaEvent = events[0];
    EventBuilder eventBuilder = new EventBuilder();
    eventBuilder.withMessage(ideaEvent.getMessage());
    eventBuilder.withRelease(getPluginVersion());
    eventBuilder.withTag(TAG_PLATFORM_VERSION, getPlatformVersion());
    eventBuilder.withTag(TAG_OS, SystemInfo.OS_NAME);
    eventBuilder.withTag(TAG_OS_VERSION, SystemInfo.OS_VERSION);
    eventBuilder.withTag(TAG_OS_ARCH, SystemInfo.OS_ARCH);
    eventBuilder.withTag(TAG_JAVA_VERSION, SystemInfo.JAVA_VERSION);
    eventBuilder.withTag(TAG_JAVA_RUNTIME_VERSION, SystemInfo.JAVA_RUNTIME_VERSION);
    if (ideaEvent.getThrowable() != null) {
        eventBuilder.withSentryInterface(new ExceptionInterface(ideaEvent.getThrowable()));
    }
    if (additionalInfo != null) {
        eventBuilder.withExtra(EXTRA_ADDITIONAL_INFO, additionalInfo);
    }
    if (events.length > 1) {
        eventBuilder.withExtra(EXTRA_MORE_EVENTS, getMoreEvents(events));
    }
    eventBuilder.withExtra(EXTRA_OTHER_PLUGINS, getOtherPluginsInfo());
    return eventBuilder;
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:25,代码来源:SentryBugReporter.java

示例3: canHandle

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
public boolean canHandle(IdeaLoggingEvent event) {
  if (ourLoggerBroken) return false;

  try {
    UpdateChecker.checkForUpdate(event);

    boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));

    ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
    boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter)submitter).showErrorInRelease(event);

    //noinspection ThrowableResultOfMethodCallIgnored
    return notificationEnabled ||
           showPluginError ||
           ApplicationManagerEx.getApplicationEx().isInternal() ||
           isOOMError(event.getThrowable()) ||
           event.getThrowable() instanceof MappingFailedException;
  }
  catch (LinkageError e) {
    if (e.getMessage().contains("Could not initialize class com.intellij.diagnostic.IdeErrorsDialog")) {
      //noinspection AssignmentToStaticFieldFromInstanceMethod
      ourLoggerBroken = true;
    }
    throw e;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DefaultIdeaErrorLogger.java

示例4: configureErrorFromEvent

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
private static void configureErrorFromEvent(IdeaLoggingEvent event, ErrorBean error) {
  Throwable throwable = event.getThrowable();
  if (throwable != null) {
    PluginId pluginId = IdeErrorsDialog.findPluginId(throwable);
    if (pluginId != null) {
      IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
      if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
        error.setPluginName(ideaPluginDescriptor.getName());
        error.setPluginVersion(ideaPluginDescriptor.getVersion());
      }
    }
  }

  Object data = event.getData();

  if (data instanceof AbstractMessage) {
    error.setAttachments(((AbstractMessage) data).getIncludedAttachments());
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:20,代码来源:GoogleFeedbackErrorReporter.java

示例5: canHandle

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
public boolean canHandle(IdeaLoggingEvent event) {
  if (ourLoggerBroken) return false;

  try {
    boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));

    ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
    boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter)submitter).showErrorInRelease(event);

    //noinspection ThrowableResultOfMethodCallIgnored
    return notificationEnabled ||
           showPluginError ||
           ApplicationManagerEx.getApplicationEx().isInternal() ||
           isOOMError(event.getThrowable()) ||
           event.getThrowable() instanceof MappingFailedException;
  }
  catch (LinkageError e) {
    if (e.getMessage().contains("Could not initialize class com.intellij.diagnostic.IdeErrorsDialog")) {
      //noinspection AssignmentToStaticFieldFromInstanceMethod
      ourLoggerBroken = true;
    }
    throw e;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:DefaultIdeaErrorLogger.java

示例6: LogMessage

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
public LogMessage(IdeaLoggingEvent aEvent) {
  super();

  myThrowable = aEvent.getThrowable();

  if (StringUtil.isNotEmpty(aEvent.getMessage())) {
    myHeader = aEvent.getMessage();
  }

  if (myThrowable != null && StringUtil.isNotEmpty(myThrowable.getMessage())) {
    if (!myHeader.equals(NO_MESSAGE)) {
      if (!myHeader.endsWith(": ") && !myHeader.endsWith(":")) {
        myHeader += ": ";
      }
      myHeader += myThrowable.getMessage();
    }
    else {
      myHeader = myThrowable.getMessage();
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:LogMessage.java

示例7: checkForUpdate

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
public static void checkForUpdate(IdeaLoggingEvent event) {
  if (!ourHasFailedPlugins && UpdateSettings.getInstance().isCheckNeeded()) {
    final Throwable throwable = event.getThrowable();
    final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(IdeErrorsDialog.findPluginId(throwable));
    if (pluginDescriptor != null && !pluginDescriptor.isBundled()) {
      ourHasFailedPlugins = true;
      updateAndShowResult();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:UpdateChecker.java

示例8: LogMessage

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
public LogMessage(IdeaLoggingEvent aEvent) {
  super();

  myThrowable = aEvent.getThrowable();

  String header = null;

  if (!StringUtil.isEmptyOrSpaces(aEvent.getMessage())) {
    header = aEvent.getMessage();
  }

  if (myThrowable != null) {
    String message = myThrowable.getMessage();
    if (StringUtil.isNotEmpty(message) && (header == null || !header.startsWith(message))) {
      if (header != null) {
        if (header.endsWith(":")) header += " ";
        else if (!header.endsWith(": ")) header += ": ";
        header += message;
      }
      else {
        header = message;
      }
    }
  }

  if (header == null) {
    header = "No message";
  }

  myHeader = header;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:LogMessage.java

示例9: sendError

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
/**
   * @noinspection ThrowablePrintStackTrace
   */
private static boolean sendError(IdeaLoggingEvent event,
                              String additionalInfo,
                              final Component parentComponent,
                              final Consumer<SubmittedReportInfo> callback) {
  ErrorBean errorBean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);

  return doSubmit(event, parentComponent, callback, errorBean, additionalInfo);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ITNReporter.java

示例10: handle

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
@Override
public void handle(IdeaLoggingEvent event) {
  if (ourLoggerBroken) return;

  try {
    Throwable throwable = event.getThrowable();
    final MemoryKind kind = getOOMErrorKind(throwable);
    if (kind != null) {
      ourOomOccurred = true;
      SwingUtilities.invokeAndWait(() -> new OutOfMemoryDialog(kind).show());
    }
    else if (throwable instanceof MappingFailedException) {
      processMappingFailed(event);
    }
    else if (!ourOomOccurred) {
      MessagePool messagePool = MessagePool.getInstance();
      messagePool.addIdeFatalMessage(event);
    }
  }
  catch (Throwable e) {
    String message = e.getMessage();
    //noinspection InstanceofCatchParameter
    if (message != null && message.contains("Could not initialize class com.intellij.diagnostic.MessagePool") || e instanceof NullPointerException && ApplicationManager.getApplication() == null) {
      ourLoggerBroken = true;
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:DefaultIdeaErrorLogger.java

示例11: sendError

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
/**
 * @noinspection ThrowablePrintStackTrace
 */
private static boolean sendError(IdeaLoggingEvent event,
                                 String additionalInfo,
                                 final Component parentComponent,
                                 final Consumer<SubmittedReportInfo> callback) {
  ErrorBean errorBean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);

  return doSubmit(event, parentComponent, callback, errorBean, additionalInfo);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:ITNReporter.java

示例12: doSubmit

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
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);
  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 AbstractMessage) {
    bean.setAttachments(((AbstractMessage)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 = 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 e) {
      // TODO: check for updates
      String message = AndroidBundle.message("error.report.at.b.android", e.getMessage());
      ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT,
                                              message,
                                              NotificationType.ERROR,
                                              NotificationListener.URL_OPENING_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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:74,代码来源:ErrorReporter.java

示例13: doSubmit

import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入方法依赖的package包/类
private static boolean doSubmit(
    final IdeaLoggingEvent event,
    final Component parentComponent,
    final Consumer<SubmittedReportInfo> callback,
    final ErrorBean error,
    final String description) {
  error.setDescription(description);
  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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:77,代码来源:GoogleFeedbackErrorReporter.java


注:本文中的com.intellij.openapi.diagnostic.IdeaLoggingEvent.getThrowable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。