jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Schueler <g...@controltier.com>
Subject Re: error retrieving large file from WebDAV servlet
Date Fri, 06 Mar 2009 23:26:21 GMT
Specifically, it seems the OutputContextImpl.java makes the mistake of
potentially trying to parse a Long as an Integer, here:
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/io/OutputContextImpl.java
in the method setContentLength(long contentLength):
public void setContentLength(*long* contentLength) {
       int length = *Integer.parseInt(contentLength + "");*
       if (length >= 0) {
           response.setContentLength(length);
       }
   }

Why is Integer.parseInt used to convert long to int here? This seems a
really awful way to do it.

I'm not sure, but a fix might be like this:

public void setContentLength(long contentLength) {
       if(contentLength <= Integer.MAX_VALUE && contentLength >= 0) {
           response.setContentLength((int) contentLength);
       }else if (contentLength >  Integer.MAX_VALUE) {
            response.addHeader("Content-Length",
Long.toString(contentLength));
       }
   }

This would at least set the Content-Length header.

On Fri, Mar 6, 2009 at 9:15 AM, Greg Schueler <greg@controltier.com> wrote:
>
> Hi,
> we seem to have a problem retrieving a large (>2GB) file from the WebDAV
servlet. We are using Jetty 6.1.14, and the jackrabbit-webapp-1.5.2.war.
> Note: the upload works ok, after configuring jackrabbit to use the
filesystem DataStore.
> When trying to retrieve the file with e.g. "wget", we get the following
error:
> Gozer:Desktop greg$ wget --http-user=xxx --http-passwd=xxx
http://localhost:8080/jackrabbit/repository/workbench/pkgs/demo/zip/zips/largetest-1.zip
> --08:59:50--
http://localhost:8080/jackrabbit/repository/workbench/pkgs/demo/zip/zips/largetest-1.zip
>            => `largetest-1.zip'
> Resolving localhost... done.
> Connecting to localhost[127.0.0.1]:8080... connected.
> HTTP request sent, awaiting response... 500 For input string: "3156213760"
> 09:04:53 ERROR 500: For input string: "3156213760".
>
> (Note also, there is a very long delay between seeing "awaiting
response..." and seeing "500 For input string".)
> In the server log we see this:
> 06.03.2009 08:59:50 *INFO * RepositoryImpl: SecurityManager = class
org.apache.jackrabbit.core.security.simple.SimpleSecurityManager
(RepositoryImpl.java, line 432)
> 2009-03-06 09:04:53.822::WARN:
 /jackrabbit/repository/workbench/pkgs/demo/zip/zips/largetest-1.zip
> java.lang.NumberFormatException: For input string: "3156213760"
> at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> at java.lang.Integer.parseInt(Integer.java:459)
> at java.lang.Integer.parseInt(Integer.java:497)
> at
org.apache.jackrabbit.webdav.io.OutputContextImpl.setContentLength(OutputContextImpl.java:60)
> at
org.apache.jackrabbit.server.io.ExportContextImpl.informCompleted(ExportContextImpl.java:192)
> at
org.apache.jackrabbit.server.io.IOManagerImpl.exportContent(IOManagerImpl.java:157)
> at
org.apache.jackrabbit.webdav.simple.DavResourceImpl.spool(DavResourceImpl.java:332)
> at
org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.spoolResource(AbstractWebdavServlet.java:422)
> at
org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.doGet(AbstractWebdavServlet.java:388)
> at
org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.execute(AbstractWebdavServlet.java:229)
> at
org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.service(AbstractWebdavServlet.java:196)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
> at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
> at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)
>
> I would guess that the problem lies in using Integer to hold the content
length, as using 32 bits will cause a problem with such a large value.
> Is there any way to work around this limitation?
> --
> Greg Schueler
>
> ControlTier Software, Inc
> greg@controltier.com
> 650-292-9660x709
>
> http://www.controltier.com



--
Greg Schueler

ControlTier Software, Inc
greg@controltier.com
650-292-9660x709

http://www.controltier.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message