You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2002/10/09 23:12:11 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl XMLDocumentScannerImpl.java

neilg       2002/10/09 14:12:11

  Modified:    java/src/org/apache/xerces/impl XMLDocumentScannerImpl.java
  Log:
  formerly, if Xerces encountered a file where the end-tag of the root element was repeated, it would enter an infinite loop and only stop when the JVM ran out of memory.  This commit fixes this problem.
  
  Revision  Changes    Path
  1.28      +16 -9     xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java
  
  Index: XMLDocumentScannerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- XMLDocumentScannerImpl.java	4 Oct 2002 21:49:51 -0000	1.27
  +++ XMLDocumentScannerImpl.java	9 Oct 2002 21:12:11 -0000	1.28
  @@ -662,7 +662,8 @@
               // premature end of file
               catch (EOFException e) {
                   reportFatalError("PrematureEOF", null);
  -                throw e;
  +                return false;
  +                //throw e;
               }
   
   
  @@ -817,7 +818,8 @@
               // premature end of file
               catch (EOFException e) {
                   reportFatalError("PrematureEOF", null);
  -                throw e;
  +                return false;
  +                //throw e;
               }
   
               return true;
  @@ -925,7 +927,8 @@
               // premature end of file
               catch (EOFException e) {
                   reportFatalError("PrematureEOF", null);
  -                throw e;
  +                return false;
  +                //throw e;
               }
   
               // cleanup
  @@ -1095,14 +1098,17 @@
                                   setScannerState(SCANNER_STATE_COMMENT);
                                   again = true;
                               }
  -                            /***
  -                            // REVISIT: Should we detect this?
  +                            else if (fEntityScanner.skipChar('/')) {
  +                                reportFatalError("MarkupNotRecognizedInMisc",
  +                                                 null);
  +                                again = true;
  +                            }
                               else if (XMLChar.isNameStart(fEntityScanner.peekChar())) {
                                   reportFatalError("MarkupNotRecognizedInMisc",
                                                    null);
  -                                // REVISIT: continue after fatal error
  +                                scanStartElement();
  +                                setScannerState(SCANNER_STATE_CONTENT);
                               }
  -                            /***/
                               else {
                                   reportFatalError("MarkupNotRecognizedInMisc",
                                                    null);
  @@ -1152,7 +1158,8 @@
                   //       end of file was reached prematurely.
                   if (fMarkupDepth != 0) {
                       reportFatalError("PrematureEOF", null);
  -                    throw e;
  +                    return false;
  +                    //throw e;
                   }
   
                   setScannerState(SCANNER_STATE_TERMINATED);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org