UnsupportedEncodingException thrown when using Resin and Grails
        Posted  
        
            by knorv
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by knorv
        
        
        
        Published on 2010-05-01T10:10:17Z
        Indexed on 
            2010/05/01
            10:17 UTC
        
        
        Read the original article
        Hit count: 394
        
I've encountered a strange problem in a Grails webapp running under Grails:
java.io.UnsupportedEncodingException is thrown quite frequently due to various unknown encoding strings (such as "ISO8859_10", "ISO-8859-10"), and the strange thing is that this is done entirely within the Resin and Grails code. That is - no custom code is involved when the exception is thrown.
I'm not sure if it is Grails or the servlet container's code that should handle the exception. But I'd assume that the exception should be handled somewhere and not bubble up all the way to stderr.
This is the exception in full:
java.io.UnsupportedEncodingException: ISO-8859-10
  at com.caucho.vfs.i18n.JDKWriter$OutputStreamEncodingWriter.<init>(JDKWriter.java:112)
  at com.caucho.vfs.i18n.JDKWriter.create(JDKWriter.java:79)
  at com.caucho.vfs.Encoding.getWriteEncoding(Encoding.java:231)
  at com.caucho.server.connection.ToByteResponseStream.setEncoding(ToByteResponseStream.java:137)
  at com.caucho.server.connection.AbstractHttpResponse.setLocale(AbstractHttpResponse.java:1683)
  at com.caucho.server.connection.HttpServletResponseImpl.setLocale(HttpServletResponseImpl.java: 115)
  at javax.servlet.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:139)
  at javax.servlet.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:139)
  at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1035)
  at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:290)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:114)
My questions:
- Should the exception be handled? If so, is it the responsibility of the servlet container (Resin) or the web framework (Grails)?
- How would you go about solving this? (I'd rather not having the exception log cluttered with exceptions that I can do nothing about.)
© Stack Overflow or respective owner