// ignore the exception.
canAttemptRecovery = false;
}
}
OpImage image = null;
try {
// Attempt to create an OpImage from the decoder image.
image = new DisposableNullOpImage(dec.decodeAsRenderedImage(page),
layout,
renderHints,
bound);
} catch(OutOfMemoryError memoryError) {
// Ran out of memory - may be due to the decoder being
// obliged to read the entire image when it creates the
// RenderedImage it returns.
if(canAttemptRecovery) {
// First flush the cache if one is defined.
TileCache cache = image != null ?
image.getTileCache() :
RIFUtil.getTileCacheHint(renderHints);
if(cache != null) {
cache.flush();
}