Source:
private void handleLayers() { start("Layer"); final List<LayerInfo> layers; if (request.getNamespace() != null) { final List<LayerInfo> allLayers = wmsConfig.getLayers(); layers = new ArrayList<LayerInfo>(); String namespace = wmsConfig.getNamespaceByPrefix(request.getNamespace()); for (LayerInfo layer : allLayers) { Name name = layer.getResource().getQualifiedName(); if (name.getNamespaceURI().equals(namespace)) { layers.add(layer); } } } else { layers = wmsConfig.getLayers(); } if(StringUtils.isBlank(serviceInfo.getRootLayerAbstract())) { element("Title", serviceInfo.getTitle()); element("Abstract", serviceInfo.getAbstract()); } else { element("Title", serviceInfo.getRootLayerTitle()); element("Abstract", serviceInfo.getRootLayerAbstract()); } List<String> srsList = serviceInfo.getSRS(); Set<String> srs = new LinkedHashSet<String>(); if (srsList != null) { srs.addAll(srsList); } for (ExtendedCapabilitiesProvider provider : extCapsProviders) { provider.customizeRootCrsList(srs); } handleRootCrsList(srs); handleRootBbox(layers); handleAuthorityURL(serviceInfo.getAuthorityURLs()); handleLayerIdentifiers(serviceInfo.getIdentifiers()); Set<LayerInfo> layersAlreadyProcessed = new HashSet<LayerInfo>(); try { List<LayerGroupInfo> layerGroups = wmsConfig.getLayerGroups(); layersAlreadyProcessed = handleLayerGroups(new ArrayList<LayerGroupInfo>(layerGroups)); } catch (Exception e) { throw new RuntimeException("Can't obtain Envelope of Layer-Groups: " + e.getMessage(), e); } LayerTree featuresLayerTree = new LayerTree(layers); handleLayerTree(featuresLayerTree, layersAlreadyProcessed); end("Layer"); }

Target:
private void handleLayers() { start("Layer"); final List<LayerInfo> layers; if (request.getNamespace() != null) { final List<LayerInfo> allLayers = wmsConfig.getLayers(); layers = new ArrayList<LayerInfo>(); String namespace = wmsConfig.getNamespaceByPrefix(request.getNamespace()); for (LayerInfo layer : allLayers) { Name name = layer.getResource().getQualifiedName(); if (name.getNamespaceURI().equals(namespace)) { layers.add(layer); } } } else { layers = wmsConfig.getLayers(); } if(StringUtils.isBlank(serviceInfo.getRootLayerTitle())) { element("Title", serviceInfo.getTitle()); } else { element("Title", serviceInfo.getRootLayerTitle()); } if(StringUtils.isBlank(serviceInfo.getRootLayerAbstract())) { element("Abstract", serviceInfo.getAbstract()); } else { element("Abstract", serviceInfo.getRootLayerAbstract()); } List<String> srsList = serviceInfo.getSRS(); Set<String> srs = new LinkedHashSet<String>(); if (srsList != null) { srs.addAll(srsList); } for (ExtendedCapabilitiesProvider provider : extCapsProviders) { provider.customizeRootCrsList(srs); } handleRootCrsList(srs); handleRootBbox(layers); handleAuthorityURL(serviceInfo.getAuthorityURLs()); handleLayerIdentifiers(serviceInfo.getIdentifiers()); Set<LayerInfo> layersAlreadyProcessed = new HashSet<LayerInfo>(); try { List<LayerGroupInfo> layerGroups = wmsConfig.getLayerGroups(); layersAlreadyProcessed = handleLayerGroups(new ArrayList<LayerGroupInfo>(layerGroups)); } catch (Exception e) { throw new RuntimeException("Can't obtain Envelope of Layer-Groups: " + e.getMessage(), e); } LayerTree featuresLayerTree = new LayerTree(layers); handleLayerTree(featuresLayerTree, layersAlreadyProcessed); end("Layer"); }