[Demonstration 1]

[Buggy Method]
public void setCreatedAt(Date createdAt) {
    this.createdAt = createdAt;
}

[Buggy Hunk]
this.createdAt = createdAt;

[Patch]
this.createdAt = (Date) createdAt.clone();

[Demonstration 2]

[Buggy Method]
private static long initLongValue(Properties properties, String property, long defaultValue) {
    if (properties == null || properties.get(property) == null) {
        return defaultValue;
    }
    String value = properties.getProperty(property);
    try {
        return Long.valueOf(value);
    } catch (NumberFormatException e) {
        throw BootstrapLogger.LOG.invalidPropertyValue(property, value);
    }
}

[Buggy Hunk]
return Long.valueOf(value);

[Patch]
return Long.parseLong(value);

[Demonstration 3]

[Buggy Method]
@Override
public NotarySeal notarizeDocument(String documentType, String document, NotaryKey notaryKey) {
    logger.entry(documentType, document, notaryKey);
    logger.debug("Verifying that the notary key has not expired...");
    Map<String, Object> errors = new LinkedHashMap<>();
    Watermark watermark = notaryKey.watermark;
    validateWatermark(watermark, errors);
    throwExceptionOnErrors("notary.key.has.expired", errors);
    logger.debug("Creating the notary seal attributes...");
    SealAttributes attributes = new SealAttributes();
    attributes.documentType = documentType;
    attributes.documentHash = hashDocument(document);
    attributes.verificationCitation = notaryKey.verificationCitation;
    attributes.watermark = new Watermark();
    logger.debug("Signing the notary seal...");
    NotarySeal seal = new NotarySeal();
    PrivateKey signingKey = notaryKey.signingKey;
    seal.attributes = attributes;
    seal.selfSignature = generateDocumentSignature(attributes.toString(), signingKey);
    logger.exit(seal);
    return seal;
}

[Buggy Hunk]
attributes.watermark = new Watermark();

[Patch]
attributes.watermark = generateWatermark(Notarization.VALID_FOR_FOREVER);