diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2012-04-20 20:49:25 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2012-04-20 22:11:01 +0200 |
commit | c91a817d13a8f68cc5b7399ba4cbe7cd16a4645b (patch) | |
tree | 49b4c8421b5a58e5f12de3f49c6d338fd3d4ccce /main/src/cgeo/geocaching/network | |
parent | ba6b67afc9b67210d7d487b0c7ed99a1f5d677ff (diff) | |
download | cgeo-c91a817d13a8f68cc5b7399ba4cbe7cd16a4645b.zip cgeo-c91a817d13a8f68cc5b7399ba4cbe7cd16a4645b.tar.gz cgeo-c91a817d13a8f68cc5b7399ba4cbe7cd16a4645b.tar.bz2 |
Add FIXME: message and ask for clarification
Diffstat (limited to 'main/src/cgeo/geocaching/network')
-rw-r--r-- | main/src/cgeo/geocaching/network/HtmlImage.java | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/main/src/cgeo/geocaching/network/HtmlImage.java b/main/src/cgeo/geocaching/network/HtmlImage.java index b6be931..ecf0d52 100644 --- a/main/src/cgeo/geocaching/network/HtmlImage.java +++ b/main/src/cgeo/geocaching/network/HtmlImage.java @@ -163,26 +163,25 @@ public class HtmlImage implements Html.ImageGetter { } private final String makeAbsoluteURL(final String url) { - try { - // Check if uri is absolute or not, if not attach the connector hostname - // FIXME: that should also include the scheme - if (Uri.parse(url).isAbsolute()) { - return url; - } else { - final String host = ConnectorFactory.getConnector(geocode).getHost(); - if (StringUtils.isNotEmpty(host)) { - StringBuilder builder = new StringBuilder("http://"); - builder.append(host); - if (!StringUtils.startsWith(url, "/")) { - builder.append('/'); - } - builder.append(url); - return builder.toString(); - } + // Check if uri is absolute or not, if not attach the connector hostname + // FIXME: that should also include the scheme + if (Uri.parse(url).isAbsolute()) { + return url; + } + + final String host = ConnectorFactory.getConnector(geocode).getHost(); + if (StringUtils.isNotEmpty(host)) { + final StringBuilder builder = new StringBuilder("http://"); + builder.append(host); + if (!StringUtils.startsWith(url, "/")) { + // FIXME: explain why the result URL would be valid if the path does not start with + // a '/', or signal an error. + builder.append('/'); } - } catch (Exception e) { - Log.e("HtmlImage.makeAbsoluteURL (parse URL)", e); + builder.append(url); + return builder.toString(); } + return null; } |