This fixes the ImageView class to also consider the base URL of the document for relative image locations.
2006-11-02 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/text/html/ImageView.java (getImageURL): Fetch attribute from element. Consider the base URL for relative image locations. /Roman
Index: javax/swing/text/html/ImageView.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/ImageView.java,v retrieving revision 1.1 diff -u -1 -5 -r1.1 ImageView.java --- javax/swing/text/html/ImageView.java 5 Jun 2006 12:38:30 -0000 1.1 +++ javax/swing/text/html/ImageView.java 2 Nov 2006 14:03:49 -0000 @@ -163,43 +163,46 @@ return null; else return imageIcon.getImage(); } /** * Get the URL location of the image to render. If this method returns null, * the "no image" icon is rendered instead. By defaul, url must be present as * the "src" property of the IMG tag. If it is missing, null is returned and * the "no image" icon is rendered. * * @return the URL location of the image to render. */ public URL getImageURL() { - Object url = getAttributes().getAttribute(Attribute.SRC); - if (url == null) - return null; - - try - { - return new URL(url.toString()); - } - catch (MalformedURLException e) + Element el = getElement(); + String src = (String) el.getAttributes().getAttribute(Attribute.SRC); + URL url = null; + if (src != null) { - // The URL is malformed - no image. - return null; + URL base = ((HTMLDocument) getDocument()).getBase(); + try + { + url = new URL(base, src); + } + catch (MalformedURLException ex) + { + // Return null. + } } + return url; } /** * Get the icon that should be displayed while the image is loading and hence * not yet available. * * @return an icon, showing a non broken sheet of paper with image. */ public Icon getLoadingImageIcon() { return ImageViewIconFactory.getLoadingImageIcon(); } /** * Get the image loading strategy.