Skip to content

Commit d9fc9c8

Browse files
committed
Merge branch '2.6'
Conflicts: pom.xml
2 parents b8790f7 + 737105e commit d9fc9c8

5 files changed

Lines changed: 31 additions & 19 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Some data-binding types overridden as well (ObjectMapper sub-classed as XmlMappe
2525
</scm>
2626
<properties>
2727
<version.jackson.annotations>2.7.0-rc1</version.jackson.annotations>
28-
<version.jackson.core>2.7.0-rc1</version.jackson.core>
28+
<version.jackson.core>2.7.0-rc2-SNAPSHOT</version.jackson.core>
2929
<version.jackson.jaxb>${version.jackson.core}</version.jackson.jaxb>
3030
<packageVersion.dir>com/fasterxml/jackson/dataformat/xml</packageVersion.dir>
3131
<packageVersion.package>${project.groupId}.xml</packageVersion.package>

release-notes/CREDITS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ Dan Jasek: (oillio@github)
2020

2121
* Contributed #126: Allow specifying properties that should be written as CData
2222
(2.5.0)
23+
24+
Leo Wang (wanglingsong@github)
25+
26+
* Reported #171: `@JacksonXmlRootElement` malfunction in multi-thread environment
27+
(2.6.4)

release-notes/VERSION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Project: jackson-dataformat-xml
1010

1111
2.6.4 (not yet released)
1212

13+
#171: `@JacksonXmlRootElement` malfunction in multi-thread environment
14+
(reported by Leo W)
1315
#172: XML INDENT_OUTPUT property fails to add newline/indent initial elements
1416
(reported by rpatrick00@github)
1517

src/main/java/com/fasterxml/jackson/dataformat/xml/util/XmlRootNameLookup.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,17 @@ public QName findRootName(Class<?> rootType, MapperConfig<?> config)
5151
if (name != null) {
5252
return name;
5353
}
54-
54+
name = _findRootName(rootType, config);
55+
synchronized (_rootNames) {
56+
_rootNames.put(key, name);
57+
}
58+
return name;
59+
}
60+
61+
// NOTE: needed to be synchronized in 2.6.4, but 2.7.0 adds a proper fix
62+
// for annotation introspection hence not needed any more
63+
protected QName _findRootName(Class<?> rootType, MapperConfig<?> config)
64+
{
5565
BeanDescription beanDesc = config.introspectClassAnnotations(rootType);
5666
AnnotationIntrospector intr = config.getAnnotationIntrospector();
5767
AnnotatedClass ac = beanDesc.getClassInfo();
@@ -68,21 +78,16 @@ public QName findRootName(Class<?> rootType, MapperConfig<?> config)
6878
// Should we strip out enclosing class tho? For now, nope:
6979
// one caveat: array simple names end with "[]"; also, "$" needs replacing
7080
localName = StaxUtil.sanitizeXmlTypeName(rootType.getSimpleName());
71-
name = new QName("", localName);
72-
} else {
73-
// Otherwise let's see if there's namespace, too (if we are missing it)
74-
if (ns == null || ns.length() == 0) {
75-
ns = findNamespace(intr, ac);
76-
}
81+
return new QName("", localName);
82+
}
83+
// Otherwise let's see if there's namespace, too (if we are missing it)
84+
if (ns == null || ns.length() == 0) {
85+
ns = findNamespace(intr, ac);
7786
}
7887
if (ns == null) { // some QName impls barf on nulls...
7988
ns = "";
8089
}
81-
name = new QName(ns, localName);
82-
synchronized (_rootNames) {
83-
_rootNames.put(key, name);
84-
}
85-
return name;
90+
return new QName(ns, localName);
8691
}
8792

8893
private String findNamespace(AnnotationIntrospector ai, AnnotatedClass ann)

src/test/java/com/fasterxml/jackson/dataformat/xml/misc/TextValueTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static class Simple
2323
public String text = "something";
2424
}
2525

26-
// [Issue#24]
26+
// [dataformat-xml#24]
2727

2828
static class Main {
2929
@JsonProperty("com.test.stack") public Stack stack;
@@ -56,7 +56,7 @@ static class JAXBStyle
5656
public String value;
5757
}
5858

59-
// [Issue#66]
59+
// [dataformat-xml#66]
6060
static class Issue66Bean
6161
{
6262
@JacksonXmlProperty(isAttribute = true)
@@ -66,7 +66,7 @@ static class Issue66Bean
6666
protected String textValue;
6767
}
6868

69-
// [Issue#72]
69+
// [dataformat-xml#72]
7070

7171
static class TextOnlyBean
7272
{
@@ -130,7 +130,7 @@ public void testIssue24() throws Exception
130130
assertEquals(TEXT, main.stack.slot.value);
131131
}
132132

133-
// for [Issue#36]
133+
// for [dataformat-xml#36]
134134
public void testAlternateTextElementName() throws IOException
135135
{
136136
final String XML = "<JAXBStyle>foo</JAXBStyle>";
@@ -148,7 +148,7 @@ public void testAlternateTextElementName() throws IOException
148148
assertEquals("foo", pojo.value);
149149
}
150150

151-
// [Issue#66], implicit property from "XmlText"
151+
// [dataformat-xml#66], implicit property from "XmlText"
152152
public void testIssue66() throws Exception
153153
{
154154
JacksonXmlModule module = new JacksonXmlModule();
@@ -166,7 +166,7 @@ public void testIssue66() throws Exception
166166
assertEquals(XML, json);
167167
}
168168

169-
// [Issue#72]
169+
// [dataformat-xml#72]
170170
public void testTextOnlyPojo() throws Exception
171171
{
172172
XmlMapper mapper = xmlMapper(true);

0 commit comments

Comments
 (0)