jericho     01/05/15 22:23:02

  Modified:    src/webdav/client/src/org/apache/webdav/lib/properties
                        LockDiscoveryProperty.java
  Log:
  - Use ArrayList rather than Vector.
     It means not to insist to support Java1.  Supporting Java2.
  - Fix a bug in case with parsing error.
  
  Revision  Changes    Path
  1.5       +14 -14    
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java
  
  Index: LockDiscoveryProperty.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LockDiscoveryProperty.java        2001/05/16 00:56:20     1.4
  +++ LockDiscoveryProperty.java        2001/05/16 05:23:02     1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java,v
 1.4 2001/05/16 00:56:20 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/05/16 00:56:20 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/properties/LockDiscoveryProperty.java,v
 1.5 2001/05/16 05:23:02 jericho Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/05/16 05:23:02 $
    *
    * ====================================================================
    *
  @@ -63,7 +63,7 @@
   package org.apache.webdav.lib.properties;
   
   import java.util.Enumeration;
  -import java.util.Vector;
  +import java.util.ArrayList;
   
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
  @@ -87,7 +87,7 @@
    *
    * @author Jojada J. Tirtowidjojo at SpeedLegal Holdings Inc.
    * @author <a href="mailto:[EMAIL PROTECTED]";>Park, Sung-Gu</a>
  - * $@version$
  + * @version $Revision: 1.5 $
    */
   public class LockDiscoveryProperty extends BaseProperty {
   
  @@ -124,7 +124,7 @@
           NodeList children = element.getChildNodes();
           if (children == null || children.getLength() == 0)
               return null;
  -        Vector buff = new Vector();
  +        ArrayList locks = new ArrayList();
           for (int i = 0; i < children.getLength(); i++) {
               try {
                   Element child = (Element) children.item(i);
  @@ -132,17 +132,13 @@
                   if (namespace != null && namespace.equals("DAV:")) {
                       String localName = DOMUtils.getElementLocalName(child);
                       if ("activelock".equals(localName)) {
  -                        buff.addElement(parseLock(child));
  +                        locks.add(parseLock(child));
                       }
                   }
               } catch (ClassCastException e) {
               }
           }
  -        Lock[] activeLocks = new Lock[buff.size()];
  -        for (int i = 0; i < buff.size(); i++) {
  -            activeLocks[i] = (Lock) buff.elementAt(i);
  -        }
  -        return activeLocks;
  +        return (Lock[]) locks.toArray();
       }
   
   
  @@ -202,8 +198,12 @@
           if (child != null) {
               String timeout = DOMUtils.getTextValue(child);
               int at = timeout.indexOf('-');
  -            if (at > 0) 
  -                t = Long.parseLong(timeout.substring(at + 1));
  +            if (at > 0) {
  +                try {
  +                    t = Long.parseLong(timeout.substring(at + 1));
  +                } catch (NumberFormatException e) {
  +                }
  +            }
           }
   
           String lockToken = null;
  
  
  

Reply via email to