From 26900fbe84a96688f2cdfaac218f85b9839aa8af Mon Sep 17 00:00:00 2001 From: "tm.chen" Date: Fri, 31 Dec 2021 18:52:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=86=94=E6=96=AD=E9=99=8D?= =?UTF-8?q?=E7=BA=A7=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- README_EN.md | 4 ++-- pom.xml | 2 +- .../spring/boot/core/RetrofitInvocationHandler.java | 8 +++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 20d4894..da809a7 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ gitee项目地址:[https://gitee.com/lianjiatech/retrofit-spring-boot-starter] com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 ``` @@ -67,7 +67,7 @@ gitee项目地址:[https://gitee.com/lianjiatech/retrofit-spring-boot-starter] com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 com.squareup.okhttp3 diff --git a/README_EN.md b/README_EN.md index 835aef6..1a6e005 100644 --- a/README_EN.md +++ b/README_EN.md @@ -43,7 +43,7 @@ com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 ``` @@ -53,7 +53,7 @@ This project depends on Retrofit-2.9.0, okhttp-3.14.9, and okio-1.17.5 versions. com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 com.squareup.okhttp3 diff --git a/pom.xml b/pom.xml index af248be..986dfa2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.lianjiatech retrofit-spring-boot-starter - 2.2.17 + 2.2.18 retrofit-spring-boot-starter retrofit-spring-boot-starter diff --git a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java index 4f8fac6..7909271 100644 --- a/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java +++ b/src/main/java/com/github/lianjiatech/retrofit/spring/boot/core/RetrofitInvocationHandler.java @@ -35,10 +35,12 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl return method.invoke(source, args); } catch (Throwable e) { Throwable cause = e.getCause(); - Object fallbackObject = getFallbackObject(cause); // 熔断逻辑 - if (cause instanceof RetrofitBlockException && degradeProperty.isEnable() && fallbackObject != null) { - return method.invoke(fallbackObject, args); + if (cause instanceof RetrofitBlockException && degradeProperty.isEnable()) { + Object fallbackObject = getFallbackObject(cause); + if (fallbackObject != null) { + return method.invoke(fallbackObject, args); + } } throw cause; }