[Demonstration 1]

[Buggy Method]
@Override
public void onCreateNode(ChildAssociationRef childNodeRef) {
    NodeRef node = childNodeRef.getChildRef();
    if (nodeService.exists(node)) {
        ContentData contentData = (ContentData) nodeService.getProperty(node, ContentModel.PROP_CONTENT);
        // Do this check only if the uploaded document is a PDF
        if (contentData.getMimetype().equalsIgnoreCase("application/pdf")) {
            ArrayList<Map<QName, Serializable>> signatures = getDigitalSignatures(node);
            if (signatures != null) {
                for (Map<QName, Serializable> aspectProperties : signatures) {
                    String originalFileName = nodeService.getProperty(node, ContentModel.PROP_NAME).toString();
                    String signatureFileName = FilenameUtils.getBaseName(originalFileName) + "-" + System.currentTimeMillis() + "-" + PADES;
                    // Creating a node reference without type (no content and no folder): remains invisible for Share
                    NodeRef signatureNodeRef = nodeService.createNode(nodeService.getPrimaryParent(node).getParentRef(), ContentModel.ASSOC_CONTAINS, QName.createQName(signatureFileName), ContentModel.TYPE_CMOBJECT).getChildRef();
                    nodeService.createAssociation(node, signatureNodeRef, SignModel.ASSOC_SIGNATURE);
                    nodeService.createAssociation(signatureNodeRef, node, SignModel.ASSOC_DOC);
                    aspectProperties.put(SignModel.PROP_FORMAT, PADES);
                    nodeService.addAspect(signatureNodeRef, SignModel.ASPECT_SIGNATURE, aspectProperties);
                }
            }
        }
    }
}

[Buggy Hunk]
if (contentData.getMimetype().equalsIgnoreCase("application/pdf")) {

[Patch]
if (contentData != null && contentData.getMimetype().equalsIgnoreCase("application/pdf")) {

[Demonstration 2]

[Buggy Method]
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    if (value instanceof String)
        setText((String) value);
    else if (value instanceof Time)
        setText((String) value.toString());
    if (column != -1 && row < personList.size()) {
        Color textColor = Color.black;
        if (column == tableModel.getColumnForTaskName()) {
            PersonByTaskModel person = personList.get(row);
            if (person.getTask() != null)
                textColor = new Color(person.getTask().getColor());
            else if (person.getPerson().getSingleInstanceTaskAssignment() != null)
                textColor = new Color(person.getPerson().getSingleInstanceTaskAssignment().getColor());
        }
        super.setForeground(textColor);
        if (isSelected)
            super.setBackground(new Color(0xDDDDDD));
        else
            super.setBackground(Color.WHITE);
        if (column == tableModel.getColumnForPersonName())
            super.setHorizontalAlignment(LEFT);
        else
            super.setHorizontalAlignment(CENTER);
    }
    return this;
}

[Buggy Hunk]
if (column != -1 && row < personList.size()) {

[Patch]
if (column != -1) {

[Demonstration 3]

[Buggy Method]
private Failed findFailedNative() {
    Failed failed = new Failed();
    String query = "ISNULL:\"vgr:dc.title.filename.native\" AND TYPE:\"vgr:document\" AND ASPECT:\"vgr:published\"";
    SearchParameters parameters = new SearchParameters();
    parameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
    parameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    parameters.setQuery(query);
    ResultSet nodes = _searchService.query(parameters);
    failed.total = nodes.length();
    try {
        for (NodeRef nodeRef : nodes.getNodeRefs()) {
            if (!_publishingService.isPublished(nodeRef)) {
                continue;
            }
            if (failed.list.size() >= 500) {
                break;
            }
            NodeRef pdfNodeRef = _storageService.getPublishedRendition(nodeRef);
            if (pdfNodeRef == null) {
                System.out.println("No PDF/A rendition found for '" + nodeRef + "' to populate natives for...");
                continue;
            }
            failed.list.add(new Pair(nodeRef, pdfNodeRef));
        }
    } finally {
        nodes.close();
    }
    return failed;
}

[Buggy Hunk]
NodeRef pdfNodeRef = _storageService.getPublishedRendition(nodeRef);

[Patch]
NodeRef pdfNodeRef = _storageService.getPublishedRendition(nodeRef, _globalProperties.getProperty("vgr.pdf.delivery.format"));