8000 YamlUtils工具类 ymlToObj函数 Properties baseProperties参数问题 · Issue #4355 · alibaba/canal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
YamlUtils工具类 ymlToObj函数 Properties baseProperties参数问题 #4355
Closed
@chen-collab

Description

@chen-collab
  • 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

  • canal 1.1.7
  • mysql 5.7.34

Issue Description

com.alibaba.otter.canal.client.adapter.support 包下YamlUtils工具类ymlToObj

java 基本数据类型作为参数传递时,传递的是值的拷贝,无论怎么改变这个拷贝,原值是不会改变的,
引用对象参数传递时,传递的是指向真实对象的地址,而函数中的形参 baseProperties 拿到同样的地址时,通过 baseProperties.putAll(properties);,会通过地址找到真实的对象进行操作,会改变属性数据,进而导致获取的配置对象错乱

Steps to reproduce

Expected behaviour

Actual behaviour

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

Just put your stack trace here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0