Fix generic array being changed (#13103)

This commit is contained in:
Albumen Kevin 2023-09-25 09:40:18 +08:00 committed by GitHub
parent 0fb1e4c4c6
commit da5c7ed33d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -158,9 +158,10 @@ public class DecodeableRpcInvocation extends RpcInvocation implements Codec, Dec
pts = drawPts(path, version, desc, pts);
if (pts == DubboCodec.EMPTY_CLASS_ARRAY) {
if (RpcUtils.isGenericCall(desc, getMethodName())) {
pts = DubboCodec.GENERIC_PTS_ARRAY;
// Should recreate here for each invocation because the parameterTypes may be changed by user.
pts = new Class<?>[]{String.class, String[].class, Object[].class};
} else if (RpcUtils.isEcho(desc, getMethodName())) {
pts = DubboCodec.ECHO_PTS_ARRAY;
pts = new Class<?>[]{Object.class};
} else {
throw new IllegalArgumentException("Service not found:" + path + ", " + getMethodName());
}

View File

@ -69,8 +69,6 @@ public class DubboCodec extends ExchangeCodec {
public static final byte RESPONSE_NULL_VALUE_WITH_ATTACHMENTS = 5;
public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
public static final Class<?>[] GENERIC_PTS_ARRAY = new Class<?>[]{String.class, String[].class, Object[].class};
public static final Class<?>[] ECHO_PTS_ARRAY = new Class<?>[]{Object.class};
private static final ErrorTypeAwareLogger log = LoggerFactory.getErrorTypeAwareLogger(DubboCodec.class);
private static final AtomicBoolean decodeInUserThreadLogged = new AtomicBoolean(false);