This is an automated email from the ASF dual-hosted git repository.

jianbin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new e62a9b9a1c bugfix:Fix NPE when getting branchType in a non-global 
transaction context (#6816)
e62a9b9a1c is described below

commit e62a9b9a1cfb5725716fa8329fdfa08983256d12
Author: xingfudeshi <xingfude...@gmail.com>
AuthorDate: Thu Sep 5 13:36:03 2024 +0800

    bugfix:Fix NPE when getting branchType in a non-global transaction context 
(#6816)
---
 changes/en-us/2.x.md                                            | 3 ++-
 changes/zh-cn/2.x.md                                            | 7 +++----
 compatible/src/main/java/io/seata/core/context/RootContext.java | 7 ++++++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 4352948949..e679f0e997 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -14,6 +14,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#6624](https://github.com/apache/incubator-seata/pull/6624)] fix Alibaba 
Dubbo convert error
 - [[#6627](https://github.com/apache/incubator-seata/pull/6627)] fix the issue 
of xaEnded not being reset
 - [[#6626](https://github.com/apache/incubator-seata/pull/6626)] fix hsf 
ConsumerModel convert error
+- [[#6816](https://github.com/apache/incubator-seata/pull/6816)] Fix NPE when 
getting branchType in a non-global transaction context
 - [[#6642](https://github.com/apache/incubator-seata/pull/6642)] codecov token 
not found
 - [[#6661](https://github.com/apache/incubator-seata/pull/6661)] fix 
`tableMeta` cache scheduled refresh issue
 - [[#6486](https://github.com/apache/incubator-seata/pull/6486)] fix mysql 
undo log update sql data more than max allowed packet
@@ -126,6 +127,6 @@ Thanks to these contributors for their code commits. Please 
report an unintended
 - [lightClouds917](https://github.com/lightClouds917)
 - [l81893521](https://github.com/l81893521)
 - [laywin](https://github.com/laywin)
-
+- [xingfudeshi](https://github.com/xingfudeshi)
 
 Also, we receive many valuable issues, questions and advices from our 
community. Thanks for you all.
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 0e6d1c565b..522197f7b3 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -14,6 +14,7 @@
 - [[#6624](https://github.com/apache/incubator-seata/pull/6624)] 修复 Alibaba 
Dubbo 转换错误
 - [[#6627](https://github.com/apache/incubator-seata/pull/6627)] 修复 xaEnded 
没有重置
 - [[#6626](https://github.com/apache/incubator-seata/pull/6626)] 修复 hsf 
ConsumerModel 转换错误
+- [[#6816](https://github.com/apache/incubator-seata/pull/6816)] 
修复在非全局事务上下文中获取branchType时的NPE问题
 - [[#6640](https://github.com/apache/incubator-seata/pull/6640)] 优化codecov相关配置
 - [[#6642](https://github.com/apache/incubator-seata/pull/6642)] 修复codecov 
token找不到导致无法提交单测覆盖度报告
 - [[#6661](https://github.com/apache/incubator-seata/pull/6661)] 
修复`tableMeta`缓存定时刷新失效问题
@@ -32,8 +33,7 @@
 - [[#6781](https://github.com/apache/incubator-seata/pull/6781)] 
修复tc下线时,由于定时任务没有先关闭,导致下线后还会被注册上,需要靠namingserver的健康检查来下线的bug
 - [[#6797](https://github.com/apache/incubator-seata/pull/6797)] 
当查询的集群地址为空时,获取可用的任意集群地址
 - [[#6800](https://github.com/apache/incubator-seata/pull/6800)] 
使异常消息对所有数据库驱动程序通用
-- - [[#6812](https://github.com/apache/incubator-seata/pull/6812)] 
修复切换事务分组和节点下线时namingserver没有实时感知和推送的bug
-
+- [[#6812](https://github.com/apache/incubator-seata/pull/6812)] 
修复切换事务分组和节点下线时namingserver没有实时感知和推送的bug
 - [[#6759](https://github.com/apache/incubator-seata/pull/6759)] 
修复跨库表主动刷新`tableMeta`的异常问题
 
 ### optimize:
@@ -128,8 +128,7 @@
 - [lightClouds917](https://github.com/lightClouds917)
 - [l81893521](https://github.com/l81893521)
 - [laywin](https://github.com/laywin)
-
-
+- [xingfudeshi](https://github.com/xingfudeshi)
 
 同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
 
diff --git a/compatible/src/main/java/io/seata/core/context/RootContext.java 
b/compatible/src/main/java/io/seata/core/context/RootContext.java
index 707af622ef..ca7d37d5dd 100644
--- a/compatible/src/main/java/io/seata/core/context/RootContext.java
+++ b/compatible/src/main/java/io/seata/core/context/RootContext.java
@@ -16,6 +16,7 @@
  */
 package io.seata.core.context;
 
+
 import java.util.Map;
 
 import javax.annotation.Nonnull;
@@ -42,7 +43,11 @@ public class RootContext {
     public static final String KEY_BRANCH_TYPE = "TX_BRANCH_TYPE";
 
     private static BranchType 
convertIoSeata(org.apache.seata.core.model.BranchType branchType) {
-        return BranchType.get(branchType.name());
+        if (branchType == null) {
+            return null;
+        } else {
+            return BranchType.get(branchType.name());
+        }
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to