jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject svn commit: r354815 - /incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
Date Wed, 07 Dec 2005 17:43:58 GMT
Author: bcm
Date: Wed Dec  7 09:43:54 2005
New Revision: 354815

URL: http://svn.apache.org/viewcvs?rev=354815&view=rev
Log:
only attempt to read from the http request's input stream if the
client specified a positive content length. this avoids io exceptions
being written to the debug stream when we know the input stream should
not have any content.

Modified:
    incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java?rev=354815&r1=354814&r2=354815&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
Wed Dec  7 09:43:54 2005
@@ -260,17 +260,23 @@
      */
     public Document getRequestDocument() {
         Document requestDocument = null;
-        // try to parse the request body
-        try {
-            InputStream in = httpRequest.getInputStream();
-            if (in != null) {
-                SAXBuilder builder = new SAXBuilder(false);
-                requestDocument = builder.build(in);
+        if (httpRequest.getContentLength() > 0) {
+            // try to parse the request body
+            try {
+                InputStream in = httpRequest.getInputStream();
+                if (in != null) {
+                    SAXBuilder builder = new SAXBuilder(false);
+                    requestDocument = builder.build(in);
+                }
+            } catch (IOException e) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Unable to build an XML Document from the request body: " +
e.getMessage());
+                }
+            } catch (JDOMException e) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Unable to build an XML Document from the request body: " +
e.getMessage());
+                }
             }
-        } catch (IOException e) {
-            log.debug("Unable to build an XML Document from the request body: " + e.getMessage());
-        } catch (JDOMException e) {
-            log.debug("Unable to build an XML Document from the request body: " + e.getMessage());
         }
         return requestDocument;
     }



Mime
View raw message