jfarcand    2003/08/20 14:09:57

  Modified:    util/java/org/apache/tomcat/util/http/mapper Mapper.java
  Log:
  Fix bugtraq 4897366: Tomcat fails to do a URL mapping for a servlet/jsp that 
contains the following url pattern.
      <servlet-mapping>
        <servlet-name>Two</servlet-name>
        <url-pattern>*.jsp</url-pattern>
      </servlet-mapping>
  
  When the compare method returns 0, the current algorithm will never return and the 
extension will never get mapped (at least with the test case I have). I will try to 
translate the current test I have to be run by the tester.
  
  Revision  Changes    Path
  1.29      +15 -5     
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/mapper/Mapper.java
  
  Index: Mapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/mapper/Mapper.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Mapper.java       20 Aug 2003 17:31:37 -0000      1.28
  +++ Mapper.java       20 Aug 2003 21:09:56 -0000      1.29
  @@ -900,9 +900,14 @@
           if (b == -1) {
               return -1;
           }
  -        if (compare(name, start, end, map[0].name) < 0) {
  +        
  +        int result = compare(name, start, end, map[0].name);
  +        if (result < 0 ) {
               return -1;
  +        } else if (result == 0){
  +            return 0;   
           }
  +        
           if (b == 0) {
               return 0;
           }
  @@ -910,7 +915,7 @@
           int i = 0;
           while (true) {
               i = (b + a) / 2;
  -            int result = compare(name, start, end, map[i].name);
  +            result = compare(name, start, end, map[i].name);
               if (result == 1) {
                   a = i;
               } else if (result == 0) {
  @@ -945,9 +950,14 @@
           if (b == -1) {
               return -1;
           }
  -        if (name.compareTo(map[0].name) < 0) {
  +        
  +        int result = name.compareTo(map[0].name);
  +        if (result < 0) {
               return -1;
  -        }
  +        } else if (result == 0){
  +            return 0;
  +        }   
  +        
           if (b == 0) {
               return 0;
           }
  @@ -955,7 +965,7 @@
           int i = 0;
           while (true) {
               i = (b + a) / 2;
  -            int result = name.compareTo(map[i].name);
  +            result = name.compareTo(map[i].name);
               if (result > 0) {
                   a = i;
               } else if (result == 0) {
  
  
  

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

Reply via email to