nus-yam/ex-repair huggingface dataset:
Program: 79288
Project: 79288
Buggy source:
/** 
 * Returns the iterator for parameter binding list defined on this report item. The element in the iterator is the corresponding <code>StructureHandle</code> that deal with a <code>ParamBinding</code> in the list.
 * @return the iterator for parameter binding structure list defined on thisdata set.
 * @see org.eclipse.birt.report.model.api.elements.structures.ParamBinding
 */
public Iterator paramBindingsIterator(){
}

Fixed version (ground truth):
/** 
 * Returns the iterator for parameter binding list defined on this report item. The element in the iterator is the corresponding <code>StructureHandle</code> that deal with a <code>ParamBinding</code> in the list.
 * @return the iterator for parameter binding structure list defined on thisdata set.
 * @see org.eclipse.birt.report.model.elements.structures.ParamBinding
 */
public Iterator paramBindingsIterator(){
}
Program: 79289
Project: 79289
Buggy source:
/** 
 * Returns the data set of the report item.
 * @return the handle to the data set
 */
public DesignElementHandle getDataSet(){
  DesignElement dataSet=((ReportItem)getElement()).getDataSetElement(design);
  if (dataSet == null)   return null;
  return dataSet.getHandle(design);
}

Fixed version (ground truth):
/** 
 * Returns the data set of the report item.
 * @return the handle to the data set
 */
public DataSetHandle getDataSet(){
}
Program: 79290
Project: 79290
Buggy source:
/** 
 * Returns visibility rules defined on the report item. The element in the iterator is the corresponding <code>StructureHandle</code> that deal with a <code>Hide</code> in the list.
 * @return the iterator for visibility rules defined on this report item.
 * @see org.eclipse.birt.report.model.api.elements.structures.Hide
 */
public Iterator visibilityRulesIterator(){
}

Fixed version (ground truth):
/** 
 * Returns visibility rules defined on the report item. The element in the iterator is the corresponding <code>StructureHandle</code> that deal with a <code>Hide</code> in the list.
 * @return the iterator for visibility rules defined on this report item.
 * @see org.eclipse.birt.report.model.elements.structures.Hide
 */
public Iterator visibilityRulesIterator(){
}
Program: 79291
Project: 79291
Buggy source:
/** 
 * Creates a new DtE API IParameterDefinition from a model's DataSetParameterHandle.
 */
IParameterDefinition newParam(DataSetParameterHandle modelParam){
  ParameterDefinition dteParam=new ParameterDefinition();
  dteParam.setName(modelParam.getName());
  if (modelParam.getPosition() != null)   dteParam.setPosition(modelParam.getPosition().intValue());
  dteParam.setType(toDteDataType(modelParam.getDataType()));
  dteParam.setInputMode(modelParam.isInput());
  dteParam.setOutputMode(modelParam.isOutput());
  dteParam.setNullable(modelParam.getIsNullable());
  dteParam.setInputOptional(modelParam.isOptional());
  dteParam.setDefaultInputValue(modelParam.getDefaultValue());
  return dteParam;
}

Fixed version (ground truth):
/** 
 * Creates a new DtE API IParameterDefinition from a model's DataSetParameterHandle.
 */
IParameterDefinition newParam(DataSetParameterHandle modelParam){
  ParameterDefinition dteParam=new ParameterDefinition();
  dteParam.setName(modelParam.getName());
  if (modelParam.getPosition() != null)   dteParam.setPosition(modelParam.getPosition().intValue());
  dteParam.setType(toDteDataType(modelParam.getDataType()));
  dteParam.setInputMode(modelParam.isInput());
  dteParam.setOutputMode(modelParam.isOutput());
  dteParam.setNullable(modelParam.isNullable());
  dteParam.setInputOptional(modelParam.isOptional());
  dteParam.setDefaultInputValue(modelParam.getDefaultValue());
  return dteParam;
}
Program: 79293
Project: 79293
Buggy source:
/** 
 * Creates a new DtE API InputParamBinding from a model's binding. Could return null if no expression is bound.
 */
IInputParameterBinding newInputParamBinding(ParamBindingHandle modelInputParamBndg){
  if (modelInputParamBndg.getExpression() == null)   return null;
  ScriptExpression expr=new ScriptExpression(modelInputParamBndg.getExpression());
  return new InputParameterBinding(modelInputParamBndg.getParamName(),expr);
}

Fixed version (ground truth):
private IInputParameterBinding newInputParamBinding(String paramName,String paramValue){
  ScriptExpression paramValueExpr=new ScriptExpression(paramValue);
  return new InputParameterBinding(paramName,paramValueExpr);
}
Program: 79294
Project: 79294
Buggy source:
public void startBody(){
  logger.log(Level.FINE,"String_Node_Str");
  IStyle bodyStyle=report.getBodyStyle();
  if (!isEmbeddable) {
    writer.openTag(HTMLTags.TAG_BODY);
    if (bodyStyle != null) {
      writer.attribute(HTMLTags.ATTR_CLASS,bodyStyle.getName());
    }
  }
 else {
    writer.openTag(HTMLTags.TAG_DIV);
    if (bodyStyle != null) {
      StringBuffer styleBuffer=new StringBuffer();
      AttributeBuilder.buildStyle(styleBuffer,bodyStyle,this);
      writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
    }
  }
}

Fixed version (ground truth):
public void startBody(){
  logger.log(Level.FINE,"String_Node_Str");
  if (report != null) {
    IStyle bodyStyle=report.getBodyStyle();
    if (!isEmbeddable) {
      writer.openTag(HTMLTags.TAG_BODY);
      if (bodyStyle != null) {
        writer.attribute(HTMLTags.ATTR_CLASS,bodyStyle.getName());
      }
    }
 else {
      writer.openTag(HTMLTags.TAG_DIV);
      if (bodyStyle != null) {
        StringBuffer styleBuffer=new StringBuffer();
        AttributeBuilder.buildStyle(styleBuffer,bodyStyle,this);
        writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
      }
    }
  }
}
Program: 79295
Project: 79295
Buggy source:
public String getValue(String str){
  String sTmp="String_Node_Str";
  sTmp=getKey(str);
  if ("String_Node_Str".equals(sTmp)) {
    int iSeparator=str.indexOf(SEPARATOR) + SEPARATOR.length();
    if (iSeparator == (-1 + SEPARATOR.length())) {
      iSeparator=0;
    }
    return str.substring(iSeparator);
  }
 else {
    sTmp=serviceprovider.getValue(sTmp);
    if (sTmp == null || "String_Node_Str".equals(sTmp)) {
      sTmp="String_Node_Str";
    }
  }
  return sTmp;
}

