Return-Path: Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 93476 invoked from network); 13 Mar 2000 06:03:08 -0000 Received: from unknown (HELO envision.asiaconnect.com.my) (root@202.190.60.154) by locus.apache.org with SMTP; 13 Mar 2000 06:03:08 -0000 Received: from localbar.com (IDENT:niclas@localhost [127.0.0.1]) by envision.asiaconnect.com.my (8.9.3/8.8.7) with ESMTP id OAA21019 for ; Mon, 13 Mar 2000 14:09:28 +0800 Sender: niclas@envision.asiaconnect.com.my Message-ID: <38CC8617.8A6D12FA@localbar.com> Date: Mon, 13 Mar 2000 14:09:27 +0800 From: Niclas Hedhman Organization: Bali Automation Sdn Bhd X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: cocoon-dev@xml.apache.org Subject: Re: BUG?: Writing NaN% to a ServletOutputStream References: <3390FF2B0DE0D21183B30008C70D751A022D17A2@SAGEMSG0003.sagemsmrd01.sa.gov.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Looks like the PercentInstance is trying to output characters that are not defined in the 8859-1 character set. The missing message of the key, is a ResourceBundle thing, I guess. No text has been defined in the resource bundle, and is not part of the actual problem. Could you possibly capture all those characters to a string object, convert it to an char[] and output the value of each one, to see exactly what is happening. The reason for JSP is working, could be things like, JSP is outputting to the Writer instead of the Stream and there are no checks there or those characters are filtered out. Niclas "Stevenson, Chris (SSABSA)" wrote: > Using Tomcat 3.1beta1 > > When I use a > NumberFormat.getPercentInstance() > to write to a ServletOutputStream, and try to format a NaN > out.print("

" + nf.format(60.0/0) + "

"); > I get the following Exception: > > java.io.IOException: cannot find message associated with key : > servletOutputStream.fmt.not_iso8859_1 > > The underlying Exception seems to be stream format error, but > this hapens ONLY if I do the call in a servlet - if it is in > a JSP file it does not cause an error! > > Is this because I have not set the output encoding? or is it a > bug? > > chris. > > -- test Servlet: Does cause Error > > import java.text.*; > import javax.servlet.*; > import javax.servlet.http.*; > > public class TestBug extends HttpServlet { > protected void doGet(HttpServletRequest request, HttpServletResponse > resp) > throws ServletException, java.io.IOException { > ServletOutputStream out = resp.getOutputStream(); > out.print(""); > out.print(""); > out.print(""); > out.print(""); > out.print("

%?

"); > NumberFormat nf = NumberFormat.getPercentInstance(); > out.print("

" + nf.format(60.0/0) + "

"); //NaN -> ?% > out.print(""); > out.print(""); > out.close(); > } > } > > -- test JSP: Does NOT cause error > > <%@ page import="java.text.NumberFormat"%> >

?%

>

> <% > NumberFormat nf = NumberFormat.getPercentInstance(); > out.print("

" + nf.format(60.0/0) + "

"); //NaN -> ?% > %> > > -- Full exception > > Internal Servlet Error: > > java.io.IOException: cannot find message associated with key : > servletOutputStream.fmt.not_iso8859_1 > at > org.apache.tomcat.core.BufferedServletOutputStream.print(BufferedServletOutp > utStream.java:222) > at TestBug.doGet(TestBug.java:20) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) > at > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:390) > at > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:422) > at > org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) > at > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:390) > at > org.apache.tomcat.core.ContextManager.service(ContextManager.java:523) > at > org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC > onnectionHandler.java:146) > at > org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:334 > ) > at java.lang.Thread.run(Thread.java:484) > > -- Chris Stevenson ----------------------- SSABSA -- > Senior Secondary Assessment Board of South Australia > 60 Greenhill Road, Wayville SA 5034, Australia > email: chris@ssabsa.sa.gov.au > phone: (08) 8372 7515 > fax: (08) 8372 7590 > ----------------------------------------------------