You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ra...@apache.org on 2002/03/13 14:21:58 UTC

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

rahuls      02/03/13 05:21:57

  Modified:    java/src/org/apache/xerces/impl XMLScanner.java
  Log:
  Fixing bug 7075.
  
  Revision  Changes    Path
  1.13      +14 -1     xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java
  
  Index: XMLScanner.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XMLScanner.java	29 Jan 2002 20:44:02 -0000	1.12
  +++ XMLScanner.java	13 Mar 2002 13:21:57 -0000	1.13
  @@ -96,7 +96,7 @@
    * @author Arnaud  Le Hors, IBM
    * @author Eric Ye, IBM
    *
  - * @version $Id: XMLScanner.java,v 1.12 2002/01/29 20:44:02 neilg Exp $
  + * @version $Id: XMLScanner.java,v 1.13 2002/03/13 13:21:57 rahuls Exp $
    */
   public abstract class XMLScanner 
       implements XMLComponent {
  @@ -365,6 +365,8 @@
           final int STATE_STANDALONE = 2;
           final int STATE_DONE = 3;
           int state = STATE_VERSION;
  +
  +        boolean versionMissingReported = false;
           boolean sawSpace = fEntityScanner.skipSpaces();
           while (fEntityScanner.peekChar() != '?') {
               String name = scanPseudoAttribute(scanningTextDecl, fString);
  @@ -380,12 +382,15 @@
                           version = fString.toString();
                           state = STATE_ENCODING;
                           if (!version.equals("1.0")) {
  +                            // REVISIT: XML REC says we should throw an error in such cases.
  +                            // some may object the throwing of fatalError.
                               reportFatalError("VersionNotSupported", 
                                                new Object[]{version});
                           }
                       }
                       else if (name == fEncodingSymbol) {
                           if (!scanningTextDecl) {
  +                            versionMissingReported = true;
                               reportFatalError("VersionInfoRequired", null);
                           }
                           if (!sawSpace) {
  @@ -470,6 +475,14 @@
           if (!fEntityScanner.skipChar('>')) {
               reportFatalError("XMLDeclUnterminated", null);
   
  +        }
  +        
  +        // If there is no data in the xml decl then we fail to report error 
  +        // for version info above. But, if already the error is reported above 
  +        // and we reach here, maybe continue-after-fatal-error is true, then 
  +        // don't report the same error again.
  +        if (version == null && !versionMissingReported) {
  +            reportFatalError("VersionInfoRequired", null);
           }
   
           // fill in return array
  
  
  

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