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

copy Map<String,Object> cause recursive value #853

Open
bljcode opened this issue Jul 4, 2023 · 2 comments
Open

copy Map<String,Object> cause recursive value #853

bljcode opened this issue Jul 4, 2023 · 2 comments

Comments

@bljcode
Copy link

bljcode commented Jul 4, 2023

Are you in the right place?

  • For issues or feature requests related to the code in this repository file a Github issue.
  • For general technical questions, post a question on Google Groups.

Whats your runtime?

  • Dozer version: 6.5.2_
  • OS version: macOs 12.5_
  • JDK version: 1.8_

Whats the problem?

Steps to reproduce:

public static  void main(String[] args){
       A model = new A();
       LinkedHashMap<String, Object> map = new LinkedHashMap<>();
       map.put("msgExtra",new LinkedHashMap<>());
       model.setTemplateExtendInfo(map);
       Mapper defaultMapper = DozerBeanMapperBuilder.buildDefault();

       B resultModel = defaultMapper.map(model, B.class);

       System.out.println(JSON.toJSONString(resultModel));
   }


   @Data
   public static class A{
       private Map<String, Object> templateExtendInfo = new HashMap<>();

   }
   @Data
   public static  class B{

       private Map<String, Object> templateExtendInfo = new HashMap<>();


   }

run the main method , I find the resultModel.templateExtendInfo recursive value ,templateExtendInfo VALUES: {msgExtra={}} --> {msgExtra=(this Map)}

Observed Results:

What happened? This could be a description, log output, etc.
image

Expected Results:

What did you expect to happen?
the resultModel.templateExtendInfo has a empty map value

@bljcode
Copy link
Author

bljcode commented Jul 4, 2023

image

@logicjwell
Copy link

image image

It's a bug of JSON lib. Can not reproduce the sense when use System.out.println(), as shown in screenshots.

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

No branches or pull requests

2 participants