return;
}
// enforce no more than x rendering errors
int maxErrors = wms.getMaxRenderingErrors();
MaxErrorEnforcer errorChecker = new MaxErrorEnforcer(renderer, maxErrors);
// Add a render listener that ignores well known rendering exceptions and reports back non
// ignorable ones
final RenderExceptionStrategy nonIgnorableExceptionListener;
nonIgnorableExceptionListener = new RenderExceptionStrategy(renderer);
renderer.addRenderListener(nonIgnorableExceptionListener);
// enforce max memory usage
int maxMemory = wms.getMaxRequestMemory() * KB;
PDFMaxSizeEnforcer memoryChecker = new PDFMaxSizeEnforcer(renderer, graphic, maxMemory);
// render the map
renderer.paint(graphic, paintArea, getRenderingArea(), getRenderingTransform());
// render the watermark
MapDecorationLayout.Block watermark =
DefaultRasterMapProducer.getWatermark(this.mapContext.getRequest().getWMS().getServiceInfo());
if (watermark != null) {
MapDecorationLayout layout = new MapDecorationLayout();
layout.paint(graphic, paintArea, this.mapContext);
}
//check if a non ignorable error occurred
if(nonIgnorableExceptionListener.exceptionOccurred()){
Exception renderError = nonIgnorableExceptionListener.getException();
throw new WmsException("Rendering process failed", "internalError", renderError);
}
// check if too many errors occurred
if(errorChecker.exceedsMaxErrors()) {
throw new WmsException("More than " + maxErrors + " rendering errors occurred, bailing out",
"internalError", errorChecker.getLastException());
}
// check we did not use too much memory
if(memoryChecker.exceedsMaxSize()) {
long kbMax = maxMemory / KB;