Skip to content

Commit ca1c671

Browse files
committed
minor backwards compatibility imrpovement wrt getOutputContext() between 2.7 and 2.8
1 parent 43ec2dd commit ca1c671

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

release-notes/VERSION

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Project: jackson-dataformat-xml
88

99
No changes since 2.7.
1010

11+
2.7.5 (not yet released)
12+
13+
No changes since 2.7.4
14+
1115
2.7.4 (29-Apr-2016)
1216

1317
#178: Problem with polymorphic serialization, inclusion type of

src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ public ToXmlGenerator configure(Feature f, boolean state) {
310310
return this;
311311
}
312312

313+
// @since 2.7.5
314+
public boolean inRoot() {
315+
return _writeContext.inRoot();
316+
}
317+
313318
/*
314319
/**********************************************************
315320
/* Extended API, access to some internal components
@@ -1070,7 +1075,12 @@ public void close() throws IOException
10701075
if (isEnabled(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT)) {
10711076
try {
10721077
while (true) {
1073-
JsonStreamContext ctxt = getOutputContext();
1078+
/* 28-May-2016, tatu: To work around incompatibility introduced by
1079+
* `jackson-core` 2.8 where return type of `getOutputContext()`
1080+
* changed, let's do direct access here.
1081+
*/
1082+
// JsonStreamContext ctxt = getOutputContext();
1083+
JsonStreamContext ctxt = _writeContext;
10741084
if (ctxt.inArray()) {
10751085
writeEndArray();
10761086
} else if (ctxt.inObject()) {

src/main/java/com/fasterxml/jackson/dataformat/xml/ser/XmlSerializerProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ protected void _startRootArray(ToXmlGenerator xgen, QName rootName) throws IOExc
214214
protected void _initWithRootName(ToXmlGenerator xgen, QName rootName) throws IOException
215215
{
216216
/* 28-Nov-2012, tatu: We should only initialize the root
217-
* name if no name has been set, as per [Issue#42],
217+
* name if no name has been set, as per [dataformat-xml#42],
218218
* to allow for custom serializers to work.
219219
*/
220220
if (!xgen.setNextNameIfMissing(rootName)) {
221221
// however, if we are root, we... insist
222-
if (xgen.getOutputContext().inRoot()) {
222+
if (xgen.inRoot()) {
223223
xgen.setNextName(rootName);
224224
}
225225
}

0 commit comments

Comments
 (0)