Skip to content

Commit 1f39a6c

Browse files
authored
Merge branch '3.x' into fix-650
2 parents 271d244 + 64d892b commit 1f39a6c

File tree

3 files changed

+11
-50
lines changed

3 files changed

+11
-50
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ jobs:
8282
generate-summary: true
8383
- name: Add coverage comment to PR
8484
if: ${{ matrix.release_build && github.event_name == 'pull_request' }}
85+
continue-on-error: true
8586
run: |
8687
# Convert decimal to percentage and round to 1 decimal place
8788
COVERAGE=$(awk -v cov="${{ steps.jacoco.outputs.coverage }}" 'BEGIN { printf "%.1f", cov * 100 }')
@@ -117,10 +118,10 @@ jobs:
117118
COMMENT_ID=$(gh pr view ${{ github.event.pull_request.number }} --json comments --jq '.comments[] | select(.body | contains("<!-- jacoco-coverage-comment -->")) | .id' | head -1)
118119
119120
if [ -n "$COMMENT_ID" ]; then
120-
gh api -X DELETE "repos/${{ github.repository }}/issues/comments/$COMMENT_ID"
121+
gh api -X DELETE "repos/${{ github.repository }}/issues/comments/$COMMENT_ID" || true
121122
fi
122123
123-
# Post new comment
124+
# Post new comment (may fail for PRs from forks due to permissions)
124125
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT_BODY"
125126
env:
126127
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

src/main/java/tools/jackson/databind/deser/jdk/UntypedObjectDeserializerNR.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -353,48 +353,6 @@ protected Object _deserializeFP(JsonParser p, DeserializationContext ctxt)
353353
}
354354
return p.getDoubleValue();
355355
}
356-
357-
// NOTE: copied from above (alas, no easy way to share/reuse)
358-
// @since 2.12 (wrt [databind#2733]
359-
protected Object _mapObjectWithDups(JsonParser p, DeserializationContext ctxt,
360-
final Map<String, Object> result, String initialKey,
361-
Object oldValue, Object newValue, String nextKey)
362-
throws JacksonException
363-
{
364-
final boolean squashDups = ctxt.isEnabled(StreamReadCapability.DUPLICATE_PROPERTIES);
365-
366-
if (squashDups) {
367-
_squashDups(result, initialKey, oldValue, newValue);
368-
}
369-
370-
while (nextKey != null) {
371-
p.nextToken();
372-
newValue = deserialize(p, ctxt);
373-
oldValue = result.put(nextKey, newValue);
374-
if ((oldValue != null) && squashDups) {
375-
_squashDups(result, nextKey, oldValue, newValue);
376-
}
377-
nextKey = p.nextName();
378-
}
379-
380-
return result;
381-
}
382-
383-
// NOTE: copied from above (alas, no easy way to share/reuse)
384-
@SuppressWarnings("unchecked")
385-
private void _squashDups(final Map<String, Object> result, String key,
386-
Object oldValue, Object newValue)
387-
{
388-
if (oldValue instanceof List<?>) {
389-
((List<Object>) oldValue).add(newValue);
390-
result.put(key, oldValue);
391-
} else {
392-
ArrayList<Object> l = new ArrayList<>();
393-
l.add(oldValue);
394-
l.add(newValue);
395-
result.put(key, l);
396-
}
397-
}
398356

399357
/*
400358
/**********************************************************************

src/test/java/tools/jackson/databind/interop/UntypedObjectWithDupsTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ static class StringStringMap extends LinkedHashMap<String,String> { };
2424
private final String DOC_WITH_DUPS = a2q(
2525
"{'hello': 'world',\n"
2626
+ "'lists' : 1,\n"
27-
+ "'lists' : 2,\n"
27+
+ "'lists' : 2.5,\n"
2828
+ "'lists' : {\n"
2929
+ " 'inner' : 'internal',\n"
3030
+ " 'time' : 123\n"
3131
+ "},\n"
32-
+ "'lists' : 3,\n"
33-
+ "'single' : 'one'\n"
32+
+ "'lists' : true,\n"
33+
+ "'single' : 'one',\n"
34+
+ "'lists' : false,\n"
35+
+ "'lists' : null\n"
3436
+ "}");
3537

3638
// Testing the baseline non-merging behavior
@@ -84,7 +86,7 @@ private <T> void _verifyDupsNoMerging(Class<T> cls) throws Exception
8486

8587
String json = JSON_MAPPER.writeValueAsString(value);
8688
assertEquals(a2q(
87-
"{'hello':'world','lists':3,'single':'one'}"),
89+
"{'hello':'world','lists':null,'single':'one'}"),
8890
json);
8991
}
9092

@@ -94,8 +96,8 @@ private <T> void _verifyDupsNoMerging(Class<T> cls) throws Exception
9496
private void _verifyDupsAreMerged(Class<?> cls) throws Exception
9597
{
9698
assertEquals(a2q(
97-
"{'hello':'world','lists':[1,2,"
98-
+"{'inner':'internal','time':123},3],'single':'one'}"),
99+
"{'hello':'world','lists':[1,2.5,"
100+
+"{'inner':'internal','time':123},true,false,null],'single':'one'}"),
99101
_readWriteDupDoc(DOC_WITH_DUPS, cls));
100102
}
101103

0 commit comments

Comments
 (0)