Author: veithen Date: Wed Apr 28 18:00:04 2010 New Revision: 939032 URL: http://svn.apache.org/viewvc?rev=939032&view=rev Log: Moved EmptyOMLocation to org.apache.axiom.util.stax and renamed it to DummyLocation. Also made it a singleton: no need to create a new instance on every call of XMLStreamReader#getLocation().
Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/DummyLocation.java - copied, changed from r937773, webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java?rev=939032&r1=939031&r2=939032&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java Wed Apr 28 18:00:04 2010 @@ -19,29 +19,10 @@ package org.apache.axiom.om.impl; -import javax.xml.stream.Location; - -public class EmptyOMLocation implements Location { - - - public int getLineNumber() { - return -1; //To change body of implemented methods use File | Settings | File Templates. - } - - public int getColumnNumber() { - return -1; //To change body of implemented methods use File | Settings | File Templates. - } - - public int getCharacterOffset() { - return 0; //To change body of implemented methods use File | Settings | File Templates. - } - - public String getPublicId() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public String getSystemId() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } +import org.apache.axiom.util.stax.DummyLocation; +/** + * @deprecated use {...@link DummyLocation#INSTANCE} instead + */ +public class EmptyOMLocation extends DummyLocation { } Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java?rev=939032&r1=939031&r2=939032&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java Wed Apr 28 18:00:04 2010 @@ -48,13 +48,13 @@ import org.apache.axiom.om.OMProcessingI import org.apache.axiom.om.OMSourcedElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.OMXMLParserWrapper; -import org.apache.axiom.om.impl.EmptyOMLocation; import org.apache.axiom.om.impl.OMNavigator; import org.apache.axiom.om.impl.builder.DataHandlerReaderUtils; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.impl.exception.OMStreamingException; import org.apache.axiom.om.impl.util.NamespaceContextImpl; import org.apache.axiom.util.stax.AbstractXMLStreamReader; +import org.apache.axiom.util.stax.DummyLocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -1146,7 +1146,7 @@ class SwitchingWrapper extends AbstractX * @return Returns Location. */ public Location getLocation() { - return new EmptyOMLocation(); + return DummyLocation.INSTANCE; } /** Copied: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/DummyLocation.java (from r937773, webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java) URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/DummyLocation.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/DummyLocation.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java&r1=937773&r2=939032&rev=939032&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/DummyLocation.java Wed Apr 28 18:00:04 2010 @@ -17,31 +17,38 @@ * under the License. */ -package org.apache.axiom.om.impl; +package org.apache.axiom.util.stax; import javax.xml.stream.Location; -public class EmptyOMLocation implements Location { - +/** + * Dummy {...@link Location} implementation. It always returns -1 for the location + * and <code>null</code> for the publicId and systemId. It may be used by + * {...@link javax.xml.stream.XMLStreamReader} implementations that don't support + * the concept of location. + */ +public class DummyLocation implements Location { + public static final DummyLocation INSTANCE = new DummyLocation(); + protected DummyLocation() {} + public int getLineNumber() { - return -1; //To change body of implemented methods use File | Settings | File Templates. + return -1; } public int getColumnNumber() { - return -1; //To change body of implemented methods use File | Settings | File Templates. + return -1; } public int getCharacterOffset() { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return 0; } public String getPublicId() { - return null; //To change body of implemented methods use File | Settings | File Templates. + return null; } public String getSystemId() { - return null; //To change body of implemented methods use File | Settings | File Templates. + return null; } - }