Hi all,

I have the following (simplified) code (using Slide 2.1):

        WebdavResource.setDefaultAction(WebdavResource.NOACTION);
WebdavResource resource = new WebdavResource(new HttpURL("http://localhost:8080/slide/files/test 11.xml"));

        resource.startTransaction("ME", 20);
        resource.putMethod(TEST_DATA);
        resource.commitTransaction();

I would expect this code to start a transaction for the resource, put some data and then commit. This works just great as long as the resource URL does not need any escaping. However, as in the case above where we got a space in the URL, this will fail with:

java.lang.IllegalArgumentException: Invalid uri '/slide/files/test 11.xml': escaped absolute path not valid at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:307) at org.apache.webdav.lib.methods.HttpRequestBodyMethodBase.<init>(HttpRequestBodyMethodBase.java:73) at org.apache.webdav.lib.methods.XMLResponseMethodBase.<init>(XMLResponseMethodBase.java:93)
        at org.apache.webdav.lib.methods.LockMethod.<init>(LockMethod.java:190)
        at org.apache.webdav.lib.methods.LockMethod.<init>(LockMethod.java:173)
at org.apache.webdav.lib.WebdavResource.startTransaction(WebdavResource.java:4308) at se.zystems.baseline.common.webdavclient.WebDAVClientTxTest.testPutOnDirectory(WebDAVClientTxTest.java:85)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
        at java.lang.reflect.Method.invoke(Method.java:391)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



The main problem here seems to be this piece of code in WebdavResource:

public boolean startTransaction(String owner, int timeout) throws IOException {
        String path = httpURL.getPath();

        setClient();

        if (owner == null) {
owner = (httpURL.getUser() != null) ? httpURL.getUser() : defaultOwner;
        }

        // default lock type setting
        LockMethod method = new LockMethod(path, owner, timeout, true);

...

Since this code uses httpURL.getPath() it will try to get a lock on the unescaped URL which will fail.

Do I do something wrong here or is this a bug? What would be the recommended way of doing what I want to do?

Thanks!

/niklas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to