Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: remove unnecessary null checks #7064

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#7075](https://github.com/apache/incubator-seata/pull/7075)] fast fail when channel is null
- [[#7089](https://github.com/apache/incubator-seata/pull/7089)] support instance registration to the registry center
- [[#7093](https://github.com/apache/incubator-seata/pull/7093)] add a test workflow for JDK 21
- [[#7088](https://github.com/apache/incubator-seata/pull/7088)] expand english abbreviations to full words
- [[#7064](https://github.com/apache/incubator-seata/pull/7064)] remove unnecessary null checks

### security:

Expand All @@ -42,6 +44,6 @@ Thanks to these contributors for their code commits. Please report an unintended
- [GoodBoyCoder](https://github.com/GoodBoyCoder)
- [PeppaO](https://github.com/PeppaO)
- [funky-eyes](https://github.com/funky-eyes)

- [MaoMaoandSnail](https://github.com/MaoMaoandSnail)

Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
3 changes: 3 additions & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
- [[#7075](https://github.com/apache/incubator-seata/pull/7075)] 当channel为空时,快速失败,以便于减少不必要的等待
- [[#7089](https://github.com/apache/incubator-seata/pull/7089)] 新增instance注册到注册中心的接口
- [[#7093](https://github.com/apache/incubator-seata/pull/7093)] 增加jdk21的工作流测试
- [[#7088](https://github.com/apache/incubator-seata/pull/7088)] 将日志中英文缩写改为全拼
- [[#7064](https://github.com/apache/incubator-seata/pull/7064)] 移除不必要的空校验

### security:

Expand All @@ -42,5 +44,6 @@
- [GoodBoyCoder](https://github.com/GoodBoyCoder)
- [PeppaO](https://github.com/PeppaO)
- [funky-eyes](https://github.com/funky-eyes)
- [MaoMaoandSnail](https://github.com/MaoMaoandSnail)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,9 @@ private void decideExecutionStatus(ProcessContext context, StateInstance stateIn

stateInstance.setStatus(ExecutionStatus.UN);
ExceptionUtils.NetExceptionType t = ExceptionUtils.getNetExceptionType(exp);
if (t != null) {
if (t.equals(ExceptionUtils.NetExceptionType.CONNECT_EXCEPTION)) {
stateInstance.setStatus(ExecutionStatus.FA);
} else if (t.equals(ExceptionUtils.NetExceptionType.READ_TIMEOUT_EXCEPTION)) {
stateInstance.setStatus(ExecutionStatus.UN);
}
} else {
if (t.equals(ExceptionUtils.NetExceptionType.CONNECT_EXCEPTION)) {
stateInstance.setStatus(ExecutionStatus.FA);
} else if (t.equals(ExceptionUtils.NetExceptionType.READ_TIMEOUT_EXCEPTION)) {
stateInstance.setStatus(ExecutionStatus.UN);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,10 @@ public static void setMachineStatusBasedOnException(StateMachineInstance stateMa
stateMachineInstance.setStatus(ExecutionStatus.UN);
} else {
NetExceptionType t = ExceptionUtils.getNetExceptionType(exp);
if (t != null) {
if (t.equals(NetExceptionType.CONNECT_EXCEPTION) || t.equals(NetExceptionType.CONNECT_TIMEOUT_EXCEPTION)
|| t.equals(NetExceptionType.NOT_NET_EXCEPTION)) {
stateMachineInstance.setStatus(ExecutionStatus.FA);
} else if (t.equals(NetExceptionType.READ_TIMEOUT_EXCEPTION)) {
stateMachineInstance.setStatus(ExecutionStatus.UN);
}
} else {
if (t.equals(NetExceptionType.CONNECT_EXCEPTION) || t.equals(NetExceptionType.CONNECT_TIMEOUT_EXCEPTION)
|| t.equals(NetExceptionType.NOT_NET_EXCEPTION)) {
stateMachineInstance.setStatus(ExecutionStatus.FA);
} else if (t.equals(NetExceptionType.READ_TIMEOUT_EXCEPTION)) {
stateMachineInstance.setStatus(ExecutionStatus.UN);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@ public enum NetExceptionType {
*/
public static boolean isNetException(Throwable throwable) {
NetExceptionType netExceptionType = getNetExceptionType(throwable);
return netExceptionType != null && netExceptionType != NetExceptionType.NOT_NET_EXCEPTION;
return netExceptionType != NetExceptionType.NOT_NET_EXCEPTION;
}
}
Loading