ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/launch Locator.java
Date Tue, 19 Apr 2005 20:57:24 GMT
jkf         2005/04/19 13:57:24

  Modified:    src/main/org/apache/tools/ant/launch Locator.java
  Log:
  Avoid using of CharacterIterator for URIs that do not contain %, as suggested in pr34529.
  PR: 34529
  
  Revision  Changes    Path
  1.17      +14 -0     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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Locator.java	7 Feb 2005 21:38:51 -0000	1.16
  +++ Locator.java	19 Apr 2005 20:57:24 -0000	1.17
  @@ -124,6 +124,20 @@
               && Character.isLetter(uri.charAt(1)) && uri.lastIndexOf(':')
> -1) {
               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;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message