cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stevenson, Chris (SSABSA)" <ch...@ssabsa.sa.gov.au>
Subject BUG?: Writing NaN% to a ServletOutputStream
Date Mon, 13 Mar 2000 05:28:42 GMT
Using Tomcat 3.1beta1

When I use a 
	NumberFormat.getPercentInstance() 
to write to a ServletOutputStream, and try to format a NaN
	out.print("<p>" + nf.format(60.0/0) + "</p>");
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("<html>");
	out.print("<head>");
	out.print("</head>");
	out.print("<body>");
	out.print("<p>%?</p>");
	NumberFormat nf = NumberFormat.getPercentInstance();
	out.print("<p>" + nf.format(60.0/0) + "</p>"); //NaN -> ?%
    	out.print("</body>");
    	out.print("</html>");
      out.close();
    }
}

-- test JSP: Does NOT cause error

<%@ page import="java.text.NumberFormat"%>
<p>?%</p>
<p>
<%
	NumberFormat nf = NumberFormat.getPercentInstance();
	out.print("<p>" + nf.format(60.0/0) + "</p>"); //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
----------------------------------------------------

Mime
View raw message