[Demonstration 1]

[Buggy Method]
@Override
public Object getPropertyAtIndex(String s, int i) {
    try {
        String attr = replaceAspectAttrSep(s);
        IDfValue dfValue = sysObject.getRepeatingValue(attr, i);
        return extractValue(dfValue, sysObject.getAttrDataType(s));
    } catch (DfException e) {
        throw new RuntimeException(e);
    }
}

[Buggy Hunk]
return extractValue(dfValue, sysObject.getAttrDataType(s));

[Patch]
return extractValue(dfValue, sysObject.getAttrDataType(attr));

[Demonstration 2]

[Buggy Method]
public void validateAttributes(List<Attribute> attributes) throws IllegalArgumentException {
    // Validate attributes if they are specified.
    if (!CollectionUtils.isEmpty(attributes)) {
        Map<String, String> attributeNameValidationMap = new HashMap<>();
        for (Attribute attribute : attributes) {
            attribute.setName(alternateKeyHelper.validateStringParameter("business object data attribute name", attribute.getName()));
            // Ensure the attribute key isn't a duplicate by using a map with a "lowercase" name as the key for case insensitivity.
            String validationMapKey = attribute.getName().toLowerCase();
            if (attributeNameValidationMap.containsKey(validationMapKey)) {
                throw new IllegalArgumentException("Duplicate attribute name found: " + attribute.getName());
            }
            attributeNameValidationMap.put(validationMapKey, attribute.getValue());
        }
    }
}

[Buggy Hunk]
attribute.setName(alternateKeyHelper.validateStringParameter("business object data attribute name", attribute.getName()));

[Patch]
attribute.setName(alternateKeyHelper.validateStringParameter("An", "attribute name", attribute.getName()));