Fixed version (ground truth):
public String getValue(String str){
  String sTmp="String_Node_Str";
  sTmp=getKey(str);
  if ("String_Node_Str".equals(sTmp)) {
    int iSeparator=str.indexOf(SEPARATOR) + SEPARATOR.length();
    if (iSeparator == (-1 + SEPARATOR.length())) {
      iSeparator=0;
    }
    return str.substring(iSeparator);
  }
  sTmp=serviceprovider.getValue(sTmp);
  if (sTmp == null || "String_Node_Str".equals(sTmp)) {
    sTmp="String_Node_Str";
  }
  return sTmp;
}
Program: 79296
Project: 79296
Buggy source:
private String getKeyComponent(String sText){
  if (sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR) != -1) {
    return sText.substring(0,sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR));
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private String getKeyComponent(String sText){
  if (sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR) != -1) {
    return sText.substring(0,sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR));
  }
  return null;
}
Program: 79297
Project: 79297
Buggy source:
private String getDisplayValue(){
  if (cbExternalize.getSelection()) {
    return "String_Node_Str" + getKeyComponent(sResult) + "String_Node_Str";
  }
 else {
    return getValueComponent(sResult);
  }
}

Fixed version (ground truth):
private String getDisplayValue(){
  if (cbExternalize.getSelection()) {
    return "String_Node_Str" + getKeyComponent(sResult) + "String_Node_Str";
  }
  return getValueComponent(sResult);
}
Program: 79298
Project: 79298
Buggy source:
private String getValueComponent(String sText){
  String sKey=getKeyComponent(sText);
  if (sKey == null || "String_Node_Str".equals(sKey)) {
    if (sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR) != -1) {
      return sText.substring(sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR) + ExternalizedTextEditorComposite.SEPARATOR.length(),sText.length());
    }
 else {
      return sText;
    }
  }
 else {
    String sValue=serviceprovider.getValue(sKey);
    if (sValue == null || "String_Node_Str".equals(sValue)) {
      sValue="String_Node_Str";
    }
    return sValue;
  }
}

Fixed version (ground truth):
private String getValueComponent(String sText){
  String sKey=getKeyComponent(sText);
  if (sKey == null || "String_Node_Str".equals(sKey)) {
    if (sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR) != -1) {
      return sText.substring(sText.indexOf(ExternalizedTextEditorComposite.SEPARATOR) + ExternalizedTextEditorComposite.SEPARATOR.length(),sText.length());
    }
    return sText;
  }
  String sValue=serviceprovider.getValue(sKey);
  if (sValue == null || "String_Node_Str".equals(sValue)) {
    sValue="String_Node_Str";
  }
  return sValue;
}
Program: 79299
Project: 79299
Buggy source:
private String getCurrentPropertyValue(){
  if (!cbExternalize.getSelection() || sResult == null || "String_Node_Str".equals(sResult)) {
    return "String_Node_Str";
  }
 else {
    return getValueComponent(sResult);
  }
}

Fixed version (ground truth):
private String getCurrentPropertyValue(){
  if (!cbExternalize.getSelection() || sResult == null || "String_Node_Str".equals(sResult)) {
    return "String_Node_Str";
  }
  return getValueComponent(sResult);
}
Program: 79300
Project: 79300
Buggy source:
public void keyPressed(KeyEvent e){
  if (cmpDropDown != null && !cmpDropDown.getShell().isDisposed()) {
    if (e.keyCode == SWT.ESC) {
      cmpDropDown.getShell().dispose();
    }
  }
}

Fixed version (ground truth):
public void keyPressed(KeyEvent e){
  if (cmpDropDown != null && !cmpDropDown.getShell().isDisposed()) {
    if (e.keyCode == SWT.ESC) {
      cmpDropDown.getShell().dispose();
    }
 else     if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
      this.iTransparency=srTransparency.getSelection();
      if (fCurrent instanceof ColorDefinition && bTransparencyChanged) {
        ((ColorDefinition)fCurrent).setTransparency(this.iTransparency);
      }
      this.setFill(fCurrent);
      cmpDropDown.getShell().dispose();
    }
  }
}
Program: 79303
Project: 79303
Buggy source:
public void mouseDown(MouseEvent e){
  fireHandleEvent(MOUSE_CLICKED_EVENT);
  if (e.getSource().equals(cnvSelection)) {
    toggleDropDown();
  }
 else   if (e.getSource() instanceof ColorSelectionCanvas) {
    ColorDefinition cTmp=AttributeFactory.eINSTANCE.createColorDefinition();
    Color clrTmp=((ColorSelectionCanvas)e.getSource()).getColorAt(e.x,e.y);
    cTmp.set(clrTmp.getRed(),clrTmp.getGreen(),clrTmp.getBlue());
    if (clrTmp.getRed() == 0) {
      cTmp.setTransparency(255);
    }
    setFill(cTmp);
    fireHandleEvent(FillChooserComposite.FILL_CHANGED_EVENT);
    cmpDropDown.getShell().dispose();
  }
}

Fixed version (ground truth):
public void mouseDown(MouseEvent e){
  fireHandleEvent(MOUSE_CLICKED_EVENT);
  if (e.getSource().equals(cnvSelection)) {
    toggleDropDown();
  }
 else   if (e.getSource() instanceof ColorSelectionCanvas) {
    ColorDefinition cTmp=AttributeFactory.eINSTANCE.createColorDefinition();
    Color clrTmp=((ColorSelectionCanvas)e.getSource()).getColorAt(e.x,e.y);
    cTmp.set(clrTmp.getRed(),clrTmp.getGreen(),clrTmp.getBlue());
    int iTransparency=0;
    if (fCurrent instanceof ColorDefinition) {
      iTransparency=(bTransparencyChanged) ? this.iTransparency : ((ColorDefinition)fCurrent).getTransparency();
    }
    cTmp.setTransparency(iTransparency);
    setFill(cTmp);
    fireHandleEvent(FillChooserComposite.FILL_CHANGED_EVENT);
    cmpDropDown.getShell().dispose();
  }
}
Program: 79306
Project: 79306
Buggy source:
/** 
 */
