Source:
<code>public V3Capabilities list() { Current current = CurrentManager.get(); StringBuilder buffer = new StringBuilder(); if (current.getVersionSource() == VersionSource.URL) { buffer.append("/v"); buffer.append(current.getVersion()); } buffer.append(current.getPrefix()); String prefix = buffer.toString(); Document document; try { DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); try (InputStream in = this.getClass().getResourceAsStream("/v3/capabilities.xml")) { document = parser.parse(in); } } catch (Exception exception) { throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR); } XPath xpath = XPathFactory.newInstance().newXPath(); try { Element versionElement = (Element) xpath.evaluate("/capabilities/version[@major='3' and @minor='6']", document, XPathConstants.NODE); versionElement = <START> this.cloneCapabilities(versionElement, <END> "332e4033-2e40-332e-4033-2e40332e4033", "4", "0"); document.getDocumentElement().appendChild(versionElement); versionElement = this.cloneCapabilities(versionElement, "876c3672-1ad3-11e7-b157-507b9dcf131d", "4", "1"); Element currentElement = (Element) xpath.evaluate("current", versionElement, XPathConstants.NODE); currentElement.setTextContent("true"); document.getDocumentElement().appendChild(versionElement); } catch (XPathExpressionException exception) { throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR); } try { NodeList nodes = (NodeList) xpath.evaluate(" for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); String href = node.getNodeValue(); href = prefix + href; node.setNodeValue(href); } } catch (XPathExpressionException exception) { throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR); } return JAXB.unmarshal(new DOMSource(document), V3Capabilities.class); }</code><technical_language>'this.' prefix needed. I this fits in a 120 characters line, need break line, that</technical_language>

Target:
public V3Capabilities list() { Current current = CurrentManager.get(); StringBuilder buffer = new StringBuilder(); if (current.getVersionSource() == VersionSource.URL) { buffer.append("/v"); buffer.append(current.getVersion()); } buffer.append(current.getPrefix()); String prefix = buffer.toString(); Document document; try { DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); try (InputStream in = this.getClass().getResourceAsStream("/v3/capabilities.xml")) { document = parser.parse(in); } } catch (Exception exception) { throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR); } XPath xpath = XPathFactory.newInstance().newXPath(); try { Element versionElement36 = (Element) xpath.evaluate("/capabilities/version[@major='3' and @minor='6']", document, XPathConstants.NODE); Element versionElement40 = cloneCapabilities(versionElement36, "332e4033-2e40-332e-4033-2e40332e4033", "4", "0"); document.getDocumentElement().appendChild(versionElement40); Element versionElement41 = cloneCapabilities(versionElement36, "876c3672-1ad3-11e7-b157-507b9dcf131d", "4", "1"); Element currentElement = (Element) xpath.evaluate("current", versionElement41, XPathConstants.NODE); currentElement.setTextContent("true"); document.getDocumentElement().appendChild(versionElement41); } catch (XPathExpressionException exception) { throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR); } try { NodeList nodes = (NodeList) xpath.evaluate(" for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); String href = node.getNodeValue(); href = prefix + href; node.setNodeValue(href); } } catch (XPathExpressionException exception) { throw new WebApplicationException(exception, Response.Status.INTERNAL_SERVER_ERROR); } return JAXB.unmarshal(new DOMSource(document), V3Capabilities.class); }