Skip to content

Commit 6b6a5ed

Browse files
committed
Merge branch '2.11'
2 parents f925f3a + 091cef7 commit 6b6a5ed

File tree

5 files changed

+47
-22
lines changed

5 files changed

+47
-22
lines changed

release-notes/CREDITS-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,11 @@ Stefan Wendt (stewe@github)
10131013
* Reported #2560: Check `WRAP_EXCEPTIONS` in `CollectionDeserializer.handleNonArray()`
10141014
(2.10.2)
10151015
1016+
Greg Arakelian (arakelian@github)
1017+
* Reported #2566: `MissingNode.toString()` returns `null` (4 character token) instead
1018+
of empty string
1019+
(2.10.2)
1020+
10161021
Máté Rédecsi (rmatesz@github)
10171022
* Reported #953: i-I case convertion problem in Turkish locale with case-insensitive deserialization
10181023
(2.11.0)

release-notes/VERSION-2.x

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ Project: jackson-databind
4040
#2560: Check `WRAP_EXCEPTIONS` in `CollectionDeserializer.handleNonArray()`
4141
(reported by Stefan W)
4242
#2564: Fix `IllegalArgumentException` on empty input collection for `ArrayBlockingQueue`
43-
(repoted, fix suggested by yamert89@github)
43+
(reported, fix suggested by yamert89@github)
44+
#2566: `MissingNode.toString()` returns `null` (4 character token) instead of empty string
45+
(reported by Greg A)
4446
#2567: Incorrect target type for arrays when providing nulls and nulls are disabled
4547
(reported by João G)
4648

src/main/java/com/fasterxml/jackson/databind/node/BaseJsonNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public abstract void serializeWithType(JsonGenerator jgen, SerializerProvider pr
135135

136136
/*
137137
/**********************************************************
138-
/* Std method overrides
138+
/* Standard method overrides
139139
/**********************************************************
140140
*/
141141

src/main/java/com/fasterxml/jackson/databind/node/MissingNode.java

+35-19
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,6 @@ public void serializeWithType(JsonGenerator g, SerializerProvider provider,
8686
{
8787
g.writeNull();
8888
}
89-
90-
@Override
91-
public boolean equals(Object o)
92-
{
93-
/* Hmmh. Since there's just a singleton instance, this
94-
* fails in all cases but with identity comparison.
95-
* However: if this placeholder value was to be considered
96-
* similar to SQL NULL, it shouldn't even equal itself?
97-
* That might cause problems when dealing with collections
98-
* like Sets... so for now, let's let identity comparison
99-
* return true.
100-
*/
101-
return (o == this);
102-
}
10389

10490
@SuppressWarnings("unchecked")
10591
@Override
@@ -113,11 +99,6 @@ public JsonNode requireNonNull() {
11399
return _reportRequiredViolation("requireNonNull() called on `MissingNode`");
114100
}
115101

116-
@Override
117-
public int hashCode() {
118-
return JsonNodeType.MISSING.ordinal();
119-
}
120-
121102
@Override
122103
public JsonNode get(int index) {
123104
return null;
@@ -158,4 +139,39 @@ public List<String> findValuesAsText(String fieldName, List<String> foundSoFar)
158139
public List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar) {
159140
return foundSoFar;
160141
}
142+
143+
/*
144+
/**********************************************************
145+
/* Standard method overrides
146+
/**********************************************************
147+
*/
148+
149+
@Override
150+
public boolean equals(Object o)
151+
{
152+
// Hmmh. Since there's just a singleton instance, this fails in all cases
153+
// but with identity comparison.
154+
// However: if this placeholder value was to be considered similar to SQL NULL,
155+
// it shouldn't even equal itself?
156+
// That might cause problems when dealing with collections like Sets...
157+
// so for now, let's let identity comparison return true.
158+
return (o == this);
159+
}
160+
161+
@Override
162+
public int hashCode() {
163+
return JsonNodeType.MISSING.ordinal();
164+
}
165+
166+
// 10-Dec-2019, tatu: Bit tricky case, see [databind#2566], but seems
167+
// best NOT to produce legit JSON.
168+
@Override
169+
public String toString() {
170+
return "";
171+
}
172+
173+
@Override
174+
public String toPrettyString() {
175+
return "";
176+
}
161177
}

src/test/java/com/fasterxml/jackson/databind/node/TestMissingNode.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public void testMissing()
1616
assertEquals("", n.asText());
1717
assertStandardEquals(n);
1818
// 10-Dec-2018, tatu: With 2.10, should serialize same as via ObjectMapper/ObjectWriter
19-
assertEquals("null", n.toString());
19+
// 10-Dec-2019, tatu: Surprise! No, this is not how it worked in 2.9, nor does it make
20+
// sense... see [databind#2566] for details
21+
assertEquals("", n.toString());
2022

2123
assertNodeNumbersForNonNumeric(n);
2224

0 commit comments

Comments
 (0)