You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2001/12/06 10:15:12 UTC

cvs commit: jakarta-cactus/src/framework/share/org/apache/cactus/client HttpClientHelper.java

vmassol     01/12/06 01:15:12

  Modified:    docs/framework/xdocs changes.xml
               src/framework/share/org/apache/cactus/client
                        HttpClientHelper.java
  Log:
  Compatibility with JDK 1.2 was broken by using the URL.getPath() in HttpClientHelper. It is now fixed and should work both for JDK 1.2 and 1.3. Thanks to Piyush Asthana.
  
  Revision  Changes    Path
  1.68      +4 -0      jakarta-cactus/docs/framework/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/docs/framework/xdocs/changes.xml,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- changes.xml	2001/12/01 14:11:00	1.67
  +++ changes.xml	2001/12/06 09:15:12	1.68
  @@ -127,6 +127,10 @@
       </devs>
   
       <release version="1.3 in CVS">
  +      <action dev="VMA" type="fix" due-to="Piyush Asthana" due-to-email="piyush.asthana@patni.com">
  +        Compatibility with JDK 1.2 was broken by using the <code>URL.getPath()</code> in
  +        <code>HttpClientHelper</code>. It is now fixed and should work both for JDK 1.2 and 1.3.
  +      </action>
         <action dev="VMA" type="add">
           Added a <code>AbstractTestCase.getLogger()</code> method that lets any test case class get
           access to a logger to perform its own logging. Logs will go into the Cactus log files.
  
  
  
  1.16      +18 -2     jakarta-cactus/src/framework/share/org/apache/cactus/client/HttpClientHelper.java
  
  Index: HttpClientHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/HttpClientHelper.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HttpClientHelper.java	2001/11/16 19:11:12	1.15
  +++ HttpClientHelper.java	2001/12/06 09:15:12	1.16
  @@ -70,7 +70,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: HttpClientHelper.java,v 1.15 2001/11/16 19:11:12 vmassol Exp $
  + * @version $Id: HttpClientHelper.java,v 1.16 2001/12/06 09:15:12 vmassol Exp $
    */
   public class HttpClientHelper
   {
  @@ -446,7 +446,23 @@
           if ((url != null) && (url.getPath() != null)) {
               path = url.getPath();
           } else {
  -            path = theConnection.getURL().getPath();
  +
  +            // We do not use the URL.getPath() API as it was only introduced in JDK 1.3 and we
  +            // want to retain compatibility with JDK 1.2. Using JDK 1.3, we would have written :
  +            //      path = theConnection.getURL().getPath();
  +
  +            String file = theConnection.getURL().getFile();
  +            if (file != null) {
  +                int q = file.lastIndexOf('?');
  +                if (q != -1) {
  +                    path = file.substring(0, q);
  +                } else {
  +                    path = file;
  +                }
  +            } else {
  +                path = null;
  +            }
  +
           }
   
           logger.debug("Cookie validation pah = [" + path + "]");
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>