mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
duplicated code removed
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user