Skip to content

Commit

Permalink
Merge branch '2.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 31, 2024
2 parents b7d63c0 + 98b67f9 commit 4baed0c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ protected static String decodeXmlClassName(String className)
protected static class XmlClassNameIdResolver
extends ClassNameIdResolver
{
private static final long serialVersionUID = 3L;

public XmlClassNameIdResolver(JavaType baseType, PolymorphicTypeValidator ptv)
{
super(baseType, ptv);
Expand All @@ -158,6 +160,8 @@ public JavaType typeFromId(DatabindContext ctxt, String id) throws JacksonExcept
protected static class XmlMinimalClassNameIdResolver
extends MinimalClassNameIdResolver
{
private static final long serialVersionUID = 3L;

public XmlMinimalClassNameIdResolver(JavaType baseType, PolymorphicTypeValidator ptv)
{
super(baseType, ptv);
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/tools/jackson/dataformat/xml/ser/ToXmlGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,18 @@ public void initGenerator() throws JacksonException
}
_initialized = true;
try {
boolean xmlDeclWritten;
if (Feature.WRITE_XML_1_1.enabledIn(_formatFeatures)) {
_xmlWriter.writeStartDocument("UTF-8", "1.1");
xmlDeclWritten = true;
} else if (Feature.WRITE_XML_DECLARATION.enabledIn(_formatFeatures)) {
_xmlWriter.writeStartDocument("UTF-8", "1.0");
xmlDeclWritten = true;
} else {
return;
xmlDeclWritten = false;
}
// as per [dataformat-xml#172], try adding indentation
if (_xmlPrettyPrinter != null) {
if (xmlDeclWritten && (_xmlPrettyPrinter != null)) {
// ... but only if it is likely to succeed:
if (!_stax2Emulation) {
_xmlPrettyPrinter.writePrologLinefeed(_xmlWriter);
Expand Down Expand Up @@ -476,10 +479,11 @@ public JsonGenerator writeRepeatedPropertyName() throws JacksonException
/* JsonGenerator method overrides
/**********************************************************************
*/

/* Most overrides in this section are just to make methods final,
* to allow better inlining...
*/

@Override
public JsonGenerator writeName(SerializableString name) throws JacksonException {
return writeName(name.getValue());
}

@Override
public JsonGenerator writeName(String name) throws JacksonException
Expand Down Expand Up @@ -663,12 +667,6 @@ public final void _handleEndObject() throws JacksonException
/**********************************************************************
*/

@Override
public JsonGenerator writeName(SerializableString name) throws JacksonException
{
return writeName(name.getValue());
}

@Override
public JsonGenerator writeString(String text) throws JacksonException
{
Expand Down

0 comments on commit 4baed0c

Please sign in to comment.