jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1213276 - /jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java
Date Mon, 12 Dec 2011 15:25:18 GMT
Author: reschke
Date: Mon Dec 12 15:25:17 2011
New Revision: 1213276

URL: http://svn.apache.org/viewvc?rev=1213276&view=rev
Log:
JCR-3175: InputContextImpl: cannot upload file larger than 2GB

Avoid truncating Content-Length to int by bypassing getIntHeader API

Modified:
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java?rev=1213276&r1=1213275&r2=1213276&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/io/InputContextImpl.java
Mon Dec 12 15:25:17 2011
@@ -70,8 +70,22 @@ public class InputContextImpl implements
         return request.getHeader(DavConstants.HEADER_CONTENT_LANGUAGE);
     }
 
+    /**
+     * @return content length or -1 when unknown
+     */
     public long getContentLength() {
-        return request.getIntHeader(DavConstants.HEADER_CONTENT_LENGTH);
+        String length = request.getHeader(DavConstants.HEADER_CONTENT_LENGTH);
+        if (length == null) {
+            // header not present
+            return -1;
+        } else {
+            try {
+                return Long.parseLong(length);
+            } catch (NumberFormatException ex) {
+                log.error("broken Content-Length header: " + length);
+                return -1;
+            }
+        }
     }
 
     public String getContentType() {



Mime
View raw message