cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: [PATCH] Fix for ServletExec 2.2 getRealPath problem + Fix for VisualCafe 4.0 bug
Date Sun, 23 Jan 2000 13:06:43 GMT
"Timm, Sean" wrote:
> 
> The following diff provides the fixes to handle the problem with ServletExec
> 2.2 returning various kinds of slashes for getRealPath depending on the type
> of URI request.  You'll also notice that I pulled the creation of the
> StringTokenizer object out of each for loop.  VisualCafe 4.0 has some sort
> of problem parsing the file when that line is located within the for which
> made it very difficult to do any sort of debugging (even though it would
> still compile...)
> 
> - Sean T.
> 
> Index: Utils.java
> ===================================================================
> RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/Utils.java,v
> retrieving revision 1.4
> diff -u -r1.4 Utils.java
> --- Utils.java  2000/01/15 11:19:17     1.4
> +++ Utils.java  2000/01/23 07:57:41
> @@ -138,7 +138,9 @@
> 
>          while (nodes.hasMoreElements()) {
>              String data = ((ProcessingInstruction)
> nodes.nextElement()).getData();
> -            for (StringTokenizer st = new StringTokenizer(data, " \t=");
> st.hasMoreTokens();) {
> +
> +            StringTokenizer st = new StringTokenizer(data, " \t=");
> +            for (; st.hasMoreTokens(); ) {
>                  String key = st.nextToken();
>                  String token = st.nextToken();
>                  token = token.substring(1, token.length() - 1);
> @@ -158,7 +160,8 @@
>          Hashtable attributes = new Hashtable();
> 
>          String data = pi.getData();
> -        for (StringTokenizer st = new StringTokenizer(data, " \t=");
> st.hasMoreTokens();) {
> +        StringTokenizer st = new StringTokenizer(data, " \t=");
> +        for (; st.hasMoreTokens();) {
>              String key = st.nextToken();
>              String token = st.nextToken();
>              token = token.substring(1, token.length() - 1);
> @@ -237,7 +240,7 @@
>                  return request.getPathTranslated().replace('\\','/');
>              } else {
>                  // otherwise use the deprecated method on all other servlet
> engines.
> -                return request.getRealPath(request.getRequestURI());
> +                return
> request.getRealPath(request.getRequestURI()).replace('\\', '/');
>              }
>          } catch (MalformedURLException e) {
>              throw new RuntimeException("Malformed request URL.");

the replace() patch was already applied in latest CVS, but in the wrong
place (Ricardo moved the code around and I missed it).

I'll apply the other two as a bug workaround.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message