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
.