From 05c16f4bfc52a10a4dded2ef447966d1ef6165c0 Mon Sep 17 00:00:00 2001 From: Nikita Iarychenko Date: Fri, 7 Aug 2026 16:41:22 +0400 Subject: [PATCH] OPENIDE add support sentry for openide plugins --- .idea/misc.xml | 2 +- .../intellij/ide/plugins/PluginManagerCore.kt | 25 +++++++++++++------ .../diagnostic/DefaultIdeaErrorLogger.java | 8 +++++- .../com/intellij/diagnostic/DialogAppender.kt | 7 ++++++ .../src/com/intellij/diagnostic/ITNUtils.kt | 6 ++--- .../intellij/diagnostic/IdeErrorsDialog.kt | 5 +++- 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 2b88e7d43ea6..d93383dae6e1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -34,7 +34,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt index 52b278f6fcd4..c37e73132615 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt @@ -72,6 +72,9 @@ object PluginManagerCore { const val ENABLE: String = "enable" const val EDIT: String = "edit" + /** Vendors whose plugins are developed as a part of the OpenIDE product, so their exceptions are processed by OpenIDE. */ + private val VENDORS_OPENIDE = listOf("OpenIDE", "Haulmont", "GitFlic", "Axiom") + @JvmField val CORE_ID: PluginId = PluginId.getId(CORE_PLUGIN_ID) @JvmField val JAVA_PLUGIN_ID: PluginId = PluginId.getId("com.intellij.java") @@ -282,14 +285,22 @@ object PluginManagerCore { isVendorTrusted(plugin.vendor ?: "") || isVendorTrusted(plugin.organization ?: "") - private fun isDevelopedByOpenIde(plugin: PluginDescriptor): Boolean = - isDevelopedByOpenIde(plugin.vendor) || - isDevelopedByOpenIde(plugin.organization) + @ApiStatus.Internal + @JvmStatic + fun isDevelopedByOpenIde(plugin: PluginDescriptor): Boolean = isDevelopedByOpenIde(plugin.vendor, plugin.organization) - private fun isDevelopedByOpenIde(vendorString: String?): Boolean { - return listOf("openide", "haulmont", "gitflic", "axiom") - .any { it.equals(vendorString, ignoreCase = true) } - } + @ApiStatus.Internal + @JvmStatic + fun isDevelopedByOpenIde(vendor: @NlsSafe String?, organization: @NlsSafe String?): Boolean = + isDevelopedByOpenIde(vendor) || + isDevelopedByOpenIde(organization) + + @ApiStatus.Internal + @JvmStatic + fun isDevelopedByOpenIde(vendorString: String?): Boolean = + vendorString != null && vendorString.splitToSequence(',').any { isVendorOpenIde(it.trim()) } + + private fun isVendorOpenIde(vendorItem: String): Boolean = VENDORS_OPENIDE.any { it.equals(vendorItem, ignoreCase = true) } @JvmStatic fun isDevelopedByJetBrains(plugin: PluginDescriptor): Boolean = isDevelopedByJetBrains(pluginId = plugin.pluginId, vendor = plugin.vendor, organization = plugin.organization) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java b/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java index eae74a3d4ac3..ce60863f1845 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java @@ -1,4 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// +// Modified by Nikita Iarychenko at 2026 as part of the OpenIDE project(https://openide.ru). +// Any modifications are available on the same license terms as the original source code. package com.intellij.diagnostic; import com.intellij.diagnostic.VMOptions.MemoryKind; @@ -60,7 +63,10 @@ public final class DefaultIdeaErrorLogger { } } - if (plugin == null || PluginManagerCore.isDevelopedByJetBrains(plugin.getPluginId(), plugin.getVendor(), plugin.getOrganization())) { + // exceptions in the platform and in plugins developed by JetBrains or OpenIDE are processed by the default (OpenIDE) reporter + if (plugin == null || + PluginManagerCore.isDevelopedByJetBrains(plugin.getPluginId(), plugin.getVendor(), plugin.getOrganization()) || + PluginManagerCore.isDevelopedByOpenIde(plugin.getVendor(), plugin.getOrganization())) { for (var reporter : reporters) { var descriptor = reporter.getPluginDescriptor(); if (descriptor == null || PluginManagerCore.CORE_ID.equals(descriptor.getPluginId())) { diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt b/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt index 6a085f052f37..a8c6556fe203 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt @@ -1,4 +1,7 @@ // Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// +// Modified by Nikita Iarychenko at 2026 as part of the OpenIDE project(https://openide.ru). +// Any modifications are available on the same license terms as the original source code. package com.intellij.diagnostic import com.intellij.featureStatistics.fusCollectors.LifecycleUsageTriggerCollector @@ -119,6 +122,10 @@ class DialogAppender : Handler() { } private fun showPluginError(throwable: Throwable, message: String?, plugin: IdeaPluginDescriptor?): Boolean { + // errors in plugins developed by OpenIDE are shown even in release builds, so that a user is able to report them to OpenIDE + if (plugin != null && PluginManagerCore.isDevelopedByOpenIde(plugin)) { + return true + } val submitter = DefaultIdeaErrorLogger.findSubmitter(throwable, plugin) return submitter !is ITNReporter || submitter.showErrorInRelease(IdeaLoggingEvent(message, throwable)) } diff --git a/platform/platform-impl/src/com/intellij/diagnostic/ITNUtils.kt b/platform/platform-impl/src/com/intellij/diagnostic/ITNUtils.kt index 1c65554fe0fa..189e866dc2fc 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/ITNUtils.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/ITNUtils.kt @@ -65,15 +65,15 @@ object ITNUtils { } if (StringUtil.isNotEmpty(error.pluginId)) { - event.setExtra("plugin.id", error.pluginId!!) + event.setTag("plugin.id", error.pluginId!!) } if (StringUtil.isNotEmpty(error.pluginVersion)) { - event.setExtra("plugin.version", error.pluginVersion!!) + event.setTag("plugin.version", error.pluginVersion!!) } if (StringUtil.isNotEmpty(error.pluginName)) { - event.setExtra("plugin.name", error.pluginName!!) + event.setTag("plugin.name", error.pluginName!!) } event.setExtra("Memory", (Runtime.getRuntime().maxMemory() / FileUtilRt.MEGABYTE).toString() + "M") diff --git a/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.kt b/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.kt index 99a85bc1092d..7a13c81b1e3c 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.kt @@ -1,4 +1,7 @@ // Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// +// Modified by Nikita Iarychenko at 2026 as part of the OpenIDE project(https://openide.ru). +// Any modifications are available on the same license terms as the original source code. package com.intellij.diagnostic import com.intellij.CommonBundle @@ -537,7 +540,7 @@ open class IdeErrorsDialog @ApiStatus.Internal @JvmOverloads constructor( val date = DateFormatUtil.formatPrettyDateTime(cluster.messages[count - 1].date) myDetailsLabel.text = DiagnosticBundle.message("error.list.message.info", date, count) val submitter = cluster.submitter - if (submitter == null && pluginInfo != null && !PluginManagerCore.isDevelopedByJetBrains(pluginInfo.pluginId, pluginInfo.vendor, pluginInfo.organization)) { + if (submitter == null && pluginInfo != null && !PluginManagerCore.isDevelopedByJetBrains(pluginInfo.pluginId, pluginInfo.vendor, pluginInfo.organization) && !PluginManagerCore.isDevelopedByOpenIde(pluginInfo.vendor, pluginInfo.organization)) { myForeignPluginWarningLabel.isVisible = true val vendor = pluginInfo.vendor val vendorUrl =