nus-yam/ex-repair huggingface dataset:
Program: 71783
Project: 71783
Buggy source:
/** 
 * In javascript, the "this" always point to the  current scope.
 */
public void testThisObject(){
  context.registerBean("String_Node_Str","String_Node_Str");
  Context cx=context.getContext();
  Scriptable scope=context.getScope();
  Scriptable obj=cx.newObject(scope);
  obj.put("String_Node_Str",obj,"String_Node_Str");
  context.enterScope(obj);
  Object result=context.eval("String_Node_Str");
  assertEquals(obj,result);
  result=context.eval("String_Node_Str");
  assertEquals("String_Node_Str",result);
  result=context.eval("String_Node_Str");
  assertEquals("String_Node_Str",result);
  result=context.eval("String_Node_Str");
  assertEquals("String_Node_Str",result);
  result=context.eval("String_Node_Str");
  assertEquals("String_Node_Str",result);
  context.exit();
}

Fixed version (ground truth):
/** 
 * In javascript, the "this" always point to the  current scope.
 */
public void testThisObject(){
  context.registerBean("String_Node_Str","String_Node_Str");
  Context cx=context.getContext();
  Scriptable scope=context.getScope();
  Scriptable obj=cx.newObject(scope);
  obj.put("String_Node_Str",obj,"String_Node_Str");
  context.enterScope(obj);
  Object result=context.eval("String_Node_Str");
  assertEquals(obj,result);
  result=context.eval("String_Node_Str");
  assertEquals("String_Node_Str",result);
  result=context.eval("String_Node_Str");
  assertEquals("String_Node_Str",result);
  result=context.eval("String_Node_Str");
  assertEquals("String_Node_Str",result);
  result=context.eval("String_Node_Str");
  assertEquals(null,result);
  context.exit();
}
Program: 71784
Project: 71784
Buggy source:
/** 
 * @param name the name of a property
 * @param value the value of a property
 */
public void registerBean(String name,Object value){
  assert(this.context != null);
  Object sObj=Context.javaToJS(value,scope);
  scope.put(name,scope,sObj);
}

Fixed version (ground truth):
/** 
 * @param name the name of a property
 * @param value the value of a property
 */
public void registerBean(String name,Object value){
  Object sObj=Context.javaToJS(value,global);
  global.put(name,global,sObj);
}
Program: 71785
Project: 71785
Buggy source:
/** 
 * register globally available script functions
 */
private void setupScriptScope(){
  if (config != null) {
    Context cx=Context.enter();
    try {
      cx.setSecurityController(ScriptUtil.createSecurityController());
    }
 catch (    Throwable throwable) {
    }
    try {
      rootScope=cx.initStandardObjects();
      registerBeans(rootScope,config.getConfigMap());
      registerBeans(rootScope,config.getScriptObjects());
      IStatusHandler handler=config.getStatusHandler();
      if (handler != null) {
        handler.initialize();
        rootScope.put("String_Node_Str",rootScope,handler);
        cx.evaluateString(rootScope,"String_Node_Str","String_Node_Str",0,null);
      }
    }
 catch (    Exception ex) {
      rootScope=null;
      logger.log(Level.INFO,"String_Node_Str",ex);
    }
 finally {
      Context.exit();
    }
  }
}

Fixed version (ground truth):
/** 
 * register globally available script functions
 */
private void setupScriptScope(){
  if (config != null) {
    Context cx=Context.enter();
    try {
      cx.setSecurityController(ScriptUtil.createSecurityController());
    }
 catch (    Throwable throwable) {
    }
    try {
      rootScope=cx.initStandardObjects();
      cx.evaluateString(rootScope,"String_Node_Str","String_Node_Str",0,null);
      cx.evaluateString(rootScope,"String_Node_Str","String_Node_Str",0,null);
      registerBeans(rootScope,config.getConfigMap());
      registerBeans(rootScope,config.getScriptObjects());
      IStatusHandler handler=config.getStatusHandler();
      if (handler != null) {
        handler.initialize();
        rootScope.put("String_Node_Str",rootScope,handler);
        cx.evaluateString(rootScope,"String_Node_Str","String_Node_Str",0,null);
      }
    }
 catch (    Exception ex) {
      rootScope=null;
      logger.log(Level.INFO,"String_Node_Str",ex);
    }
 finally {
      Context.exit();
    }
  }
}
Program: 71786
Project: 71786
Buggy source:
public Object execute(Object[] arguments) throws BirtException {
  if (arguments == null || arguments.length != 2 && arguments.length != 3)   throw new BirtException("String_Node_Str",null,Messages.getString("String_Node_Str") + "String_Node_Str");
  if (arguments[0] instanceof Object[]) {
    Object[] array=(Object[])arguments[0];
    double[] arg=new double[array.length];
    for (int i=0; i < arg.length; i++) {
      arg[i]=DataTypeUtil.toDouble(array[i]);
    }
    return mirr(arg,DataTypeUtil.toDouble(arguments[1]),arguments.length == 3 ? DataTypeUtil.toDouble(arguments[2]) : 0);
  }
 else   if (arguments[0].getClass().isAssignableFrom(double[].class)) {
    return mirr((double[])arguments[0],DataTypeUtil.toDouble(arguments[1]),arguments.length == 3 ? DataTypeUtil.toDouble(arguments[2]) : 0);
  }
  throw new BirtException("String_Node_Str",null,Messages.getString("String_Node_Str") + "String_Node_Str");
}