public GradientEditorDialog(Shell shellParent,Gradient gSelected){
  this.gCurrent=gSelected;
  if (gCurrent != null) {
    gBackup=(Gradient)EcoreUtil.copy(gSelected);
  }
 else {
    gCurrent=AttributeFactory.eINSTANCE.createGradient();
    gCurrent.setStartColor(ColorDefinitionImpl.create(254,0,0));
    gCurrent.setEndColor(ColorDefinitionImpl.create(0,0,254));
  }
  display=Display.getCurrent();
  shell=new Shell(shellParent,SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
  shell.setLayout(new FillLayout());
  placeComponents();
  shell.setText("String_Node_Str");
  shell.setSize(400,320);
  UIHelper.centerOnScreen(shell);
  shell.layout();
  shell.open();
  while (!shell.isDisposed()) {
    if (!shell.getDisplay().readAndDispatch()) {
      shell.getDisplay().sleep();
    }
  }
}

Fixed version (ground truth):
/** 
 */
public GradientEditorDialog(Shell shellParent,Gradient gSelected){
  this.gCurrent=gSelected;
  if (gCurrent != null) {
    gBackup=(Gradient)EcoreUtil.copy(gSelected);
  }
 else {
    gCurrent=AttributeFactory.eINSTANCE.createGradient();
    gCurrent.setStartColor(ColorDefinitionImpl.create(254,0,0));
    gCurrent.setEndColor(ColorDefinitionImpl.create(0,0,254));
  }
  shell=new Shell(shellParent,SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
  shell.setLayout(new FillLayout());
  placeComponents();
  shell.setText("String_Node_Str");
  shell.setSize(400,320);
  UIHelper.centerOnScreen(shell);
  shell.layout();
  shell.open();
  while (!shell.isDisposed()) {
    if (!shell.getDisplay().readAndDispatch()) {
      shell.getDisplay().sleep();
    }
  }
}
Program: 79307
Project: 79307
Buggy source:
public void startBody(){
  logger.log(Level.FINE,"String_Node_Str");
  if (report != null) {
    IStyle bodyStyle=report.getBodyStyle();
    if (!isEmbeddable) {
      writer.openTag(HTMLTags.TAG_BODY);
      if (bodyStyle != null) {
        writer.attribute(HTMLTags.ATTR_CLASS,bodyStyle.getName());
      }
    }
 else {
      writer.openTag(HTMLTags.TAG_DIV);
      if (bodyStyle != null) {
        StringBuffer styleBuffer=new StringBuffer();
        AttributeBuilder.buildStyle(styleBuffer,bodyStyle,this);
        writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
      }
    }
  }
}

Fixed version (ground truth):
public void startBody(){
  logger.log(Level.FINE,"String_Node_Str");
  IStyle bodyStyle=null;
  if (report != null) {
    bodyStyle=report.getBodyStyle();
  }
  if (!isEmbeddable) {
    writer.openTag(HTMLTags.TAG_BODY);
    if (bodyStyle != null) {
      writer.attribute(HTMLTags.ATTR_CLASS,bodyStyle.getName());
    }
  }
 else {
    writer.openTag(HTMLTags.TAG_DIV);
    if (bodyStyle != null) {
      StringBuffer styleBuffer=new StringBuffer();
      AttributeBuilder.buildStyle(styleBuffer,bodyStyle,this);
      writer.attribute(HTMLTags.ATTR_STYLE,styleBuffer.toString());
    }
  }
}
Program: 79308
Project: 79308
Buggy source:
/** 
 * Broadcasts the event to all elements in the given slot if the elements are selected by selector style.
 * @param ev the event to send
 * @param design the report design
 * @param slot the slot to send
 */
private void broadcastToSelectedElementsInSlot(ReportDesign design,ContainerSlot slot,String selectorName){
}

Fixed version (ground truth):
/** 
 * Broadcasts the event to all elements in the given slot if the elements are selected by selector style.
 * @param design the report design
 * @param slot the slot to send
 * @param selectorName the selector name
 */
private void broadcastToSelectedElementsInSlot(ReportDesign design,ContainerSlot slot,String selectorName){
}
Program: 79309
Project: 79309
Buggy source:
/** 
 * Gets the value of property.
 * @param design the report design
 * @param prop definition of the property to get
 * @return the value of the property.
 */
public Object getFactoryProperty(ReportDesign design,ElementPropertyDefn prop){
  return getProperty(design,prop);
}

Fixed version (ground truth):
/** 
 * Gets the value of property.
 * @param design the report design
 * @param prop definition of the property to get
 * @return the value of the property.
 */
public Object getFactoryProperty(ReportDesign design,ElementPropertyDefn prop){
  return getLocalProperty(design,prop);
}
Program: 79310
Project: 79310
Buggy source:
/** 
 * Creates the cached system properties for <code>PropertyInvisible</code> tags.
 */
private void createCachedSystemProperties(){
  for (Iterator iter=propVisibilites.keySet().iterator(); iter.hasNext(); ) {
    String propName=(String)iter.next();
    SystemPropertyDefn sysDefn=(SystemPropertyDefn)parent.getProperty(propName);
    if (sysDefn != null && (sysDefn.isVisible() || !sysDefn.isReadOnly())) {
      if (cachedSystemProps == null)       cachedSystemProps=new HashMap();
      SystemPropertyDefn defn=createPropertyDefn(sysDefn);
      defn.setVisibility((String)propVisibilites.get(propName));
      cachedSystemProps.put(propName,defn);
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates the cached system properties for <code>PropertyInvisible</code> tags.
 */
private void createCachedSystemProperties(){
  if (propVisibilites == null)   return;
  for (Iterator iter=propVisibilites.keySet().iterator(); iter.hasNext(); ) {
    String propName=(String)iter.next();
    SystemPropertyDefn sysDefn=(SystemPropertyDefn)parent.getProperty(propName);
    if (sysDefn != null && (sysDefn.isVisible() || !sysDefn.isReadOnly())) {
      if (cachedSystemProps == null)       cachedSystemProps=new HashMap();
      SystemPropertyDefn defn=createPropertyDefn(sysDefn);
      defn.setVisibility((String)propVisibilites.get(propName));
      cachedSystemProps.put(propName,defn);
    }
  }
}
Program: 79311
Project: 79311
Buggy source:
/** 
 * Sends a content changed and possibly element deleted event. This record is unusual because it must send two events: one for the container, one for the content. If we are dropping the content, then it is effectively deleted, and we must tell the content that it has been deleted.
 */
protected void sendNotifcations(boolean transactionStarted){
  NotificationEvent event=null;
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE)   event=new ContentEvent(container,content,slotID,ContentEvent.ADD);
 else   event=new ContentEvent(container,slotID,ContentEvent.REMOVE);
  event.setInTransaction(transactionStarted);
  if (state == DONE_STATE)   event.setSender(sender);
  container.broadcast(event);
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE)   return;
  event=new ElementDeletedEvent(content);
  if (state == DONE_STATE)   event.setSender(sender);
  content.broadcast(event,container.getRoot());
}

Fixed version (ground truth):
/** 
 * Sends a content changed and possibly element deleted event. This record is unusual because it must send two events: one for the container, one for the content. If we are dropping the content, then it is effectively deleted, and we must tell the content that it has been deleted.
 */
protected void sendNotifcations(boolean transactionStarted){
  NotificationEvent event=null;
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE)   event=new ContentEvent(container,content,slotID,ContentEvent.ADD);
 else   event=new ContentEvent(container,slotID,ContentEvent.REMOVE);
  event.setInTransaction(transactionStarted);
  if (state == DONE_STATE)   event.setSender(sender);
  container.broadcast(event);
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE) {
    if (isSelector(content))     content.broadcast(event,container.getRoot());
    return;
  }
  event=new ElementDeletedEvent(content);
  if (state == DONE_STATE)   event.setSender(sender);
  content.broadcast(event,container.getRoot());
}
Program: 79312
Project: 79312
Buggy source:
protected void broadcastToClients(NotificationEvent ev,ReportDesign design){
  super.broadcastToClients(ev,design);
  PredefinedStyle predefinedStyle=MetaDataDictionary.getInstance().getPredefinedStyle(getName());
  if (predefinedStyle != null) {
    broadcastToSelectedElementsInSlot(ev,design,design.getSlot(ReportDesign.COMPONENT_SLOT));
    broadcastToSelectedElementsInSlot(ev,design,design.getSlot(ReportDesign.PAGE_SLOT));
    broadcastToSelectedElementsInSlot(ev,design,design.getSlot(ReportDesign.BODY_SLOT));
    broadcastToSelectedElementsInSlot(ev,design,design.getSlot(ReportDesign.SCRATCH_PAD_SLOT));
  }
}

Fixed version (ground truth):
protected void broadcastToClients(NotificationEvent ev,ReportDesign design){
  super.broadcastToClients(ev,design);
  String selector=null;
  if (ev instanceof NameEvent) {
    String oldName=((NameEvent)ev).getOldName();
    String newName=((NameEvent)ev).getNewName();
    if (MetaDataDictionary.getInstance().getPredefinedStyle(oldName) != null)     selector=oldName;
 else     if (MetaDataDictionary.getInstance().getPredefinedStyle(newName) != null)     selector=newName;
  }
 else {
    if (MetaDataDictionary.getInstance().getPredefinedStyle(getName()) != null)     selector=getName();
  }
  if (selector != null) {
    broadcastToSelectedElementsInSlot(design,design.getSlot(ReportDesign.COMPONENT_SLOT),selector);
    broadcastToSelectedElementsInSlot(design,design.getSlot(ReportDesign.PAGE_SLOT),selector);
    broadcastToSelectedElementsInSlot(design,design.getSlot(ReportDesign.BODY_SLOT),selector);
    broadcastToSelectedElementsInSlot(design,design.getSlot(ReportDesign.SCRATCH_PAD_SLOT),selector);
  }
}
Program: 79313
Project: 79313
Buggy source:
/** 
 * Broadcasts the event to all elements in the given slot if the elements are selected by selector style.
 * @param ev the event to send
 * @param design the report design
 * @param slot the slot to send
 */
private void broadcastToSelectedElementsInSlot(NotificationEvent ev,ReportDesign design,ContainerSlot slot){
}

Fixed version (ground truth):
/** 
 * Broadcasts the event to all elements in the given slot if the elements are selected by selector style.
 * @param ev the event to send
 * @param design the report design
 * @param slot the slot to send
 */
private void broadcastToSelectedElementsInSlot(ReportDesign design,ContainerSlot slot,String selectorName){
}
Program: 79316
Project: 79316
Buggy source:
/** 
 * Get the margin of the current element.
 * @param retValue The margin value of the current element.
 * @return The maring's new value of the current element.
 */
public Insets getMargin(Insets retValue){
  if (retValue == null) {
    retValue=new Insets();
  }
 else {
    retValue=new Insets(retValue);
  }
  DimensionHandle fontHandle=getHandle().getPrivateStyle().getFontSize();
  int fontSize=12;
  if (fontHandle.getValue() instanceof String) {
    fontSize=Integer.valueOf((String)DesignerConstants.fontMap.get(DEUtil.getFontSize(getHandle()))).intValue();
  }
 else   if (fontHandle.getValue() instanceof DimensionValue) {
    DEUtil.convertToPixel(fontHandle.getValue(),fontSize);
  }
  DimensionValue dimensionValue=(DimensionValue)getHandle().getProperty(Style.MARGIN_TOP_PROP);
  double px=DEUtil.convertToPixel(dimensionValue,fontSize);
  dimensionValue=(DimensionValue)getHandle().getProperty(Style.MARGIN_BOTTOM_PROP);
  double py=DEUtil.convertToPixel(dimensionValue,fontSize);
  retValue.top=(int)px;
  retValue.bottom=(int)py;
  dimensionValue=(DimensionValue)getHandle().getProperty(Style.MARGIN_LEFT_PROP);
  px=DEUtil.convertToPixel(dimensionValue,fontSize);
  dimensionValue=(DimensionValue)getHandle().getProperty(Style.MARGIN_RIGHT_PROP);
  py=DEUtil.convertToPixel(dimensionValue,fontSize);
  retValue.left=(int)px;
  retValue.right=(int)py;
  return retValue;
}

Fixed version (ground truth):
/** 
 * Get the margin of the current element.
 * @param retValue The margin value of the current element.
 * @return The maring's new value of the current element.
 */
public Insets getMargin(Insets retValue){
  if (retValue == null) {
    retValue=new Insets();
  }
 else {
    retValue=new Insets(retValue);
  }
  DimensionHandle fontHandle=getHandle().getPrivateStyle().getFontSize();
  int fontSize=12;
  if (fontHandle.getValue() instanceof String) {
    fontSize=Integer.valueOf((String)DesignerConstants.fontMap.get(DEUtil.getFontSize(getHandle()))).intValue();
  }
 else   if (fontHandle.getValue() instanceof DimensionValue) {
    DEUtil.convertToPixel(fontHandle.getValue(),fontSize);
  }
  double px=0;
  Object prop=getHandle().getProperty(Style.MARGIN_TOP_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    px=DEUtil.convertToPixel((DimensionValue)prop,fontSize);
  }
  double py=0;
  prop=getHandle().getProperty(Style.MARGIN_BOTTOM_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    py=DEUtil.convertToPixel((DimensionValue)prop,fontSize);
  }
  retValue.top=(int)px;
  retValue.bottom=(int)py;
  px=py=0;
  prop=getHandle().getProperty(Style.MARGIN_LEFT_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    px=DEUtil.convertToPixel((DimensionValue)prop,fontSize);
  }
  prop=getHandle().getProperty(Style.MARGIN_RIGHT_PROP);
  if (!DesignChoiceConstants.MARGIN_AUTO.equals(prop)) {
    py=DEUtil.convertToPixel((DimensionValue)prop,fontSize);
  }
  retValue.left=(int)px;
  retValue.right=(int)py;
  return retValue;
}
Program: 79318
Project: 79318
Buggy source:
/** 
 * @param iMinorUnitsPerMajor
 * @return
 */
public final double[] getMinorCoordinates(int iMinorUnitsPerMajor){
  if (daTickCoordinates == null || iMinorUnitsPerMajor <= 0) {
    return null;
  }
  final double[] da=new double[iMinorUnitsPerMajor];
  final double dUnit=getUnitSize();
  if ((iType & LOGARITHMIC) != LOGARITHMIC) {
    final double dEach=dUnit / iMinorUnitsPerMajor;
    for (int i=1; i < iMinorUnitsPerMajor; i++) {
      da[i - 1]=dEach * i;
    }
  }
 else {
    double dCount=iMinorUnitsPerMajor;
    final double dEach=10d / dCount;
    final double dMax=Math.log(dCount);
    for (int i=0; i < iMinorUnitsPerMajor; i++) {
      da[i]=(Math.log(i + 1) * dUnit) / dMax;
    }
  }
  da[iMinorUnitsPerMajor - 1]=dUnit;
  return da;
}

Fixed version (ground truth):
/** 
 * @param iMinorUnitsPerMajor
 * @return
 */
public final double[] getMinorCoordinates(int iMinorUnitsPerMajor){
  if (daTickCoordinates == null || iMinorUnitsPerMajor <= 0) {
    return null;
  }
  final double[] da=new double[iMinorUnitsPerMajor];
  final double dUnit=getUnitSize();
  if ((iType & LOGARITHMIC) != LOGARITHMIC) {
    final double dEach=dUnit / iMinorUnitsPerMajor;
    for (int i=1; i < iMinorUnitsPerMajor; i++) {
      da[i - 1]=dEach * i;
    }
  }
 else {
    final double dCount=iMinorUnitsPerMajor;
    final double dMax=Math.log(dCount);
    for (int i=0; i < iMinorUnitsPerMajor; i++) {
      da[i]=(Math.log(i + 1) * dUnit) / dMax;
    }
  }
  da[iMinorUnitsPerMajor - 1]=dUnit;
  return da;
}
Program: 79325
Project: 79325
Buggy source:
/** 
 * Sends a content changed and possibly element deleted event. This record is unusual because it must send two events: one for the container, one for the content. If we are dropping the content, then it is effectively deleted, and we must tell the content that it has been deleted.
 */
protected void sendNotifcations(boolean transactionStarted){
  NotificationEvent event=null;
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE)   event=new ContentEvent(container,slotID,ContentEvent.ADD);
 else   event=new ContentEvent(container,slotID,ContentEvent.REMOVE);
  event.setInTransaction(transactionStarted);
  if (state == DONE_STATE)   event.setSender(sender);
  container.broadcast(event);
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE)   return;
  event=new ElementDeletedEvent(content);
  if (state == DONE_STATE)   event.setSender(sender);
  content.broadcast(event);
}

