Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public static Map<String, String> cacheStreamCallType(Class proxyClass) {
for (Method method : declaredMethods) {
String streamType = mapStreamType(method);
if (StringUtils.isNotBlank(streamType)) {
methodCallType.put(method.getName(), streamType);
if (methodCallType.putIfAbsent(method.getName(), streamType) != null) {
throw new SofaRpcException(RpcErrorType.UNKNOWN, "triple pojo stream do not support method overload!!!");
}
Comment on lines +103 to +105
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use consistent error type and improve error message quality.

The validation logic correctly prevents method overloads, but there are two issues:

  1. Inconsistent error type: This validation uses RpcErrorType.UNKNOWN, while similar call-type validations elsewhere in this file (lines 92, 126, 134) use RpcErrorType.CLIENT_CALL_TYPE. For consistency, this should also use CLIENT_CALL_TYPE.

  2. Error message quality: The message has grammatical issues ("stream do not" → "streaming does not") and excessive exclamation marks. Consider a more professional message like: "Triple POJO streaming does not support method overloads"

Apply this diff to address both issues:

-                if (methodCallType.putIfAbsent(method.getName(), streamType) != null) {
-                    throw new SofaRpcException(RpcErrorType.UNKNOWN, "triple pojo stream do not support method overload!!!");
-                }
+                if (methodCallType.putIfAbsent(method.getName(), streamType) != null) {
+                    throw new SofaRpcException(RpcErrorType.CLIENT_CALL_TYPE, 
+                        "Triple POJO streaming does not support method overloads");
+                }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (methodCallType.putIfAbsent(method.getName(), streamType) != null) {
throw new SofaRpcException(RpcErrorType.UNKNOWN, "triple pojo stream do not support method overload!!!");
}
if (methodCallType.putIfAbsent(method.getName(), streamType) != null) {
throw new SofaRpcException(RpcErrorType.CLIENT_CALL_TYPE,
"Triple POJO streaming does not support method overloads");
}
🤖 Prompt for AI Agents
In
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/utils/SofaProtoUtils.java
around lines 103 to 105, the exception uses RpcErrorType.UNKNOWN and an
unpolished message; change the error type to RpcErrorType.CLIENT_CALL_TYPE to
match other call-type validations and replace the message with a professional
sentence such as "Triple POJO streaming does not support method overloads"
(remove extra punctuation and fix grammar).

}
}
return methodCallType;
Expand Down
Loading