修复:rpc 数据解析错误

This commit is contained in:
绝尘 2024-04-22 00:13:56 +08:00
parent 8a5f1c10e1
commit 4d125f8e46
3 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.tccn</groupId>
<artifactId>zhub-client-redkale</artifactId>
<version>0.1.1-dev</version>
<version>0.1.3.dev</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>

View File

@ -34,7 +34,7 @@ public class RpcResult<R> {
return result;
}
public void setResult(Object result) {
this.result = (R) result;
public void setResult(R result) {
this.result = result;
}
}

View File

@ -679,7 +679,7 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
TypeToken typeToken = rpc.getTypeToken();
if (typeToken.getType() != ((RpcResult<?>) value).getResult().getClass()) {
Object result = convert.convertFrom(typeToken.getType(), toStr(((RpcResult<?>) value).getResult()));
((RpcResult<?>) value).setResult(result);
((RpcResult<Object>) value).setResult(result);
}
rpc.setRpcResult((RpcResult) value);
@ -725,7 +725,8 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
Rpc<T> rpc = null;
try {
if (v instanceof String) {
rpc = convert.convertFrom(IType.STRING.getType(), (String) v);
rpc = convert.convertFrom(new TypeToken<Rpc<String>>() {
}.getType(), (String) v);
} else {
rpc = (Rpc<T>) v;
}