内容简介:接入其它系统RPC接口:调用成功,到 return rpcResult.getResult();这行报错:断点执行,发现返的rpcResult中的类型是Integer类型,Byte被自动转化为了Integer
RPC接口
接入其它系统RPC接口:
RpcResult<Byte> findRecipeTypeById(Long id);
调用
@Override
public Byte getRecipeTypeById(Long recipeId) {
RpcResult<Byte> rpcResult = null;
try {
rpcResult = recipeCommonFacadeService.findRecipeTypeById(recipeId);
} catch (Exception e) {
return null;
}
if (null == rpcResult || rpcResult.isSuccess() == false) {
return null;
}
return rpcResult.getResult();
}
报错
调用成功,到 return rpcResult.getResult();这行报错:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Byte
排查
断点执行,发现返的rpcResult中的类型是Integer类型,Byte被自动转化为了Integer
以上所述就是小编给大家介绍的《RPC返回Byte类型的坑》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。