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

[BUG]dubbo序列化BUG,值错误 #3139

Open
pigeon-fancier opened this issue Oct 29, 2024 · 3 comments
Open

[BUG]dubbo序列化BUG,值错误 #3139

pigeon-fancier opened this issue Oct 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@pigeon-fancier
Copy link

问题描述

简要描述您碰到的问题。
dubbo-version3.3.0+,在java consumer调用kotlin provider时,出现kotlin端有实际值(有效值),但是java端出现值变成默认值的情况

环境信息

请填写以下信息:

  • OS信息: 版本 Windows 11 专业版
    版本号 23H2
    安装日期 ‎2023/‎9/‎6
    操作系统版本 22631.4317
    体验 Windows Feature Experience Pack 1000.22700.1041.0
    RAM:32.0 GB
  • JDK信息: [e.g.:Openjdk 17.0.9]
  • 版本信息:[e.g.:Fastjson2 2.0.52-2.0.53]

重现步骤

如何操作可以重现该问题:
kotlin端

data class Item(val value: String = "默认值")
data class Result(val low: Item = Item(), val mid: Item = Item(), val high: Item = Item() )
// interface定义
fun getResult(q: String) : Result
Result result = getResult("xxxx");
log.info("{}", JSON.toJSONString(result))
// 输出 {"low": {"value": "low"}, "mid": {"value": "默认值"}, "high": {"value": "high"}}
// 比较固定的是,只有mid这个里面的值会是默认值
  1. 使用 xxx.xxx 方法
  2. 输入 ... 数据
  3. 出现 ... 错误
//可在此输入示例代码

期待的正确结果

对您期望发生的结果进行清晰简洁的描述。
{"low": {"value": "low"}, "mid": {"value": "mid"}, "high": {"value": "high"}}

相关日志输出

请复制并粘贴任何相关的日志输出。

附加信息

如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。

@pigeon-fancier pigeon-fancier added the bug Something isn't working label Oct 29, 2024
wenshao added a commit that referenced this issue Nov 2, 2024
@wenshao
Copy link
Member

wenshao commented Nov 2, 2024

class Issue3139 {
    data class Item(val value: String = "默认值")
    data class Result(val low: Item = Item(), val mid: Item = Item(), val high: Item = Item() )

    @Test
    fun test() {
        var r = Result(Item("L"), Item("M"), Item("H"))
        var jsonb = JSONB.toBytes(r)
        println(JSONB.toJSONString(jsonb))
        var r1 = JSONB.parseObject(jsonb, Result::class.java)
        assertEquals("{\"high\":{\"value\":\"H\"},\"low\":{\"value\":\"L\"},\"mid\":{\"value\":\"M\"}}", JSON.toJSONString(r1))
    }
}

问题没重现,你是否可以帮忙构造重现问题的testcase

@pigeon-fancier
Copy link
Author

class Issue3139 {
    data class Item(val value: String = "默认值")
    data class Result(val low: Item = Item(), val mid: Item = Item(), val high: Item = Item() )

    @Test
    fun test() {
        var r = Result(Item("L"), Item("M"), Item("H"))
        var jsonb = JSONB.toBytes(r)
        println(JSONB.toJSONString(jsonb))
        var r1 = JSONB.parseObject(jsonb, Result::class.java)
        assertEquals("{\"high\":{\"value\":\"H\"},\"low\":{\"value\":\"L\"},\"mid\":{\"value\":\"M\"}}", JSON.toJSONString(r1))
    }
}

问题没重现,你是否可以帮忙构造重现问题的testcase

kotlin端输出

