From fd729360c7f6f428d959408e556b16c8ce2c9ca6 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+Rsl1122@users.noreply.github.com> Date: Wed, 20 Jan 2021 17:22:56 +0200 Subject: [PATCH] Ignored all UnsupportedOperationExceptions from Extensions Affects issues: - Fixed #1667 --- .../extension/implementation/providers/MethodWrapper.java | 3 ++- .../plan/extension/implementation/ExtensionRegister.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/providers/MethodWrapper.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/providers/MethodWrapper.java index 070bae8ce..052574e52 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/providers/MethodWrapper.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/providers/MethodWrapper.java @@ -47,7 +47,8 @@ public class MethodWrapper { try { return returnType.cast(with.usingOn(extension, method)); } catch (InvocationTargetException notReadyToBeCalled) { - if (notReadyToBeCalled.getCause() instanceof NotReadyException) { + if (notReadyToBeCalled.getCause() instanceof NotReadyException + || notReadyToBeCalled.getCause() instanceof UnsupportedOperationException) { return null; // Data or API not available to make the call. } else { throw new IllegalArgumentException(method.getDeclaringClass() + " method " + method.getName() + " could not be called: " + notReadyToBeCalled.getMessage(), notReadyToBeCalled); diff --git a/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java b/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java index 6c7f1cd48..27fbb198e 100644 --- a/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java +++ b/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java @@ -140,7 +140,7 @@ public class ExtensionRegister { try { // Creates the extension with factory and registers it createExtension.apply(factory).ifPresent(this::register); - } catch (NotReadyException ignore) { + } catch (NotReadyException | UnsupportedOperationException ignore) { // This exception signals that the extension can not be registered right now (Intended fail). } catch (Exception | NoClassDefFoundError | IncompatibleClassChangeError e) { // Places all exceptions to one exception with plugin information so that they can be reported. @@ -155,7 +155,7 @@ public class ExtensionRegister { try { // Creates the extension with factory and registers it createExtension.apply(factory).forEach(this::register); - } catch (NotReadyException ignore) { + } catch (NotReadyException | UnsupportedOperationException ignore) { // This exception signals that the extension can not be registered right now (Intended fail). } catch (Exception | NoClassDefFoundError | IncompatibleClassChangeError e) { // Places all exceptions to one exception with plugin information so that they can be reported. @@ -173,7 +173,7 @@ public class ExtensionRegister { createExtension.apply(factory) .flatMap(this::register) .ifPresent(caller -> registerListener.accept(factory, caller)); - } catch (NotReadyException ignore) { + } catch (NotReadyException | UnsupportedOperationException ignore) { // This exception signals that the extension can not be registered right now (Intended fail). } catch (Exception | NoClassDefFoundError | IncompatibleClassChangeError e) { // Places all exceptions to one exception with plugin information so that they can be reported.