You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mi...@apache.org on 2003/11/25 01:02:09 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/serializer ToTextStream.java

minchau     2003/11/24 16:02:09

  Modified:    java/src/org/apache/xml/serializer ToTextStream.java
  Log:
  
  PR: bugzilla 24278
  Submitted by:	Brian Minchau
  
  Revision  Changes    Path
  1.14      +42 -8     xml-xalan/java/src/org/apache/xml/serializer/ToTextStream.java
  
  Index: ToTextStream.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToTextStream.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ToTextStream.java	23 Oct 2003 15:56:06 -0000	1.13
  +++ ToTextStream.java	25 Nov 2003 00:02:09 -0000	1.14
  @@ -357,11 +357,28 @@
                   }
                   else
                   {
  +                    /* The character is greater than the allowed 
  +                     * maximum value and it is not part of a UTF-16
  +                     * pair that would be put out as a character reference.
  +                     */
                       String encoding = getEncoding();
  -                    String integralValue = Integer.toString(c);
  -                    throw new SAXException(XMLMessages.createXMLMessage(
  -                        XMLErrorResources.ER_ILLEGAL_CHARACTER,
  -                        new Object[]{ integralValue, encoding}));
  +                    if (encoding != null)
  +                    {
  +                        /* The output encoding is known, 
  +                         * so somthing is wrong.
  +                         */ 
  +                        String integralValue = Integer.toString(c);
  +                        throw new SAXException(XMLMessages.createXMLMessage(
  +                            XMLErrorResources.ER_ILLEGAL_CHARACTER,
  +                            new Object[]{ integralValue, encoding}));
  +                    }
  +                    else 
  +                    {
  +                        /* The output encoding is not known,
  +                         * so just write it out as-is.
  +                         */                        
  +                        writer.write(c);
  +                    }
                   }
               }
           }
  @@ -388,11 +405,28 @@
               }
               else
               {
  +                /* The character is greater than the allowed 
  +                 * maximum value and it is not part of a UTF-16
  +                 * pair that would be put out as a character reference.
  +                 */
                   String encoding = getEncoding();
  -                String integralValue = Integer.toString(c);
  -                throw new SAXException(XMLMessages.createXMLMessage(
  -                    XMLErrorResources.ER_ILLEGAL_CHARACTER,
  -                    new Object[]{ integralValue, encoding}));                 
  +                if (encoding != null) 
  +                {
  +                    /* The output encoding is known, 
  +                     * so somthing is wrong.
  +                     */ 
  +                    String integralValue = Integer.toString(c);
  +                    throw new SAXException(XMLMessages.createXMLMessage(
  +                        XMLErrorResources.ER_ILLEGAL_CHARACTER,
  +                        new Object[]{ integralValue, encoding}));
  +                }
  +                else 
  +                {
  +                    /* The output encoding is not known,
  +                     * so just write it out as-is.
  +                     */                        
  +                    writer.write(c);
  +                }                
               }
           }
       }
  
  
  

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