tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 9591] New: - Creating a temporary file in a servlet throws an IOException
Date Mon, 03 Jun 2002 22:11:07 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9591>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9591

Creating a temporary file in a servlet throws an IOException

           Summary: Creating a temporary file in a servlet throws an
                    IOException
           Product: Tomcat 4
           Version: 4.0.3 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: leolion_75@hotmail.com


When a servlet attepts to create a temporary file an IOException is thrown 
indicating that the system cannot find the path specified.

Code to reproduce error:

public class Example3 extends HttpServlet {
  
    public void doGet (HttpServletRequest request,HttpServletResponse response
    ) throws ServletException, IOException {
        
        PrintStream out = new PrintStream (response.getOutputStream());
        response.setContentType ("text/html");

        try {
            File f = File.createTempFile("foo",".txt");
            out.println("<h3>"+f+"</h3>");        
	    } catch (Exception e) {
	        out.println("<i><b>Error code:</b> " + e + "</i>");
	        e.printStackTrace(System.err);
	    } finally {
            out.close();
            response.getOutputStream().close();
        }
    }
}

Stacktrace:
java.io.IOException: The system cannot find the path specified
        at java.io.Win32FileSystem.createFileExclusively(Native Method)
        at java.io.File.checkAndCreate(File.java:1157)
        at java.io.File.createTempFile(File.java:1242)
        at java.io.File.createTempFile(File.java:1279)
        at Example3.doGet(Example3.java:24)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.servlets.InvokerServlet.serveRequest
(InvokerServlet.java:446)
        at org.apache.catalina.servlets.InvokerServlet.doGet
(InvokerServlet.java:180)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:190)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2343)
        at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
        at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:468)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1012)
        at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1107)
        at java.lang.Thread.run(Thread.java:479)

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message