Fix hessian2 serialized short, byte is converted to int bug#1232
Fix hessian2 serialized short, byte is converted to int bug#1232lovepoem merged 3 commits intoapache:2.5.xfrom zonghaishang:support_new_serialization
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1232 +/- ##
=========================================
+ Coverage 31.78% 32.29% +0.5%
=========================================
Files 689 689
Lines 34454 34561 +107
Branches 6799 6848 +49
=========================================
+ Hits 10950 11160 +210
+ Misses 21591 21466 -125
- Partials 1913 1935 +22
Continue to review full report at Codecov.
|
|
@lovepoem Do you have time to review this PR? I've seen you fixed bugs in hessian before, you must be familiar with hessian code. |
|
ok I will review this PR |
|
@lovepoem Do you have any question about this pr ? |
There was a problem hiding this comment.
This PR will be merged to 2.5.x at first. please merge 2.5.x to you pr. Then please check the hessian-lite/src/test/java/com/alibaba/com/caucho/hessian/io/PersonType.java , these is a JDK version adaptation assue @zonghaishang
|
|
||
| import java.io.Serializable; | ||
| import java.util.List; | ||
| import java.util.Objects; |
There was a problem hiding this comment.
Objects is a java8+ feature. please adapt the lower version
There was a problem hiding this comment.
I‘m using Objects.hash is java7+ feature, must adapt jdk1.6 ?
|
@chickenlj @lovepoem please help review code, thanks. |
* @reference support annotate on annotation type * Fixes apache#1303 TimeUnit conversion error * Fixes apache#1289, use bind_port as mapping key * Fixes apache#1313, remove destroy check in Registry. * checkout .travis.yml from origin/master * Fix hessian2 serialized short, byte is converted to int bug (apache#1232) * Fix hessian2 serialized short, byte is converted to int bug * Fix hessian2 serialized short, byte is converted to int bug * adapt jdk1.5+ * fixed travis-ci failed because of test cases. (apache#1370) * Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable() * Merge pull request apache#1378, replace StringBuider with simple string concatenation in log. * Merge pull request apache#1375, remove unnecessary boxing. Fixes apache#1245 * Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version. * Merge pull request apache#1376, do not instantiate load balance if there is no invokers Fixes apache#1297 * Merge pull request apache#1384, fix build string bug. * Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis. * Merge pull request apache#1242, remove redundant null check. fixes apache#1231
* @reference support annotate on annotation type * Fixes apache#1303 TimeUnit conversion error * Fixes apache#1289, use bind_port as mapping key * Fixes apache#1313, remove destroy check in Registry. * checkout .travis.yml from origin/master * Fix hessian2 serialized short, byte is converted to int bug (apache#1232) * Fix hessian2 serialized short, byte is converted to int bug * Fix hessian2 serialized short, byte is converted to int bug * adapt jdk1.5+ * fixed travis-ci failed because of test cases. (apache#1370) * Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable() * Merge pull request apache#1378, replace StringBuider with simple string concatenation in log. * Merge pull request apache#1375, remove unnecessary boxing. Fixes apache#1245 * Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version. * Merge pull request apache#1376, do not instantiate load balance if there is no invokers Fixes apache#1297 * Merge pull request apache#1384, fix build string bug. * Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis. * Merge pull request apache#1242, remove redundant null check. fixes apache#1231 * Change Mailing list address * Fixed apache#1398, revert bugs introduced from apache#1375 * Fix time unit problem in UT * Fix time unit problem related with FutureAdapter in UT
* @reference support annotate on annotation type * Fixes apache#1303 TimeUnit conversion error * Fixes apache#1289, use bind_port as mapping key * Fixes apache#1313, remove destroy check in Registry. * checkout .travis.yml from origin/master * Fix hessian2 serialized short, byte is converted to int bug (apache#1232) * Fix hessian2 serialized short, byte is converted to int bug * Fix hessian2 serialized short, byte is converted to int bug * adapt jdk1.5+ * fixed travis-ci failed because of test cases. (apache#1370) * Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable() * Merge pull request apache#1378, replace StringBuider with simple string concatenation in log. * Merge pull request apache#1375, remove unnecessary boxing. Fixes apache#1245 * Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version. * Merge pull request apache#1376, do not instantiate load balance if there is no invokers Fixes apache#1297 * Merge pull request apache#1384, fix build string bug. * Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis. * Merge pull request apache#1242, remove redundant null check. fixes apache#1231 * Change Mailing list address * Fixed apache#1398, revert bugs introduced from apache#1375 * Fix time unit problem in UT * Fix time unit problem related with FutureAdapter in UT * Fix time unit problem related with FutureAdapter in UT * Merge pull request apache#1391, fix typo of method name in qos module. * fix hessian lite test case fail bug (apache#1394) * fix hessian lite test case fail bug * update test * remove ignore * Fix time unit problem related with FutureAdapter in UT * revert file * fix number type is lost in yaml config file (apache#1401) * apache#1399 fi * update test * update readme to add some details (apache#1403) * update readme to add some details update readme to add some details * delete duplicated words delete duplicated words * update README format * apache#1411: Locale deserialize 'zh-hant_CN'
| * @param expectedTypes the runtime type hints, eg: expectedClass equals Map, expectedTypes can | ||
| * equals String.class, Short.class | ||
| */ | ||
| public Object readObject(Class expectedClass, Class<?>... expectedTypes) |
There was a problem hiding this comment.
#1232
@lovepoem @zonghaishang
the add method will work in Hessian2Input, but in HessianInput not unsupported.
I think the HessianInput need to change to support the new methods.
|
HessianInput.readObject(Class, Class[]) nosupported, effect #1608 |
Fix hessian2 serialized short, byte is converted to int bug
for example:
if we test deserialize mode 'Hessian2StringShortType'
`
public class Hessian2StringShortType implements Serializable {
}
public class PersonType implements Serializable {
}
@test
public void serialize_string_short_map_then_deserialize() throws Exception {
`
When we test serialize and deserialize 'Hessian2StringShortType', because it contains short、byte,
the property stringShortMap will be deserialized Map<String, Integer>, not Map<String, Short>!!!
More detail unit test can see:
com.alibaba.com.caucho.hessian.io.Hessian2StringShortTestThe problem has been fixed in the current branch, please verify and merge, Thank you.
Here is my email: shangzonghai@youzan.com or jason.shang@hotmail.com