add CancellationException to OCM#getPlatformOperationCanceledException

Signed-off-by: mmews <marcus.mews@numberfour.eu>
This commit is contained in:
mmews 2019-12-10 22:51:31 +01:00
parent cefc79857a
commit 3102556c4e
3 changed files with 7 additions and 4 deletions

View file

@ -17,7 +17,6 @@ import org.apache.log4j.Logger
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
import org.eclipse.xtext.service.OperationCanceledManager
import org.eclipse.xtext.util.CancelIndicator
import java.util.concurrent.CancellationException
/**
*
@ -61,7 +60,7 @@ class RequestManager {
queue.submit(request)
val future = request.get;
future.whenComplete[v, thr|
if (thr !== null && !isCancelException(thr) && !(thr instanceof CancellationException)) {
if (thr !== null && !isCancelException(thr)) {
LOG.error("Error during request: ", thr);
}
]

View file

@ -10,7 +10,6 @@ package org.eclipse.xtext.ide.server.concurrent;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.inject.Inject;
import java.util.ArrayList;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutorService;
@ -69,7 +68,7 @@ public class RequestManager {
this.queue.submit(request);
final CompletableFuture<V> future = request.get();
final BiConsumer<V, Throwable> _function = (V v, Throwable thr) -> {
if ((((thr != null) && (!this.isCancelException(thr))) && (!(thr instanceof CancellationException)))) {
if (((thr != null) && (!this.isCancelException(thr)))) {
RequestManager.LOG.error("Error during request: ", thr);
}
};

View file

@ -7,6 +7,8 @@
*/
package org.eclipse.xtext.service;
import java.util.concurrent.CancellationException;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.xtext.util.CancelIndicator;
@ -19,6 +21,9 @@ import org.eclipse.xtext.util.CancelIndicator;
*/
public class OperationCanceledManager {
protected RuntimeException getPlatformOperationCanceledException(Throwable t) {
if (t instanceof CancellationException) {
return (RuntimeException) t;
}
if (t instanceof OperationCanceledException) {
return (RuntimeException) t;
}