Fixed version (ground truth):
/** 
 * Sends a content changed and possibly element deleted event. This record is unusual because it must send two events: one for the container, one for the content. If we are dropping the content, then it is effectively deleted, and we must tell the content that it has been deleted.
 */
protected void sendNotifcations(boolean transactionStarted){
  NotificationEvent event=null;
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE)   event=new ContentEvent(container,slotID,ContentEvent.ADD);
 else   event=new ContentEvent(container,slotID,ContentEvent.REMOVE);
  event.setInTransaction(transactionStarted);
  if (state == DONE_STATE)   event.setSender(sender);
  container.broadcast(event);
  if (add && state != UNDONE_STATE || !add && state == UNDONE_STATE)   return;
  event=new ElementDeletedEvent(content);
  if (state == DONE_STATE)   event.setSender(sender);
  content.broadcast(event,container.getRoot());
}
Program: 79326
Project: 79326
Buggy source:
public NotificationEvent getEvent(){
  return new NameEvent(element);
}

Fixed version (ground truth):
public NotificationEvent getEvent(){
  return new NameEvent(element,oldName,newName);
}
Program: 79327
Project: 79327
Buggy source:
/** 
 * Implements to broadcast an event to all listeners of this design element on a design tree. Note subclasses should override this method to change the behavior of broadcast method. Part of: Notification system.
 * @param ev the event to send
 * @param design the root node of the design tree.
 */
