[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_text_input);
    activity = this;
    final String strCardAttribute;
    final ce.modelwhilework.data.Process process;
    final EditText te_text = (EditText) this.findViewById(R.id.activity_input_text_edittext);
    Bundle args = getIntent().getExtras();
    if (args != null) {
        strCardAttribute = args.getString("CardAttrib");
        if (strCardAttribute == null) {
            showAlert("General error: connection to card is missing!");
            this.finish();
        } else {
            process = ProcessManager.getInstance().getProcess(args.getString("ProcessName"));
            if (process == null) {
                showAlert("General error: can't get process!");
                this.finish();
            } else {
                if (args.getString("DefaultText") != null) {
                    te_text.setText(args.getString("DefaultText"));
                    te_text.setSelection(te_text.getText().length());
                }
                Button button = (Button) this.findViewById(R.id.activity_input_text_ok);
                button.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        boolean alert = false;
                        if (strCardAttribute.equals(CardAttribute.TITLETASK.toString()))
                            process.setTaskCardTitle(te_text.getText().toString());
                        else if (strCardAttribute.equals(CardAttribute.TITLEMSG.toString()))
                            process.setMessageCardTitle(te_text.getText().toString());
                        else if (strCardAttribute.equals(CardAttribute.PERSONMSG.toString()))
                            process.setMessagekCardSenderReceiver(te_text.getText().toString());
                        else if (strCardAttribute.equals(CardAttribute.TITLEMAINSTACK.toString())) {
                            if (!process.setTopCardTitleMainStack(te_text.getText().toString())) {
                                alert = true;
                                showAlert("Error: You have to enter a valid and unique title!!!");
                            }
                        } else if (strCardAttribute.equals(CardAttribute.TITLESIDESTACK.toString())) {
                            if (!process.setTopCardTitleSideStack(te_text.getText().toString())) {
                                alert = true;
                                showAlert("Error: You have to enter a valid and unique title!!!");
                            }
                        } else if (strCardAttribute.equals(CardAttribute.PERSONMAINSTACK.toString())) {
                            if (te_text.getText().length() == 0) {
                                alert = true;
                                showAlert("You have to enter a sender/receiver!!!");
                            } else {
                                if (!process.setTopCardSenderReceiverMainStack(te_text.getText().toString()))
                                    showAlert("Error: can't set sender/receiver!!!!");
                            }
                        } else if (strCardAttribute.equals(CardAttribute.PERSONSIDESTACK.toString())) {
                            if (te_text.getText().length() == 0) {
                                alert = true;
                                showAlert("You have to enter a sender/receiver!!!");
                            } else {
                                if (!process.setTopCardSenderReceiverSideStack(te_text.getText().toString()))
                                    showAlert("Error: can't set sender/receiver!!!!");
                            }
                        } else if (strCardAttribute.equals(CardAttribute.USERROLE.toString()))
                            process.setUserRole(te_text.getText().toString());
                        else {
                            alert = true;
                            showAlert("General error: invalid argument!");
                        }
                        if (!alert)
                            activity.finish();
                    }
                });
                button = (Button) this.findViewById(R.id.activity_input_text_cancel);
                button.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        activity.finish();
                    }
                });
            }
        }
    } else {
        showAlert("General error: arguments are missing!");
        this.finish();
    }
}

[Buggy Hunk]
process.setMessagekCardSenderReceiver(te_text.getText().toString());

[Patch]
process.setMessageCardSenderReceiver(te_text.getText().toString());

[Demonstration 2]

[Buggy Method]
public static Entity teleportEntity(Entity entity, Vector3 t2, int dimension, boolean destBlocked) {
    if (entity.isRiding()) {
        Entity mount = entity.getRidingEntity();
        mount = teleportEntity(mount, t2, dimension, false);
        return entity;
    }
    if (dimension != entity.dimension) {
        entity = transferToDimension(entity, t2, dimension);
        for (Entity e : entity.getRecursivePassengers()) {
            transferToDimension(e, t2, dimension);
        }
    }
    int x = t2.intX() >> 4;
    int z = t2.intZ() >> 4;
    for (int i = x - 1; i <= x + 1; i++) for (int j = z - 1; j <= z + 1; j++) {
        entity.worldObj.getChunkFromChunkCoords(x, z);
    }
    entity.setPositionAndUpdate(t2.x, t2.y, t2.z);
    List<Entity> passengers = Lists.newArrayList(entity.getPassengers());
    for (Entity e : passengers) {
        e.dismountRidingEntity();
        e.setPositionAndUpdate(t2.x, t2.y, t2.z);
        MinecraftForge.EVENT_BUS.register(new ReMounter(e, entity, dimension));
    }
    WorldServer world = entity.getServer().worldServerForDimension(dimension);
    EntityTracker tracker = world.getEntityTracker();
    if (tracker.getTrackingPlayers(entity).getClass().getSimpleName().equals("EmptySet")) {
        tracker.trackEntity(entity);
        if (entity instanceof EntityPlayerMP) {
            EntityPlayerMP playerIn = (EntityPlayerMP) entity;
            tracker.updateVisibility(playerIn);
        }
    }
    return entity;
}

[Buggy Hunk]
transferToDimension(e, t2, dimension);

[Patch]
e = transferToDimension(e, t2, dimension);

[Demonstration 3]

[Buggy Method]
@Override
public void addProjectSuggestion(String projectId, String suggestion, String result) {
    ProjectEntity entity = findOneProjectEntity(projectId);
    entity.setComment(suggestion);
    if (result.equals("approve")) {
        entity.setStatus("待立项");
        try {
            PdfUtil pdfUtil = new PdfUtil();
            pdfUtil.createProjectPdfFile(entity);
        } catch (IOException e) {
            e.printStackTrace();
        }
        entity.setFileUrl("./generate/" + entity.getProjectId());
    } else {
        entity.setStatus("初审被驳");
    }
    projectDao.update(entity);
}

[Buggy Hunk]
entity.setFileUrl("./generate/" + entity.getProjectId());

[Patch]
entity.setFileUrl("./generate/" + entity.getProjectId() + ".pdf");