You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/02/07 22:37:50 UTC
svn commit: r1729039 -
/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
Author: veithen
Date: Sun Feb 7 21:37:50 2016
New Revision: 1729039
URL: http://svn.apache.org/viewvc?rev=1729039&view=rev
Log:
Remove dead code.
Modified:
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java?rev=1729039&r1=1729038&r2=1729039&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java Sun Feb 7 21:37:50 2016
@@ -498,79 +498,73 @@ public class StAXOMBuilder extends Abstr
if (!builderHandler.cache) {
throw new IllegalStateException("Can't process next node because caching is disabled");
}
- // We need a loop here because we may decide to skip an event
- while (true) {
- if (builderHandler.done) {
- throw new OMException();
- }
- int token = parserNext();
- if (!builderHandler.cache) {
- return token;
- }
-
- // Note: if autoClose is enabled, then the parser may be null at this point
-
- try {
- switch (token) {
- case XMLStreamConstants.START_DOCUMENT:
- handler.startDocument(charEncoding, parser.getVersion(), parser.getCharacterEncodingScheme(), parser.isStandalone());
- break;
- case XMLStreamConstants.START_ELEMENT: {
- createNextOMElement();
- break;
- }
- case XMLStreamConstants.CHARACTERS:
- case XMLStreamConstants.CDATA:
- case XMLStreamConstants.SPACE:
- createOMText(token);
- break;
- case XMLStreamConstants.END_ELEMENT:
- handler.endElement();
- break;
- case XMLStreamConstants.END_DOCUMENT:
- handler.endDocument();
- break;
- case XMLStreamConstants.COMMENT:
- handler.processComment(parser.getText());
- break;
- case XMLStreamConstants.DTD:
- createDTD();
- break;
- case XMLStreamConstants.PROCESSING_INSTRUCTION:
- handler.processProcessingInstruction(parser.getPITarget(), parser.getPIData());
- break;
- case XMLStreamConstants.ENTITY_REFERENCE:
- handler.processEntityReference(parser.getLocalName(), parser.getText());
- break;
- default :
- throw new OMException();
+ if (builderHandler.done) {
+ throw new OMException();
+ }
+ int token = parserNext();
+
+ // Note: if autoClose is enabled, then the parser may be null at this point
+
+ try {
+ switch (token) {
+ case XMLStreamConstants.START_DOCUMENT:
+ handler.startDocument(charEncoding, parser.getVersion(), parser.getCharacterEncodingScheme(), parser.isStandalone());
+ break;
+ case XMLStreamConstants.START_ELEMENT: {
+ createNextOMElement();
+ break;
}
- } catch (StreamException ex) {
- throw new OMException(ex);
+ case XMLStreamConstants.CHARACTERS:
+ case XMLStreamConstants.CDATA:
+ case XMLStreamConstants.SPACE:
+ createOMText(token);
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ handler.endElement();
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ handler.endDocument();
+ break;
+ case XMLStreamConstants.COMMENT:
+ handler.processComment(parser.getText());
+ break;
+ case XMLStreamConstants.DTD:
+ createDTD();
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ handler.processProcessingInstruction(parser.getPITarget(), parser.getPIData());
+ break;
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ handler.processEntityReference(parser.getLocalName(), parser.getText());
+ break;
+ default :
+ throw new OMException();
}
-
- // TODO: this will fail if there is whitespace before the document element
- if (token != XMLStreamConstants.START_DOCUMENT && builderHandler.target == null && !builderHandler.done) {
- // We get here if the document has been discarded (by getDocumentElement(true)
- // or because the builder is linked to an OMSourcedElement) and
- // we just processed the END_ELEMENT event for the root element. In this case, we consume
- // the remaining events until we reach the end of the document. This serves several purposes:
- // * It allows us to detect documents that have an epilog that is not well formed.
- // * Many parsers will perform some cleanup when the end of the document is reached.
- // For example, Woodstox will recycle the symbol table if the parser gets past the
- // last END_ELEMENT. This improves performance because Woodstox by default interns
- // all symbols; if the symbol table can be recycled, then this reduces the number of
- // calls to String#intern().
- // * If autoClose is set, the parser will be closed so that even more resources
- // can be released.
- while (parserNext() != XMLStreamConstants.END_DOCUMENT) {
- // Just loop
- }
- builderHandler.done = true;
+ } catch (StreamException ex) {
+ throw new OMException(ex);
+ }
+
+ // TODO: this will fail if there is whitespace before the document element
+ if (token != XMLStreamConstants.START_DOCUMENT && builderHandler.target == null && !builderHandler.done) {
+ // We get here if the document has been discarded (by getDocumentElement(true)
+ // or because the builder is linked to an OMSourcedElement) and
+ // we just processed the END_ELEMENT event for the root element. In this case, we consume
+ // the remaining events until we reach the end of the document. This serves several purposes:
+ // * It allows us to detect documents that have an epilog that is not well formed.
+ // * Many parsers will perform some cleanup when the end of the document is reached.
+ // For example, Woodstox will recycle the symbol table if the parser gets past the
+ // last END_ELEMENT. This improves performance because Woodstox by default interns
+ // all symbols; if the symbol table can be recycled, then this reduces the number of
+ // calls to String#intern().
+ // * If autoClose is set, the parser will be closed so that even more resources
+ // can be released.
+ while (parserNext() != XMLStreamConstants.END_DOCUMENT) {
+ // Just loop
}
-
- return token;
+ builderHandler.done = true;
}
+
+ return token;
}
/**