protected void broadcast(NotificationEvent ev,ReportDesign design){
  if (listeners != null) {
    ArrayList tmpListeners=new ArrayList(listeners);
    Iterator iter=tmpListeners.iterator();
    while (iter.hasNext()) {
      ((Listener)iter.next()).elementChanged(getHandle(design),ev);
    }
  }
  if (derived != null) {
    if (ev.getDeliveryPath() == NotificationEvent.ELEMENT_CLIENT)     return;
    if (ev.getDeliveryPath() != NotificationEvent.STYLE_CLIENT)     ev.setDeliveryPath(NotificationEvent.DESCENDENT);
    Iterator iter=derived.iterator();
    while (iter.hasNext()) {
      ((DesignElement)iter.next()).broadcast(ev,design);
    }
  }
}

Fixed version (ground truth):
/** 
 * Implements to broadcast an event to all listeners of this design element on a design tree. Note subclasses should override this method to change the behavior of broadcast method. Part of: Notification system.
 * @param ev the event to send
 * @param design the root node of the design tree.
 */
public void broadcast(NotificationEvent ev,ReportDesign design){
  if (listeners != null) {
    ArrayList tmpListeners=new ArrayList(listeners);
    Iterator iter=tmpListeners.iterator();
    while (iter.hasNext()) {
      ((Listener)iter.next()).elementChanged(getHandle(design),ev);
    }
  }
  if (derived != null) {
    if (ev.getDeliveryPath() == NotificationEvent.ELEMENT_CLIENT)     return;
    if (ev.getDeliveryPath() != NotificationEvent.STYLE_CLIENT)     ev.setDeliveryPath(NotificationEvent.DESCENDENT);
    Iterator iter=derived.iterator();
    while (iter.hasNext()) {
      ((DesignElement)iter.next()).broadcast(ev,design);
    }
  }
}
Program: 79328
Project: 79328
Buggy source:
/** 
 * Gets the root node of the design tree. This node must be a instance of <code>ReportDesign</code>.
 * @return the root node of the design tree
 */
