Author: markt
Date: Fri Apr 3 10:28:40 2009
New Revision: 761601
URL: http://svn.apache.org/viewvc?rev=761601&view=rev
Log:
Fix a handful of failures when using the litmus WebDAV testsuite.
Still other failures but these appear to relate to the lack of PROPPATCH
support.
Modified:
tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java
tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java
Modified: tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java?rev=761601&r1=761600&r2=761601&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java Fri Apr
3 10:28:40 2009
@@ -19,6 +19,7 @@
package org.apache.catalina.servlets;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -463,7 +464,7 @@
Node propNode = null;
- if (req.getInputStream().available() > 0) {
+ if (req.getContentLength() > 0) {
DocumentBuilder documentBuilder = getDocumentBuilder();
try {
@@ -494,9 +495,11 @@
}
}
} catch (SAXException e) {
- // Something went wrong - use the defaults.
+ // Something went wrong - bad request
+ resp.sendError(WebdavStatus.SC_BAD_REQUEST);
} catch (IOException e) {
- // Something went wrong - use the defaults.
+ // Something went wrong - bad request
+ resp.sendError(WebdavStatus.SC_BAD_REQUEST);
}
}
@@ -1662,14 +1665,20 @@
path, destinationPath);
if ((!result) || (!errorList.isEmpty())) {
-
- sendReport(req, resp, errorList);
+ if (errorList.size() == 1) {
+ resp.sendError(errorList.elements().nextElement().intValue());
+ } else {
+ sendReport(req, resp, errorList);
+ }
return false;
-
}
// Copy was successful
- resp.setStatus(WebdavStatus.SC_CREATED);
+ if (exists) {
+ resp.setStatus(WebdavStatus.SC_NO_CONTENT);
+ } else {
+ resp.setStatus(WebdavStatus.SC_CREATED);
+ }
// Removing any lock-null resource which would be present at
// the destination path
@@ -1739,9 +1748,15 @@
try {
resources.bind(dest, object);
} catch (NamingException e) {
- errorList.put
- (source,
- new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
+ if (e.getCause() instanceof FileNotFoundException) {
+ // We know the source exists so it must be the
+ // destination dir that can't be found
+ errorList.put(source,
+ new Integer(WebdavStatus.SC_CONFLICT));
+ } else {
+ errorList.put(source,
+ new
Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
+ }
return false;
}
} else {
Modified: tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java?rev=761601&r1=761600&r2=761601&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java Fri Apr
3 10:28:40 2009
@@ -578,8 +578,10 @@
is.close();
}
} catch (IOException e) {
- throw new NamingException
- (sm.getString("resources.bindFailed", e));
+ NamingException ne = new NamingException
+ (sm.getString("resources.bindFailed", e));
+ ne.initCause(e);
+ throw ne;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]