Author: barrettj Date: Mon Dec 7 19:52:14 2009 New Revision: 888109 URL: http://svn.apache.org/viewvc?rev=888109&view=rev Log: Override getOMFactory in OMDocumentImpl. This allows OMDocumentImpl constructors that don't take an OMFactory parameter to return a valid OMFactory.
Revision 786706 refactored getOMFactory into superclass OMSerializableImpl. The other subclass, OMNodeImpl, always takes an OMFactory as a parameter to its constructors, so it doesn't have the same problem. OMDocumentImpl has several constructors such as OMDocumentImpl(OMXMLParserWrapper) that do not take have a factory parameter so the value can not be set in the superclass during construction. For those code paths, the factory needs to be gotten at a later time. Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java?rev=888109&r1=888108&r2=888109&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java Mon Dec 7 19:52:14 2009 @@ -112,6 +112,12 @@ this.factory = factory; } + public OMFactory getOMFactory() { + if (factory == null) { + factory = this.getOMDocumentElement().getOMFactory(); + } + return factory; + } /** * Method getDocumentElement. Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java?rev=888109&r1=888108&r2=888109&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java Mon Dec 7 19:52:14 2009 @@ -48,7 +48,7 @@ protected OMFactory factory; - public final OMFactory getOMFactory() { + public OMFactory getOMFactory() { return factory; }