fix: fix npe when add circuitbreak module without feign.hystrix.enable=true

pull/1292/head
andrew shan 1 year ago
parent e4577ea9ea
commit 3bc8051674

@ -113,10 +113,11 @@ public class PolarisFeignCircuitBreakerInvocationHandler implements InvocationHa
else if ("toString".equals(method.getName())) {
return toString();
}
Supplier<Object> supplier = asSupplier(method, args);
if (circuitBreakerNameResolver != null) {
String circuitName = circuitBreakerNameResolver.resolveCircuitBreakerName(feignClientName, target, method);
CircuitBreaker circuitBreaker = factory.create(circuitName);
Supplier<Object> supplier = asSupplier(method, args);
Function<Throwable, Object> fallbackFunction;
if (this.nullableFallbackFactory != null) {
fallbackFunction = throwable -> {
@ -145,6 +146,10 @@ public class PolarisFeignCircuitBreakerInvocationHandler implements InvocationHa
throw e.getCause();
}
}
else {
return supplier.get();
}
}
private void unwrapAndRethrow(Exception exception) {
if (exception instanceof InvocationTargetException || exception instanceof NoFallbackAvailableException) {

Loading…
Cancel
Save