/* for non-cached, or not-yet-cached instances, preload the image */
if ((cachedInstance == null || cachedInstance == newInstance)
&& !("".equals(newInstance.backgroundImage))) {
//Additional processing: preload image
String uri = URISpecification.getURL(newInstance.backgroundImage);
FObj fobj = pList.getFObj();
FOUserAgent userAgent = pList.getFObj().getUserAgent();
ImageManager manager = userAgent.getFactory().getImageManager();
ImageSessionContext sessionContext = userAgent.getImageSessionContext();
ImageInfo info;
try {
info = manager.getImageInfo(uri, sessionContext);
newInstance.backgroundImageInfo = info;
} catch (ImageException e) {
ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
fobj.getUserAgent().getEventBroadcaster());
eventProducer.imageError(fobj, uri, e, fobj.getLocator());
} catch (FileNotFoundException fnfe) {
ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
fobj.getUserAgent().getEventBroadcaster());
eventProducer.imageNotFound(fobj, uri, fnfe, fobj.getLocator());
} catch (IOException ioe) {
ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
fobj.getUserAgent().getEventBroadcaster());
eventProducer.imageIOError(fobj, uri, ioe, fobj.getLocator());
}
}
}
return (cachedInstance != null ? cachedInstance : newInstance);