mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
reuse CompoundRuntimeException#throwIfNotEmpty
GitOrigin-RevId: a46fb3076e649f93c3bd793a2a2353f7dc78f5e2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3427858d90
commit
9185e79e7b
@@ -9,7 +9,6 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.lang.CompoundRuntimeException;
|
||||
@@ -431,23 +430,7 @@ public class MessageBusImpl implements MessageBus {
|
||||
}
|
||||
}
|
||||
|
||||
if (exceptions != null) {
|
||||
throwExceptions(exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static void throwExceptions(@NotNull List<Throwable> exceptions) {
|
||||
if (exceptions.size() == 1) {
|
||||
ExceptionUtil.rethrow(exceptions.get(0));
|
||||
}
|
||||
else {
|
||||
for (Throwable exception : exceptions) {
|
||||
if (exception instanceof ProcessCanceledException) {
|
||||
throw (ProcessCanceledException)exception;
|
||||
}
|
||||
}
|
||||
throw new CompoundRuntimeException(exceptions);
|
||||
}
|
||||
CompoundRuntimeException.throwIfNotEmpty(exceptions);
|
||||
}
|
||||
|
||||
private @Nullable List<Throwable> deliverMessage(@NotNull Message job,
|
||||
@@ -611,9 +594,7 @@ public class MessageBusImpl implements MessageBus {
|
||||
exceptions = deliverMessage(job, jobQueue, myMessageDeliveryListener, exceptions);
|
||||
}
|
||||
|
||||
if (exceptions != null) {
|
||||
throwExceptions(exceptions);
|
||||
}
|
||||
CompoundRuntimeException.throwIfNotEmpty(exceptions);
|
||||
}
|
||||
|
||||
public final void setMessageDeliveryListener(@Nullable MessageDeliveryListener listener) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util.lang;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.EmptyConsumer;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
@@ -106,6 +107,11 @@ public final class CompoundRuntimeException extends RuntimeException {
|
||||
ExceptionUtil.rethrow(throwables.get(0));
|
||||
}
|
||||
else {
|
||||
for (Throwable th : throwables) {
|
||||
if (th instanceof ProcessCanceledException) {
|
||||
throw (ProcessCanceledException)th;
|
||||
}
|
||||
}
|
||||
throw new CompoundRuntimeException(throwables);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user