protected ReportDesign getRoot(){
  DesignElement element=this;
  while (element.getContainer() != null)   element=element.getContainer();
  if (element instanceof ReportDesign == false)   return null;
  return (ReportDesign)element;
}

Fixed version (ground truth):
/** 
 * Gets the root node of the design tree. This node must be a instance of <code>ReportDesign</code>.
 * @return the root node of the design tree
 */
public ReportDesign getRoot(){
  DesignElement element=this;
  while (element.getContainer() != null)   element=element.getContainer();
  if (element instanceof ReportDesign == false)   return null;
  return (ReportDesign)element;
}
Program: 79329
Project: 79329
Buggy source:
/** 
 * Sends the event to all clients in addition to the routing for a design element.
 * @param ev the event to send
 * @param design the root node of the design tree.
 */
protected void broadcast(NotificationEvent ev,ReportDesign design){
  super.broadcast(ev,design);
  adjustDeliveryPath(ev);
  broadcastToClients(ev,design);
}

Fixed version (ground truth):
/** 
 * Sends the event to all clients in addition to the routing for a design element.
 * @param ev the event to send
 * @param design the root node of the design tree.
 */
public void broadcast(NotificationEvent ev,ReportDesign design){
  super.broadcast(ev,design);
  adjustDeliveryPath(ev);
  broadcastToClients(ev,design);
}
Program: 79330
Project: 79330
Buggy source:
/** 
 * creates a new scripting scope
 */
public void newScope(){
  Scriptable newScope;
  try {
    newScope=context.newObject(scope);
    scope=newScope;
  }
 catch (  EvaluatorException e) {
    logger.error(e);
  }
catch (  JavaScriptException e) {
    logger.error(e);
  }
}

Fixed version (ground truth):
/** 
 * creates a new scripting scope
 */
public void newScope(){
  Scriptable newScope;
  try {
    newScope=context.newObject(scope);
    newScope.setParentScope(scope);
    scope=newScope;
  }
 catch (  EvaluatorException e) {
    logger.error(e);
  }
catch (  JavaScriptException e) {
    logger.error(e);
  }
}
Program: 79331
Project: 79331
Buggy source:
/** 
 * Reusable 'strokes' for rendering lines may be obtained from here
 * @param ls
 * @return
 */
public final Stroke getCachedStroke(LineAttributes lia){
  if (lia == null)   return null;
  Stroke s=(Stroke)_htLineStyles.get(lia);
  if (s == null) {
    BasicStroke bs=null;
    if (lia.getStyle().getValue() == LineStyle.DASHED) {
      float[] faStyle=new float[]{6.0f,4.0f};
      bs=new BasicStroke(lia.getThickness(),BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,0,faStyle,0);
    }
 else     if (lia.getStyle().getValue() == LineStyle.DOTTED) {
      float[] faStyle=new float[]{1.0f,4.0f};
      bs=new BasicStroke(lia.getThickness(),BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,0,faStyle,0);
    }
 else     if (lia.getStyle().getValue() == LineStyle.SOLID && lia.getThickness() > 1) {
      bs=new BasicStroke(lia.getThickness(),BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);
    }
    if (bs != null) {
      _htLineStyles.put(lia,bs);
    }
    return bs;
  }
  return s;
}

Fixed version (ground truth):
/** 
 * Reusable 'strokes' for rendering lines may be obtained from here
 * @param ls
 * @return
 */
public final Stroke getCachedStroke(LineAttributes lia){
  if (lia == null)   return null;
  Stroke s=(Stroke)_htLineStyles.get(lia);
  if (s == null) {
    BasicStroke bs=null;
    if (lia.getStyle().getValue() == LineStyle.DASHED) {
      float[] faStyle=new float[]{6.0f,4.0f};
      bs=new BasicStroke(lia.getThickness(),BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,0,faStyle,0);
    }
 else     if (lia.getStyle().getValue() == LineStyle.DOTTED) {
      float[] faStyle=new float[]{1.0f,4.0f};
      bs=new BasicStroke(lia.getThickness(),BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,0,faStyle,0);
    }
 else     if (lia.getStyle().getValue() == LineStyle.SOLID) {
      bs=new BasicStroke(lia.getThickness(),BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);
    }
    if (bs != null) {
      _htLineStyles.put(lia,bs);
    }
    return bs;
  }
  return s;
}
Program: 79332
Project: 79332
Buggy source:
public ElementDefn getDefn(){
}

Fixed version (ground truth):
public ElementDefn getDefn(){
  ElementDefn extDefn=((ExtendedItem)getElement()).getExtDefn();
  if (extDefn != null)   return extDefn;
  return getElement().getDefn();
}
Program: 79333
Project: 79333
Buggy source:
public char[] getCompletionProposalAutoActivationCharacters(){
  return new char[]{'?','.'};
}

Fixed version (ground truth):
public char[] getCompletionProposalAutoActivationCharacters(){
  return new char[]{'.'};
}
Program: 79334
Project: 79334
Buggy source:
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,int offset){
  try {
    if (offset > viewer.getTopIndexStartOffset()) {
      char ch=viewer.getDocument().getChar(offset - 1);
      if (ch == '?') {
        lastProposals=getParameterCompletionProposals(viewer,offset);
        return lastProposals;
      }
 else       if (ch == '.') {
        lastProposals=getTableOrColumnCompletionProposals(viewer,offset);
        return lastProposals;
      }
 else {
        return getRelevantProposals(viewer,offset);
      }
    }
  }
 catch (  BadLocationException e) {
  }
  return null;
}

