Author: markt Date: Tue Apr 28 11:25:01 2009 New Revision: 769338 URL: http://svn.apache.org/viewvc?rev=769338&view=rev Log: Fix some failures when testing WebDAV with litmus test suite
Modified: tomcat/tc6.0.x/trunk/ (props changed) tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/WebdavServlet.java tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc6.0.x/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Apr 28 11:25:01 2009 @@ -1 +1 @@ -/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719119,719124,719602,719626,719628,720046,720069,721040,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729681,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,747834,747863,748344,750258,750291,750921,751286-751287,751295,757774,758596,758616,758664,759074,768335 +/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719119,719124,719602,719626,719628,720046,720069,721040,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729681,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,747834,747863,748344,750258,750291,750921,751286-751287,751295,757774,758596,758616,758664,759074,761601,768335 Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=769338&r1=769337&r2=769338&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Apr 28 11:25:01 2009 @@ -104,11 +104,6 @@ +1: markt, remm -1: -* Fix some failures when testing WebDAV with litmus test suite - http://svn.apache.org/viewvc?view=rev&revision=761601 - +1: markt, remm, rjung - -1: - * Update native to 1.1.16 http://svn.apache.org/viewvc?view=rev&revision=762868 +1: markt, remm, rjung Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/WebdavServlet.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/WebdavServlet.java?rev=769338&r1=769337&r2=769338&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/WebdavServlet.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/WebdavServlet.java Tue Apr 28 11:25:01 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; @@ -464,7 +465,7 @@ Node propNode = null; - if (req.getInputStream().available() > 0) { + if (req.getContentLength() > 0) { DocumentBuilder documentBuilder = getDocumentBuilder(); try { @@ -495,9 +496,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); } } @@ -1663,14 +1666,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 @@ -1738,9 +1747,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/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java?rev=769338&r1=769337&r2=769338&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java Tue Apr 28 11:25:01 2009 @@ -575,8 +575,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; } } Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=769338&r1=769337&r2=769338&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Apr 28 11:25:01 2009 @@ -53,6 +53,10 @@ <bug>46875</bug>: Catch and handle possible IllegalStateExceptions in CometConnectionManagerValve related to session expiration. (markt) </fix> + <fix> + Correct some errors reported when testing the WebDAV servlet with the + Litmus test suite. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org