Skip to content

Commit

Permalink
DUBBO-627 处理返回值为 null 的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
kimi committed Jan 6, 2013
1 parent 645152a commit 4f8ed01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ public void testGenericImplementationWithBeanSerialization() throws Exception {
reference.set(arg);
return args[0];
}
if ("sayName".equals(method)) {
return null;
}
return args;
}
});
Expand Down Expand Up @@ -301,6 +304,7 @@ public void testGenericImplementationWithBeanSerialization() throws Exception {
Assert.assertTrue(descriptor.isBeanType());
Assert.assertEquals(User.class.getName(), descriptor.getClassName());
Assert.assertEquals(user.getName(), ((JavaBeanDescriptor)descriptor.getProperty("name")).getPrimitiveProperty());
Assert.assertNull(demoService.sayName("zhangsan"));
} finally {
if (ref != null) {
ref.destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcExcept
try {
Method method = invoker.getInterface().getMethod(methodName, parameterTypes);
if (ProtocolUtils.isBeanGenericSerialization(generic)) {
if (value instanceof JavaBeanDescriptor) {
if (value == null) {
return new RpcResult(value);
} else if (value instanceof JavaBeanDescriptor) {
return new RpcResult(JavaBeanSerializeUtil.deserialize((JavaBeanDescriptor)value));
} else {
throw new RpcException(
Expand Down

0 comments on commit 4f8ed01

Please sign in to comment.