Fixed version (ground truth):
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,int offset){
  try {
    if (offset > viewer.getTopIndexStartOffset()) {
      char ch=viewer.getDocument().getChar(offset - 1);
      if (ch == '.') {
        lastProposals=getTableOrColumnCompletionProposals(viewer,offset);
        return lastProposals;
      }
 else {
        return getRelevantProposals(viewer,offset);
      }
    }
  }
 catch (  BadLocationException e) {
  }
  return null;
}
Program: 79339
Project: 79339
Buggy source:
/** 
 * Parse the input stream to get a DOM tree.
 * @param in the input stream
 * @param textType the text type (case-insensitive). Valid types includesauto,plain,html. If null, it is regarded as auto; if set to any other value, treat the text as plain text.
 * @return DOM tree if no error exists,otherwise null.
 */
public Document parse(InputStream in,String textType){
}

Fixed version (ground truth):
/** 
 * Parse the input stream to get a DOM tree.
 * @param in the input stream
 * @param textType the text type (case-insensitive). Valid types includes auto,plain,html. If null, it is regarded as auto; if set to any other value, treat the text as plain text.
 * @return DOM tree if no error exists,otherwise null.
 */
public Document parse(InputStream in,String textType){
}
Program: 79341
Project: 79341
Buggy source:
/** 
 * @param value
 */
public void style(String name,String value){
}

Fixed version (ground truth):
/** 
 * @param value
 * @param isGeneral
 */
public void style(String name,String value,boolean isGeneral){
}
Program: 79342
Project: 79342
Buggy source:
/** 
 * Extract the file extension string from the given file name.
 * @param fileName The file name.
 * @param separatorFlag Specifies whether the file name uses File or URI separator character.
 * @return The file extension string containing the '.' character.
 */
public static String getExtFromFileName(String fileName,int separatorFlag){
}

Fixed version (ground truth):
/** 
 * Extract the file extension string from the given file name.
 * @param fileName The file name.
 * @param separatorFlag Specifies whether the file name uses File or URI separator character.
 * @return The file extension string containing the '.' character.
 */
public static String getExtFromFileName(String fileName,int separatorFlag){
  if (fileName != null) {
    int lastindex=fileName.lastIndexOf('.');
    if (lastindex > fileName.lastIndexOf(separators[separatorFlag])) {
      return fileName.substring(lastindex,fileName.length());
    }
  }
  return null;
}
Program: 79343
Project: 79343
Buggy source:
/** 
 * Generates an absolute file name from the give path and file name.
 * @param path The path name.
 * @param fileName The file name.
 * @return The absolute file path.
 */
public static String getAbsolutePath(String path,String fileName){
  if (fileName == null || fileName.length() == 0) {
    return null;
  }
  if (path == null || path.length() == 0 || fileName.indexOf(':') > 0) {
    return fileName;
  }
  StringBuffer fullPath=new StringBuffer();
  fullPath.append(path);
  if (path.charAt(path.length() - 1) != File.separatorChar) {
    fullPath.append(File.separatorChar);
  }
  fullPath.append(fileName);
  return fullPath.toString();
}

Fixed version (ground truth):
/** 
 * Generates an absolute file name from the give path and file name.
 * @param path The path name.
 * @param fileName The file name.
 * @return The absolute file path.
 */
public static String getAbsolutePath(String path,String fileName){
  File file=new File(fileName);
  if (!file.exists()) {
    file=new File(path,fileName);
  }
  if (file.exists()) {
    return file.getAbsolutePath();
  }
  return null;
}
Program: 79344
Project: 79344
Buggy source:
private void registerDriver(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
  Driver driver=(Driver)Class.forName(className).newInstance();
  DriverManager.registerDriver(driver);
}

Fixed version (ground truth):
/** 
 * Ensures that the JDBC driver with specified class name is loaded and registered with JDBC DriverManager
 */
private void registerDriver(String className) throws DriverException {
  if (className == null)   return;
  Class driverClass;
  try {
    driverClass=Class.forName(className);
  }
 catch (  ClassNotFoundException e) {
    throw new DriverException(e);
  }
  if (!registeredDrivers.contains(className)) {
    try {
      Driver driver=(Driver)driverClass.newInstance();
      DriverManager.registerDriver(driver);
    }
 catch (    SQLException e) {
    }
catch (    IllegalAccessException e) {
      throw new DriverException(e);
    }
catch (    InstantiationException e) {
      throw new DriverException(e);
    }
    registeredDrivers.add(className);
  }
}
Program: 79346
Project: 79346
Buggy source:
public void showTargetFeedback(Request request){
  if (this.getSelected() == 0) {
    this.getViewer().setCursor(ReportPlugin.getDefault().getCellCursor());
  }
  super.showTargetFeedback(request);
}

Fixed version (ground truth):
public void showTargetFeedback(Request request){
  if (this.getSelected() == 0 && request.getType() == RequestConstants.REQ_SELECTION) {
    this.getViewer().setCursor(ReportPlugin.getDefault().getCellCursor());
  }
  super.showTargetFeedback(request);
}
Program: 79347
Project: 79347
Buggy source:
/** 
 * @param reportDesign The reportDesign to set.
 */
public void setReportDesign(ReportDesign reportDesign){
  this.reportDesign=reportDesign;
  File file=new File(reportDesign.getFileName());
  basePath=file.getParent();
}

Fixed version (ground truth):
/** 
 * @param reportDesign The reportDesign to set.
 */
public void setReportDesign(ReportDesign reportDesign){
  this.reportDesign=reportDesign;
  if (basePath == null || basePath.equals("String_Node_Str")) {
    File file=new File(reportDesign.getFileName());
    basePath=file.getParent();
  }
}
Program: 79348
Project: 79348
Buggy source:
public void visitReportDesign(ReportDesignHandle handle){
  report.setUnit(handle.getDefaultUnits());
  defaultUnit=report.getUnit();
  SlotHandle paramSlot=handle.getParameters();
  IParameterDefnBase param;
  for (int i=0; i < paramSlot.getCount(); i++) {
    apply(paramSlot.get(i));
    assert(currentElement != null);
    param=(IParameterDefnBase)currentElement;
    report.addParameter(param);
  }
  PageSetupDesign pageSetup=new PageSetupDesign();
  SlotHandle pageSlot=handle.getMasterPages();
  for (int i=0; i < pageSlot.getCount(); i++) {
    apply(pageSlot.get(i));
    assert(currentElement != null);
    pageSetup.addMasterPage((MasterPageDesign)currentElement);
  }
  report.setPageSetup(pageSetup);
  SlotHandle bodySlot=handle.getBody();
  for (int i=0; i < bodySlot.getCount(); i++) {
    apply(bodySlot.get(i));
    assert(currentElement != null);
    report.addContent((ReportItemDesign)currentElement);
  }
}

