Skip to content

Commit

Permalink
Merge branch '2.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 6, 2024
2 parents 1822daf + e6145c3 commit 244e26e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: ./mvnw -B -q -ff -ntp test
- name: Publish code coverage
if: github.event_name != 'pull_request' && matrix.java_version == '8'
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./target/site/jacoco/jacoco.xml
Expand Down
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Project: jackson-databind
String ".05": not a valid representation
(reported by @EAlf91)
(fix by @pjfanning)
#4450: Empty QName deserialized as `null`
(reported by @winfriedgerlach)

2.17.0 (12-Mar-2024)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
*/
public class CoreXMLDeserializers
{
protected final static QName EMPTY_QNAME = QName.valueOf("");

/**
* Data type factories are thread-safe after instantiation (and
* configuration, if any); and since instantion (esp. implementation
* configuration, if any); and since instantiation (esp. implementation
* introspection) can be expensive we better reuse the instance.
*/
final static DatatypeFactory _dataTypeFactory;
Expand Down Expand Up @@ -115,6 +117,14 @@ protected Object _deserialize(String value, DeserializationContext ctxt)
throw new IllegalStateException();
}

@Override
protected Object _deserializeFromEmptyString(DeserializationContext ctxt) {
if (_kind == TYPE_QNAME) {
return EMPTY_QNAME;
}
return super._deserializeFromEmptyString(ctxt);
}

protected XMLGregorianCalendar _gregorianFromDate(DeserializationContext ctxt,
Date d)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public void testQNameDeser() throws Exception
String qstr = qn.toString();
assertEquals(qn, MAPPER.readValue(q(qstr), QName.class),
"Should deserialize to equal QName (exp serialization: '"+qstr+"')");

// [databind#4450]
qn = MAPPER.readValue(q(""), QName.class);
assertNotNull(qn);
assertEquals("", qn.getLocalPart());
}

@Test
Expand Down

0 comments on commit 244e26e

Please sign in to comment.