File tree 3 files changed +30
-2
lines changed
main/java/com/fasterxml/jackson/dataformat/xml/deser
test/java/com/fasterxml/jackson/dataformat/xml/failing
3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -1391,6 +1391,10 @@ protected int _nextToken() throws IOException {
1391
1391
return _xmlTokens .next ();
1392
1392
} catch (XMLStreamException e ) {
1393
1393
return StaxUtil .throwAsParseException (e , this );
1394
+ } catch (IllegalStateException e ) {
1395
+ // 08-Apr-2021, tatu: Should improve on this, wrt better information
1396
+ // on issue.
1397
+ throw new JsonParseException (this , e .getMessage (), e );
1394
1398
}
1395
1399
}
1396
1400
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ public class XmlTokenStream
143
143
*/
144
144
protected String _nextLocalName ;
145
145
protected String _nextNamespaceURI ;
146
-
146
+
147
147
/*
148
148
/**********************************************************************
149
149
/* Life-cycle
@@ -426,7 +426,8 @@ private final int _next() throws XMLStreamException
426
426
throw new IllegalStateException ("Unexpected end-of-input after null token" );
427
427
default :
428
428
}
429
- throw new IllegalStateException ("Unexpected START_ELEMENT after null token" );
429
+ throw new IllegalStateException (
430
+ "Unexpected START_ELEMENT after null token (inside element with 'xsi:nil' attribute)" );
430
431
}
431
432
if (_nextAttributeIndex < _attributeCount ) {
432
433
//System.out.println(" XmlTokenStream._next(): Got attr(s)!");
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .xml .failing ;
2
+
3
+ import com .fasterxml .jackson .databind .JsonNode ;
4
+ import com .fasterxml .jackson .dataformat .xml .XmlMapper ;
5
+ import com .fasterxml .jackson .dataformat .xml .XmlTestBase ;
6
+
7
+ public class XsiNilEnableDisable467Test extends XmlTestBase
8
+ {
9
+ private final static String XSI_NS_DECL = "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" ;
10
+
11
+ private final XmlMapper MAPPER = newMapper ();
12
+
13
+ // [databind#467] / [databind#467]: xsi:nil handling of nested elements etc
14
+ public void testNilAsNodeLeaf () throws Exception
15
+ {
16
+ JsonNode node = MAPPER .readTree (
17
+ "<e>"
18
+ +"<h xmlns:xsi='" +XSI_NS_DECL +"' xsi:nil='true'><child /></h>"
19
+ +"</e>"
20
+ );
21
+ assertNotNull (node );
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments