diff --git a/platform/util/src/com/intellij/util/ExceptionUtil.java b/platform/util/src/com/intellij/util/ExceptionUtil.java index ff0ab77eb30b..0c6d3a06b12a 100644 --- a/platform/util/src/com/intellij/util/ExceptionUtil.java +++ b/platform/util/src/com/intellij/util/ExceptionUtil.java @@ -154,9 +154,15 @@ public class ExceptionUtil { public static void rethrowAll(@Nullable Throwable t) throws Exception { if (t != null) { - if (t instanceof Error) throw (Error)t; - if (t instanceof RuntimeException) throw (RuntimeException)t; + rethrowUnchecked(t); throw (Exception)t; } } + + public static void rethrowAllAsUnchecked(@Nullable Throwable t) { + if (t != null) { + rethrowUnchecked(t); + throw new RuntimeException(t); + } + } } diff --git a/platform/vcs-api/vcs-api-core/src/com/intellij/lifecycle/PeriodicalTasksCloser.java b/platform/vcs-api/vcs-api-core/src/com/intellij/lifecycle/PeriodicalTasksCloser.java index 3b6a7ff2a5c6..34478d3403a6 100644 --- a/platform/vcs-api/vcs-api-core/src/com/intellij/lifecycle/PeriodicalTasksCloser.java +++ b/platform/vcs-api/vcs-api-core/src/com/intellij/lifecycle/PeriodicalTasksCloser.java @@ -21,7 +21,7 @@ import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; -import com.intellij.vcsUtil.Rethrow; +import com.intellij.util.ExceptionUtil; import org.jetbrains.annotations.NotNull; public class PeriodicalTasksCloser implements ApplicationComponent { @@ -85,7 +85,7 @@ public class PeriodicalTasksCloser implements ApplicationComponent { synchronized (myLock) { // allow NPE & assertion _catch_ only if project is closed and being disposed if (project.isOpen()) { - Rethrow.reThrowRuntime(t); + ExceptionUtil.rethrowAllAsUnchecked(t); } } throw new ProcessCanceledException(); diff --git a/platform/vcs-api/vcs-api-core/src/com/intellij/vcsUtil/Rethrow.java b/platform/vcs-api/vcs-api-core/src/com/intellij/vcsUtil/Rethrow.java index 6c42caaa3126..c8cf8e74f1ab 100644 --- a/platform/vcs-api/vcs-api-core/src/com/intellij/vcsUtil/Rethrow.java +++ b/platform/vcs-api/vcs-api-core/src/com/intellij/vcsUtil/Rethrow.java @@ -15,20 +15,21 @@ */ package com.intellij.vcsUtil; +import com.intellij.util.ExceptionUtil; + /** * @author irengrig + * + * @deprecated use {@link ExceptionUtil} instead */ public class Rethrow { private Rethrow() { } + /** + * @deprecated use {@link ExceptionUtil#rethrowAllAsUnchecked(Throwable)} instead + */ public static void reThrowRuntime(final Throwable t) { - if (t instanceof Error) { - throw (Error) t; - } - if (t instanceof RuntimeException) { - throw (RuntimeException) t; - } - throw new RuntimeException(t); + ExceptionUtil.rethrowAllAsUnchecked(t); } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index ae17cdee4c35..c2ba63815a0f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -55,7 +55,6 @@ import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.continuation.ContinuationPause; import com.intellij.util.messages.Topic; -import com.intellij.vcsUtil.Rethrow; import com.intellij.vcsUtil.VcsUtil; import org.jdom.Element; import org.jetbrains.annotations.CalledInAwt; @@ -761,7 +760,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec } catch (Throwable t) { LOG.debug(t); - Rethrow.reThrowRuntime(t); + ExceptionUtil.rethrowAllAsUnchecked(t); } finally { if (!myUpdater.isStopped()) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/CodeSmellDetectorImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/CodeSmellDetectorImpl.java index b97ee78e92ff..89f45cc3f3cf 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/CodeSmellDetectorImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/CodeSmellDetectorImpl.java @@ -43,8 +43,8 @@ import com.intellij.openapi.wm.ex.ProgressIndicatorEx; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; +import com.intellij.util.ExceptionUtil; import com.intellij.util.ui.MessageCategory; -import com.intellij.vcsUtil.Rethrow; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -139,8 +139,7 @@ public class CodeSmellDetectorImpl extends CodeSmellDetector { } }); if (!exception.isNull()) { - Exception t = exception.get(); - Rethrow.reThrowRuntime(t); + ExceptionUtil.rethrowAllAsUnchecked(exception.get()); } return result;