jkf         2005/04/19 13:55:17

  Modified:    src/main/org/apache/tools/ant/launch Tag: ANT_16_BRANCH
                        Locator.java
  Log:
  Avoid using of CharacterIterator for URIs that do not contain %, as suggested 
in pr34529.
  PR: 34529
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.6.2.8   +15 -3     ant/src/main/org/apache/tools/ant/launch/Locator.java
  
  Index: Locator.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/launch/Locator.java,v
  retrieving revision 1.6.2.7
  retrieving revision 1.6.2.8
  diff -u -r1.6.2.7 -r1.6.2.8
  --- Locator.java      23 Apr 2004 14:33:33 -0000      1.6.2.7
  +++ Locator.java      19 Apr 2005 20:55:17 -0000      1.6.2.8
  @@ -126,6 +126,20 @@
               uri = uri.substring(1);
           }
   
  +        String path = decodeUri(uri);
  +        return path;
  +    }
  +
  +    /**
  +     * Decodes an Uri with % characters.
  +     * @param uri String with the uri possibly containing % characters.
  +     * @return The decoded Uri
  +     */
  +    private static String decodeUri(String uri) {
  +        if (uri.indexOf('%') == -1)
  +        {
  +            return uri;
  +        }
           StringBuffer sb = new StringBuffer();
           CharacterIterator iter = new StringCharacterIterator(uri);
           for (char c = iter.first(); c != CharacterIterator.DONE;
  @@ -144,12 +158,10 @@
                   sb.append(c);
               }
           }
  -
           String path = sb.toString();
           return path;
       }
  -
  -
  +    
       /**
        * Get the File necessary to load the Sun compiler tools. If the classes
        * are available to this class, then no additional URL is required and
  
  
  

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

Reply via email to