Fixed version (ground truth):
public Object execute(Object[] arguments) throws BirtException {
  if (arguments == null || arguments.length != 2 && arguments.length != 3)   throw new BirtException("String_Node_Str",null,Messages.getString("String_Node_Str") + "String_Node_Str");
  if (arguments[0] instanceof Object[]) {
    Object[] array=(Object[])arguments[0];
    double[] arg=new double[array.length];
    for (int i=0; i < arg.length; i++) {
      arg[i]=getDouble(array[i]);
    }
    return mirr(arg,getDouble(arguments[1]),arguments.length == 3 ? getDouble(arguments[2]) : 0);
  }
 else   if (arguments[0].getClass().isAssignableFrom(double[].class)) {
    return mirr((double[])arguments[0],getDouble(arguments[1]),arguments.length == 3 ? getDouble(arguments[2]) : 0);
  }
  throw new BirtException("String_Node_Str",null,Messages.getString("String_Node_Str") + "String_Node_Str");
}
Program: 71789
Project: 71789
Buggy source:
protected Composite createTitleArea(Composite parent){
  Composite cmpTitle=super.createTitleArea(parent);
  previewCanvas=new Canvas(cmpTitle,SWT.BORDER);
{
    GridData gd=new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan=2;
    previewCanvas.setLayoutData(gd);
    previewCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
  }
  return cmpTitle;
}

Fixed version (ground truth):
protected Composite createTitleArea(Composite parent){
  Composite cmpTitle=super.createTitleArea(parent);
  previewCanvas=new Canvas(cmpTitle,SWT.BORDER);
{
    GridData gd=new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan=2;
    previewCanvas.setLayoutData(gd);
    previewCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
  }
  return cmpTitle;
}
Program: 71790
Project: 71790
Buggy source:
private void createPreviewArea(Composite parent){
  Composite cmpPreview=ChartUIUtil.createCompositeWrapper(parent);
{
    GridData gridData=new GridData(GridData.FILL_BOTH);
    gridData.widthHint=CENTER_WIDTH_HINT;
    gridData.heightHint=200;
    cmpPreview.setLayoutData(gridData);
  }
  Label label=new Label(cmpPreview,SWT.NONE);
{
    label.setFont(JFaceResources.getBannerFont());
    label.setText(Messages.getString("String_Node_Str"));
  }
  previewCanvas=new Canvas(cmpPreview,SWT.BORDER);
{
    GridData gd=new GridData(GridData.FILL_BOTH);
    previewCanvas.setLayoutData(gd);
    previewCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
  }
}

Fixed version (ground truth):
private void createPreviewArea(Composite parent){
  Composite cmpPreview=ChartUIUtil.createCompositeWrapper(parent);
{
    GridData gridData=new GridData(GridData.FILL_BOTH);
    gridData.widthHint=CENTER_WIDTH_HINT;
    gridData.heightHint=200;
    cmpPreview.setLayoutData(gridData);
  }
  Label label=new Label(cmpPreview,SWT.NONE);
{
    label.setFont(JFaceResources.getBannerFont());
    label.setText(Messages.getString("String_Node_Str"));
  }
  previewCanvas=new Canvas(cmpPreview,SWT.BORDER);
{
    GridData gd=new GridData(GridData.FILL_BOTH);
    previewCanvas.setLayoutData(gd);
    previewCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
  }
}
Program: 71791
Project: 71791
Buggy source:
private void createPreviewArea(){
  Composite cmpPreview=new Composite(foSashForm,SWT.NONE);
  cmpPreview.setLayout(new GridLayout());
  GridData gridData=new GridData(GridData.FILL_BOTH);
  gridData.horizontalSpan=2;
  gridData.heightHint=270;
  cmpPreview.setLayoutData(gridData);
  Label label=new Label(cmpPreview,SWT.NONE);
{
    label.setText(Messages.getString("String_Node_Str"));
    label.setFont(JFaceResources.getBannerFont());
  }
  previewCanvas=new Canvas(cmpPreview,SWT.BORDER);
  previewCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));
  previewCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
  previewPainter=createPreviewPainter();
}

