ceefour / webdav-servlet

Java servlet that provides an implementation of the webdav protocol. Underlying data-storage (database, custom file systems) can be easily plugged in.
http://sourceforge.net/projects/webdav-servlet/
Apache License 2.0
55 stars 40 forks source link

DoUnlock fails with NullPointerException when accessed with Windows (or Linux) and MacOS concurrently. #4

Open jackgene opened 10 years ago

jackgene commented 10 years ago

The system seems to work fine in Windows-only, Linux-only or Mac-only environments. However, as soon as a Mac client and a Windows or Linux client tries to access the DAV mount, the next DoUnlock will fail with the following NullPointerException, and all subsequent write accesses will fail until lock times out for a given file.

caarlos0 commented 10 years ago

Hi @jackgene, you forgot to add the exception.

Anyways, check out the file paths: / vs \ and remember that the URL encode process may not work as expected in some cases.

Cheers

jackgene commented 10 years ago

Oops, here's the stack trace: 16:14:30.861 [http-nio-9642-exec-4] ERROR net.sf.webdav.WebDavServletBean - Exception: java.lang.NullPointerException at net.sf.webdav.locking.LockedObject.removeLockedObjectOwner(LockedObject.java:123) at net.sf.webdav.locking.ResourceLocks.unlock(ResourceLocks.java:136) at net.sf.webdav.methods.DoUnlock.execute(DoUnlock.java:72) at net.sf.webdav.WebDavServletBean.service(WebDavServletBean.java:129) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1571) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

I've also submitted a pull request, looks like it's a pretty simple fix.