{"high":{"cabins":[{"cabinClass":"ECONOMY_CLASS","cabinClassDisplay":"经济舱","cabinCode":"H","seat":9,"segmentIndex":1}],"durationTotal":"2h42m","prices":[{"passengerType":"ADULT","price":"4510","taxDetail":{"tax":"","yq":""},"taxTotal":"3741.00"}],"productInfo":{"orderInfo":"{\"offerId\":\"v2ZgXMx1Qlw0S03hWecLitAEp6ihQfxq7vXR2+MWAXPOwKFqz8RZIaDPsFEuO6N1TqS7i5APsiinuC9mDLie6hFCrVaBew5aRjklkJvjnRaPAN3P40efCI0p+mIXe+BUtroddxHMsGocVkcH2UA0T7WYKtvAw9plrm8EO/cFJAyeBVKm5VgfSP9kS2gqLZfb5FQHk4ywSCjZbVAl16e5c62MjrPMVdAnWhFaaGxFDLSb7nE0ypwQ9K0g3OUlVRiubrvi0pPIzXlQYk3JLvF69w8MHct2m3YyzB4iog27+86z7DucMeLbzE/5p3IFUvLZZzYo6Nff8TJXAqXaJa1ohbaUg7+5JIaJJ4FNpI2MM3nVlfJesSvYZruCTwkz0KlsGa9ZJsG6lQkdRcZRzKadREg1qlnkGVpPIU222OV22V4Q5tHAhJ+FGhJCY61Hfkly/EEw6IzCFSeXX+nyofsboDLLKS9UkmQ5sh1vmv4OLRYb7lF9Aymy60r5ELe3ocWhdAMgbf3RfiRhHZnxmW7xkzAsgE7C1w0as1uTrjwhBuaWqUJNKueMhAe1bPv7PkowOGK/sCCu9r/mRROUriyxxwfkYMA9yi8O0LXTOrhlpG74iQX/fMlfRKT9RDyTcmIlb5JKEFDE58Lbzl8QxVoOLIx+yFmbKDvvXZi68UnlUz7hQn6eUABY4KCjQAbknN4oOZbV+MbTYIdlSi08egxhQcLJgeCorm0+5qwqHjnZrsdt8G/4zU6kWpdnNtb71Ba6xhLlmyszdCnl4BOHPR2rQkmgX3XR5tvMlNh3z0A6sZGcgHVCyU+RZxDanFZLuv8Pr078s7iHKVMlhl8ibK3DCSGBdQY/Mx3Lcmfe/7MCRLAQQ=\"}","productCode":"9354121222a166941d00f001e2e2056c","productSource":"","productTag":"","productTagDisplay":""},"segments":[{"aircraft":"","aircraftType":"","airline":"9C","airlineDisplay":{"code":"9C","logo":"1777237772294971392.png","nameCn":"春秋航空","nameEn":"Spring Airlines","nameFt":"春秋航空","tel":[{"name":"中国","value":"95524"},{"name":"中国","value":"021-62520000"},{"name":"中国","value":"021-62515444"},{"name":"国际","value":""}],"website":"https://www.ch.com/"},"arriveAirport":"PKX","arriveAirportDisplay":"大兴国际机场","arriveAirportTerm":"","arriveDateTime":"2024-11-25 13:22:00","cabinCode":"","departAirport":"HKG","departAirportDisplay":"香港国际机场","departAirportTerm":"","departDateTime":"2024-11-25 10:40:00","duration":"2h42m","durationTotal":"2h42m","flightNo":"9C9990","flightShare":false,"meal":"","mileage":"","operationAirline":"","operationFlightNo":"","segmentIndex":1,"stopTime":"","stops":[],"stopsDisplay":[],"transitTime":"","tripType":0}],"sourceType":1},"low":{"cabins":[{"cabinClass":"ECONOMY_CLASS","cabinClassDisplay":"经济舱","cabinCode":"M","seat":9,"segmentIndex":1}],"durationTotal":"4h53m","prices":[{"passengerType":"ADULT","price":"908","taxDetail":{"tax":"","yq":""},"taxTotal":"753.00"}],"productInfo":{"orderInfo":"{\"offerId\":\"v2DjjutUlWzAjSTxomMbNXwjuaxSEV3ECXjrBqBXqroM2vt0VAuAsJopKkCPFON7J3d+hqjVAFRFh85dHLFYdi9tvbgq/mCkICRIZGThDebr4S14/gR6W2fu+akw95957Jf7qCFARpJdYpmY440aUy336NwQnWFOzvIb+uGb2wdh9fPKlNzecazMf2LzC6QV71AJOCfGvC2j8R9aeOj/66MA0CAkUEiU9JoNYGexLQfP5Rel7zX1oVZimIEGAkMb6DdQOVt9prNVHDxyW1CgiivefriKj7mn7fMlpgTmjB+Z/30P8lByhmIZ/71JnFYq+ZGPzZ7zGc3Z16NeFrcL3RZU95gBW+52OgMkU5Ai9LX49yP1az7S7wRhv792Kbd8IFvRYht3LSbZ+1P5qCWTFQ+NBfpTHitjOw5LruisykLVsqbQ8iTz/7KBBK00duvAKgmCBglF1rOlMMnRVMfEKyE1Z0aswr2gaSz5f/Bojg92aPcAy6BN1Th5dVbB+1YirrpT8h9KrsyXuSecn9nhowu6GXg04wkcwQQRoEgBA1VwXoRDsegeXyCfVWQ9UkYbznFSNO4I47K53221QoMITXRUc4WlncfxZYLKo+18O3ckJRqIFcXNKnWZTL6ZTvvWEteZP4BqYPqpEfsMrx83klxaUcTXZxsA44b2bZWkKXGOsEo/MFv5WctQaKWUJmDmJI+sYEnTlO4aXBoj3cJ1UKi61aRyv1FPIqXrbCKgwFHUw8q40clt9FqS27cVKPXNjPT8CXuk+iFzvgB3MyTds1WY/GqBkrGK+DR3x7hGeOlcNoILeOVKWVtnzvgOqEhij/I9e1d0ZlHFFVXadJDbExYTxuZ8TYRMrqqU5nBJLFZzhGjHTMoRKqzk0iNNpGIRS0\"}","productCode":"4fd794492e0986180166ade996d4df3c","productSource":"","productTag":"","productTagDisplay":""},"segments":[{"aircraft":"","aircraftType":"","airline":"CX","airlineDisplay":{"code":"CX","logo":"1777237785402171392.png","nameCn":"国泰航空","nameEn":"Cathay Pacific Airways","nameFt":"國泰航空","tel":[{"name":"中国","value":"400 815 2888"},{"name":"国际","value":"+852 2747 3333"}],"website":"https://www.cathaypacific.com/"},"arriveAirport":"PEK","arriveAirportDisplay":"首都国际机场","arriveAirportTerm":"","arriveDateTime":"2024-11-25 11:43:00","cabinCode":"","departAirport":"HKG","departAirportDisplay":"香港国际机场","departAirportTerm":"","departDateTime":"2024-11-25 06:50:00","duration":"4h53m","durationTotal":"4h53m","flightNo":"CX8594","flightShare":false,"meal":"","mileage":"","operationAirline":"","operationFlightNo":"","segmentIndex":1,"stopTime":"","stops":[],"stopsDisplay":[],"transitTime":"","tripType":0}],"sourceType":1},"mid":{"cabins":[{"cabinClass":"ECONOMY_CLASS","cabinClassDisplay":"经济舱","cabinCode":"W","seat":9,"segmentIndex":1}],"durationTotal":"4h4m","prices":[{"passengerType":"ADULT","price":"920","taxDetail":{"tax":"","yq":""},"taxTotal":"762.00"}],"productInfo":{"orderInfo":"{\"offerId\":\"v2krVhuR074ZjLNKoNac3po2R4YEl2ZB24F2iJzNqiBc8y4+XZzCDETuzt5J83qnlt7/gyK7ik93ICj1p0eJ/PYdlhul965JdWaBf69WzQi045cQdjZgFcBsasQDFEswvIk+OihzszrimhT9z+EUmlft5PMN48KqSDQcn4Nu+tprLfwEGzvXT464ljiXZ+y7xtXf6GBiPTY6Q6It9sP8sQ6SHoLYuiM/Xefh+t42ONjDZgPcdaJ9sJMWHiocus2mEh9R0EiD4l14pBhjwGj+FiogUjh0nSq4hO2LP9NjkPFmi2Fg4Sgsuq6b0BIehQdF9bmfvSehrRVtfdiZqjY49XLuuamc3yjrM99SRzzb0DZu3MNTWDy5UReQo9MrYWFdJJc5DCzZq+raRaUltqedratadmFyhfQ/vHHz48zSsypFSac6pvmIkBadhI9Dgrg38bd5al+wXnMzT0+VK2DF5Ihp1f87PVCZdZ6uLgUj1B3jxHZyMoFDlTDSnuX688MEXSZ1PI33RopKvrlTtCHHfppiBv8+uRJnp6gsxYqwceyR6wqy0I9am4LOdCSgn219ne1IEJ2ByngI+520Yp5OLFLUQZ/GNIHGRcGw0t5w7DrJ1fkuIytI0Bq5toOXIWnC+80zM80a+f6XBY+IDXNld9QeH/17xCFhUmLQucFUAgZ5UTRm526IAVHx723BMItUg7Mmkm1qFnzYWDWEhRK5iCy58LmBCOz26f/rrmOmPmJt27BQ+KSxyTik8YNtNyp9R2Q6CuSljT3TT2J7z7H+X8+XIveF3N3WGK5Ahal/EJMqEFwmyUcjO1Dkqm05krAw27sK7ci5zz/RdyDfrfCAnH5Oitjb3ssYIB6GSdSECpL20=\"}","productCode":"c43f09f83e5ecf72d23095d1d3d37aa5","productSource":"","productTag":"","productTagDisplay":""},"segments":[{"aircraft":"","aircraftType":"","airline":"NZ","airlineDisplay":{"code":"NZ","logo":"1777237805836820480.png","nameCn":"新西兰航空","nameEn":"Air New Zealand","nameFt":"新西蘭航空","tel":[{"name":"中国","value":"400-101-8080"},{"name":"中国","value":"+86-21-2325 3333"},{"name":"国际","value":"+64 (0)9 357 3000"}],"website":"https://www.airnewzealand.cn/"},"arriveAirport":"PKX","arriveAirportDisplay":"大兴国际机场","arriveAirportTerm":"","arriveDateTime":"2024-11-25 13:19:00","cabinCode":"","departAirport":"HKG","departAirportDisplay":"香港国际机场","departAirportTerm":"","departDateTime":"2024-11-25 09:15:00","duration":"4h4m","durationTotal":"4h4m","flightNo":"NZ5730","flightShare":false,"meal":"","mileage":"","operationAirline":"","operationFlightNo":"","segmentIndex":1,"stopTime":"","stops":[],"stopsDisplay":[],"transitTime":"","tripType":0}],"sourceType":1}}

