Skip to content

Commit

Permalink
bugfix: fix the possible NPE (#3597)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Mar 26, 2021
1 parent 3c21b93 commit 2dac3a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions changes/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#3555](https://github.com/seata/seata/pull/3555)] 通过setBytes代替setBlob,避免高版本jdbc驱动工作异常
- [[#3540](https://github.com/seata/seata/pull/3540)] 修复server发布打包时缺失文件
- [[#3573](https://github.com/seata/seata/pull/3573)] 修复 README.md 文件中设计器路径错误
- [[#3597](https://github.com/seata/seata/pull/3597)] 修复可能导致NPE的问题

### optimize:

Expand Down
1 change: 1 addition & 0 deletions changes/en-us/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- [[#3555](https://github.com/seata/seata/pull/3555)] do not call setBlob to invalid the jdbc exception
- [[#3540](https://github.com/seata/seata/pull/3540)] fix server distribution missing files
- [[#3573](https://github.com/seata/seata/pull/3573)] fix designer directory path in README.md
- [[#3597](https://github.com/seata/seata/pull/3597)] fix the possible NPE

### optimize:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,16 @@ private StateMachineInstance createMachineInstance(String stateMachineName, Stri
inst.setBusinessKey(businessKey);

inst.setStartParams(startParams);
if (StringUtils.hasText(businessKey) && startParams != null) {
startParams.put(DomainConstants.VAR_NAME_BUSINESSKEY, businessKey);
}
if (startParams != null) {
if (StringUtils.hasText(businessKey)) {
startParams.put(DomainConstants.VAR_NAME_BUSINESSKEY, businessKey);
}

if (StringUtils.hasText((String)startParams.get(DomainConstants.VAR_NAME_PARENT_ID))) {
inst.setParentId((String)startParams.get(DomainConstants.VAR_NAME_PARENT_ID));
startParams.remove(DomainConstants.VAR_NAME_PARENT_ID);
String parentId = (String)startParams.get(DomainConstants.VAR_NAME_PARENT_ID);
if (StringUtils.hasText(parentId)) {
inst.setParentId(parentId);
startParams.remove(DomainConstants.VAR_NAME_PARENT_ID);
}
}

inst.setStatus(ExecutionStatus.RU);
Expand Down

0 comments on commit 2dac3a5

Please sign in to comment.