Fixed version (ground truth):
public void visitReportDesign(ReportDesignHandle handle){
  report.setUnit(handle.getDefaultUnits());
  if (handle.getBase() != null && !handle.getBase().equals("String_Node_Str")) {
    report.setBasePath(handle.getBase());
  }
  defaultUnit=report.getUnit();
  SlotHandle paramSlot=handle.getParameters();
  IParameterDefnBase param;
  for (int i=0; i < paramSlot.getCount(); i++) {
    apply(paramSlot.get(i));
    assert(currentElement != null);
    param=(IParameterDefnBase)currentElement;
    report.addParameter(param);
  }
  PageSetupDesign pageSetup=new PageSetupDesign();
  SlotHandle pageSlot=handle.getMasterPages();
  for (int i=0; i < pageSlot.getCount(); i++) {
    apply(pageSlot.get(i));
    assert(currentElement != null);
    pageSetup.addMasterPage((MasterPageDesign)currentElement);
  }
  report.setPageSetup(pageSetup);
  SlotHandle bodySlot=handle.getBody();
  for (int i=0; i < bodySlot.getCount(); i++) {
    apply(bodySlot.get(i));
    assert(currentElement != null);
    report.addContent((ReportItemDesign)currentElement);
  }
}
Program: 79349
Project: 79349
Buggy source:
public void newScope(){
  Scriptable newScope=new NativeObject();
  newScope.setPrototype(scope);
  newScope.setParentScope(scope);
  scope=newScope;
}

Fixed version (ground truth):
/** 
 * creates a new scripting scope
 */
public void newScope(){
  Scriptable newScope;
  try {
    newScope=context.newObject(scope);
    scope=newScope;
  }
 catch (  EvaluatorException e) {
    logger.error(e);
  }
catch (  JavaScriptException e) {
    logger.error(e);
  }
}
Program: 79350
Project: 79350
Buggy source:
public Object eval(String source,String name,int lineNo){
  assert(this.context != null);
  try {
    Object value=context.evaluateString(this.scope,source,name,lineNo,null);
    return jsToJava(value);
  }
 catch (  Exception ex) {
    logger.error(source,ex);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * evaluates a script 
 */
public Object eval(String source,String name,int lineNo){
  assert(this.context != null);
  try {
    Object value=context.evaluateString(scope,source,name,lineNo,null);
    return jsToJava(value);
  }
 catch (  Exception ex) {
    logger.error(source,ex);
    return null;
  }
}
Program: 79351
Project: 79351
Buggy source:
public ScriptContext(){
  try {
    this.context=Context.enter();
    this.scope=this.context.initStandardObjects();
    context.setWrapFactory(new BIRTWrapFactory());
    NativeFinance.init(context,scope,true);
    NativeDateTimeSpan.init(context,scope,true);
  }
 catch (  Exception ex) {
    Context.exit();
    this.scope=null;
    this.context=null;
    logger.error(ex);
  }
}

Fixed version (ground truth):
/** 
 * constructor
 */
public ScriptContext(){
  try {
    this.context=Context.enter();
    this.scope=this.context.initStandardObjects();
    context.setWrapFactory(new BIRTWrapFactory());
    NativeFinance.init(context,scope,true);
    NativeDateTimeSpan.init(context,scope,true);
  }
 catch (  Exception ex) {
    Context.exit();
    this.scope=null;
    this.context=null;
    logger.error(ex);
  }
}
Program: 79352
Project: 79352
Buggy source:
public Object jsToJava(Object jsValue){
  if (jsValue instanceof Scriptable) {
    String className=((Scriptable)jsValue).getClassName();
    if ("String_Node_Str".equals(className)) {
      return Context.toType(jsValue,java.util.Date.class);
    }
 else     if ("String_Node_Str".equals(className)) {
      return Boolean.valueOf(Context.toString(jsValue));
    }
 else     if ("String_Node_Str".equals(className)) {
      return Context.toString(jsValue);
    }
  }
  return Context.toType(jsValue,Object.class);
}

Fixed version (ground truth):
/** 
 * converts a JS object to a Java object
 * @param jsValue javascript object
 * @return Java object
 */
public Object jsToJava(Object jsValue){
  if (jsValue instanceof Scriptable) {
    String className=((Scriptable)jsValue).getClassName();
    if ("String_Node_Str".equals(className)) {
      return Context.toType(jsValue,java.util.Date.class);
    }
 else     if ("String_Node_Str".equals(className)) {
      return Boolean.valueOf(Context.toString(jsValue));
    }
 else     if ("String_Node_Str".equals(className)) {
      return Context.toString(jsValue);
    }
  }
  return Context.toType(jsValue,Object.class);
}
Program: 79353
Project: 79353
Buggy source:
public void exitScope(){
  Scriptable parentScope=scope.getParentScope();
  if (parentScope != null) {
    scope=parentScope;
  }
}

Fixed version (ground truth):
/** 
 * exits from the current scripting scope
 */
public void exitScope(){
  Scriptable parentScope=scope.getParentScope();
  if (parentScope != null)   scope=parentScope;
}
Program: 79354
Project: 79354
Buggy source:
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){
  assert(this.context != null);
  Object sObj=Context.javaToJS(value,scope);
  scope.put(name,scope,sObj);
}
Program: 79355
Project: 79355
Buggy source:
public Scriptable getCurrentScope(){
  return scope;
}

Fixed version (ground truth):
/** 
 * @return the current scope
 */
public Scriptable getCurrentScope(){
  return scope;
}
Program: 79356
Project: 79356
Buggy source:
public Object lookupBean(String name){
  assert(this.context != null);
  return this.scope.get(name,this.scope);
}

Fixed version (ground truth):
/** 
 * checks if a property is available in the scope
 * @param name 
 * @return
 */
public Object lookupBean(String name){
  assert(context != null);
  return scope.get(name,scope);
}