3434 * as constructor argument, or set using a property.
3535 *
3636 * @author Arjen Poutsma
37+ * @author Greg Turnquist
3738 * @see #Wsdl4jDefinition(javax.wsdl.Definition)
3839 * @see #setDefinition(javax.wsdl.Definition)
3940 * @since 1.0.0
@@ -42,9 +43,6 @@ public class Wsdl4jDefinition implements Wsdl11Definition {
4243
4344 private Definition definition ;
4445
45- /** Cached DOM version of the definition */
46- private Document document ;
47-
4846 /** WSDL4J is not thread safe, hence the need for a monitor. */
4947 private final Object monitor = new Object ();
5048
@@ -76,26 +74,23 @@ public Definition getDefinition() {
7674 public void setDefinition (Definition definition ) {
7775 synchronized (monitor ) {
7876 this .definition = definition ;
79- this .document = null ;
8077 }
8178 }
8279
8380 @ Override
8481 public Source getSource () {
8582 synchronized (monitor ) {
8683 Assert .notNull (definition , "definition must not be null" );
87- if (document == null ) {
88- try {
89- WSDLFactory wsdlFactory = WSDLFactory .newInstance ();
90- WSDLWriter wsdlWriter = wsdlFactory .newWSDLWriter ();
91- document = wsdlWriter .getDocument (definition );
92- }
93- catch (WSDLException ex ) {
94- throw new WsdlDefinitionException (ex .getMessage (), ex );
95- }
84+ try {
85+ WSDLFactory wsdlFactory = WSDLFactory .newInstance ();
86+ WSDLWriter wsdlWriter = wsdlFactory .newWSDLWriter ();
87+ Document document = wsdlWriter .getDocument (definition );
88+ return new DOMSource (document );
89+ }
90+ catch (WSDLException ex ) {
91+ throw new WsdlDefinitionException (ex .getMessage (), ex );
9692 }
9793 }
98- return new DOMSource (document );
9994 }
10095
10196 public String toString () {
0 commit comments