[Demonstration 1]

[Buggy Method]
public Long indexPicture(BufferedImage image, Long id, Map<String, String> properties) throws AlreadyIndexedException, NoValidPictureException, PictureTooHomogeneous {
    return index.addPicture(image, id, properties, config.getNumberOfPatch(), config.getResizeMethod(), config.getSizeOfPatchResizeWidth(), config.getSizeOfPatchResizeHeight(), config.isSyncAfterImage());
}

[Buggy Hunk]
properties,

[Patch]
new HashMap<String,String>(properties),

[Demonstration 2]

[Buggy Method]
public static Schema convertSchema(HCatSchema hcatSchema, String tableName) throws HCatException {
    LOG.info(hcatSchema.getSchemaAsTypeString());
    Schema avroSchema = getRecordAvroFieldSchema(hcatSchema, tableName);
    LOG.info(avroSchema.toString());
    return avroSchema;
}

[Buggy Hunk]
public static Schema convertSchema(HCatSchema hcatSchema, String tableName) throws HCatException {

[Patch]
public static Schema convertSchema(HCatSchema hcatSchema, String tableName) throws IOException {

[Demonstration 3]

[Buggy Method]
public static String getNextPosition(List<Selection> selections, String position, boolean next) {
    List<String> p = new ArrayList<>(getPositions(selections));
    Collections.sort(p);
    logger.debug("getNext pos: {}, cur: {}", p, position);
    int idx = Collections.binarySearch(p, position);
    if (idx == -1) {
        if (next)
            return p.get(0);
        else
            return null;
    } else if (idx < 0) {
        idx = -idx - 1;
        if (!next) {
            if (idx > 0)
                idx--;
            else
                return null;
        }
    } else {
        if (next) {
            if (idx == p.size() - 1)
                return null;
            else
                idx = p.size() - 1;
        } else {
            if (idx > 0)
                idx--;
            else
                return null;
        }
    }
    return p.get(idx);
}

[Buggy Hunk]
int idx = Collections.binarySearch(p, position);

[Patch]
int idx = position ==null ? -1 : Collections.binarySearch(p, position);