Skip to content

Commit

Permalink
AbstractMarshaller defensively uses DocumentBuilderFactory within syn…
Browse files Browse the repository at this point in the history
…chronized block

Issue: SPR-13935
  • Loading branch information
jhoeller committed Feb 10, 2016
1 parent c788a8a commit f61b998
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -130,12 +130,13 @@ public boolean isProcessExternalEntities() {
*/
protected Document buildDocument() {
try {
DocumentBuilder documentBuilder;
synchronized (this.documentBuilderFactoryMonitor) {
if (this.documentBuilderFactory == null) {
this.documentBuilderFactory = createDocumentBuilderFactory();
}
documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
}
DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
return documentBuilder.newDocument();
}
catch (ParserConfigurationException ex) {
Expand Down

0 comments on commit f61b998

Please sign in to comment.