Skip to content

PojoUtil realize type convert not support subclasses of 'java.util.date' #2499

@ningyu1

Description

@ningyu1
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.5.x, 2.6.x
  • Operating System version: windows 7
  • Java version: jdk1.7,jdk1.8

Steps to reproduce this issue

  1. String convert to java.sql.Time
  2. String convert to java.sql.Date
  3. String convert to java.sql.Timestamp

Expected Result

The Convert is successful and you can get the object of the converted type.

Actual Result

Conversion failed.

When the interface is called by 'jmeter-plugin-dubbo', it is passed into the hashmap through a generalization call. The value in the hashmap is a Date string, and an error occurred when the server accepts a type of java.sql.timestamp |Date

If there is an exception, please attach the exception trace:

java.lang.RuntimeException: Failed to set pojo TestVo property timestamp value 2018-09-13 10:00:00(class java.lang.String), cause: argument type mismatch
	at com.alibaba.dubbo.common.utils.PojoUtils.realize0(PojoUtils.java:456)
	at com.alibaba.dubbo.common.utils.PojoUtils.realize(PojoUtils.java:196)
	at com.alibaba.dubbo.common.utils.PojoUtils.realize(PojoUtils.java:86)
	at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:68)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:103)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:172)
	at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
	at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:80)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.alibaba.dubbo.common.utils.PojoUtils.realize0(PojoUtils.java:453)
	... 16 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugBugs to being fixed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions