Fixed [JACKSON-687]
diff --git a/release-notes/CREDITS b/release-notes/CREDITS
index c1bb2aa..803a4a2 100644
--- a/release-notes/CREDITS
+++ b/release-notes/CREDITS
@@ -629,6 +629,8 @@
[1.7.7]
* Suggested [JACKSON-581] Add 'ObjectMapper.readTree(File)'
[1.9.0]
+ * Reported [JACKSON-687] Problems with PropertyNamingStrategy, property merging
+ [1.9.1]
Maik Jorra:
* Reported [JACKSON-540] Side-effects with ObjectMapper.canSerialize(),
diff --git a/release-notes/VERSION b/release-notes/VERSION
index 5983649..1dd873e 100644
--- a/release-notes/VERSION
+++ b/release-notes/VERSION
@@ -1,13 +1,27 @@
-Version: 1.9.0
+Version: 1.9.1
Release date:
- 04-Oct-2011
+ xx-Oct-2011
+
+Description:
+ The first patch release for 1.9.
+
+ Fixes:
+
+ * [JACKSON-687] Problems with PropertyNamingStrategy, property merging
+ (reported by Pascal G)
+
+------------------------------------------------------------------------
+=== History: ===
+------------------------------------------------------------------------
Description:
Another minor release. Major internal rewrite for property introspection; other
big changes to prepare for upcoming 2.0 version, including significant
number of newly deprecated methods.
+1.9.0 [04-Oct-2011]
+
Fixes:
* [JACKSON-539] Incorrect handling of combination of JAXB annotations
@@ -125,10 +139,6 @@
JsonContentClass (deprecated since 1.1)
* Move TokenBufferDeserializer to separate class (from inside StdDeserializer)
-------------------------------------------------------------------------
-=== History: ===
-------------------------------------------------------------------------
-
1.8.4 [25-Jul-2011]
Fixes:
diff --git a/src/mapper/java/org/codehaus/jackson/map/introspect/POJOPropertiesCollector.java b/src/mapper/java/org/codehaus/jackson/map/introspect/POJOPropertiesCollector.java
index 23a8b9b..8c06b84 100644
--- a/src/mapper/java/org/codehaus/jackson/map/introspect/POJOPropertiesCollector.java
+++ b/src/mapper/java/org/codehaus/jackson/map/introspect/POJOPropertiesCollector.java
@@ -655,7 +655,15 @@
if (!name.equals(prop.getName())) {
prop = prop.withName(name);
}
- _properties.put(name, prop);
+ /* As per [JACKSON-687], need to consider case where there may already be
+ * something in there...
+ */
+ POJOPropertyBuilder old = _properties.get(name);
+ if (old == null) {
+ _properties.put(name, prop);
+ } else {
+ old.addAll(prop);
+ }
}
}
diff --git a/src/test/org/codehaus/jackson/map/TestNamingStrategy.java b/src/test/org/codehaus/jackson/map/TestNamingStrategy.java
index 5fda9f2..50ca254 100644
--- a/src/test/org/codehaus/jackson/map/TestNamingStrategy.java
+++ b/src/test/org/codehaus/jackson/map/TestNamingStrategy.java
@@ -134,12 +134,22 @@
}
}
+ // [JACKSON-687]
+ static class LcStrategy extends PropertyNamingStrategy.PropertyNamingStrategyBase
+ {
+ @Override
+ public String translate(String propertyName) {
+ return propertyName.toLowerCase();
+ }
+ }
+
static class RenamedCollectionBean
{
@JsonDeserialize
- private List<String> theValues = Collections.emptyList();
+ private List<String> THEvalues = Collections.emptyList();
- public List<String> getTheValues() { return theValues; }
+ // intentionally odd name, to be renamed by naming strategy
+ public List<String> getTheVALUEs() { return THEvalues; }
}
/*
@@ -206,13 +216,14 @@
}
// For [JACKSON-687]
- public void testJson() throws Exception {
+ public void testJson() throws Exception
+ {
ObjectMapper mapper = new ObjectMapper();
- mapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
+ mapper.setPropertyNamingStrategy(new LcStrategy());
// mapper.disable(DeserializationConfig.Feature.USE_GETTERS_AS_SETTERS);
- RenamedCollectionBean foo = mapper.readValue("{\"the_values\":[\"a\"]}", RenamedCollectionBean.class);
- assertNotNull(foo.getTheValues());
- assertEquals(1, foo.getTheValues().size());
- assertEquals("a", foo.getTheValues().get(0));
+ RenamedCollectionBean foo = mapper.readValue("{\"thevalues\":[\"a\"]}", RenamedCollectionBean.class);
+ assertNotNull(foo.getTheVALUEs());
+ assertEquals(1, foo.getTheVALUEs().size());
+ assertEquals("a", foo.getTheVALUEs().get(0));
}
}
diff --git a/src/test/org/codehaus/jackson/map/TestStdNamingStrategies.java b/src/test/org/codehaus/jackson/map/TestStdNamingStrategies.java
index ca40ddf..35047e3 100644
--- a/src/test/org/codehaus/jackson/map/TestStdNamingStrategies.java
+++ b/src/test/org/codehaus/jackson/map/TestStdNamingStrategies.java
@@ -134,7 +134,8 @@
{"_user_name", "user_name"},
{"_UserName", "user_name"},
{"_User_Name", "user_name"},
- {"UGLY_NAME", "ugly_name"}
+ {"UGLY_NAME", "ugly_name"},
+ {"_Bars", "bars" }
});
private ObjectMapper mapper;