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

Properties properties = new Properties(); properties.put("key", 1); // fix bug: such properties can't be serialized #2656

Closed
wants to merge 1 commit into from

Conversation

fan2008shuai
Copy link

Properties properties = new Properties();
properties.put("key", 1);
fix bug: such properties can't be serialized

properties.put("key", 1);
fix bug: such properties can't be serialized
@cowtowncoder
Copy link
Member

Hmmh. This is tricky.

So, I can see that if you use Properties as just general Map<String, String> -- which to me is wrong, even tho JDK sort of allows it (due to raw typing of its extension) -- there is problem with serialization.

Unfortunately existing handling is absolutely required to make deserialization (reading json as Properties) work correctly, and making suggested change actually breaks 3 existing unit tests (earlier #810 lead to type parameters being derived to make Properties look like Map<String, String>, to avoid quietly dropping non-String values).

Given this, I don't think change as suggested can be used. But I will file an issue for the problem itself -- it seems reasonable that serialization of Properties with non-String values should not fail with an exception but work similar to Map<String, Object>.

@cowtowncoder
Copy link
Member

Created #2657 as follow-up.

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.

2 participants