Catching image fetch exception



I am rendering some rough and ready HTML as part of a screen-scraping
task.

Presumably it is NOT valid HTML. I get messages like these often:

Uncaught error fetching image:
Exception in thread "AWT-EventQueue-1" java.lang.SecurityException
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.awt.image.URLImageSource.checkSecurity(Unknown Source)
at sun.awt.image.ImageRepresentation.imageComplete(Unknown
Source)
at sun.awt.image.InputStreamImageSource.errorConsumer(Unknown
Source)
at sun.awt.image.InputStreamImageSource.setDecoder(Unknown
Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown
Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)
Exception in thread "AWT-EventQueue-1" java.lang.SecurityExceptio


OR

Exception in thread "AWT-EventQueue-1" java.lang.SecurityException
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.awt.image.URLImageSource.checkSecurity(Unknown Source)
at sun.awt.image.ToolkitImage.getHeight(Unknown Source)
at javax.swing.text.html.ImageView.hasPixels(Unknown Source)
at javax.swing.text.html.ImageView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.ParagraphView.paint(Unknown Source)
at javax.swing.text.html.ParagraphView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.TableView$RowView.paint(Unknown
Source)
at javax.swing.text.html.TableView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.TableView$RowView.paint(Unknown
Source)
at javax.swing.text.html.TableView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.TableView$RowView.paint(Unknown
Source)
at javax.swing.text.html.TableView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI$RootView.paint(Unknown
Source)
at javax.swing.plaf.basic.BasicTextUI.paintSafely(Unknown
Source)
at javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source)
at javax.swing.plaf.synth.SynthEditorPaneUI.paint(Unknown
Source)
at javax.swing.plaf.synth.SynthEditorPaneUI.update(Unknown
Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at
javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown
Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown
Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown
Source)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown
Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


I presume these are a side effect of links to images that don't exist,
or that are not being rendered relative the the correct base.

So questions:

1. can I fake the base the HTML came from.

2. is there a way to catch these exceptions and ignore them?
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Climate change is no longer a doomsday prophecy, it?s a reality."
~ Astrid Heiberg president of the International Federation of Red Cross and Red Crescent Societies
.



Relevant Pages

  • Re: Text_IO, was: Re: Something I dont understand
    ... have Ada library implementations of reasonable size and complexity. ... There are, of course, forms of text, such as HTML or other mark-up ... typewriter-style formatting. ... before rendering on some viewing device. ...
    (comp.lang.ada)
  • Re: Q.: invoking Small Caps ...
    ... Good enough for paragraphs for many of us. ... suitable than the default rendering of any other HTML element, ... Yet some HTML tags have meaningful, mnemonic, suggestive names, like ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Q.: invoking Small Caps ...
    ... with (so it is *a* paragraph element), and it says that by "paragraph" they don't mean what the word has normally meant, without really saying *what* it means. ... If that's a suitable default rendering for something, or at least more suitable than the default rendering of any other HTML element, use. ... Yet some HTML tags have meaningful, mnemonic, suggestive names, like, ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: safari rendering bug: site display not correct
    ... > The problem there is not Safari, it's your HTML. ... > and you cannot reasonably expect a specific rendering. ... invalid elements and failure to close inline elements (and either ...
    (comp.sys.mac.apps)
  • Re: trying to achieve Level Triple-A conformance
    ... rendering but also behaviour. ... that the HTML DTD requires. ... the way browsers occasionally do decide to repair it for you. ... Validation is the process of comparing a document that DTD. ...
    (alt.html)