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 re...@locus.apache.org on 2000/11/30 04:14:46 UTC

cvs commit: jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods PropFindMethod.java

remm        00/11/29 19:14:46

  Modified:    src/webdav/client/src/org/apache/webdav/lib/methods
                        PropFindMethod.java
  Log:
  - Fixes some NPE when trying to get the results of a PROPFIND if status was
    not 207. Now returns empty Enumerations.
  
  Revision  Changes    Path
  1.5       +30 -20    jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java
  
  Index: PropFindMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PropFindMethod.java	2000/11/30 02:23:04	1.4
  +++ PropFindMethod.java	2000/11/30 03:14:45	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java,v 1.4 2000/11/30 02:23:04 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/11/30 02:23:04 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java,v 1.5 2000/11/30 03:14:45 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/11/30 03:14:45 $
    *
    * ====================================================================
    *
  @@ -319,7 +319,13 @@
   
       public Enumeration getAllResponseURLs() {
           checkUsed();
  -        return getResponseHashtable().keys();
  +        
  +        if (getStatusCode() == WebdavStatus.SC_MULTI_STATUS) {
  +            return getResponseHashtable().keys();
  +        } else {
  +            Vector vector = new Vector();
  +            return vector.elements();
  +        }
       }
   
   
  @@ -358,27 +364,31 @@
           
           Vector vector = new Vector();
   
  -        try {
  -            Element response = (Element) getResponseHashtable().get(urlPath);
  -            if (response != null) {
  -                NodeList list = response.getElementsByTagName(
  -                    getPrefix() + "prop");
  -                for (int i = 0; i < list.getLength(); i++) {
  -                    try {
  -                        Element prop = (Element) list.item(i);
  -                        NodeList subList = prop.getChildNodes();
  -                        for (int j = 0; j < subList.getLength(); j++) {
  -                            try {
  -                                vector.add(new PropertyImpl(
  -                                    getPrefix(), (Element) subList.item(j)));
  -                            } catch (ClassCastException e) {
  +        if (getStatusCode() == WebdavStatus.SC_MULTI_STATUS) {
  +            try {
  +                Element response = 
  +                    (Element) getResponseHashtable().get(urlPath);
  +                if (response != null) {
  +                    NodeList list = response.getElementsByTagName
  +                        (getPrefix() + "prop");
  +                    for (int i = 0; i < list.getLength(); i++) {
  +                        try {
  +                            Element prop = (Element) list.item(i);
  +                            NodeList subList = prop.getChildNodes();
  +                            for (int j = 0; j < subList.getLength(); j++) {
  +                                try {
  +                                    vector.add(new PropertyImpl
  +                                        (getPrefix(), 
  +                                         (Element) subList.item(j)));
  +                                } catch (ClassCastException e) {
  +                                }
                               }
  +                        } catch (ClassCastException e) {
                           }
  -                    } catch (ClassCastException e) {
                       }
                   }
  +            } catch (ClassCastException e) {
               }
  -        } catch (ClassCastException e) {
           }
           return vector.elements();
       }