I check with Bugzilla and I found a bug
(http://issues.apache.org/bugzilla/show_bug.cgi?id=11410) fixed in 2003
that sounds very similar to this. But I'm guessing this is not the one
you mean?
Also, looking in the CVS, it looks like it's still not fixed:
http://cvs.apache.org/viewcvs.cgi/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java?rev=1.36&view=markup
/niklas
Warwick Burrows wrote:
You might want to check bugzilla as I think this has been fixed
recently. I don't know if the patch was applied to the 2.1 release or
just the slide cvs head.
Warwick
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Niklas Gustavsson
Sent: Thursday, June 30, 2005 10:24 AM
To: slide-user@jakarta.apache.org
Subject: startTransaction on a resource in need of escaping
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>(HttpMethod
Base.java:307)
at
org.apache.webdav.lib.methods.HttpRequestBodyMethodBase.<init>
(HttpRequestBodyMethodBase.java:73)
at
org.apache.webdav.lib.methods.XMLResponseMethodBase.<init>(XML
ResponseMethodBase.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(WebdavRe
source.java:4308)
at
se.zystems.baseline.common.webdavclient.WebDAVClientTxTest.tes
tPutOnDirectory(WebDAVClientTxTest.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
orImpl.java:85)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
orImpl.java:58)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
odAccessorImpl.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.runTest
s(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(Rem
oteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(Re
moteTestRunner.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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]