}
// If the URL contains a host, look it up in the bookmark list and use that
// as the root of the returned path.
else {
Bookmark bookmark;
// If the bookmark doesn't exist, but a path is specified, throws an exception.
// Otherwise, returns the requested bookmark.
if((bookmark = BookmarkManager.getBookmark(url.getHost())) == null) {
if(!url.getPath().equals("/"))
throw new IOException();
return new BookmarkFile(new Bookmark(url.getHost(), url.getPath()));
}
// If the bookmark exists, and a path is specified, creates a new path
// from the bookmark's location and the specified path.
if(!url.getPath().equals("/"))
return FileFactory.getFile(bookmark.getLocation() + url.getPath());
// Otherwise, creates a new bookmark file.
return new BookmarkFile(bookmark);
}
}