I have code that basically does the following to read in properties that are added to json like e.g. ‘name’ and ‘ value’ in the follow JSON {"operation":"write-attribute","address":[{"subsystem":"web"},{"connector":"http"}],"name":"socket-binding","value":"jndi"}.
As the methods are generic, I can’s just rely on hardcoding name and value – other json strings could contain other properties that should be “caught”.
@JsonAnySetter
public void addAdditionalProperty(String key, Object value) {
if (additionalProperties == null)
additionalProperties = new HashMap<String, Object>();
additionalProperties.put(key,value);
}
@SuppressWarnings("unused")
public void setAdditionalProperties(Map<String, Object> additionalProperties) {
this.additionalProperties = additionalProperties;
}
@JsonAnyGetter
public Map<String,Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonIgnore
public String getName() {
return (String) getProperty("name");
}
@JsonIgnore
public String getValue() {
return (String) getProperty("value");
}
This code works well with Jackson 1.7.4, but fails in 1.9.3 where the additionalProperties are not set.
I fail to see if this is an intended change or if its is a regression.
If it is an intended change – does anyone know how to “fix” my code to work again?
Full code is here , test is here (first test, OperationSerDeserTest)
Sounds like potential bug to me — easiest way to figure out is to either send question to user list, or file a Jira. I can do latter, see if I can see what happens.