You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Chris Knight <ck...@mail.arc.nasa.gov> on 2001/07/24 20:44:34 UTC

minor client API bug fix

Using the command-line, I received the following error:

[ Slide ] $ open http://corum/dav
DEBUG: getSessionInstance(http://corum/dav,false)
[CORUM] /dav/ $ ls
None                      xls_test_from_djk.xls     Readme.txt
.core                     1                         testfolder_from_LA
[CORUM] /dav/ $ propput .core foo bar
Putting property(foo, bar) to '/dav/.core':
Fatal Error: org.apache.commons.httpclient.State
Command input: propput .core foo bar
java.lang.ClassCastException: org.apache.commons.httpclient.State
        at
org.apache.webdav.lib.WebdavResource.generateIfHeader(WebdavResource.java:60
0)
        at
org.apache.webdav.lib.WebdavResource.proppatchMethod(WebdavResource.java:273
4)
        at
org.apache.webdav.lib.WebdavResource.proppatchMethod(WebdavResource.java:269
8)
        at org.apache.webdav.cmd.Slide.processCommands(Slide.java:1081)
        at org.apache.webdav.cmd.Slide$1.run(Slide.java:201)
        at java.lang.Thread.run(Thread.java:484)
Please, email to slide-user@jakarta.apache.org

I was able to trace this down to WebdavSession.getSessionInstance(), it
calls startSession() which indirectly calls HttpClient.startSession() which
in turn resets the client state.  Moving the client.setState() to below the
startSession() call fixes the problem.

Index: WebdavSession.java
===================================================================
RCS file:
/home/cvspublic/jakarta-slide/src/webdav/client/src/org/apache/webdav/li
b/WebdavSession.java,v
retrieving revision 1.15
diff -r1.15 WebdavSession.java
172c172
<
---
>
178a179
>             client.startSession(httpURL.getHost(), httpURL.getPort());
181d181
<             client.startSession(httpURL.getHost(), httpURL.getPort());


Re: minor client API bug fix

Posted by Remy Maucherat <re...@betaversion.org>.
Quoting Chris Knight <ck...@mail.arc.nasa.gov>:

> Using the command-line, I received the following error:
> 
> [ Slide ] $ open http://corum/dav
> DEBUG: getSessionInstance(http://corum/dav,false)
> [CORUM] /dav/ $ ls
> None                      xls_test_from_djk.xls     Readme.txt
> .core                     1                         testfolder_from_LA
> [CORUM] /dav/ $ propput .core foo bar
> Putting property(foo, bar) to '/dav/.core':
> Fatal Error: org.apache.commons.httpclient.State
> Command input: propput .core foo bar
> java.lang.ClassCastException: org.apache.commons.httpclient.State
>         at
> org.apache.webdav.lib.WebdavResource.generateIfHeader(WebdavResource.java:60
> 0)
>         at
> org.apache.webdav.lib.WebdavResource.proppatchMethod(WebdavResource.java:273
> 4)
>         at
> org.apache.webdav.lib.WebdavResource.proppatchMethod(WebdavResource.java:269
> 8)
>         at org.apache.webdav.cmd.Slide.processCommands(Slide.java:1081)
>         at org.apache.webdav.cmd.Slide$1.run(Slide.java:201)
>         at java.lang.Thread.run(Thread.java:484)
> Please, email to slide-user@jakarta.apache.org
> 
> I was able to trace this down to WebdavSession.getSessionInstance(), it
> calls startSession() which indirectly calls HttpClient.startSession()
> which
> in turn resets the client state.  Moving the client.setState() to below
> the
> startSession() call fixes the problem.

Do you have the latest commons-httpclient code ? I made a change so that 
startSession wouldn't override the state if it has been set.
Juergen also added a fix where the state type is checked before accessing it.

Switching the order is probably not needed anymore with the latest code.

Remy