Source:
public BufferedImage getTileImage( String layer, TileIndex index, Iterable<TileIndex> tileSet, JSONObject query ) { int width = 256; int height = 256; BufferedImage bi = null; try { LayerConfiguration config = _layerService.getLayerConfiguration( layer, query ); PyramidMetaData metadata = _layerService.getMetaData( layer ); String minimum = metadata.getCustomMetaData(""+index.getLevel(), "minimum"); String maximum = metadata.getCustomMetaData(""+index.getLevel(), "maximum"); config.setLevelProperties( index, minimum, maximum ); TileDataImageRenderer tileRenderer = config.produce(TileDataImageRenderer.class); config.prepareForRendering(layer, index, tileSet); String dataId = config.getPropertyValue(LayerConfiguration.DATA_ID); PyramidIO pyramidIO = config.produce(PyramidIO.class); TileSerializer<Double> serializer = SerializationTypeChecker.checkBinClass(config.produce(TileSerializer.class), tileRenderer.getAcceptedBinClass(), tileRenderer.getAcceptedTypeDescriptor()); int coarseness = config.getPropertyValue(LayerConfiguration.COARSENESS); TileData<?> data = tileDataForIndex(index, dataId, serializer, pyramidIO, coarseness); if (data != null) { bi = tileRenderer.render(data, config); } } catch (ConfigurationException e) { LOGGER.warn("No renderer specified for tile request. "+ e.getMessage()); } catch (IllegalArgumentException e) { LOGGER.info("Renderer configuration not recognized."); } catch (Exception e) { LOGGER.warn("Tile is corrupt: " + layer + ":" + index); LOGGER.warn("Tile error: ", e); } if (bi == null){ bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = bi.createGraphics(); g.setColor(COLOR_BLANK); g.fillRect(0, 0, 256, 256); g.dispose(); } return bi; }

Target:
public BufferedImage getTileImage( String layer, TileIndex index, Iterable<TileIndex> tileSet, JSONObject query ) { int width = 256; int height = 256; BufferedImage bi = null; try { LayerConfiguration config = _layerService.getLayerConfiguration( layer, query ); PyramidMetaData metadata = _layerService.getMetaData( layer ); String minimum = metadata.getCustomMetaData(""+index.getLevel(), "minimum"); String maximum = metadata.getCustomMetaData(""+index.getLevel(), "maximum"); config.setLevelProperties( index, minimum, maximum ); TileDataImageRenderer tileRenderer = config.produce(TileDataImageRenderer.class); config.prepareForRendering(layer, index, tileSet); String dataId = config.getPropertyValue(LayerConfiguration.DATA_ID); PyramidIO pyramidIO = config.produce(PyramidIO.class); TileSerializer<?> serializer = SerializationTypeChecker.checkBinClass(config.produce(TileSerializer.class), tileRenderer.getAcceptedBinClass(), tileRenderer.getAcceptedTypeDescriptor()); int coarseness = config.getPropertyValue(LayerConfiguration.COARSENESS); TileData<?> data = tileDataForIndex(index, dataId, serializer, pyramidIO, coarseness); if (data != null) { bi = tileRenderer.render(data, config); } } catch (ConfigurationException e) { LOGGER.warn("No renderer specified for tile request. "+ e.getMessage()); } catch (IllegalArgumentException e) { LOGGER.info("Renderer configuration not recognized."); } catch (Exception e) { LOGGER.warn("Tile is corrupt: " + layer + ":" + index); LOGGER.warn("Tile error: ", e); } if (bi == null){ bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = bi.createGraphics(); g.setColor(COLOR_BLANK); g.fillRect(0, 0, 256, 256); g.dispose(); } return bi; }