// if it's a feature layer, setup the feature collection for it (some decorators use it)
if (layer instanceof FeatureLayer) {
try {
WMSMapContent mapContent = context.getMapContent();
SimpleFeatureCollection fc = new KMLFeatureAccessor().loadFeatureCollection(
layer, mapContent,
context.getWms(), mapContent.getScaleDenominator());
context.setCurrentFeatureCollection(fc);
} catch (Exception e) {
if (e instanceof ServiceException) {