~ubuntu-branches/ubuntu/oneiric/ivy/oneiric

« back to all changes in this revision

Viewing changes to src/java/org/apache/ivy/util/url/ApacheURLLister.java

  • Committer: Bazaar Package Importer
  • Author(s): Miguel Landaeta
  • Date: 2011-02-06 20:56:32 UTC
  • mfrom: (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110206205632-sqhg7bx09z0ywj79
Tags: 2.2.0-1
* New upstream release.
* Update pom.xml to the latest version.
* Add Build-Depends and Suggests on libbcprov-java and libbcpg-java.
* Add mh_clean call in clean target.
* Bump Standards-Version to 3.9.1. No changes were required.
* Add myself to Uploaders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import java.net.URL;
24
24
import java.util.ArrayList;
25
25
import java.util.List;
26
 
import java.util.Locale;
27
26
import java.util.regex.Matcher;
28
27
import java.util.regex.Pattern;
29
28
 
159
158
 
160
159
            // exclude those where they do not match
161
160
            // href will never be truncated, text may be truncated by apache
162
 
            // may have a '.' from either the extension (.jar) or "..>"
163
 
            int dotIndex = text.indexOf('.');
164
 
 
165
 
            if (((dotIndex != -1) && !href.startsWith(text.substring(0, dotIndex)))
166
 
                    || ((dotIndex == -1) 
167
 
                            && !href.toLowerCase(Locale.US).equals(text.toLowerCase(Locale.US)))) {
168
 
                // the href and the text do not "match"
169
 
                continue;
 
161
            if (text.endsWith("..>")) {
 
162
                // text is probably truncated, we can only check if the href starts with text
 
163
                if (!href.startsWith(text.substring(0, text.length() - 3))) {
 
164
                    continue;
 
165
                }
 
166
            } else if (text.endsWith("..>")) {
 
167
                // text is probably truncated, we can only check if the href starts with text
 
168
                if (!href.startsWith(text.substring(0, text.length() - 6))) {
 
169
                    continue;
 
170
                }
 
171
            } else {
 
172
                // text is not truncated, so it must match the url after stripping optional
 
173
                // trailing slashes
 
174
                String strippedHref = href.endsWith("/") ? href.substring(0, href.length() - 1) : href;
 
175
                String strippedText = text.endsWith("/") ? text.substring(0, text.length() - 1) : text;
 
176
                if (!strippedHref.equalsIgnoreCase(strippedText)) {
 
177
                    continue;
 
178
                }
170
179
            }
171
180
 
172
181
            boolean directory = href.endsWith("/");