Skip to content

Commit

Permalink
Apply code formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-nagel committed Apr 12, 2018
1 parent 06e2601 commit ff720e3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/crawlercommons/sitemaps/SiteMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ public String toString() {
*/
private void setBaseUrl(URL sitemapUrl) {
// Remove everything back to last slash on the file path:
// http://example.com/abc/sitemap.xml
// becomes
// http://example.com/abc/
// - http://example.com/abc/sitemap.xml
// becomes
// - http://example.com/abc/
// But ignore slashes in the query part:
// http://example.com/index.php?route=feed/imagemap
// becomes
// http://example.com/
// - http://example.com/index.php?route=feed/imagemap
// becomes
// - http://example.com/
String path = sitemapUrl.getPath();
int lastPathDelimPos = path.lastIndexOf('/');
if (lastPathDelimPos < 0) {
path = "/";
} else {
path = path.substring(0, lastPathDelimPos+1);
path = path.substring(0, lastPathDelimPos + 1);
}
try {
baseUrl = new URL(sitemapUrl.getProtocol(), sitemapUrl.getHost(), sitemapUrl.getPort(), path).toString();
Expand Down

0 comments on commit ff720e3

Please sign in to comment.