From 89f0da2f59dc80aec57af7aa0097846b3ed1a449 Mon Sep 17 00:00:00 2001 From: Alexander Kirillin Date: Thu, 14 Feb 2013 19:16:02 +0400 Subject: [PATCH] Disabled "Cycle in components initialization" false positive when the component throws an exception during initialization --- .../components/impl/ComponentManagerImpl.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java b/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java index eb2fcb13151b..842abaf9f67b 100644 --- a/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java @@ -578,17 +578,23 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements LOG.error(new Throwable("Cyclic component initialization: " + componentKey)); } } - myInitializing = true; - myComponentsRegistry.registerComponentInstance(componentInstance); - initComponent(componentInstance); - long endTime = System.nanoTime(); - long ms = (endTime - startTime) / 1000000; - if (ms > 10) { - if (logSlowComponents()) { - LOG.info(componentInstance.getClass().getName() + " initialized in " + ms + " ms"); + + try { + myInitializing = true; + myComponentsRegistry.registerComponentInstance(componentInstance); + initComponent(componentInstance); + long endTime = System.nanoTime(); + long ms = (endTime - startTime) / 1000000; + if (ms > 10) { + if (logSlowComponents()) { + LOG.info(componentInstance.getClass().getName() + " initialized in " + ms + " ms"); + } } } - myInitializing = false; + finally { + myInitializing = false; + } + myInitialized = true; } }