[Demonstration 1]

[Buggy Method]
@Override
void resetCodePathes(Boolean merge, String suffix) {
    Iterator<String> iPack = context.getPackNames();
    while (iPack.hasNext()) {
        InvarPackage pack = context.getPack(iPack.next());
        if (context.isBuildInPack(pack))
            continue;
        String name = pack.getName();
        Iterator<String> iType = pack.getTypeNames();
        while (iType.hasNext()) {
            String typeName = iType.next();
            InvarType type = pack.getType(typeName);
            if (onePackOneFile == false) {
                name = typeName;
                if (flattenCodeDir) {
                    name = type.fullName("_");
                }
            }
            String split = snippetTryGet(Key.FILE_INCLUDE + ".split", "/");
            String path = flattenCodeDir ? name : type.fullName(split);
            //path = dirPrefix + path;
            path = (path + suffix);
            switch(type.getId()) {
                case ENUM:
                case STRUCT:
                    resetCodePath(type, path, name, merge);
                    break;
                case PROTOCOL:
                    resetCodePath(type, path, name, merge);
                    TypeProtocol t = (TypeProtocol) type;
                    if (t.hasClient()) {
                        resetCodePath(t.getClient(), path, name, merge);
                    }
                    if (t.hasServer()) {
                        resetCodePath(t.getServer(), path, name, merge);
                    }
                    break;
                default:
                    break;
            }
        }
    }
}

[Buggy Hunk]
if (onePackOneFile == false) {

[Patch]
if (!onePackOneFile) {

[Demonstration 2]

[Buggy Method]
public boolean updatePropertyList() {
    byte[] announcemap = this.readProperty((byte) 0x9D);
    byte[] writemap = this.readProperty((byte) 0x9E);
    byte[] readmap = this.readProperty((byte) 0x9F);
    byte[] announcecodes = AbstractObjectWrapper.propertyMap(announcemap);
    byte[] writecodes = AbstractObjectWrapper.propertyMap(writemap);
    byte[] readcodes = AbstractObjectWrapper.propertyMap(readmap);
    ArrayList<EchonetRemoteProperty> properties = new ArrayList<>();
    //start from the read map
    if (readcodes == null) {
        return false;
    }
    for (Byte propcode : readcodes) {
        properties.add(new EchonetRemoteProperty(this, propcode, true, false, false));
    }
    //write properties
    if (writecodes == null) {
        return false;
    }
    for (Byte propcode : writecodes) {
        EchonetRemoteProperty property = getOrCreateProperty(propcode, properties);
        property.setWritable(true);
    }
    //finally, notify properties;
    if (announcecodes == null) {
        return false;
    }
    for (Byte propcode : announcecodes) {
        EchonetRemoteProperty property = getOrCreateProperty(propcode, properties);
        property.setNotifies(true);
    }
    //add the properties to the remote object
    for (EchonetRemoteProperty property : properties) {
        this.properties.replace(property.getPropertyCode(), property);
    }
    return true;
}

[Buggy Hunk]
this.properties.replace(property.getPropertyCode(), property);

[Patch]
this.properties.put(property.getPropertyCode(), property);

[Demonstration 3]

[Buggy Method]
@Override
public void userEventTriggered(final ChannelHandlerContext context, final Object event) throws Exception {
    if (event instanceof IdleStateEvent) {
        log.debug("{} will shut down due to inactivity.", this.apnsConnection.name);
        context.pipeline().remove(ApnsConnection.PIPELINE_IDLE_STATE_HANLDER);
        this.apnsConnection.shutdownGracefully();
    } else {
        super.userEventTriggered(context, event);
    }
}

[Buggy Hunk]
context.pipeline().remove(ApnsConnection.PIPELINE_IDLE_STATE_HANLDER);

[Patch]
context.pipeline().remove(ApnsConnection.PIPELINE_IDLE_STATE_HANDLER);