You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2013/05/15 04:16:03 UTC

[Bug 54971] New: javax.servlet.http.Part.write(String fileName) is not properly implemented

https://issues.apache.org/bugzilla/show_bug.cgi?id=54971

            Bug ID: 54971
           Summary: javax.servlet.http.Part.write(String fileName) is not
                    properly implemented
           Product: Tomcat 7
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: howeverking@gmail.com
    Classification: Unclassified

1. fileName parameter / relative vs absolute
filaName parameter specification in
<1><JSR-000315 Java Servlet 3.0 Final Release javadocs>
is different from the <2><javax API tomcat refers to>.

<1> <JSR-000315 Java Servlet 3.0 Final Release javadocs>

Parameters:fileName - the name of the file to which the stream will be written.
The file is created relative to the location as specified in the
MultipartConfig

<2> javax. API tomcat refers to

 * @param fileName  The location into which the uploaded part should be
     *                  stored. Relative locations are relative to {@link
     *                  javax.servlet.MultipartConfigElement#getLocation()}


Tomcat is implemented as specified in <2> so that it can process "absolute
path",
but it should only accept "relative path" as specified in <1>
<JSR-000315 Java Servlet 3.0 Final Release javadocs>

2.
If MultiPartConfig.location is not set,
write( String relative path ) throws FileNotFound Exception.
A default location needs to be set in order to avoid such exception.

example) os: windows8

part.write("/test");

java.io.IOException: java.io.FileNotFoundException: \test (Access is denied)
    at org.apache.catalina.core.ApplicationPart.write(ApplicationPart.java:123)
    at
servlet.multipart.MultipleUploadServlet.doPost(MultipleUploadServlet.java:76)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 54971] javax.servlet.http.Part.write(String fileName) is not properly implemented

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54971

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
(In reply to comment #2)
> For the problem 2, the default location of MultipartConfig is
> avax.servlet.context.tempdir as defined by 8.1.5
> @MultipartConfig.

Agreed. Tomcat applies that default elsewhere but it is missing in this case.
Tomcat also handles relative locations by making them relative to
javax.servlet.context.tempdir

I'll see about getting this fixed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 54971] javax.servlet.http.Part.write(String fileName) is not properly implemented

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54971

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
This has been fixed in trunk and 7.0.x and will be included in 7.0.41 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 54971] javax.servlet.http.Part.write(String fileName) is not properly implemented

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54971

--- Comment #1 from Daniel Koh <ho...@gmail.com> ---
http://docs.oracle.com/javaee/6/api/javax/servlet/http/Part.html#write%28java.lang.String%29

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 54971] javax.servlet.http.Part.write(String fileName) is not properly implemented

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54971

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
(In reply to comment #0)
> 1. fileName parameter / relative vs absolute

Tomcat is implementing a container specific extension that allows absolute
paths to be specified. I thought that there had been some discussion of this
previously but I can't find anything in the archives.

Any specification compliant input (i.e. a relative path) will work so nothing
is broken w.r.t. to the spec here.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 54971] javax.servlet.http.Part.write(String fileName) is not properly implemented

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54971

--- Comment #2 from Eugene Chung (TmaxSoft) <bl...@gmail.com> ---
For the problem 2, the default location of MultipartConfig is
avax.servlet.context.tempdir as defined by 8.1.5
@MultipartConfig.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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