Skip to content

Commit 600f0db

Browse files
goodjavalovepoem
authored andcommitted
Fixes a bug in gson's deserialization feature (apache#5099)
1 parent 0d09ef9 commit 600f0db

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void handleValue(ObjectInput in) throws IOException {
141141

142142
private void handleException(ObjectInput in) throws IOException {
143143
try {
144-
Object obj = in.readObject();
144+
Object obj = in.readObject(Throwable.class);
145145
if (!(obj instanceof Throwable)) {
146146
throw new IOException("Response data error, expect Throwable, but get " + obj);
147147
}

dubbo-serialization/dubbo-serialization-gson/src/main/java/org/apache/dubbo/common/serialize/gson/GsonJsonObjectInput.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public byte[] readBytes() throws IOException {
9090
@Override
9191
public Object readObject() throws IOException, ClassNotFoundException {
9292
String json = readLine();
93-
return gson.fromJson(json, String.class);
93+
return gson.fromJson(json, Object.class);
9494
}
9595

9696
@Override

0 commit comments

Comments
 (0)