Skip to content

Commit

Permalink
Escape special characters in HTML quote feed URL
Browse files Browse the repository at this point in the history
  • Loading branch information
buchen committed Apr 14, 2014
1 parent dd0a8d1 commit 9ab2f34
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.MessageFormat;
Expand Down Expand Up @@ -234,7 +236,15 @@ else if (os.startsWith("mac"))
else
userAgent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0";

return parse(Jsoup.connect(url).userAgent(userAgent).get(), errors);
try
{
String escapedUrl = new URI(url).toASCIIString();
return parse(Jsoup.connect(escapedUrl).userAgent(userAgent).get(), errors);
}
catch (URISyntaxException e)
{
throw new IOException(e);
}
}

protected List<LatestSecurityPrice> parseFromHTML(String html, List<Exception> errors) throws IOException
Expand Down

0 comments on commit 9ab2f34

Please sign in to comment.