Author: mrglavas Date: Thu Sep 28 22:01:30 2006 New Revision: 451121 URL: http://svn.apache.org/viewvc?view=rev&rev=451121 Log: Fixing JIRA Issue #1198:
http://issues.apache.org/jira/browse/XERCESJ-1198 If hasNext() returns false next() should throw a NoSuchElementException. Both the SAX and DOM XMLStreamReaders were throwing an XMLStreamException instead. Modified: xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java xerces/java/branches/stax-dev/src/org/apache/xerces/stax/SAXXMLStreamReaderImpl.java Modified: xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java?view=diff&rev=451121&r1=451120&r2=451121 ============================================================================== --- xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java (original) +++ xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java Thu Sep 28 22:01:30 2006 @@ -172,8 +172,8 @@ * @throws XMLStreamException if there is an error processing the underlying XML source */ public int next() throws XMLStreamException { - if (hasNext() == false) { - throw new XMLStreamException("No such element!"); + if (!hasNext()) { + throw new NoSuchElementException("No more events in the stream."); } if (curType == XMLStreamConstants.END_ELEMENT) Modified: xerces/java/branches/stax-dev/src/org/apache/xerces/stax/SAXXMLStreamReaderImpl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/stax-dev/src/org/apache/xerces/stax/SAXXMLStreamReaderImpl.java?view=diff&rev=451121&r1=451120&r2=451121 ============================================================================== --- xerces/java/branches/stax-dev/src/org/apache/xerces/stax/SAXXMLStreamReaderImpl.java (original) +++ xerces/java/branches/stax-dev/src/org/apache/xerces/stax/SAXXMLStreamReaderImpl.java Thu Sep 28 22:01:30 2006 @@ -165,12 +165,12 @@ * @throws XMLStreamException if there is an error processing the underlying XML source */ public int next() throws XMLStreamException { - if (hasNext() == false) { + if (!hasNext()) { asp.interrupt(); - throw new XMLStreamException("No such element!"); + throw new NoSuchElementException("No more events in the stream."); } - if(asp.ex != null) { + if (asp.ex != null) { asp.interrupt(); throw new XMLStreamException(asp.ex.getMessage(), asp.ex); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