java端接收输出

{"high":{"cabins":[{"cabinClass":"ECONOMY_CLASS","cabinClassDisplay":"经济舱","cabinCode":"S","seat":9,"segmentIndex":1}],"durationTotal":"4h36m","prices":[{"passengerType":"ADULT","price":"4488","taxDetail":{"tax":"","yq":""},"taxTotal":"3723.00"}],"productInfo":{"orderInfo":"{\"offerId\":\"v2QesK6sqD3IjV/7LTIU4XxXtAjSMZKTqKL5qmimE/pwZ+T78PuJcYwnSryiN79fiTfp4EPO1j1hSHX1VCVCkl73+mn17DuLB06dOeOoQTg8mkZdRB8GVUJGAE665P+apK0ed/bS8O6Ab9NJshnVuEcF8b1rQK9oyEOgVpDQcQ0xr5JEsby11/lSdXUMvczCmUFcVAS5mmWpJQbccCmbpgNU1NJkbGLj1stJ0xLhSyhHDpIkoD9ycvTlhm+5iaF/tjdto21KN9RsGyMxU1njAwbpDeV+N/B5+6x2/oFtVqdpmL6MVSR0VrJYKDE1b3Ywo60pe7Gg2EXdpGBELPNBE/gUmgJyDSuX+T5PEqc/cd8lOMG7wtvJ4NdzkdlOF+3IdOdeflh+jr1BkwKPZEqgTyjnQPSK/K49oEC7RevB+vCo29WkiJPXgf0rKdAtMcARRgn4G/4kN6dGH+DYeN3ip4lSVigviU2DGJEZvOm2agWyIV3jSAv/iFKtpdpxpg8UO3pwwKXnLlAX8j3lrj1HsQuN70LyfG98XD4AyDWhiHhqAZQ/rAlH/8tWqVs60beXXbYvXoA+4Yprx3TLJV3auMYFrDJiRkf7uYcLuTtFOHu2CWpzki1K3Wgr59t7ULAoacnSwClfxsY7D/oWqSehzMOHMr37KkYjrqPF+Sl4HMrqFujTz+BHo2NaDgRueF/1dhCnh28KSdFDF6vtI72b4DlZoW3QW/52GNRx07XaV5zXmEB8I+6AFsNSr/Keg8aiUK4MflbT3sOXW+5cvCbNv97Zx+H+G7fTLeaCy4S9n19U1lX6Uf447P4l9b7cY3V+AUy9DAH4e4W8zSzNqSJNdmtdBK3leIyGyS+WHIuu14By4=\"}","productCode":"bb064622776370b0bbf0a36f9cc4e641","productSource":"","productTag":"","productTagDisplay":""},"segments":[{"aircraft":"","aircraftType":"","airline":"QR","airlineDisplay":{"code":"QR","logo":"1777237811004203008.png","nameCn":"卡塔尔航空","nameEn":"Qatar Airways","nameFt":"卡塔爾航空","tel":[{"name":"中国","value":"400-994-9991"},{"name":"国际","value":"+974 4144 5555"}],"website":"https://www.qatarairways.com/"},"arriveAirport":"HKG","arriveAirportDisplay":"香港国际机场","arriveAirportTerm":"","arriveDateTime":"2024-11-20 14:51:00","cabinCode":"","departAirport":"NAY","departAirportDisplay":"内比都国际机场","departAirportTerm":"","departDateTime":"2024-11-20 10:15:00","duration":"4h36m","durationTotal":"4h36m","flightNo":"QR5872","flightShare":false,"meal":"","mileage":"","operationAirline":"","operationFlightNo":"","segmentIndex":1,"stopTime":"","stops":[],"stopsDisplay":[],"transitTime":"","tripType":0}],"sourceType":1},"low":{"cabins":[{"cabinClass":"ECONOMY_CLASS","cabinClassDisplay":"经济舱","cabinCode":"Q","seat":9,"segmentIndex":1}],"durationTotal":"2h25m","prices":[{"passengerType":"ADULT","price":"902","taxDetail":{"tax":"","yq":""},"taxTotal":"765.00"}],"productInfo":{"orderInfo":"{\"offerId\":\"v2QesK6sqD3IjV/7LTIU4XxfM+s1boZbZnhSJwMeTnBYPBSa2C8iSpLK2XQ/B1DGGZHghkff9LQecCzkxKabvfCRMwIIC49djLGb2O3R6b3t1KOTtknjx5GAilzeLCQAzAbV13En/kkhReY1jcCRCzqlRumyoZlickDyLjK574+C7sSDb816+UoGeIqcUnZEV5K9egCxRpo5xhXhdCfF2UnBb1NBUXOh8Zjsm0QpQ1wdRjAHjMJhLVREC66y3VINGRQu1xPCDrqfOhfXtb7qQYhzDweiiXLkP9uSGKQCQJTzZi4BDMxKTk3jW5aITMwVAhNFS2y56kR5HBPGLZO9m9PP39XclS4563UbYZAE0iXjr2aLOnVve7czlgX3UI9GcPa7nlR3W3Uv6O2NVYxG7greEGfUXs2zzWulcXl3PboyCLLB2CgqN8NDvAELFvqU3J7bGzaz+GsLeg4j1G+juhIG6NO68XjnOOJ2I+shxt6oc5c4KALTycduyeBoa6OIt/Zp7S2zPLohnrUY0guyrOZplCCKO/VoDoARNUoi9YI/ikdcsmu1P/GRsQn6Ony3BShhVLAuvctYMGDqFvpMJISyRTUYzarav54opDdeEAHwh829mFfGJC5jSvUBuoDsAqrwyvQOhriquBgnDYtkS8sR+aSCI96bkLLURUh24Rkr9QTTScVKQGppBo8fQZRd/jWKotmCWMO7ghJPqx8Nqilz4YHKnk8ybDd7GtNHFIqETFzLQIsatbrOrFxaFDtb20JPYpDTdxZx4ZUDHgWs0RaYCe6sgKdjuge8xC7J2HWhTX79zKZp8Ie7fD3n/IVtaSuD2OiqHoI0dCS2JtyP448utcVDim1YWs75CIoxG9nNk=\"}","productCode":"05237b2498ff1b82bf5ade8ae9b7a5aa","productSource":"","productTag":"","productTagDisplay":""},"segments":[{"aircraft":"","aircraftType":"","airline":"TW","airlineDisplay":{},"arriveAirport":"HKG","arriveAirportDisplay":"香港国际机场","arriveAirportTerm":"","arriveDateTime":"2024-11-20 21:35:00","cabinCode":"","departAirport":"NAY","departAirportDisplay":"内比都国际机场","departAirportTerm":"","departDateTime":"2024-11-20 19:10:00","duration":"2h25m","durationTotal":"2h25m","flightNo":"TW1354","flightShare":false,"meal":"","mileage":"","operationAirline":"","operationFlightNo":"","segmentIndex":1,"stopTime":"","stops":[],"stopsDisplay":[],"transitTime":"","tripType":0}],"sourceType":1},"mid":{"cabins":[],"durationTotal":"","prices":[],"productInfo":{"orderInfo":"","productCode":"","productSource":"DEFAULT","productTag":"DEFAULT","productTagDisplay":"默认"},"segments":[],"sourceType":0}}

@pigeon-fancier
Copy link
Author

class Issue3139 {
    data class Item(val value: String = "默认值")
    data class Result(val low: Item = Item(), val mid: Item = Item(), val high: Item = Item() )

    @Test
    fun test() {
        var r = Result(Item("L"), Item("M"), Item("H"))
        var jsonb = JSONB.toBytes(r)
        println(JSONB.toJSONString(jsonb))
        var r1 = JSONB.parseObject(jsonb, Result::class.java)
        assertEquals("{\"high\":{\"value\":\"H\"},\"low\":{\"value\":\"L\"},\"mid\":{\"value\":\"M\"}}", JSON.toJSONString(r1))
    }
}

问题没重现,你是否可以帮忙构造重现问题的testcase

我怀疑是不是因为high跟mid是指向同一个对象的情况下才会出现这个BUG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants