myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bara...@apache.org
Subject svn commit: r278740 - /myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImpl.java
Date Mon, 05 Sep 2005 14:08:21 GMT
Author: baranda
Date: Mon Sep  5 07:08:17 2005
New Revision: 278740

URL: http://svn.apache.org/viewcvs?rev=278740&view=rev
Log:
Fix for MYFACES-499

Modified:
    myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImpl.java

Modified: myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImpl.java
URL: http://svn.apache.org/viewcvs/myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImpl.java?rev=278740&r1=278739&r2=278740&view=diff
==============================================================================
--- myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImpl.java
(original)
+++ myfaces/share/trunk/src/java/org/apache/myfaces/renderkit/html/HtmlResponseWriterImpl.java
Mon Sep  5 07:08:17 2005
@@ -25,10 +25,12 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.faces.FacesException;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.util.HashSet;
 import java.util.Set;
@@ -77,6 +79,7 @@
     }
 
     public HtmlResponseWriterImpl(Writer writer, String contentType, String characterEncoding)
+    throws FacesException
     {
         _writer = writer;
         _contentType = contentType;
@@ -90,6 +93,18 @@
         {
             if (log.isInfoEnabled()) log.debug("No character encoding given, using default
character encoding " + DEFAULT_CHARACTER_ENCODING);
             _characterEncoding = DEFAULT_CHARACTER_ENCODING;
+        } 
+        else
+        {
+            // validates the encoding, it will throw an UnsupportedEncodingException if it
the encoding is invalid
+            try
+            {
+                new String("myfaces".getBytes(), characterEncoding);
+            }
+            catch (UnsupportedEncodingException e)
+            {
+                throw new IllegalArgumentException("Unsupported encoding: "+characterEncoding);
+            }
         }
     }
 



Mime
View raw message