Fixed version (ground truth):
private void createPreviewArea(){
  Composite cmpPreview=new Composite(foSashForm,SWT.NONE);
  cmpPreview.setLayout(new GridLayout());
  GridData gridData=new GridData(GridData.FILL_BOTH);
  gridData.horizontalSpan=2;
  gridData.heightHint=270;
  cmpPreview.setLayoutData(gridData);
  Label label=new Label(cmpPreview,SWT.NONE);
{
    label.setText(Messages.getString("String_Node_Str"));
    label.setFont(JFaceResources.getBannerFont());
  }
  previewCanvas=new Canvas(cmpPreview,SWT.BORDER);
  previewCanvas.setLayoutData(new GridData(GridData.FILL_BOTH));
  previewCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
  previewPainter=createPreviewPainter();
}
Program: 71792
Project: 71792
Buggy source:
public void placeComponents(Composite parent){
  linkAxis=new Link(parent,SWT.NONE);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    linkAxis.setLayoutData(gd);
    linkAxis.setText("String_Node_Str" + axisName + "String_Node_Str");
    linkAxis.addSelectionListener(this);
  }
  btnVisible=new Button(parent,SWT.CHECK);
{
    GridData gd=new GridData();
    gd.horizontalAlignment=SWT.CENTER;
    btnVisible.setLayoutData(gd);
    btnVisible.addSelectionListener(this);
    btnVisible.setSelection(axis.getLineAttributes().isVisible());
  }
  cmbTypes=new Combo(parent,SWT.DROP_DOWN | SWT.READ_ONLY);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment=SWT.CENTER;
    cmbTypes.setLayoutData(gd);
    NameSet ns=ChartUIUtil.getCompatibleAxisType(((SeriesDefinition)axis.getSeriesDefinitions().get(0)).getDesignTimeSeries());
    cmbTypes.setItems(ns.getDisplayNames());
    cmbTypes.select(ns.getSafeNameIndex(axis.getType().getName()));
    cmbTypes.addSelectionListener(this);
  }
  ColorDefinition clrCurrent=null;
  if (axis.eIsSet(ComponentPackage.eINSTANCE.getAxis_LineAttributes())) {
    clrCurrent=axis.getLineAttributes().getColor();
  }
  cmbColor=new FillChooserComposite(parent,SWT.DROP_DOWN | SWT.READ_ONLY,getContext(),clrCurrent,false,false);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmbColor.setLayoutData(gd);
    cmbColor.addListener(this);
  }
}

Fixed version (ground truth):
public void placeComponents(Composite parent){
  linkAxis=new Link(parent,SWT.NONE);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    linkAxis.setLayoutData(gd);
    linkAxis.setText("String_Node_Str" + axisName + "String_Node_Str");
    linkAxis.addSelectionListener(this);
  }
  btnVisible=new Button(parent,SWT.CHECK);
{
    GridData gd=new GridData();
    gd.horizontalAlignment=SWT.CENTER;
    btnVisible.setLayoutData(gd);
    btnVisible.addSelectionListener(this);
    btnVisible.setSelection(axis.getLineAttributes().isVisible());
  }
  cmbTypes=new Combo(parent,SWT.DROP_DOWN | SWT.READ_ONLY);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment=SWT.CENTER;
    cmbTypes.setLayoutData(gd);
    NameSet ns=ChartUIUtil.getCompatibleAxisType(((SeriesDefinition)axis.getSeriesDefinitions().get(0)).getDesignTimeSeries());
    cmbTypes.setItems(ns.getDisplayNames());
    cmbTypes.select(ns.getSafeNameIndex(axis.getType().getName()));
    cmbTypes.addSelectionListener(this);
  }
  ColorDefinition clrCurrent=null;
  if (axis.eIsSet(ComponentPackage.eINSTANCE.getAxis_LineAttributes())) {
    clrCurrent=axis.getLineAttributes().getColor();
  }
  cmbColor=new FillChooserComposite(parent,SWT.DROP_DOWN | SWT.READ_ONLY,getContext(),clrCurrent,false,false,true,true);
{
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmbColor.setLayoutData(gd);
    cmbColor.addListener(this);
  }
}
Program: 71793
Project: 71793
Buggy source:
/** 
 * Clear preview canvas area with white color.
 */
protected void clearPreviewCanvas(){
  if (isDisposedPreviewCanvas()) {
    return;
  }
  Rectangle re=preview.getClientArea();
  Rectangle adjustedRe=new Rectangle(0,0,re.width,re.height);
  Image oldBuffer=null;
  if (buffer == null) {
    if (adjustedRe.width <= 0 || adjustedRe.height <= 0) {
      return;
    }
    buffer=new Image(Display.getDefault(),adjustedRe);
  }
 else {
    Rectangle ore=buffer.getBounds();
    oldBuffer=buffer;
    if (!adjustedRe.equals(ore)) {
      if (adjustedRe.width <= 0 || adjustedRe.height <= 0) {
        return;
      }
      buffer=new Image(Display.getDefault(),adjustedRe);
    }
  }
  GC gc=new GC(buffer);
  gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
  gc.fillRectangle(buffer.getBounds());
  gc.dispose();
  if (oldBuffer != null && oldBuffer != buffer) {
    oldBuffer.dispose();
  }
  if (isDisposedPreviewCanvas()) {
    return;
  }
  preview.redraw();
}

Fixed version (ground truth):
/** 
 * Clear preview canvas area with white color.
 */
