ITeye博客

zhengjie110120的博客

zhengjie110120 · 共 1 篇文章

thrift 0.8 java客户端无法catch异常

问题描述: 当方法返回值为thrift基本类型(i64,bool...)时,客户端无法捕捉异常。 ps.当方法返回值为用户定义的类型时,不会出现该问题。 注意 thrift 版本0.8 跟踪thrift代码发现,问题出现的原因: step 1: 服务端,写数据 (基本类型) 不会先判断返回值是否为空,基本类型也无法判断是否为空 oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(SUCCESS_FIELD_DESC); oprot.writeI64(struct.success); oprot.writeFieldEnd();…

2012-03-17 00:15 · 评论(1)