Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1245 #1375

Merged
merged 1 commit into from
Feb 24, 2018
Merged

fix #1245 #1375

merged 1 commit into from
Feb 24, 2018

Conversation

hqq2023623
Copy link
Contributor

@hqq2023623 hqq2023623 commented Feb 19, 2018

What is the purpose of the change

fix #1245

Brief changelog

fix #1245

Verifying this change

fix #1245

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@codecov-io
Copy link

Codecov Report

Merging #1375 into master will decrease coverage by 0.22%.
The diff coverage is 14.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1375      +/-   ##
==========================================
- Coverage   32.57%   32.35%   -0.23%     
==========================================
  Files         691      691              
  Lines       34537    34537              
  Branches     6812     6812              
==========================================
- Hits        11252    11173      -79     
- Misses      21357    21433      +76     
- Partials     1928     1931       +3
Impacted Files Coverage Δ
...libaba/com/caucho/hessian/io/JavaDeserializer.java 41.52% <14.28%> (ø) ⬆️
...bo/rpc/cluster/support/FailbackClusterInvoker.java 71.79% <0%> (-12.83%) ⬇️
...mon/serialize/support/dubbo/GenericDataOutput.java 63.5% <0%> (-11.93%) ⬇️
...ba/dubbo/remoting/transport/netty/NettyClient.java 72.58% <0%> (-11.3%) ⬇️
...ubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java 41.66% <0%> (-8.34%) ⬇️
...mmon/serialize/support/dubbo/GenericDataInput.java 57.14% <0%> (-6.57%) ⬇️
...libaba/com/caucho/hessian/util/IdentityIntMap.java 25% <0%> (-5.96%) ⬇️
.../com/alibaba/dubbo/monitor/dubbo/DubboMonitor.java 73.14% <0%> (-2.78%) ⬇️
.../dubbo/rpc/protocol/dubbo/filter/FutureFilter.java 54.54% <0%> (-2.03%) ⬇️
...bo/remoting/transport/netty/NettyCodecAdapter.java 55.22% <0%> (-1.5%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c20d99...1b7fc08. Read the comment docs.

else if (int.class.equals(cl))
return Integer.valueOf(0);
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, do you think we should merge these else statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean change like this

protected static Object getParamArg(Class cl) {
        if (!cl.isPrimitive())
            return null;
        else if (boolean.class.equals(cl))
            return Boolean.FALSE;
        else if (byte.class.equals(cl) 
                || short.class.equals(cl) 
                || char.class.equals(cl) 
                || int.class.equals(cl))
            return 0;
        else if (long.class.equals(cl))
            return 0L;
        else if (float.class.equals(cl))
            return 0F;
        else if (double.class.equals(cl))
            return 0D;
        else
            throw new UnsupportedOperationException();
    }

It's ok with me to do so

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, let's keep is as it is.

@chickenlj chickenlj merged commit ddb677b into apache:master Feb 24, 2018
zonghaishang pushed a commit to zonghaishang/dubbo that referenced this pull request Feb 26, 2018
* @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
@zonghaishang
Copy link
Member

zonghaishang commented Feb 26, 2018

@hqq2023623 @chickenlj This branch will lead to failure of the deserialization error。
com.alibaba.com.caucho.hessian.io.JavaDeserializer#getParamArg:

    protected static Object getParamArg(Class cl) {
        if (!cl.isPrimitive())
            return null;
        else if (boolean.class.equals(cl))
            return Boolean.FALSE;
        else if (byte.class.equals(cl))
            return 0;
        else if (short.class.equals(cl))
            return 0;
        else if (char.class.equals(cl))
            return 0;
        else if (int.class.equals(cl))
            return 0;
        else if (long.class.equals(cl))
            return 0L;
        else if (float.class.equals(cl))
            return 0F;
        else if (double.class.equals(cl))
            return 0D;
        else
            throw new UnsupportedOperationException();
    }

Deserialization requires parsing of constructor argument types.

image

My construct :

    public PersonType(String, int, double, short, byte, List<Short>) {
        this.name = name;
        this.age = age;
        this.money = money;
        this.p1 = p1;
        this.p2 = p2;
        this.p3 = p3;
    }

Please revert code.

@zonghaishang
Copy link
Member

zonghaishang commented Feb 26, 2018

@hqq2023623 Before submitting the code, please make sure that all local units tested correctly and passed.

@hqq2023623
Copy link
Contributor Author

hqq2023623 commented Feb 26, 2018

@zonghaishang
It's my fault , I will make sure all the local unit tests are passed before submit next time.
the type mismatch exception is caused by class byte and short because the default type of 0 is Integer.
so change them to the Xxx.valueof() will resolve this

protected static Object getParamArg(Class cl) {
        if (!cl.isPrimitive())
            return null;
        else if (boolean.class.equals(cl))
            return Boolean.FALSE;
        else if (byte.class.equals(cl))
            return Byte.valueOf("0");
        else if (short.class.equals(cl))
            return Short.valueOf("0");
        else if (char.class.equals(cl))
            return '0';
        else if (int.class.equals(cl))
            return 0;
        else if (long.class.equals(cl))
            return 0L;
        else if (float.class.equals(cl))
            return 0F;
        else if (double.class.equals(cl))
            return 0D;
        else
            throw new UnsupportedOperationException();
    }

chickenlj added a commit that referenced this pull request Feb 26, 2018
@chickenlj
Copy link
Contributor

I have reverted the code, and will merge to PRs created affected with this bug.

zonghaishang pushed a commit to zonghaishang/dubbo that referenced this pull request Feb 26, 2018
* @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
zonghaishang pushed a commit to zonghaishang/dubbo that referenced this pull request Mar 2, 2018
* @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'
xpylq pushed a commit to xpylq/dubbo that referenced this pull request Mar 5, 2018
* remotes/upstream/master: (226 commits)
  clean up imports for CacheTest
  [Dubbo-apache#1362] cache provider always lru cache (apache#1396)
  Remove author info and add apache license
  Fix "promoteTransitiveDependencies=false" of maven-shade-plugin
  apache#1411: Locale deserialize 'zh-hant_CN'
  update README format
  update readme to add some details (apache#1403)
  fix number type is lost in yaml config file (apache#1401)
  fix hessian lite test case fail bug (apache#1394)
  Merge pull request apache#1391, fix typo of method name in qos module.
  Fix time unit problem related with FutureAdapter in UT
  Fix time unit problem related with FutureAdapter in UT
  Fix time unit problem in UT
  Fixed apache#1398, revert bugs introduced from apache#1375
  Change Mailing list address
  Merge pull request apache#1242, remove redundant null check.
  Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis.
  Merge pull request apache#1384, fix build string bug.
  Merge pull request apache#1376, do not instantiate load balance if there is no invokers
  Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version.
  ...
rolandhe pushed a commit to rolandhe/dubbo that referenced this pull request Sep 9, 2019
rolandhe pushed a commit to rolandhe/dubbo that referenced this pull request Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method invokes inefficient Number constructor
4 participants