You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/08/16 03:20:05 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources WARDirContext.java

craigmcc    01/08/15 18:20:05

  Modified:    catalina/src/share/org/apache/naming/resources
                        WARDirContext.java
  Log:
  Sort entries in directory lists for WAR-based webapps also.
  
  PR: Bugzilla #3104
  Submitted by:	wille@loverbek.de
  
  Revision  Changes    Path
  1.3       +13 -5     jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/WARDirContext.java
  
  Index: WARDirContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/WARDirContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WARDirContext.java	2001/02/05 04:41:08	1.2
  +++ WARDirContext.java	2001/08/16 01:20:05	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/WARDirContext.java,v 1.2 2001/02/05 04:41:08 remm Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/02/05 04:41:08 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/WARDirContext.java,v 1.3 2001/08/16 01:20:05 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/08/16 01:20:05 $
    *
    * ====================================================================
    *
  @@ -64,6 +64,7 @@
   
   package org.apache.naming.resources;
   
  +import java.util.Arrays;
   import java.util.Hashtable;
   import java.util.Vector;
   import java.util.Date;
  @@ -99,7 +100,7 @@
    * WAR Directory Context implementation.
    *
    * @author Remy Maucherat
  - * @version $Revision: 1.2 $ $Date: 2001/02/05 04:41:08 $
  + * @version $Revision: 1.3 $ $Date: 2001/08/16 01:20:05 $
    */
   
   public class WARDirContext extends BaseDirContext {
  @@ -803,6 +804,7 @@
           
           Vector entries = new Vector();
           Entry[] children = entry.getChildren();
  +        Arrays.sort(children);
           NamingEntry namingEntry = null;
           
           for (int i = 0; i < children.length; i++) {
  @@ -829,7 +831,7 @@
       /**
        * Entries structure.
        */
  -    protected class Entry {
  +    protected class Entry implements Comparable {
   
   
           // -------------------------------------------------------- Constructor
  @@ -856,6 +858,12 @@
           // ----------------------------------------------------- Public Methods
           
           
  +        public int compareTo(Object o) {
  +            if (!(o instanceof Entry))
  +                return (+1);
  +            return (name.compareTo(((Entry) o).getName()));
  +        }
  +
           public ZipEntry getEntry() {
               return entry;
           }