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 bu...@apache.org on 2004/05/05 17:57:14 UTC

DO NOT REPLY [Bug 28787] New: - WebdavFile.isDirectory fails with exception when the resource is a collection

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28787>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28787

WebdavFile.isDirectory fails with exception when the resource is a collection

           Summary: WebdavFile.isDirectory fails with exception when the
                    resource is a collection
           Product: Slide
           Version: 2.0
          Platform: All
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Major
          Priority: Other
         Component: WebDAV client
        AssignedTo: slide-dev@jakarta.apache.org
        ReportedBy: e_baley@hotmail.com


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);
			}

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org