The second solution isn't good because this method has to return an image, so displaying a a webpage e.g. in a <img> tag would look ugly.
Ideally it should show a default image, but default image would be read from the filesystem and again the same exceptions, if not here then below in ImageIO.write.