[Demonstration 1]

[Buggy Method]
@Override
public void onStartFinished() {
    try {
        serverSocket = new Socket("127.0.0.1", Constant.SocketPort);
        System.out.println("Erfolgreich mit Server auf " + serverSocket.getInetAddress());
        startReading();
    } catch (Exception IO) {
    }
}

[Buggy Hunk]
serverSocket = new Socket("127.0.0.1", Constant.SocketPort);

[Patch]
serverSocket = new Socket("127.0.0.1", Constant.ChatServerPort);

[Demonstration 2]

[Buggy Method]
public void setFuel(String fuel) throws InvalidLenghtException {
    if (fuel.length() >= MAX_LENGTH_10) {
        this.fuel = fuel;
    } else {
        throw new InvalidLenghtException("fuel");
    }
}

[Buggy Hunk]
if(fuel.length() >= MAX_LENGTH_10){

[Patch]
if(fuel.length() <= MAX_LENGTH_10){

[Demonstration 3]

[Buggy Method]
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object getObject(NodeConfig rootNode, Class rootClass, Object rootObject) throws UnmarshalException, SecurityException {
    Field[] fields = rootClass.getDeclaredFields();
    Map<String, Field> elementMap = new HashMap<String, Field>();
    Map<String, Field> attributeMap = new HashMap<String, Field>();
    Field elementValue = null;
    for (Field field : fields) {
        if (field.isAnnotationPresent(Element.class)) {
            Element element = (Element) field.getAnnotation(Element.class);
            elementMap.put(element.name(), field);
            continue;
        }
        if (field.isAnnotationPresent(Attribute.class)) {
            Attribute attribute = (Attribute) field.getAnnotation(Attribute.class);
            attributeMap.put(attribute.name(), field);
            continue;
        }
        if (field.isAnnotationPresent(ElementValue.class)) {
            elementValue = field;
            continue;
        }
    }
    Object targetObject = null;
    try {
        if (rootObject != null) {
            Constructor constructor = rootClass.getConstructor(new Class[] { rootObject.getClass() });
            targetObject = constructor.newInstance(rootObject);
        } else {
            targetObject = rootClass.newInstance();
        }
    } catch (Exception e) {
        throw new UnmarshalException(e);
    }
    boolean isNalaObject = targetObject instanceof XmlObject ? true : false;
    if (rootNode.hasChildren()) {
        List childrenNode = rootNode.getChildrenNodes();
        for (Iterator iterNode = childrenNode.iterator(); iterNode.hasNext(); ) {
            NodeConfig nodeConfig = (NodeConfig) iterNode.next();
            Field field = elementMap.get(nodeConfig.getName());
            if (field != null) {
                String fieldType = field.getType().getName();
                Object fieldValue = null;
                List<Object> listField = null;
                field.setAccessible(true);
                if (fieldType.equals(Constant.LIST_CLASS)) {
                    String listTypeName = field.getGenericType().toString();
                    fieldType = listTypeName.substring(Constant.LIST_CLASS.length() + 1, listTypeName.length() - 1);
                    try {
                        listField = (List<Object>) field.get(targetObject);
                    } catch (IllegalArgumentException e) {
                        throw new UnmarshalException(e);
                    } catch (IllegalAccessException e) {
                        throw new UnmarshalException(e);
                    }
                }
                ObjectValueCreator objectValueCreator = new ObjectValueCreator();
                fieldValue = objectValueCreator.getValue(fieldType, nodeConfig);
                if (fieldValue == null) {
                    //如果字段类别是带有$(表示内部类)则采用先构造外部类, 然后通过外部类生成内部类实例
                    if (fieldType.indexOf('$') > 0) {
                        try {
                            fieldValue = getObject(nodeConfig, Class.forName(fieldType), targetObject);
                        } catch (ClassNotFoundException e) {
                            throw new UnmarshalException(e);
                        }
                    } else {
                        try {
                            fieldValue = getObject(nodeConfig, Class.forName(fieldType), null);
                        } catch (ClassNotFoundException e) {
                            throw new UnmarshalException(e);
                        }
                    }
                }
                if (listField != null) {
                    listField.add(fieldValue);
                    fieldValue = listField;
                }
                setField(field, targetObject, fieldValue);
            }
        }
    }
    if (rootNode.getValue() != null && elementValue != null) {
        setField(elementValue, targetObject, rootNode.getValue());
    }
    if (rootNode.hasAttributes()) {
        List attributes = rootNode.getAttribute();
        if (attributes != null && attributes.size() > 0) {
            for (Iterator iterAttribute = attributes.iterator(); iterAttribute.hasNext(); ) {
                AttributeConfig attributeConfig = (AttributeConfig) iterAttribute.next();
                Field field = attributeMap.get(attributeConfig.getName());
                if (field != null) {
                    String fieldType = field.getType().getName();
                    Object attributeValue = TypeConver.converValue(fieldType, attributeConfig.getValue());
                    setField(field, targetObject, attributeValue);
                }
            }
        }
    }
    if (isNalaObject) {
        setNameSpaces(rootNode, targetObject);
    }
    return targetObject;
}

[Buggy Hunk]
Field[] fields = rootClass.getDeclaredFields();

[Patch]
Field[] fields = getClassFields(rootClass);