[Demonstration 1]

[Buggy Method]
@Help("Creates a plan from this task")
@Expose(value = "plan", context = true)
public Object plan(LanguageContext cx, Map map) {
    final Plan plan = new Plan(ScriptContext.get(), this);
    PlanInputs inputs = Plan.getMappings(map, cx);
    plan.add(inputs);
    return plan;
}

[Buggy Hunk]
final Plan plan = new Plan(ScriptContext.get(), this);

[Patch]
final Plan plan = new Plan(ScriptContext.get().copy(true, false), this);

[Demonstration 2]

[Buggy Method]
@Test
public void testCreateNewPlan() throws Exception {
    Plan basicPlan = createplan(PlansEnum.BASIC);
    planRepository.save(basicPlan);
    Plan retrievedPlan = planRepository.findOne(BASIC_PLAN_ID);
    Assert.assertNotNull(retrievedPlan);
}

[Buggy Hunk]
Plan retrievedPlan = planRepository.findOne(BASIC_PLAN_ID);

[Patch]
Plan retrievedPlan = planRepository.findOne(PlansEnum.BASIC.getId());

[Demonstration 3]

[Buggy Method]
protected boolean allowDragUp(float dy) {
    return mCurItem != getChildCount() - 1 && dy < 0;
}

[Buggy Hunk]
return mCurItem != getChildCount() - 1 && dy < 0;

[Patch]
return mCurItem != getAdapter().getCount() - 1 && dy < 0;