morten      01/12/05 03:27:50

  Modified:    java/src/org/apache/xalan/xsltc/compiler Output.java
               java/src/org/apache/xalan/xsltc/compiler/util
                        ErrorMessages.java ErrorMessages_no.java
                        ErrorMsg.java
               java/src/org/apache/xalan/xsltc/runtime TextOutput.java
  Log:
  Added a warning message for unsupported output encodings.
  PR:           bugzilla 5139
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.11      +15 -2     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Output.java
  
  Index: Output.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Output.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Output.java       2001/10/30 08:42:55     1.10
  +++ Output.java       2001/12/05 11:27:50     1.11
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Output.java,v 1.10 2001/10/30 08:42:55 morten Exp $
  + * @(#)$Id: Output.java,v 1.11 2001/12/05 11:27:50 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -67,6 +67,7 @@
   import java.util.Vector;
   import java.util.Enumeration;
   import java.util.StringTokenizer;
  +import java.io.OutputStreamWriter;
   
   import de.fub.bytecode.generic.*;
   import de.fub.bytecode.classfile.JavaClass;
  @@ -149,7 +150,19 @@
   
        // Get the output encoding - any value accepted here
        _encoding = getAttribute("encoding");
  -     if (_encoding.equals(Constants.EMPTYSTRING)) _encoding = null;
  +     if (_encoding.equals(Constants.EMPTYSTRING))
  +         _encoding = null;
  +     else {
  +         try {
  +             OutputStreamWriter writer =
  +                 new OutputStreamWriter(System.out, _encoding);
  +         }
  +         catch (java.io.UnsupportedEncodingException e) {
  +             ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_ENCODING,
  +                                         _encoding, this);
  +             parser.reportError(Constants.WARNING, msg);
  +         }
  +     }
   
        // Should the XML header be omitted - translate to true/false
        attrib = getAttribute("omit-xml-declaration");
  
  
  
  1.5       +4 -3      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java
  
  Index: ErrorMessages.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ErrorMessages.java        2001/11/08 11:38:18     1.4
  +++ ErrorMessages.java        2001/12/05 11:27:50     1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ErrorMessages.java,v 1.4 2001/11/08 11:38:18 morten Exp $
  + * @(#)$Id: ErrorMessages.java,v 1.5 2001/12/05 11:27:50 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -247,8 +247,9 @@
        "         The -s option disables calling System.exit.",
   
        // STRAY_SORT_ERR
  -     "<xsl:sort> can only be used within <xsl:for-each> or 
<xsl:apply-templates>."
  -
  +     "<xsl:sort> can only be used within <xsl:for-each> or 
<xsl:apply-templates>.",
  +     // UNSUPPORTED_ENCODING
  +     "Output encoding ''{0}'' is not supported on this JVM."
       };
   
       private static Vector _keys;
  
  
  
  1.5       +4 -3      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_no.java
  
  Index: ErrorMessages_no.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_no.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ErrorMessages_no.java     2001/11/08 11:38:18     1.4
  +++ ErrorMessages_no.java     2001/12/05 11:27:50     1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ErrorMessages_no.java,v 1.4 2001/11/08 11:38:18 morten Exp $
  + * @(#)$Id: ErrorMessages_no.java,v 1.5 2001/12/05 11:27:50 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -247,8 +247,9 @@
        "         -s blokkerer alle kall til System.exit().",
   
        // STRAY_SORT_ERR
  -     "<xsl:sort> kan bare brukes under <xsl:for-each> eller 
<xsl:apply-templates>."
  -
  +     "<xsl:sort> kan bare brukes under <xsl:for-each> eller 
<xsl:apply-templates>.",
  +     // UNSUPPORTED_ENCODING
  +     "Karaktersett ''{0}'' er ikke st\u00f8ttet av denne JVM."
       };
   
       public Object handleGetObject(String key) {
  
  
  
  1.12      +2 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java
  
  Index: ErrorMsg.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ErrorMsg.java     2001/11/08 11:38:18     1.11
  +++ ErrorMsg.java     2001/12/05 11:27:50     1.12
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ErrorMsg.java,v 1.11 2001/11/08 11:38:18 morten Exp $
  + * @(#)$Id: ErrorMsg.java,v 1.12 2001/12/05 11:27:50 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -164,6 +164,7 @@
   
       // Recently added error messages
       public static final int STRAY_SORT_ERR          = 74;
  +    public static final int UNSUPPORTED_ENCODING    = 75;
   
       // All error messages are localized and are stored in resource bundles.
       // This array and the following 4 strings are read from that bundle.
  
  
  
  1.45      +2 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java
  
  Index: TextOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- TextOutput.java   2001/11/22 13:08:23     1.44
  +++ TextOutput.java   2001/12/05 11:27:50     1.45
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TextOutput.java,v 1.44 2001/11/22 13:08:23 morten Exp $
  + * @(#)$Id: TextOutput.java,v 1.45 2001/12/05 11:27:50 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -998,7 +998,7 @@
            if ((_outputType == HTML) || (_outputType == XML))
                _escapeChars = true;
            if (_encoding == null)
  -             _encoding = "UTF-8";
  +             _encoding = "UTF-8";
            if (_saxHandler instanceof DefaultSAXOutputHandler)
                ((DefaultSAXOutputHandler)_saxHandler).setOutputType(type);
        }
  
  
  

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

Reply via email to