protected void clearPreviewCanvas(){
  if (isDisposedPreviewCanvas()) {
    return;
  }
  Rectangle re=preview.getClientArea();
  Rectangle adjustedRe=new Rectangle(0,0,re.width,re.height);
  Image oldBuffer=null;
  if (buffer == null) {
    if (adjustedRe.width <= 0 || adjustedRe.height <= 0) {
      return;
    }
    buffer=new Image(Display.getDefault(),adjustedRe);
  }
 else {
    Rectangle ore=buffer.getBounds();
    oldBuffer=buffer;
    if (!adjustedRe.equals(ore)) {
      if (adjustedRe.width <= 0 || adjustedRe.height <= 0) {
        return;
      }
      buffer=new Image(Display.getDefault(),adjustedRe);
    }
  }
  GC gc=new GC(buffer);
  gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
  gc.fillRectangle(buffer.getBounds());
  gc.dispose();
  if (oldBuffer != null && oldBuffer != buffer) {
    oldBuffer.dispose();
  }
  if (isDisposedPreviewCanvas()) {
    return;
  }
  preview.redraw();
}
Program: 71795
Project: 71795
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffDay(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffDay((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffDay((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffDay(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffDay((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffDay((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71796
Project: 71796
Buggy source:
/** 
 * @param interval
 * @param dataType
 * @return
 * @throws DataException
 */
private static void validateInterval(int interval,int dataType) throws DataException {
  if (interval != IGroupDefinition.NO_INTERVAL && interval != IGroupDefinition.NUMERIC_INTERVAL && interval != IGroupDefinition.STRING_PREFIX_INTERVAL && interval != IGroupDefinition.SECOND_INTERVAL && interval != IGroupDefinition.MINUTE_INTERVAL && interval != IGroupDefinition.HOUR_INTERVAL && interval != IGroupDefinition.DAY_INTERVAL && interval != IGroupDefinition.WEEK_INTERVAL && interval != IGroupDefinition.MONTH_INTERVAL && interval != IGroupDefinition.QUARTER_INTERVAL && interval != IGroupDefinition.YEAR_INTERVAL) {
    throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_INVALID);
  }
  if (dataType == DataType.ANY_TYPE || dataType == DataType.UNKNOWN_TYPE) {
    return;
  }
switch (interval) {
case IGroupDefinition.NO_INTERVAL:
    return;
case IGroupDefinition.NUMERIC_INTERVAL:
  if (isNumber(dataType))   return;
 else   throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_TYPE,new Object[]{"String_Node_Str",DataType.getName(dataType)});
case IGroupDefinition.STRING_PREFIX_INTERVAL:
if (isString(dataType)) return;
 else throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_TYPE,new Object[]{"String_Node_Str",DataType.getName(dataType)});
default :
if (isDate(dataType)) return;
 else throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_TYPE,new Object[]{"String_Node_Str",DataType.getName(dataType)});
}
}

Fixed version (ground truth):
/** 
 * @param interval
 * @param dataType
 * @return
 * @throws DataException
 */
private static void validateInterval(int interval,int dataType) throws DataException {
  if (interval != IGroupDefinition.NO_INTERVAL && interval != IGroupDefinition.NUMERIC_INTERVAL && interval != IGroupDefinition.STRING_PREFIX_INTERVAL && interval != IGroupDefinition.SECOND_INTERVAL && interval != IGroupDefinition.MINUTE_INTERVAL && interval != IGroupDefinition.HOUR_INTERVAL && interval != IGroupDefinition.DAY_INTERVAL && interval != IGroupDefinition.WEEK_INTERVAL && interval != IGroupDefinition.MONTH_INTERVAL && interval != IGroupDefinition.QUARTER_INTERVAL && interval != IGroupDefinition.YEAR_INTERVAL) {
    throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_INVALID);
  }
  if (dataType == DataType.ANY_TYPE || dataType == DataType.UNKNOWN_TYPE) {
    return;
  }
switch (interval) {
case IGroupDefinition.NO_INTERVAL:
    return;
case IGroupDefinition.NUMERIC_INTERVAL:
  if (isNumber(dataType))   return;
 else   throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_TYPE,new Object[]{"String_Node_Str",DataType.getName(dataType)});
case IGroupDefinition.STRING_PREFIX_INTERVAL:
if (isString(dataType)) return;
 else throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_TYPE,new Object[]{"String_Node_Str",DataType.getName(dataType)});
default :
if (canBeConvertToDate(dataType)) return;
 else throw new DataException(ResourceConstants.BAD_GROUP_INTERVAL_TYPE,new Object[]{"String_Node_Str",DataType.getName(dataType)});
}
}
Program: 71797
Project: 71797
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffHour(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffHour((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffHour((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffHour(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffHour((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffHour((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71798
Project: 71798
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMinute(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffMinute((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMinute((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMinute(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffMinute((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMinute((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71799
Project: 71799
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMonth(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffMonth((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMonth((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMonth(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffMonth((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMonth((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71800
Project: 71800
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffQuarter(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffQuarter((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffQuarter((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffQuarter(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffQuarter((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffQuarter((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71801
Project: 71801
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffSecond(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffSecond((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffSecond((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffSecond(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffSecond((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffSecond((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71802
Project: 71802
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffWeek(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffWeek((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffWeek((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffWeek(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffWeek((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffWeek((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71803
Project: 71803
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffYear(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffYear((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffYear((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null) {
    return new Double(-1);
  }
  Date target=getDate(value);
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffYear(defaultStart,target) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffYear((Date)intervalStart,target) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffYear((Date)intervalStart,target) / getDateIntervalRange()));
    }
  }
}
Program: 71804
Project: 71804
Buggy source:
protected void createContentsVirtically(){
  content.setLayout(UIUtil.createGridLayoutWithoutMargin());
  Composite topContainer=new Composite(content,SWT.NONE);
  topContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  topContainer.setLayout(new GridLayout(2,false));
  FormWidgetFactory.getInstance().createLabel(topContainer,isFormStyle()).setText(LABEL_FORMAT_DATE_TIME_PAGE);
  if (!isFormStyle())   typeChoicer=new CCombo(topContainer,SWT.READ_ONLY);
 else   typeChoicer=FormWidgetFactory.getInstance().createCCombo(topContainer,true);
  typeChoicer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  typeChoicer.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      reLayoutSubPages();
      updatePreview();
      notifyFormatChange();
    }
  }
);
  typeChoicer.setItems(provider.getFormatTypes());
  typeChoicer.select(0);
  infoComp=new Composite(content,SWT.NONE);
  infoComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  infoComp.setLayout(new StackLayout());
  createCategoryPages(infoComp);
  setInput(null,null);
  setPreviewText(defaultDateTime);
}

Fixed version (ground truth):
protected void createContentsVirtically(){
  content.setLayout(UIUtil.createGridLayoutWithoutMargin());
  Composite topContainer=new Composite(content,SWT.NONE);
  topContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  topContainer.setLayout(new GridLayout(2,false));
  FormWidgetFactory.getInstance().createLabel(topContainer,isFormStyle()).setText(LABEL_FORMAT_DATE_TIME_PAGE);
  if (!isFormStyle())   typeChoicer=new CCombo(topContainer,SWT.READ_ONLY | SWT.BORDER);
 else   typeChoicer=FormWidgetFactory.getInstance().createCCombo(topContainer,true);
  typeChoicer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  typeChoicer.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      reLayoutSubPages();
      updatePreview();
      notifyFormatChange();
    }
  }
);
  typeChoicer.setItems(provider.getFormatTypes());
  typeChoicer.select(0);
  infoComp=new Composite(content,SWT.NONE);
  infoComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  infoComp.setLayout(new StackLayout());
  createCategoryPages(infoComp);
  setInput(null,null);
  setPreviewText(defaultDateTime);
}
Program: 71805
Project: 71805
Buggy source:
protected void createContentsVirtically(){
  content.setLayout(UIUtil.createGridLayoutWithoutMargin());
  Composite topContainer=new Composite(content,SWT.NONE);
  topContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  topContainer.setLayout(new GridLayout(2,false));
  FormWidgetFactory.getInstance().createLabel(topContainer,isFormStyle()).setText(LABEL_FORMAT_NUMBER_PAGE);
  if (!isFormStyle())   typeChoicer=new CCombo(topContainer,SWT.READ_ONLY);
 else   typeChoicer=FormWidgetFactory.getInstance().createCCombo(topContainer,true);
  typeChoicer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  typeChoicer.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      reLayoutSubPages();
      updatePreview();
      notifyFormatChange();
    }
  }
);
  typeChoicer.setItems(provider.getFormatTypes());
  infoComp=new Composite(content,SWT.NONE);
  infoComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  infoComp.setLayout(new StackLayout());
  createCategoryPages(infoComp);
  createCategoryPatterns();
  setInput(null,null);
  setPreviewText(DEFAULT_PREVIEW_TEXT);
}

Fixed version (ground truth):
protected void createContentsVirtically(){
  content.setLayout(UIUtil.createGridLayoutWithoutMargin());
  Composite topContainer=new Composite(content,SWT.NONE);
  topContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  topContainer.setLayout(new GridLayout(2,false));
  FormWidgetFactory.getInstance().createLabel(topContainer,isFormStyle()).setText(LABEL_FORMAT_NUMBER_PAGE);
  if (!isFormStyle())   typeChoicer=new CCombo(topContainer,SWT.READ_ONLY | SWT.BORDER);
 else   typeChoicer=FormWidgetFactory.getInstance().createCCombo(topContainer,true);
  typeChoicer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  typeChoicer.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      reLayoutSubPages();
      updatePreview();
      notifyFormatChange();
    }
  }
);
  typeChoicer.setItems(provider.getFormatTypes());
  infoComp=new Composite(content,SWT.NONE);
  infoComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  infoComp.setLayout(new StackLayout());
  createCategoryPages(infoComp);
  createCategoryPatterns();
  setInput(null,null);
  setPreviewText(DEFAULT_PREVIEW_TEXT);
}
Program: 71806
Project: 71806
Buggy source:
protected void createContentsVirtically(){
  content.setLayout(UIUtil.createGridLayoutWithoutMargin());
  Composite topContainer=new Composite(content,SWT.NONE);
  topContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  topContainer.setLayout(new GridLayout(2,false));
  FormWidgetFactory.getInstance().createLabel(topContainer,isFormStyle()).setText(LABEL_FORMAT_STRING_PAGE);
  if (!isFormStyle())   typeChoicer=new CCombo(topContainer,SWT.READ_ONLY);
 else   typeChoicer=FormWidgetFactory.getInstance().createCCombo(topContainer,true);
  typeChoicer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  typeChoicer.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      reLayoutSubPages();
      updatePreview();
      notifyFormatChange();
    }
  }
);
  typeChoicer.setItems(provider.getFormatTypes());
  infoComp=new Composite(content,SWT.NONE);
  infoComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  infoComp.setLayout(new StackLayout());
  createCategoryPages(infoComp);
  setInput(null,null);
  setPreviewText(DEFAULT_PREVIEW_TEXT);
}

Fixed version (ground truth):
protected void createContentsVirtically(){
  content.setLayout(UIUtil.createGridLayoutWithoutMargin());
  Composite topContainer=new Composite(content,SWT.NONE);
  topContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  topContainer.setLayout(new GridLayout(2,false));
  FormWidgetFactory.getInstance().createLabel(topContainer,isFormStyle()).setText(LABEL_FORMAT_STRING_PAGE);
  if (!isFormStyle())   typeChoicer=new CCombo(topContainer,SWT.READ_ONLY | SWT.BORDER);
 else   typeChoicer=FormWidgetFactory.getInstance().createCCombo(topContainer,true);
  typeChoicer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  typeChoicer.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      reLayoutSubPages();
      updatePreview();
      notifyFormatChange();
    }
  }
);
  typeChoicer.setItems(provider.getFormatTypes());
  infoComp=new Composite(content,SWT.NONE);
  infoComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  infoComp.setLayout(new StackLayout());
  createCategoryPages(infoComp);
  setInput(null,null);
  setPreviewText(DEFAULT_PREVIEW_TEXT);
}
Program: 71807
Project: 71807
Buggy source:
private static String findParameterExp(String script,int fromIndex){
  int iStart=script.indexOf(ExpressionUtil.PARAMETER_INDICATOR + '[',fromIndex);
  if (iStart < fromIndex) {
    return null;
  }
  int iEnd=script.indexOf(']',iStart);
  if (iEnd < iStart + ExpressionUtil.PARAMETER_INDICATOR.length()) {
    return null;
  }
  return script.substring(iStart,iEnd + 1);
}

Fixed version (ground truth):
private static String findParameterExp(String script,int fromIndex){
  int iStart=script.indexOf(ExpressionUtil.PARAMETER_INDICATOR + '[',fromIndex);
  if (iStart < fromIndex) {
    return null;
  }
  int iEnd=script.indexOf(']',iStart);
  if (iEnd < iStart + ExpressionUtil.PARAMETER_INDICATOR.length()) {
    return null;
  }
  return script.substring(iStart,iEnd + 1 + ExpressionUtil.EXPRESSION_VALUE_SUFFIX.length());
}
Program: 71809
Project: 71809
Buggy source:
public JSObjectMetaData getReturn(){
  return new ExtensionClassJSObject(method.getClassReturnType());
}

Fixed version (ground truth):
public JSObjectMetaData getReturn(){
  IClassInfo rtInfo=method.getClassReturnType();
  if (rtInfo != null) {
    return new ExtensionClassJSObject(method.getClassReturnType());
  }
  return null;
}
Program: 71811
Project: 71811
Buggy source:
/** 
 * @param e
 */
public void mouseDoubleClick(MouseEvent e){
  editSelectedBinding(table.getSelectionIndex());
}

Fixed version (ground truth):
/** 
 * @param e
 */
public void mouseDoubleClick(MouseEvent e){
  editSelectedBinding(table.getSelectionIndex());
  refreshBindingTable();
}
Program: 71814
Project: 71814
Buggy source:
public void testResultSet(){
  ResultSetIndex index=new ResultSetIndex();
  setupIndex(index);
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str",null,"String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str",null,"String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public void testResultSet(){
  ResultSetIndex index=new ResultSetIndex();
  setupIndex(index);
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str",null,"String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str",null,"String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals("String_Node_Str",index.getResultSet("String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 71815
Project: 71815
Buggy source:
private String getIntRowId(int rowId){
  if (entries == null) {
    entries=rsets.toArray(new ResultSetEntry[rsets.size()]);
    Arrays.sort(entries,comparator);
  }
  int index=Arrays.binarySearch(entries,new ResultSetEntry(rowId,"String_Node_Str"),comparator);
  if (index < 0) {
    index=-(index + 1) - 1;
  }
  if (index >= 0 && index < entries.length) {
    return entries[index].rset;
  }
  return null;
}

Fixed version (ground truth):
private String getIntRowId(int rowId){
  if (entries == null) {
    entries=rsets.toArray(new ResultSetEntry[rsets.size()]);
    Arrays.sort(entries,comparator);
  }
  int index=Arrays.binarySearch(entries,new ResultSetEntry(rowId,"String_Node_Str"),comparator);
  if (index < 0) {
    index=-(index + 1) - 1;
  }
  if (index < 0) {
    index=0;
  }
  if (index >= 0 && index < entries.length) {
    return entries[index].rset;
  }
  return null;
}
Program: 71816
Project: 71816
Buggy source:
/** 
 * Creates an instance of the resource factory. <!-- begin-user-doc --> <!-- end-user-doc -->
 */
public ModelResourceFactoryImpl(){
  super();
  ExtendedMetaData extendedMetaData=ExtendedMetaData.INSTANCE;
  extendedMetaData.putPackage("String_Node_Str",ModelPackage.eINSTANCE);
  extendedMetaData.putPackage("String_Node_Str",AttributePackage.eINSTANCE);
  extendedMetaData.putPackage("String_Node_Str",ComponentPackage.eINSTANCE);
  extendedMetaData.putPackage("String_Node_Str",DataPackage.eINSTANCE);
  extendedMetaData.putPackage("String_Node_Str",LayoutPackage.eINSTANCE);
  extendedMetaData.putPackage("String_Node_Str",TypePackage.eINSTANCE);
}

Fixed version (ground truth):
/** 
 * Creates an instance of the resource factory. <!-- begin-user-doc --> <!-- end-user-doc -->
 */
public ModelResourceFactoryImpl(){
  super();
}
Program: 71817
Project: 71817
Buggy source:
public IPreparedDSQuery prepare() throws DataException {
  if (odaStatement != null)   throw new DataException(ResourceConstants.QUERY_HAS_PREPARED);
  odaStatement=dataSource.prepareStatement(queryText,queryType);
  addProperties();
  addParameterDefns();
  IOdaDataSetDesign design=null;
  if (session.getDataSetCacheManager().getCurrentDataSetDesign() instanceof IOdaDataSetDesign)   design=(IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign();
  if (design != null) {
    if (supportNameResults(design)) {
      addCustomFields(design.getPrimaryResultSetName(),odaStatement);
      addColumnHints(design.getPrimaryResultSetName(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetName(),this.projectedFields);
    }
 else     if (design.getPrimaryResultSetNumber() > 0) {
      addCustomFields(design.getPrimaryResultSetNumber(),odaStatement);
      addColumnHints(design.getPrimaryResultSetNumber(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetNumber(),this.projectedFields);
    }
 else {
      prepareColumns();
    }
  }
 else {
    prepareColumns();
  }
  odaStatement.setMaxRows(this.getRowFetchLimit());
  try {
    resultMetadata=getMetaData((IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign(),odaStatement);
  }
 catch (  DataException e) {
    resultMetadata=null;
  }
  return this;
}

Fixed version (ground truth):
public IPreparedDSQuery prepare() throws DataException {
  if (odaStatement != null)   throw new DataException(ResourceConstants.QUERY_HAS_PREPARED);
  odaStatement=dataSource.prepareStatement(queryText,queryType);
  addProperties();
  addParameterDefns();
  IOdaDataSetDesign design=null;
  if (session.getDataSetCacheManager().getCurrentDataSetDesign() instanceof IOdaDataSetDesign)   design=(IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign();
  if (design != null) {
    if (canAccessResultSetByName(design)) {
      addCustomFields(design.getPrimaryResultSetName(),odaStatement);
      addColumnHints(design.getPrimaryResultSetName(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetName(),this.projectedFields);
    }
 else     if (canAccessResultSetByNumber(design)) {
      addCustomFields(design.getPrimaryResultSetNumber(),odaStatement);
      addColumnHints(design.getPrimaryResultSetNumber(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetNumber(),this.projectedFields);
    }
 else {
      prepareColumns();
    }
  }
 else {
    prepareColumns();
  }
  odaStatement.setMaxRows(this.getRowFetchLimit());
  try {
    resultMetadata=getMetaData((IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign(),odaStatement);
  }
 catch (  DataException e) {
    resultMetadata=null;
  }
  return this;
}
Program: 71818
Project: 71818
Buggy source:
/** 
 * @param design
 * @param odaStatement
 * @return
 * @throws DataException
 */
private IResultClass getMetaData(IOdaDataSetDesign design,PreparedStatement odaStatement) throws DataException {
  IResultClass result=null;
  if (design != null) {
    if (odaStatement.supportsNamedResults() && design.getPrimaryResultSetName() != null) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetName());
    }
 else     if (design.getPrimaryResultSetNumber() > 0) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetNumber());
    }
  }
  if (result == null)   result=odaStatement.getMetaData();
  return result;
}

Fixed version (ground truth):
/** 
 * @param design
 * @param odaStatement
 * @return
 * @throws DataException
 */
private IResultClass getMetaData(IOdaDataSetDesign design,PreparedStatement odaStatement) throws DataException {
  IResultClass result=null;
  if (design != null) {
    if (canAccessResultSetByName(design)) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetName());
    }
 else     if (canAccessResultSetByNumber(design)) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetNumber());
    }
  }
  if (result == null)   result=odaStatement.getMetaData();
  return result;
}
Program: 71819
Project: 71819
Buggy source:
public void setDataElement(DataElement data){
  if (!(data == null || data instanceof DateTimeDataElement)) {
    return;
  }
  btnCheck.setSelection(data != null);
  Calendar calendar=null;
  if (data == null) {
    calendar=Calendar.getInstance();
    calendar.set(Calendar.HOUR,0);
    calendar.set(Calendar.MINUTE,0);
    calendar.set(Calendar.SECOND,0);
  }
 else {
    calendar=((DateTimeDataElement)data).getValueAsCalendar();
  }
  pickerDate.setYear(calendar.get(Calendar.YEAR));
  pickerDate.setMonth(calendar.get(Calendar.MONTH));
  pickerDate.setDay(calendar.get(Calendar.DATE));
  pickerTime.setHours(calendar.get(Calendar.HOUR));
  pickerTime.setMinutes(calendar.get(Calendar.MINUTE));
  pickerTime.setSeconds(calendar.get(Calendar.SECOND));
  setEnabled(data != null);
}

Fixed version (ground truth):
public void setDataElement(DataElement data){
  if (!(data == null || data instanceof DateTimeDataElement)) {
    return;
  }
  btnCheck.setSelection(data != null);
  Calendar calendar=null;
  if (data == null) {
    calendar=Calendar.getInstance();
    calendar.set(Calendar.HOUR,0);
    calendar.set(Calendar.MINUTE,0);
    calendar.set(Calendar.SECOND,0);
  }
 else {
    calendar=((DateTimeDataElement)data).getValueAsCalendar();
  }
  pickerDate.setYear(calendar.get(Calendar.YEAR));
  pickerDate.setMonth(calendar.get(Calendar.MONTH));
  pickerDate.setDay(calendar.get(Calendar.DATE));
  pickerTime.setHours(calendar.get(Calendar.HOUR_OF_DAY));
  pickerTime.setMinutes(calendar.get(Calendar.MINUTE));
  pickerTime.setSeconds(calendar.get(Calendar.SECOND));
  setEnabled(data != null);
}
Program: 71821
Project: 71821
Buggy source:
/** 
 * Create base evaluator for chart using data set.
 * @param handle
 * @param cm
 * @param columnExpression
 * @param session
 * @return
 * @throws ChartException
 */
private IDataRowExpressionEvaluator createBaseEvaluator(ExtendedItemHandle handle,Chart cm,List columnExpression,DataRequestSession session) throws ChartException {
  IQueryResults actualResultSet;
  BaseQueryHelper cbqh=new BaseQueryHelper(handle,cm);
  QueryDefinition queryDefn=(QueryDefinition)cbqh.createBaseQuery(columnExpression);
  resetParametersForDataPreview(getDataSetFromHandle(),queryDefn);
  handleGroup(queryDefn,handle);
  try {
    actualResultSet=session.executeQuery(queryDefn,null,getPropertyIterator(handle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP)),ChartReportItemUtil.getColumnDataBindings(handle));
    if (actualResultSet != null) {
      return new BaseGroupedQueryResultSetEvaluator(actualResultSet.getResultIterator(),ChartReportItemUtil.hasAggregation(cm),cm);
    }
  }
 catch (  BirtException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Create base evaluator for chart using data set.
 * @param handle
 * @param cm
 * @param columnExpression
 * @param session
 * @return
 * @throws ChartException
 */
private IDataRowExpressionEvaluator createBaseEvaluator(ExtendedItemHandle handle,Chart cm,List columnExpression,final DataRequestSession session) throws ChartException {
  IQueryResults actualResultSet;
  BaseQueryHelper cbqh=new BaseQueryHelper(handle,cm);
  QueryDefinition queryDefn=(QueryDefinition)cbqh.createBaseQuery(columnExpression);
  resetParametersForDataPreview(getDataSetFromHandle(),queryDefn);
  handleGroup(queryDefn,handle);
  try {
    actualResultSet=session.executeQuery(queryDefn,null,getPropertyIterator(handle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP)),ChartReportItemUtil.getColumnDataBindings(handle));
    if (actualResultSet != null) {
      return new BaseGroupedQueryResultSetEvaluator(actualResultSet.getResultIterator(),ChartReportItemUtil.hasAggregation(cm),cm){
        @Override public void close(){
          super.close();
          session.shutdown();
        }
      }
;
    }
  }
 catch (  BirtException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
  return null;
}
Program: 71823
Project: 71823
Buggy source:
/** 
 * Creates the evaluator for Cube Live preview.
 * @param cube
 * @param session
 * @return
 * @throws BirtException
 */
private IDataRowExpressionEvaluator createCubeEvaluator(CubeHandle cube,DataRequestSession session) throws BirtException {
  IBaseCubeQueryDefinition qd=new ChartCubeQueryHelper(itemHandle,context.getModel()).createCubeQuery(null);
  session.defineCube(cube);
  IPreparedCubeQuery ipcq=session.prepare((ICubeQueryDefinition)qd);
  return new BIRTCubeResultSetEvaluator(ipcq.execute(null,null));
}

Fixed version (ground truth):
/** 
 * Creates the evaluator for Cube Live preview.
 * @param cube
 * @param session
 * @return
 * @throws BirtException
 */
private IDataRowExpressionEvaluator createCubeEvaluator(CubeHandle cube,final DataRequestSession session) throws BirtException {
  IBaseCubeQueryDefinition qd=new ChartCubeQueryHelper(itemHandle,context.getModel()).createCubeQuery(null);
  session.defineCube(cube);
  IPreparedCubeQuery ipcq=session.prepare((ICubeQueryDefinition)qd);
  return new BIRTCubeResultSetEvaluator(ipcq.execute(null,null)){
    @Override public void close(){
      super.close();
      session.shutdown();
    }
  }
;
}