mrglavas    2004/03/11 10:15:18

  Modified:    java/src/org/apache/xerces/impl XMLDocumentScannerImpl.java
                        XMLDocumentFragmentScannerImpl.java
               java/src/org/apache/xerces/xinclude XIncludeHandler.java
               java/src/org/apache/xerces/impl/msg XMLMessages.properties
  Log:
  Further fixes for Bugs #27083 & #27422:

  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27083

  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27422

  

  Report illegal byte sequences for other encodings than UTF-8

  and US-ASCII as fatal errors. Added a generic message for

  other encodings stating that illegal sequences in a given

  encoding are not allowed.
  
  Revision  Changes    Path
  1.42      +22 -1     
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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- XMLDocumentScannerImpl.java       5 Mar 2004 22:17:00 -0000       1.41
  +++ XMLDocumentScannerImpl.java       11 Mar 2004 18:15:17 -0000      1.42
  @@ -16,6 +16,7 @@
   
   package org.apache.xerces.impl;
   
  +import java.io.CharConversionException;
   import java.io.EOFException;
   import java.io.IOException;
   
  @@ -668,11 +669,16 @@
                   // if no XMLDecl, then scan piece of prolog
                   return true;
               }
  +            // encoding errors
               catch (MalformedByteSequenceException e) {
                   fErrorReporter.reportError(e.getDomain(), e.getKey(), 
                       e.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR);
                   return false;
               }
  +            catch (CharConversionException e) {
  +                reportFatalError("CharConversionFailure", null);
  +                return false;
  +            }
               // premature end of file
               catch (EOFException e) {
                   reportFatalError("PrematureEOF", null);
  @@ -836,11 +842,16 @@
                       setDispatcher(fContentDispatcher);
                   }
               }
  +            // encoding errors
               catch (MalformedByteSequenceException e) {
                   fErrorReporter.reportError(e.getDomain(), e.getKey(), 
                       e.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR);
                   return false;
               }
  +            catch (CharConversionException e) {
  +                reportFatalError("CharConversionFailure", null);
  +                return false;
  +            }
               // premature end of file
               catch (EOFException e) {
                   reportFatalError("PrematureEOF", null);
  @@ -949,11 +960,16 @@
                       }
                   } while (complete || again);
               }
  +            // encoding errors
               catch (MalformedByteSequenceException e) {
                   fErrorReporter.reportError(e.getDomain(), e.getKey(), 
                       e.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR);
                   return false;
               }
  +            catch (CharConversionException e) {
  +                reportFatalError("CharConversionFailure", null);
  +                return false;
  +            }
               // premature end of file
               catch (EOFException e) {
                   reportFatalError("PrematureEOF", null);
  @@ -1188,9 +1204,14 @@
                       }
                   } while (complete || again);
               }
  +            // encoding errors
               catch (MalformedByteSequenceException e) {
                   fErrorReporter.reportError(e.getDomain(), e.getKey(), 
                       e.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR);
  +                return false;
  +            }
  +            catch (CharConversionException e) {
  +                reportFatalError("CharConversionFailure", null);
                   return false;
               }
               catch (EOFException e) {
  
  
  
  1.50      +7 -1      
xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java
  
  Index: XMLDocumentFragmentScannerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- XMLDocumentFragmentScannerImpl.java       5 Mar 2004 22:17:00 -0000       1.49
  +++ XMLDocumentFragmentScannerImpl.java       11 Mar 2004 18:15:17 -0000      1.50
  @@ -16,6 +16,7 @@
   
   package org.apache.xerces.impl;
   
  +import java.io.CharConversionException;
   import java.io.EOFException;
   import java.io.IOException;
   
  @@ -1609,9 +1610,14 @@
                       }
                   } while (complete || again);
               }
  +            // encoding errors
               catch (MalformedByteSequenceException e) {
                   fErrorReporter.reportError(e.getDomain(), e.getKey(), 
                       e.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR);
  +                return false;
  +            }
  +            catch (CharConversionException e) {
  +                reportFatalError("CharConversionFailure", null);
                   return false;
               }
               // premature end of file
  
  
  
  1.24      +8 -1      
xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java
  
  Index: XIncludeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- XIncludeHandler.java      4 Mar 2004 22:48:08 -0000       1.23
  +++ XIncludeHandler.java      11 Mar 2004 18:15:18 -0000      1.24
  @@ -15,6 +15,7 @@
    */
   package org.apache.xerces.xinclude;
   
  +import java.io.CharConversionException;
   import java.io.IOException;
   import java.util.Enumeration;
   import java.util.Stack;
  @@ -25,6 +26,7 @@
   import org.apache.xerces.impl.XMLEntityManager;
   import org.apache.xerces.impl.XMLErrorReporter;
   import org.apache.xerces.impl.io.MalformedByteSequenceException;
  +import org.apache.xerces.impl.msg.XMLMessageFormatter;
   import org.apache.xerces.util.AugmentationsImpl;
   import org.apache.xerces.util.IntStack;
   import org.apache.xerces.util.ParserConfigurationSettings;
  @@ -1265,9 +1267,14 @@
                   reader.setErrorReporter(fErrorReporter);
                   reader.parse();
               }
  +            // encoding errors
               catch (MalformedByteSequenceException ex) {
                   fErrorReporter.reportError(ex.getDomain(), ex.getKey(), 
                       ex.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR);
  +            }
  +            catch (CharConversionException e) {
  +                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
  +                    "CharConversionFailure", null, 
XMLErrorReporter.SEVERITY_FATAL_ERROR);
               }
               catch (IOException e) {
                   reportResourceError(
  
  
  
  1.29      +1 -0      
xml-xerces/java/src/org/apache/xerces/impl/msg/XMLMessages.properties
  
  Index: XMLMessages.properties
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/msg/XMLMessages.properties,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XMLMessages.properties    13 Nov 2003 05:21:17 -0000      1.28
  +++ XMLMessages.properties    11 Mar 2004 18:15:18 -0000      1.29
  @@ -120,6 +120,7 @@
           InvalidHighSurrogate = High surrogate bits in UTF-8 sequence must not 
exceed 0x10 but found 0x{0}.
           OperationNotSupported = Operation \"{0}\" not supported by {1} reader.
           InvalidASCII = Byte \"{0}\" is not a member of the (7-bit) ASCII character 
set.
  +        CharConversionFailure = An entity determined to be in a certain encoding 
must not contain sequences illegal in that encoding.
           
   # DTD Messages
   # 2.2 Characters
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to