[Demonstration 1]

[Buggy Method]
public static String prettyPrint(String xml) throws Exception {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(false);
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(IOUtils.toInputStream(xml, "UTF-8"));
    Transformer tf = TransformerFactory.newInstance().newTransformer();
    tf.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    tf.setOutputProperty(OutputKeys.INDENT, "yes");
    Writer out = new StringWriter();
    tf.transform(new DOMSource(doc), new StreamResult(out));
    return out.toString();
}

[Buggy Hunk]
Document doc = db.parse(IOUtils.toInputStream(xml, "UTF-8"));

[Patch]
Document doc = db.parse(IOUtils.toInputStream(xml, StandardCharsets.UTF_8));

[Demonstration 2]

[Buggy Method]
private List<UrlMapping> getUrlMappings(@NotNull final Configuration configuration, final String app) {
    checkNotNull(configuration);
    return Optional.ofNullable(configuration).map(Configuration::getUrlMappings).map(URLMappings::getFeatureGroups).map(featureGroups -> featureGroups.stream().filter(e -> StringUtils.endsWithIgnoreCase(app, e.getName())).findFirst().map(FeatureGroup::getUrlMappings).orElse(new ArrayList<>())).get();
}

[Buggy Hunk]
.get();

[Patch]
.orElse(new ArrayList<UrlMapping>());

[Demonstration 3]

[Buggy Method]
@Override
public void shutdown() {
    try {
        flush();
        sync(Sync.MAJOR_SYNC);
        domDb.close();
        collectionsDb.close();
        notifyClose();
    } catch (final Exception e) {
        LOG.warn(e.getMessage(), e);
    }
    super.shutdown();
}

[Buggy Hunk]
LOG.warn(e.getMessage(), e);

[Patch]
LOG.error(e.getMessage(), e);