mytang0 opened a new pull request, #11489:
URL: https://github.com/apache/dubbo/pull/11489
## What is the purpose of the change
Fix hessian2 deserialize bug, #11442
## Verifying this change
`@SuppressWarnings("unchecked")
public static void listTest() throws Exception {
Hessian2Serialization hessian2Serialization = new
Hessian2Serialization();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutput objectOutput = hessian2Serialization.serialize(null,
baos);
// List test
List<Float> floatList = new ArrayList<>();
floatList.add(3.5F);
floatList.add(3.51F);
objectOutput.writeObject(floatList);
objectOutput.flushBuffer();
List<Float> list =
(List<Float>) hessian2Serialization.deserialize(null, new
ByteArrayInputStream(baos.toByteArray()))
.readObject(List.class, new TypeReference<List<Float>>() {
}.getType());
}
@SuppressWarnings("unchecked")
public static void mapTest() throws Exception {
Hessian2Serialization hessian2Serialization = new
Hessian2Serialization();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutput objectOutput = hessian2Serialization.serialize(null,
baos);
// Map test
HashMap<String, Float> floatMap = new HashMap<>();
floatMap.put("a", 3.50F);
floatMap.put("b", 3.54F);
objectOutput.writeObject(floatMap);
objectOutput.flushBuffer();
Map<String, Float> map =
hessian2Serialization.deserialize(null, new
ByteArrayInputStream(baos.toByteArray()))
.readObject(Map.class, new TypeReference<Map<String,
Float>>() {
}.getType());
}`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]