Author: mvdb
Date: Sat Mar 24 17:32:23 2007
New Revision: 522133

URL: http://svn.apache.org/viewvc?view=rev&rev=522133
Log:
- Add a warning to the javadoc, so people know what they can excpect
- Fix a NullPointerException when trying to login into a authenticated webdav 
store (tested with httpd webdav). It will check for a 401 and throw the 
exception that was anticipated in the first place.

I thought it was best to leave the WebdevResource.java unchanged in it's 
behaviour, because of possible on this behaviour.

Modified:
    
jakarta/slide/trunk/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java
    
jakarta/slide/trunk/webdavclient/commandline/src/java/org/apache/webdav/cmd/Client.java

Modified: 
jakarta/slide/trunk/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java
URL: 
http://svn.apache.org/viewvc/jakarta/slide/trunk/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java?view=diff&rev=522133&r1=522132&r2=522133
==============================================================================
--- 
jakarta/slide/trunk/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java
 (original)
+++ 
jakarta/slide/trunk/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java
 Sat Mar 24 17:32:23 2007
@@ -1289,6 +1289,11 @@
 
     /**
      * Set the HttpURL for this WebdavResource.
+     * <p>
+     * <b>Warning : </b>
+     * Exceptions that are thrown during retrieval of properties
+     * will be silently ignored.
+     * </p>
      *
      * @param httpURL the specified HttpURL.
      * @param action The action to decide, which properties to find.

Modified: 
jakarta/slide/trunk/webdavclient/commandline/src/java/org/apache/webdav/cmd/Client.java
URL: 
http://svn.apache.org/viewvc/jakarta/slide/trunk/webdavclient/commandline/src/java/org/apache/webdav/cmd/Client.java?view=diff&rev=522133&r1=522132&r2=522133
==============================================================================
--- 
jakarta/slide/trunk/webdavclient/commandline/src/java/org/apache/webdav/cmd/Client.java
 (original)
+++ 
jakarta/slide/trunk/webdavclient/commandline/src/java/org/apache/webdav/cmd/Client.java
 Sat Mar 24 17:32:23 2007
@@ -271,7 +271,16 @@
             if (webdavResource == null) {
                 webdavResource = new WebdavResource(httpURL);
                 webdavResource.setDebug(debugLevel);
-                
+
+                // since getting properties is "eating" the authorisation 
exception
+                // we throw the exception when the status code is unauthorized
+                // so we get asked for credentials.
+                if (webdavResource.getStatusCode() == 
HttpStatus.SC_UNAUTHORIZED) {
+                    HttpException exception = new HttpException();
+                    exception.setReasonCode(HttpStatus.SC_UNAUTHORIZED);
+                    throw exception;
+                }
+
                 // is not a collection?
                 if 
(!((ResourceTypeProperty)webdavResource.getResourceType()).isCollection()) {
                     webdavResource = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to