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