Re: Related to [Bug 32886]? - client webdav lib - resource not found
Tiffany Dodge <[email protected]> Fri, 16 Mar 2007 17:34:48 -0700
| Newsgroups | gmane.comp.jakarta.slide.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Here is the change I am considering ...
CURRENT CODE:
if (lenDiff == 0) {
if ((compareLen == 0 && httpURLPath.equals
(escapedHref))
|| httpURLPath.regionMatches(0, escapedHref, 0,
compareLen))
{
MODIFIED CODE:
if (lenDiff == 0) {
if ((compareLen == 0 && httpURLPath.equals
(escapedHref))
|| (compareLen != 0 && httpURLPath.regionMatches
(0, escapedHref, 0, compareLen)))
{
I gave it a quick test and it fixed my issue while not breaking other
stuff (from what I can tell). Can anyone confirm that this change
won't break something else?
Thanks,
Tiff
On Mar 16, 2007, at 1:00 PM, Tiffany Dodge wrote:
> Hello,
>
> I sent the forwarded message below to slide-users, but I haven't
> heard anything so I thought I would try this list with more code-
> type details. I believe the problem I'm having is related to [Bug
> 32886].
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=32886
>
> Here are some more details on the files listed in the forwarded email.
>
> escapedHref = /webdavtest/abcdefghijklm
> httpURLPath = /webdavtest/uploading/xxy
>
> abcdefghijklm is the file that was uploaded
> xxy is the directory that the file was uploaded to
>
> Other files in xxy were added properly to childResources. I added
> several System.out.println statements to the setWebdavProperties
> method (in WebdavResource.java) and here's what I got (there is
> info for two files: one that was properly added and one that
> wasn't) ...
>
> // file was properly added to childResources
> Before if stmts, lenDiff = 4
> escapedHref = /webdavtest/abcdefghijklm1234, httpURLPath = /
> webdavtest/uploading/xxy
> After if stmts, lenDiff = 4
> compareLen = 0
> httpURLPath.equals(escapedHref) = false
> httpURLPath.regionMatches(0, escapedHref, 0, compareLen) = true
> (compareLen == 0 && httpURLPath.equals(escapedHref)) = false
> itself = false
> Added resource named abcdefghijklm1234 to childResources
>
> // file was NOT properly added to childResources
> Before if stmts, lenDiff = 0
> escapedHref = /webdavtest/abcdefghijklm, httpURLPath = /webdavtest/
> uploading/xxy
> After if stmts, lenDiff = 0
> compareLen = 0
> httpURLPath.equals(escapedHref) = false
> httpURLPath.regionMatches(0, escapedHref, 0, compareLen) = true
> (compareLen == 0 && httpURLPath.equals(escapedHref)) = false
> In if stmt body to set status code
> itself = true
> Did NOT add resource named abcdefghijklm to childResources
>
> I'm guessing that "httpURLPath.regionMatches(0, escapedHref, 0,
> compareLen)" should not have been true but I'm not really sure.
> Can anyone help me determine how I should change this bit of code ...
>
>
> // if they are the same length then compare them.
> if (lenDiff == 0) {
> if ((compareLen == 0 && httpURLPath.equals
> (escapedHref))
> || httpURLPath.regionMatches(0, escapedHref, 0,
> compareLen))
> {
>
>
> so that my bug is fixed, but so that I don't break everything else?
>
> Thanks,
> Tiff
>
> Begin forwarded message:
>
>> From: Tiffany Dodge <[email protected]>
>> Date: March 15, 2007 4:08:52 PM PDT
>> To: "Slide Users Mailing List" <[email protected]>
>> Subject: Re: client webdav lib - resource not found
>> Reply-To: "Slide Users Mailing List" <[email protected]>
>>
>> Correcting a typo below (the escapedHref value - removing the comma)
>>
>> On Mar 15, 2007, at 3:54 PM, Tiffany Dodge wrote:
>>
>>> Hello,
>>>
>>> I've run into a problem where slide can't find a file right after
>>> it has been uploaded. The file does exist on the DAV server (I
>>> checked). FYI, I am using slide 2.1 with Apache 1.3.
>>>
>>> Basically, I do this ...
>>> - upload a file
>>> - get the childResources
>>> - and then try to getResource(filename) for the file that I just
>>> uploaded.
>>>
>>> From my debugging (which could totall be wrong), the problem is
>>> in WebdavResource.java, in the method setWebdavProperties ...
>>>
>>> int lenDiff = escapedHref.length() -
>>> httpURLPath.length();
>>>
>>> lenDiff is zero, but the paths are completely different. For
>>> example, they could be ...
>>>
>>> escapedHref = /webdavtest/abcdefghijklm
>>> httpURLPath = /webdavtest/uploading/xxy
>>>
>>> So the local var "itself" ends up being true in this case and the
>>> workingResource is not added to the childResources at the end of
>>> the method, as it should. That in turn means that the resource
>>> cannot be found.
>>>
>>> Has anyone else experienced this? If so, what did you do to fix
>>> it? Any help would be appreciated.
>>>
>>> Thanks,
>>> Tiff
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>