apache / apache/incubator-seata

NettyBaseConfig静态初始化SERVER_CHANNEL_CLAZZ 写的不正确

Open Beginner friendly
#3,732 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

case NATIVE:
...................
} else {
raiseUnsupportedTransportError();
SERVER_CHANNEL_CLAZZ = null;
CLIENT_CHANNEL_CLAZZ = null;
}

private static void raiseUnsupportedTransportError() throws RuntimeException {
String errMsg = String.format("Unsupported provider type :[%s] for transport:[%s].", TRANSPORT_SERVER_TYPE,
TRANSPORT_PROTOCOL_TYPE);
LOGGER.error(errMsg);
throw new IllegalArgumentException(errMsg);
}

raiseUnsupportedTransportError方法已经抛出异常,那么 SERVER_CHANNEL_CLAZZ = null;
CLIENT_CHANNEL_CLAZZ = null; 这两句赋值语句没有机会执行。应该改为:
case NATIVE:
...................
} else {
SERVER_CHANNEL_CLAZZ = null;
CLIENT_CHANNEL_CLAZZ = null;
raiseUnsupportedTransportError();
}

Contributor guide

Open the contributing guide

Research direction

Start in NettyBaseConfig and inspect the static initialization branch for the unsupported transport case. Confirm how raiseUnsupportedTransportError behaves, then ensure SERVER_CHANNEL_CLAZZ and CLIENT_CHANNEL_CLAZZ are assigned before that error is raised. Done means the unsupported-provider path preserves the null assignments while still throwing the expected exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.