From 8454c3e2fc2e724d8108b9594f1a7eaf6182750a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com> Date: Tue, 3 Sep 2024 16:23:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(core):=20TenantContextHolderFilter=20?= =?UTF-8?q?=E6=B8=85=E7=A9=BATTL=20=E9=81=BF=E5=85=8D=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes 5896 --- .../data/tenant/TenantContextHolderFilter.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/tenant/TenantContextHolderFilter.java b/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/tenant/TenantContextHolderFilter.java index 4ac229583..1b69c6fb6 100644 --- a/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/tenant/TenantContextHolderFilter.java +++ b/pigx-common/pigx-common-data/src/main/java/com/pig4cloud/pigx/common/data/tenant/TenantContextHolderFilter.java @@ -75,10 +75,16 @@ public class TenantContextHolderFilter extends GenericFilterBean { TenantContextHolder.setTenantId(CommonConstants.TENANT_ID_1); } - if (!checkTenantStatus(request, response)) return; + if (!checkTenantStatus(request, response)) { + TenantContextHolder.clear(); + return; + } - filterChain.doFilter(request, response); - TenantContextHolder.clear(); + try { + filterChain.doFilter(request, response); + } finally { + TenantContextHolder.clear(); + } } /**