Bug 28787 - WebdavFile.isDirectory fails with exception when the resource is a collection
Summary: WebdavFile.isDirectory fails with exception when the resource is a collection
Status: NEW
Alias: None
Product: Slide
Classification: Unclassified
Component: WebDAV client (show other bugs)
Version: 2.0
Hardware: All Windows XP
: P3 major (vote)
Target Milestone: ---
Assignee: Slide Developer List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-05 15:57 UTC by Elijah Baley
Modified: 2007-03-25 19:41 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elijah Baley 2004-05-05 15:57:13 UTC
The code below yields the following exception:

org.apache.commons.httpclient.HttpMethodBase processRedirectResponse
INFO: Redirect requested but followRedirects is disabled

The problem is several-fold:

1. the failure seems to be associated with the fact that the collection name
does not end in '/' - i.e. instead of asking if '/a/b/c/' is a collection, the
code asks if '/a/b/c'

2. the "getPath" returns value without the terminating '/' for the collection

3. the code accesses the DAV server to query for the state (collection or
"simple") whereas this could have been inferred from the initial response to the
"listFiles" request and cached (along with the correct path name)

			try
			{
				final HttpURL		u=new HttpURL("somehost", somePort, "someCollectionPath");
				final WebdavFile	wf=new WebdavFile(u);
				final File[]		fl=wf.listFiles();
				final int			numFiles=(null == fl) ? 0 : fl.length;
				for (int	fIndex=0; fIndex < numFiles; fIndex++)
				{
					final File	f=fl[fIndex];
					if (null == f)	// should not happen
						continue;

					final boolean	isFolder=f.isDirectory();
					System.out.println("\t" + f.getPath() + "(" + isFolder + ")");
				}
			}
			catch(URIException ue)
			{
				System.err.println("URI exception: " + ue.getMessage());
				return (-1);
			}
Comment 1 Antoine Levy-Lambert 2007-03-25 19:41:34 UTC
Elijah, I think that this is solved in the source code already. If you can
checkout from SVN the current Slide codebase and compile it, you will get a
Slide client without this bug.