Fix hessian2 deserialize bug
What is the purpose of the change
Fix hessian2 deserialize bug, #11442
Brief changelog
Verifying this change
#11442
Codecov Report
Merging #11448 (4d354a1) into 3.1 (6154b1d) will increase coverage by
0.00%. The diff coverage is87.50%.
@@ Coverage Diff @@
## 3.1 #11448 +/- ##
=========================================
Coverage 64.66% 64.67%
Complexity 14 14
=========================================
Files 1431 1431
Lines 59969 59982 +13
Branches 8807 8811 +4
=========================================
+ Hits 38780 38794 +14
+ Misses 17120 17110 -10
- Partials 4069 4078 +9
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...common/serialize/hessian2/Hessian2ObjectInput.java | 46.34% <77.77%> (+8.84%) |
:arrow_up: |
| ...bbo/common/utils/DefaultSerializeClassChecker.java | 91.86% <100.00%> (ø) |
|
| ...org/apache/dubbo/rpc/filter/GenericImplFilter.java | 51.88% <100.00%> (+1.88%) |
:arrow_up: |
| ...gistrycenter/processor/ZookeeperUnixProcessor.java | 60.71% <0.00%> (-17.86%) |
:arrow_down: |
| ...e/dubbo/remoting/transport/netty/NettyChannel.java | 51.13% <0.00%> (-7.96%) |
:arrow_down: |
| ...va/org/apache/dubbo/registry/RegistryNotifier.java | 74.35% <0.00%> (-2.57%) |
:arrow_down: |
| ...dubbo/rpc/cluster/directory/AbstractDirectory.java | 79.87% <0.00%> (-1.95%) |
:arrow_down: |
| ...ntext/event/AwaitingNonWebApplicationListener.java | 70.66% <0.00%> (-1.34%) |
:arrow_down: |
| ...bo/rpc/cluster/support/AbstractClusterInvoker.java | 78.80% <0.00%> (-0.67%) |
:arrow_down: |
| ... and 10 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
PTAL @AlbumenJ
Please merge the latest 3.1 branch to your branch
Please merge the latest 3.1 branch to your branch
ok, merged.

Test code: `@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());
}`
I tested the deserialization of Map locally and it was ok.
Dubbo 3.1 branch, in hessian-lite version 3.2.13 the map deserializer should be MapDeserializer. Not sure which version of AbstractMapDeserializer is in the error stack?
The original problem of hessian2 makes it difficult to fix bug only through dubbo.








