Skip to content

Commit 5047e90

Browse files
committed
AbstractMarshaller defensively uses DocumentBuilderFactory within synchronized block
Issue: SPR-13935 (cherry picked from commit f61b998)
1 parent cf3e460 commit 5047e90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -130,12 +130,13 @@ public boolean isProcessExternalEntities() {
130130
*/
131131
protected Document buildDocument() {
132132
try {
133+
DocumentBuilder documentBuilder;
133134
synchronized (this.documentBuilderFactoryMonitor) {
134135
if (this.documentBuilderFactory == null) {
135136
this.documentBuilderFactory = createDocumentBuilderFactory();
136137
}
138+
documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
137139
}
138-
DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
139140
return documentBuilder.newDocument();
140141
}
141142
catch (ParserConfigurationException ex) {

0 commit comments

Comments
 (0)