AbstractMarshaller defensively uses DocumentBuilderFactory within synchronized block
Issue: SPR-13935
This commit is contained in:
parent
c788a8a260
commit
f61b998447
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -130,12 +130,13 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller {
|
||||||
*/
|
*/
|
||||||
protected Document buildDocument() {
|
protected Document buildDocument() {
|
||||||
try {
|
try {
|
||||||
|
DocumentBuilder documentBuilder;
|
||||||
synchronized (this.documentBuilderFactoryMonitor) {
|
synchronized (this.documentBuilderFactoryMonitor) {
|
||||||
if (this.documentBuilderFactory == null) {
|
if (this.documentBuilderFactory == null) {
|
||||||
this.documentBuilderFactory = createDocumentBuilderFactory();
|
this.documentBuilderFactory = createDocumentBuilderFactory();
|
||||||
}
|
}
|
||||||
|
documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
|
||||||
}
|
}
|
||||||
DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
|
|
||||||
return documentBuilder.newDocument();
|
return documentBuilder.newDocument();
|
||||||
}
|
}
|
||||||
catch (ParserConfigurationException ex) {
|
catch (ParserConfigurationException ex) {
|
||||||
|
|
Loading…
Reference in New Issue