nus-yam/ex-repair huggingface dataset:
Program: 68011
Project: 68011
Buggy source:
/** 
 * actions of Edit Driver in Driver Page
 */
private void editDriver(){
  if (driverViewer.getTable().getSelectionIndex() >= 0 && driverViewer.getTable().getSelectionIndex() < driverViewer.getTable().getItemCount()) {
    EditJdbcDriverDialog dlg=new EditJdbcDriverDialog(getShell());
    Object obj=driverViewer.getTable().getItem(driverViewer.getTable().getSelectionIndex()).getData();
    DriverInfo driverInfo=(DriverInfo)((Map.Entry)obj).getValue();
    if (obj instanceof Map.Entry) {
      dlg.setDriverClassName(((Map.Entry)obj).getKey().toString());
      dlg.setDisplayName(driverInfo.getDisplayName());
      dlg.setUrlTemplate(driverInfo.getUrlTemplate());
    }
    if (dlg.open() == Window.OK) {
      if (obj instanceof Map.Entry && (!dlg.getDisplayName().trim().equals(driverInfo.getDisplayName().trim()) || !dlg.getUrlTemplate().trim().equals(driverInfo.getUrlTemplate().trim()))) {
        driverInfo.setDisplayName(dlg.getDisplayName());
        driverInfo.setUrlTemplate(dlg.getUrlTemplate());
        driverMap.put(((Map.Entry)obj).getKey(),driverInfo);
        Utility.setPreferenceStoredMap(JdbcPlugin.DRIVER_MAP_PREFERENCE_KEY,driverMap);
        driverChanged=true;
      }
      refreshDriverViewer();
      updateDriverButtons();
    }
  }
}

Fixed version (ground truth):
/** 
 * actions of Edit Driver in Driver Page
 */
private void editDriver(){
  if (driverViewer.getTable().getSelectionIndex() >= 0 && driverViewer.getTable().getSelectionIndex() < driverViewer.getTable().getItemCount()) {
    EditJdbcDriverDialog dlg=new EditJdbcDriverDialog(getShell());
    Object obj=driverViewer.getTable().getItem(driverViewer.getTable().getSelectionIndex()).getData();
    DriverInfo driverInfo=(DriverInfo)((Map.Entry)obj).getValue();
    if (externalDrivers == null || !externalDrivers.contains(driverInfo.getDriverName())) {
      return;
    }
    if (obj instanceof Map.Entry) {
      dlg.setDriverClassName(((Map.Entry)obj).getKey().toString());
      dlg.setDisplayName(driverInfo.getDisplayName());
      dlg.setUrlTemplate(driverInfo.getUrlTemplate());
    }
    if (dlg.open() == Window.OK) {
      if (obj instanceof Map.Entry && (!dlg.getDisplayName().trim().equals(driverInfo.getDisplayName().trim()) || !dlg.getUrlTemplate().trim().equals(driverInfo.getUrlTemplate().trim()))) {
        driverInfo.setDisplayName(dlg.getDisplayName());
        driverInfo.setUrlTemplate(dlg.getUrlTemplate());
        driverMap.put(((Map.Entry)obj).getKey(),driverInfo);
        Utility.setPreferenceStoredMap(JdbcPlugin.DRIVER_MAP_PREFERENCE_KEY,driverMap);
        driverChanged=true;
      }
      refreshDriverViewer();
      updateDriverButtons();
    }
  }
}
Program: 68012
Project: 68012
Buggy source:
/** 
 * Update states of driver buttons
 */
private void updateDriverButtons(){
  editButton.setEnabled(driverViewer.getTable().getSelectionIndex() >= 0 && driverViewer.getTable().getSelectionIndex() < driverViewer.getTable().getItemCount());
}

Fixed version (ground truth):
/** 
 * Update states of driver buttons
 */
private void updateDriverButtons(){
  if (driverViewer.getTable().getSelectionIndex() >= 0 && driverViewer.getTable().getSelectionIndex() < driverViewer.getTable().getItemCount()) {
    if (externalDrivers != null) {
      Object obj=((Map.Entry)driverViewer.getTable().getSelection()[0].getData()).getValue();
      editButton.setEnabled(externalDrivers.contains(((DriverInfo)obj).getDriverName()));
    }
 else {
      editButton.setEnabled(false);
    }
  }
 else {
    editButton.setEnabled(false);
  }
}
Program: 68013
Project: 68013
Buggy source:
/** 
 * update driverMap at runtime
 */
private void updateDriverMapRuntime(){
  if (jarsToBeCopiedRuntime.equals(jarsToBeDeletedRuntime))   return;
  List fileList=new ArrayList();
  Iterator jarsCopyIterator=jarsToBeCopiedRuntime.values().iterator();
  while (jarsCopyIterator.hasNext()) {
    fileList.add(new File(((JarFile)jarsCopyIterator.next()).getFilePath()));
  }
  JdbcToolKit.addToDriverList(fileList);
  fileList.clear();
  Iterator jarsDeleteIterator=jarsToBeDeletedRuntime.values().iterator();
  while (jarsDeleteIterator.hasNext()) {
    fileList.add(new File(((JarFile)jarsDeleteIterator.next()).getFilePath()));
  }
  JdbcToolKit.removeFromDriverList(fileList);
  resetRuntimeJars();
  updateDriverMap(JdbcToolKit.getDriverList());
}

Fixed version (ground truth):
/** 
 * update driverMap at runtime
 */
private void updateDriverMapRuntime(){
  if (jarsToBeCopiedRuntime.equals(jarsToBeDeletedRuntime))   return;
  List fileList=new ArrayList();
  Iterator jarsCopyIterator=jarsToBeCopiedRuntime.values().iterator();
  while (jarsCopyIterator.hasNext()) {
    fileList.add(new File(((JarFile)jarsCopyIterator.next()).getFilePath()));
  }
  List addedDrivers=JdbcToolKit.addToDriverList(fileList);
  if (addedDrivers != null) {
    for (int i=0; i < addedDrivers.size(); i++) {
      externalDrivers.add(((JDBCDriverInformation)addedDrivers.get(i)).toString());
    }
  }
  fileList.clear();
  Iterator jarsDeleteIterator=jarsToBeDeletedRuntime.values().iterator();
  while (jarsDeleteIterator.hasNext()) {
    fileList.add(new File(((JarFile)jarsDeleteIterator.next()).getFilePath()));
  }
  List removedDrivers=JdbcToolKit.removeFromDriverList(fileList);
  if (removedDrivers != null) {
    for (int i=0; i < removedDrivers.size(); i++) {
      externalDrivers.remove(((JDBCDriverInformation)removedDrivers.get(i)).toString());
    }
  }
  resetRuntimeJars();
  updateDriverMap(JdbcToolKit.getDriverList());
}
Program: 68014
Project: 68014
Buggy source:
/** 
 * initialize jarMap,driverMap and Viewer
 */
private void initialize(){
  jarMap=new HashMap();
  driverMap=new HashMap();
  jarsToBeCopied=new Hashtable();
  jarsToBeDeleted=new Hashtable();
  jarsToBeCopiedRuntime=new Hashtable();
  jarsToBeDeletedRuntime=new Hashtable();
  updateJarMap();
  updateDriverMapInit();
  refreshJarViewer();
  refreshDriverViewer();
  updateJarButtons();
  updateDriverButtons();
}

Fixed version (ground truth):
/** 
 * initialize jarMap,driverMap and Viewer
 */
private void initialize(){
  jarMap=new HashMap();
  driverMap=new HashMap();
  jarsToBeCopied=new Hashtable();
  jarsToBeDeleted=new Hashtable();
  jarsToBeCopiedRuntime=new Hashtable();
  jarsToBeDeletedRuntime=new Hashtable();
  updateJarMap();
  updateDriverMapInit();
  updateExternalDriverList();
  refreshJarViewer();
  refreshDriverViewer();
  updateJarButtons();
  updateDriverButtons();
}
Program: 68015
Project: 68015
Buggy source:
/** 
 * add new found driver(s) to runtime driver list
 * @param fileList
 */
public static void addToDriverList(List fileList){
  if (fileList != null && fileList.size() != 0)   getJdbcDriverFromFile(fileList);
}

Fixed version (ground truth):
/** 
 * add new found driver(s) to runtime driver list
 * @param fileList
 */
public static List addToDriverList(List fileList){
  if (fileList != null && fileList.size() != 0)   return getJdbcDriverFromFile(fileList);
  return null;
}
Program: 68016
Project: 68016
Buggy source:
/** 
 * remove driver(s) from runtime driver list
 * @param fileList
 */
public static void removeFromDriverList(List fileList){
  for (int i=0; i < fileList.size(); i++) {
    String fileName=((File)fileList.get(i)).getName();
    List driverNames=(List)file2Drivers.get(fileName);
    for (int j=0; j < jdbcDriverInfos.size(); j++) {
      for (int k=0; k < driverNames.size(); k++)       if (((JDBCDriverInformation)jdbcDriverInfos.get(j)).getDriverClassName().equals(((JDBCDriverInformation)driverNames.get(k)).getDriverClassName())) {
        jdbcDriverInfos.remove(j);
      }
    }
    if (failLoadFileList.contains(fileList.get(i)))     failLoadFileList.remove(fileList.get(i));
  }
}

Fixed version (ground truth):
/** 
 * remove driver(s) from runtime driver list
 * @param fileList
 */
public static List removeFromDriverList(List fileList){
  List removedDrivers=new ArrayList();
  for (int i=0; i < fileList.size(); i++) {
    String fileName=((File)fileList.get(i)).getName();
    List driverNames=(List)file2Drivers.get(fileName);
    for (int j=0; j < jdbcDriverInfos.size(); j++) {
      for (int k=0; k < driverNames.size(); k++)       if (((JDBCDriverInformation)jdbcDriverInfos.get(j)).getDriverClassName().equals(((JDBCDriverInformation)driverNames.get(k)).getDriverClassName())) {
        removedDrivers.add(jdbcDriverInfos.get(j));
        jdbcDriverInfos.remove(j);
      }
    }
    if (failLoadFileList.contains(fileList.get(i)))     failLoadFileList.remove(fileList.get(i));
  }
  return removedDrivers;
}
Program: 68017
Project: 68017
Buggy source:
/** 
 * Found drivers in the Jar file List
 * @param file
 * @return a List of JDBCDriverInformation
 */
public static void getJdbcDriverFromFile(List fileList){
  if (failLoadFileList != null) {
    boolean duplicated;
    for (int i=0; i < failLoadFileList.size(); i++) {
      duplicated=false;
      File failToLoadFile=(File)failLoadFileList.get(i);
      for (int j=0; j < fileList.size(); j++) {
        if (failToLoadFile.getName().equals(((File)fileList.get(j)).getName())) {
          duplicated=true;
          break;
        }
      }
      if (!duplicated)       fileList.add(failToLoadFile);
    }
  }
  List driverInfos=getJDBCDriverInfoList(fileList);
  jdbcDriverInfos.addAll(driverInfos);
  tempAddedInDriverInfos.addAll(driverInfos);
}

Fixed version (ground truth):
/** 
 * Found drivers in the Jar file List
 * @param file
 * @return a List of JDBCDriverInformation
 */
public static List getJdbcDriverFromFile(List fileList){
  if (failLoadFileList != null) {
    boolean duplicated;
    for (int i=0; i < failLoadFileList.size(); i++) {
      duplicated=false;
      File failToLoadFile=(File)failLoadFileList.get(i);
      for (int j=0; j < fileList.size(); j++) {
        if (failToLoadFile.getName().equals(((File)fileList.get(j)).getName())) {
          duplicated=true;
          break;
        }
      }
      if (!duplicated)       fileList.add(failToLoadFile);
    }
  }
  List driverInfos=getJDBCDriverInfoList(fileList);
  jdbcDriverInfos.addAll(driverInfos);
  tempAddedInDriverInfos.addAll(driverInfos);
  return driverInfos;
}
Program: 68018
Project: 68018
Buggy source:
/** 
 * Save the column meta data to data set handle.
 * @param dataSetHandle
 * @param holdEvent
 */
public static void updateColumnCache(DataSetHandle dataSetHandle,boolean holdEvent){
  try {
    if (dataSetHandle.getModuleHandle() instanceof ReportDesignHandle) {
      EngineConfig ec=new EngineConfig();
      ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(ec);
      ReportDesignHandle copy=(ReportDesignHandle)(dataSetHandle.getModuleHandle().copy().getHandle(null));
      DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign(copy),copy);
      DataRequestSession session=engineTask.getDataSession();
      Map appContext=new HashMap();
      appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
      appContext.put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers());
      engineTask.setAppContext(appContext);
      engineTask.run();
      DataService.getInstance().registerSession(dataSetHandle,session);
      session.refreshMetaData(dataSetHandle,holdEvent);
      engineTask.close();
      engine.destroy();
    }
 else     if (dataSetHandle.getModuleHandle() instanceof DataMartHandle) {
      DataSessionContext context=new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,dataSetHandle.getModuleHandle());
      Map appContext=new HashMap();
      appContext.put(DataEngine.MEMORY_DATA_SET_CACHE,Integer.valueOf(dataSetHandle.getRowFetchLimit()));
      appContext.put(ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,createResourceIdentifiers());
      context.setAppContext(appContext);
      DataRequestSession session=DataRequestSession.newSession(context);
      session.refreshMetaData(dataSetHandle,holdEvent);
      session.shutdown();
    }
 else {
      DataSessionContext context=new DataSessionContext(DataEngineContext.DIRECT_PRESENTATION,dataSetHandle.getRoot(),null);
      DataRequestSession drSession=DataRequestSession.newSession(context);
      drSession.refreshMetaData(dataSetHandle,holdEvent);
      drSession.shutdown();
    }
  }
 catch (  BirtException ex) {
    logger.entering(DataSetUIUtil.class.getName(),"String_Node_Str",new Object[]{ex});
  }
}

Fixed version (ground truth):
/** 
 * Save the column meta data to data set handle.
 * @param dataSetHandle
 * @param holdEvent
 */
public static void updateColumnCache(DataSetHandle dataSetHandle,boolean holdEvent){
  DataService.getInstance().updateColumnCache(dataSetHandle,holdEvent);
}
Program: 68020
Project: 68020
Buggy source:
/** 
 * Add this method according to GUI's requirement.This method is only for temporarily usage.
 * @param dataSetHandle
 * @return
 * @throws SemanticException
 * @deprecated
 */
public static CachedMetaDataHandle getCachedMetaDataHandle(DataSetHandle dataSetHandle) throws SemanticException {
  if (dataSetHandle.getCachedMetaDataHandle() == null) {
    updateColumnCache(dataSetHandle,true);
  }
  return dataSetHandle.getCachedMetaDataHandle();
}

Fixed version (ground truth):
/** 
 * Add this method according to GUI's requirement.This method is only for temporarily usage.
 * @param dataSetHandle
 * @return
 * @throws SemanticException
 * @deprecated
 */
public static CachedMetaDataHandle getCachedMetaDataHandle(DataSetHandle dataSetHandle) throws SemanticException {
  if (!hasMetaData(dataSetHandle)) {
    updateColumnCache(dataSetHandle,true);
  }
  return dataSetHandle.getCachedMetaDataHandle();
}
Program: 68028
Project: 68028
Buggy source:
public HyperlinkDef parseHyperLink(IContent content){
  HyperlinkDef hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
    IReportRunnable reportRunnable=service.getReportRunnable();
    IReportContext reportContext=service.getReportContext();
    IHTMLActionHandler actionHandler=(IHTMLActionHandler)service.getOption(RenderOption.ACTION_HANDLER);
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      hyperlink=new HyperlinkDef(bookmark,IHyperlinkAction.ACTION_BOOKMARK,tooltip);
    break;
case IHyperlinkAction.ACTION_HYPERLINK:
  String url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_HYPERLINK,tooltip);
break;
case IHyperlinkAction.ACTION_DRILLTHROUGH:
url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_DRILLTHROUGH,tooltip);
break;
}
}
return hyperlink;
}

Fixed version (ground truth):
public HyperlinkDef parseHyperLink(IContent content){
  HyperlinkDef hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
    IReportRunnable reportRunnable=service.getReportRunnable();
    IReportContext reportContext=service.getReportContext();
    IHTMLActionHandler actionHandler=(IHTMLActionHandler)service.getOption(RenderOption.ACTION_HANDLER);
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      hyperlink=new HyperlinkDef(bookmark,IHyperlinkAction.ACTION_BOOKMARK,tooltip);
    break;
case IHyperlinkAction.ACTION_HYPERLINK:
  String url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_HYPERLINK,tooltip);
break;
case IHyperlinkAction.ACTION_DRILLTHROUGH:
url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_DRILLTHROUGH,tooltip);
break;
}
}
if (hyperlink != null) {
Color color=PropertyUtil.getColor(content.getStyle().getProperty(IStyle.STYLE_COLOR));
hyperlink.setColor(color);
}
return hyperlink;
}
Program: 68029
Project: 68029
Buggy source:
protected void setlinkStyle(StyleEntry entry,HyperlinkDef link){
  if (link != null) {
    entry.setProperty(StyleConstant.COLOR_PROP,StyleConstant.HYPERLINK_COLOR);
    entry.setProperty(StyleConstant.TEXT_UNDERLINE_PROP,true);
    entry.setName(StyleEntry.ENTRYNAME_HYPERLINK);
  }
}

Fixed version (ground truth):
protected void setlinkStyle(StyleEntry entry,HyperlinkDef link){
  if (link != null) {
    Color color=link.getColor();
    if (color != null) {
      entry.setProperty(StyleConstant.COLOR_PROP,color);
    }
 else {
      entry.setProperty(StyleConstant.COLOR_PROP,StyleConstant.HYPERLINK_COLOR);
    }
    entry.setProperty(StyleConstant.TEXT_UNDERLINE_PROP,true);
    entry.setName(StyleEntry.ENTRYNAME_HYPERLINK);
  }
}
Program: 68030
Project: 68030
Buggy source:
protected HyperlinkInfo getHyperlink(IContent content){
  HyperlinkInfo hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      bookmark=bookmark.replaceAll("String_Node_Str","String_Node_Str");
    hyperlink=new HyperlinkInfo(HyperlinkInfo.BOOKMARK,bookmark,tooltip);
  break;
case IHyperlinkAction.ACTION_HYPERLINK:
case IHyperlinkAction.ACTION_DRILLTHROUGH:
String url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkInfo(HyperlinkInfo.HYPERLINK,url,tooltip);
break;
}
}
return hyperlink;
}

Fixed version (ground truth):
protected HyperlinkInfo getHyperlink(IContent content){
  HyperlinkInfo hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      bookmark=bookmark.replaceAll("String_Node_Str","String_Node_Str");
    hyperlink=new HyperlinkInfo(HyperlinkInfo.BOOKMARK,bookmark,tooltip);
  break;
case IHyperlinkAction.ACTION_HYPERLINK:
case IHyperlinkAction.ACTION_DRILLTHROUGH:
String url=EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkInfo(HyperlinkInfo.HYPERLINK,url,tooltip);
break;
}
}
if (hyperlink != null) {
String color=WordUtil.parseColor(content.getStyle().getColor());
hyperlink.setColor(color);
}
return hyperlink;
}
Program: 68031
Project: 68031
Buggy source:
protected void writeRunProperties(IStyle style,String fontFamily,boolean ishyperlink){
  writeHyperlinkStyle(ishyperlink,style);
  writeFont(fontFamily);
  writeFontSize(style);
  writeLetterSpacing(style);
  writeTextLineThrough(style);
  writeFontStyle(style);
  writeFontWeight(style);
}

Fixed version (ground truth):
protected void writeRunProperties(IStyle style,String fontFamily,HyperlinkInfo info){
  writeHyperlinkStyle(info,style);
  writeFont(fontFamily);
  writeFontSize(style);
  writeLetterSpacing(style);
  writeTextLineThrough(style);
  writeFontStyle(style);
  writeFontWeight(style);
}
Program: 68032
Project: 68032
Buggy source:
private void writeHyperlinkStyle(boolean isHyperlink,IStyle style){
  if (isHyperlink) {
    writeAttrTag("String_Node_Str","String_Node_Str");
  }
 else {
    writeTextUnderline(style);
    writeTextColor(style);
  }
}

Fixed version (ground truth):
private void writeHyperlinkStyle(HyperlinkInfo info,IStyle style){
  if (info != null) {
    String color=info.getColor();
    if (color != null) {
      writeAttrTag("String_Node_Str",color);
    }
    writeAttrTag("String_Node_Str","String_Node_Str");
  }
 else {
    writeTextUnderline(style);
    writeTextColor(style);
  }
}
Program: 68033
Project: 68033
Buggy source:
/** 
 * from object class to its type index value
 * @param obValue
 * @return
 */
private static int getTypeIndex(Object obValue){
  if (obValue == null)   return TYPE_NULL;
  if (obValue instanceof String) {
    if (isLongString((String)obValue)) {
      return TYPE_LONG_STRING;
    }
 else {
      return TYPE_STRING;
    }
  }
  Integer indexOb=(Integer)type2IndexMap.get(obValue.getClass());
  if (indexOb == null) {
    if (obValue instanceof Map) {
      return TYPE_MAP;
    }
    if (obValue instanceof List) {
      return TYPE_LIST;
    }
    if (obValue instanceof Scriptable) {
      return TYPE_JSObject;
    }
    if (Timestamp.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME_STAMP;
    }
    if (Time.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME;
    }
    if (java.sql.Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE;
    }
    if (Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE_TIME;
    }
    if (obValue instanceof Serializable) {
      return TYPE_SERIALIZABLE;
    }
    return -1;
  }
  return indexOb.intValue();
}

Fixed version (ground truth):
/** 
 * from object class to its type index value
 * @param obValue
 * @return
 */
public static int getTypeIndex(Object obValue){
  if (obValue == null)   return TYPE_NULL;
  if (obValue instanceof String) {
    if (isLongString((String)obValue)) {
      return TYPE_LONG_STRING;
    }
 else {
      return TYPE_STRING;
    }
  }
  Integer indexOb=(Integer)type2IndexMap.get(obValue.getClass());
  if (indexOb == null) {
    if (obValue instanceof Map) {
      return TYPE_MAP;
    }
    if (obValue instanceof List) {
      return TYPE_LIST;
    }
    if (obValue instanceof Scriptable) {
      if (obValue instanceof IdScriptableObject) {
        IdScriptableObject jsObject=((IdScriptableObject)obValue);
        if (jsObject.getClassName().equals("String_Node_Str")) {
          return TYPE_JSObject;
        }
        return -1;
      }
 else       if (obValue instanceof NativeJavaObject) {
        return TYPE_JSObject;
      }
      return -1;
    }
    if (Timestamp.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME_STAMP;
    }
    if (Time.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_TIME;
    }
    if (java.sql.Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE;
    }
    if (Date.class.isAssignableFrom(obValue.getClass())) {
      return TYPE_DATE_TIME;
    }
    if (obValue instanceof Serializable) {
      return TYPE_SERIALIZABLE;
    }
    return -1;
  }
  return indexOb.intValue();
}
Program: 68035
Project: 68035
Buggy source:
protected void initialize() throws BirtException {
  checkObjectType();
  IImageContent imageContent=(IImageContent)content;
  Image imageObject=null;
  if (isOutputSupported(objectType)) {
    if (objectType == TYPE_IMAGE_OBJECT) {
      imageObject=EmitterUtil.getImage(imageContent);
    }
    if (imageObject != null && objectType == TYPE_IMAGE_OBJECT || objectType == TYPE_FLASH_OBJECT || objectType == TYPE_SVG_OBJECT) {
      layout=new ConcreteImageLayout(context,parent,content,imageObject);
    }
 else {
      layout=createAltTextLayout(RESOURCE_UNREACHABLE);
    }
  }
 else {
    if (objectType == TYPE_SVG_OBJECT) {
      imageObject=EmitterUtil.getImage(imageContent);
      if (imageObject != null) {
        layout=new ConcreteImageLayout(context,parent,content,imageObject);
        return;
      }
    }
    layout=createAltTextLayout(UNSUPPORTED_OBJECTS);
  }
}

Fixed version (ground truth):
protected void initialize() throws BirtException {
  checkObjectType();
  IImageContent imageContent=(IImageContent)content;
  Image imageObject=null;
  if (isOutputSupported(objectType)) {
    if (objectType == TYPE_IMAGE_OBJECT) {
      imageObject=EmitterUtil.getImage(imageContent);
    }
    if (imageObject != null && objectType == TYPE_IMAGE_OBJECT || objectType == TYPE_FLASH_OBJECT || objectType == TYPE_SVG_OBJECT) {
      layout=new ConcreteImageLayout(context,parent,content,imageObject);
    }
 else {
      layout=createAltTextLayout(RESOURCE_UNREACHABLE);
    }
  }
 else {
    if (objectType == TYPE_SVG_OBJECT) {
      imageObject=EmitterUtil.getImage(imageContent);
      if (imageObject != null) {
        layout=new ConcreteImageLayout(context,parent,content,imageObject);
        return;
      }
 else {
        layout=createAltTextLayout(RESOURCE_UNREACHABLE);
        return;
      }
    }
    layout=createAltTextLayout(UNSUPPORTED_OBJECTS);
  }
}
Program: 68038
Project: 68038
Buggy source:
/** 
 * Returns the application properties
 * @param context
 * @param props
 * @return
 */
public synchronized static Map initViewerProps(ServletContext context,Map props){
  if (props == null)   props=new HashMap();
  String file=context.getInitParameter(INIT_PARAM_CONFIG_FILE);
  if (file == null || file.trim().length() <= 0)   file=IBirtConstants.DEFAULT_VIEWER_CONFIG_FILE;
  try {
    InputStream is=null;
    if (isRelativePath(file)) {
      if (!file.startsWith("String_Node_Str"))       file="String_Node_Str" + file;
      is=context.getResourceAsStream(file);
    }
 else {
      is=new FileInputStream(file);
    }
    PropertyResourceBundle bundle=new PropertyResourceBundle(is);
    if (bundle != null) {
      Enumeration keys=bundle.getKeys();
      while (keys != null && keys.hasMoreElements()) {
        String key=(String)keys.nextElement();
        String value=(String)bundle.getObject(key);
        if (key != null && value != null)         props.put(key,value);
      }
    }
  }
 catch (  Exception e) {
  }
  return props;
}

Fixed version (ground truth):
/** 
 * Returns the application properties
 * @param context
 * @param props
 * @return
 */
public synchronized static Map initViewerProps(ServletContext context,Map props){
  if (props == null)   props=new HashMap();
  String file=context.getInitParameter(INIT_PARAM_CONFIG_FILE);
  if (file == null || file.trim().length() <= 0)   file=IBirtConstants.DEFAULT_VIEWER_CONFIG_FILE;
  try {
    InputStream is=null;
    if (isRelativePath(file)) {
      if (!file.startsWith("String_Node_Str"))       file="String_Node_Str" + file;
      is=context.getResourceAsStream(file);
    }
 else {
      is=new FileInputStream(file);
    }
    PropertyResourceBundle bundle=new PropertyResourceBundle(is);
    if (bundle != null) {
      Enumeration<String> keys=bundle.getKeys();
      while (keys != null && keys.hasMoreElements()) {
        String key=keys.nextElement();
        String value=(String)bundle.getObject(key);
        if (key != null && value != null)         props.put(key,value);
      }
    }
  }
 catch (  Exception e) {
  }
  return props;
}
Program: 68039
Project: 68039
Buggy source:
/** 
 * This function is used to encode an ordinary string that may contain characters or more than one consecutive spaces for appropriate HTML display.
 * @param s
 * @return String
 */
public static final String htmlEncode(String s){
  String sHtmlEncoded="String_Node_Str";
  if (s == null) {
    return null;
  }
  StringBuffer sbHtmlEncoded=new StringBuffer();
  final char chrarry[]=s.toCharArray();
  for (int i=0; i < chrarry.length; i++) {
    char c=chrarry[i];
switch (c) {
case '\t':
      sbHtmlEncoded.append("String_Node_Str");
    break;
case '\n':
  sbHtmlEncoded.append("String_Node_Str");
break;
case '\r':
sbHtmlEncoded.append("String_Node_Str");
break;
case ' ':
sbHtmlEncoded.append("String_Node_Str");
break;
case '"':
sbHtmlEncoded.append("String_Node_Str");
break;
case '\'':
sbHtmlEncoded.append("String_Node_Str");
break;
case '<':
sbHtmlEncoded.append("String_Node_Str");
break;
case '>':
sbHtmlEncoded.append("String_Node_Str");
break;
case '`':
sbHtmlEncoded.append("String_Node_Str");
break;
case '&':
sbHtmlEncoded.append("String_Node_Str");
break;
case '\\':
sbHtmlEncoded.append("String_Node_Str");
break;
case '/':
sbHtmlEncoded.append("String_Node_Str");
break;
default :
sbHtmlEncoded.append(c);
}
}
sHtmlEncoded=sbHtmlEncoded.toString();
return sHtmlEncoded;
}

Fixed version (ground truth):
/** 
 * This function is used to encode an ordinary string that may contain characters or more than one consecutive spaces for appropriate HTML display.
 * @param s
 * @return String
 */
public static final String htmlEncode(String s){
  String sHtmlEncoded="String_Node_Str";
  if (s == null) {
    return null;
  }
  StringBuffer sbHtmlEncoded=new StringBuffer();
  final char chrarry[]=s.toCharArray();
  final int length=chrarry.length;
  for (int i=0; i < length; i++) {
    char c=chrarry[i];
switch (c) {
case '\t':
      sbHtmlEncoded.append("String_Node_Str");
    break;
case '\n':
  sbHtmlEncoded.append("String_Node_Str");
break;
case '\r':
sbHtmlEncoded.append("String_Node_Str");
break;
case ' ':
sbHtmlEncoded.append("String_Node_Str");
break;
case '"':
sbHtmlEncoded.append("String_Node_Str");
break;
case '\'':
sbHtmlEncoded.append("String_Node_Str");
break;
case '<':
sbHtmlEncoded.append("String_Node_Str");
break;
case '>':
sbHtmlEncoded.append("String_Node_Str");
break;
case '`':
sbHtmlEncoded.append("String_Node_Str");
break;
case '&':
sbHtmlEncoded.append("String_Node_Str");
break;
case '\\':
sbHtmlEncoded.append("String_Node_Str");
break;
case '/':
sbHtmlEncoded.append("String_Node_Str");
break;
default :
if ((c > 0xd7ff && c < 0xdc00) && (i + 1) < length) {
i++;
char nc=chrarry[i];
if (nc > 0xdbff && nc < 0xe000) {
int rc=((c - 0xd7c0) << 10) | (nc & 0x3ff);
sbHtmlEncoded.append("String_Node_Str").append(rc).append(';');
}
 else {
sbHtmlEncoded.append(c);
sbHtmlEncoded.append(nc);
}
}
 else {
sbHtmlEncoded.append(c);
}
}
}
sHtmlEncoded=sbHtmlEncoded.toString();
return sHtmlEncoded;
}
Program: 68040
Project: 68040
Buggy source:
/** 
 * Get selected column name list.
 * @param request
 * @return
 */
public static Collection getSelectedColumns(HttpServletRequest request){
  ArrayList columns=new ArrayList();
  int columnCount=getParameterAsInt(request,PARAM_SELECTEDCOLUMNNUMBER);
  for (int i=0; i < columnCount; i++) {
    String paramName=PARAM_SELECTEDCOLUMN + String.valueOf(i);
    String columnName=getParameter(request,paramName);
    if (columnName != null && !"String_Node_Str".equals(columnName)) {
      columns.add(columnName);
    }
  }
  return columns;
}

Fixed version (ground truth):
/** 
 * Get selected column name list.
 * @param request
 * @return
 */
public static Collection getSelectedColumns(HttpServletRequest request){
  ArrayList<String> columns=new ArrayList<String>();
  int columnCount=getParameterAsInt(request,PARAM_SELECTEDCOLUMNNUMBER);
  for (int i=0; i < columnCount; i++) {
    String paramName=PARAM_SELECTEDCOLUMN + String.valueOf(i);
    String columnName=getParameter(request,paramName);
    if (columnName != null && !"String_Node_Str".equals(columnName)) {
      columns.add(columnName);
    }
  }
  return columns;
}
Program: 68041
Project: 68041
Buggy source:
/** 
 * Get named parameters from http request. parameter names and values are all in iso-8859-1 format in request.
 * @param request incoming http request
 * @param parameterName parameter name
 * @return
 */
public static Set getParameterValues(HttpServletRequest request,String parameterName){
  Set parameterValues=null;
  String[] parameterValuesArray=request.getParameterValues(parameterName);
  if (parameterValuesArray != null) {
    parameterValues=new LinkedHashSet();
    for (int i=0; i < parameterValuesArray.length; i++) {
      parameterValues.add(parameterValuesArray[i]);
    }
  }
  return parameterValues;
}

Fixed version (ground truth):
/** 
 * Get named parameters from http request. parameter names and values are all in iso-8859-1 format in request.
 * @param request incoming http request
 * @param parameterName parameter name
 * @return
 */
public static Set getParameterValues(HttpServletRequest request,String parameterName){
  Set<String> parameterValues=null;
  String[] parameterValuesArray=request.getParameterValues(parameterName);
  if (parameterValuesArray != null) {
    parameterValues=new LinkedHashSet<String>();
    for (int i=0; i < parameterValuesArray.length; i++) {
      parameterValues.add(parameterValuesArray[i]);
    }
  }
  return parameterValues;
}
Program: 68042
Project: 68042
Buggy source:
/** 
 * Returns the application classloader
 * @return
 */
public static ClassLoader getAppClassLoader(){
  return reloadableClassLoader;
}

Fixed version (ground truth):
/** 
 * Returns the application classloader reloaded with given parent
 */
public static ClassLoader getAppClassLoader(ClassLoader parent){
  if (reloadableClassLoader != null) {
    reloadableClassLoader.setParent(parent);
    reloadableClassLoader.reload();
  }
  return reloadableClassLoader;
}
Program: 68043
Project: 68043
Buggy source:
private String getAutoText(IAutoTextContent autoText){
  String result=null;
  int type=autoText.getType();
  if (type == IAutoTextContent.PAGE_NUMBER) {
    result="String_Node_Str";
  }
 else   if (type == IAutoTextContent.TOTAL_PAGE) {
    result="String_Node_Str";
  }
  return result;
}

Fixed version (ground truth):
private String getAutoText(IAutoTextContent autoText){
  String result=null;
  int type=autoText.getType();
  if (type == IAutoTextContent.PAGE_NUMBER) {
    result="String_Node_Str";
  }
 else   if (type == IAutoTextContent.TOTAL_PAGE) {
    result="String_Node_Str";
  }
 else {
    result=autoText.getText();
  }
  return result;
}
Program: 68044
Project: 68044
Buggy source:
/** 
 * @param imageName
 * @param imageTitle
 * @param width
 * @param height
 * @param x
 * @param y
 */
private void exportImageDefn(String imageName,String imageTitle,double width,double height,double x,double y,HyperlinkDef link){
  println("String_Node_Str" + (shapeCount) + "String_Node_Str");
  if (link != null) {
    String hyperlink=link.getLink();
    String tooltip=link.getTooltip();
    if (tooltip != null) {
      tooltip=codeLink(tooltip);
      print("String_Node_Str" + tooltip + "String_Node_Str");
    }
    if (hyperlink != null) {
      hyperlink=codeLink(hyperlink);
      print("String_Node_Str" + link + "String_Node_Str");
    }
  }
  println("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str" + imageName + "String_Node_Str"+ imageTitle+ "String_Node_Str");
  println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param imageName
 * @param imageTitle
 * @param width
 * @param height
 * @param x
 * @param y
 */
private void exportImageDefn(String imageName,String imageTitle,double width,double height,double x,double y,HyperlinkDef link){
  println("String_Node_Str" + (shapeCount) + "String_Node_Str");
  if (link != null) {
    String hyperlink=link.getLink();
    String tooltip=link.getTooltip();
    if (tooltip != null) {
      tooltip=codeLink(tooltip);
      print("String_Node_Str" + tooltip + "String_Node_Str");
    }
    if (hyperlink != null) {
      hyperlink=codeLink(hyperlink);
      print("String_Node_Str" + hyperlink + "String_Node_Str");
    }
  }
  println("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str" + imageName + "String_Node_Str"+ imageTitle+ "String_Node_Str");
  println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  println("String_Node_Str");
}
Program: 68048
Project: 68048
Buggy source:
public RadarChart(){
}

Fixed version (ground truth):
public RadarChart(){
  chartTitle=Messages.getString("String_Node_Str");
}
Program: 68049
Project: 68049
Buggy source:
public ICubeOperation[] getCubeOperations(){
  return cqd.getCubeOperations();
}

Fixed version (ground truth):
public ICubeOperation[] getCubeOperations(){
  return realCubeOperations;
}
Program: 68050
Project: 68050
Buggy source:
protected void addPages(){
  List formPageList=EditorContributorManager.getInstance().getEditorContributor(getEditorSite().getId()).formPageList;
  boolean error=false;
  String fileName=getProvider().getInputPath(getEditorInput()).toOSString();
  List message=ModuleUtil.checkVersion(fileName);
  if (message.size() > 0) {
    IVersionInfo info=(IVersionInfo)message.get(0);
    if (!MessageDialog.openConfirm(UIUtil.getDefaultShell(),Messages.getString("String_Node_Str"),info.getLocalizedMessage())) {
      for (Iterator iter=formPageList.iterator(); iter.hasNext(); ) {
        FormPageDef pagedef=(FormPageDef)iter.next();
        if (XMLSourcePage_ID.equals(pagedef.id)) {
          try {
            addPage(pagedef.createPage(),pagedef.displayName);
            break;
          }
 catch (          Exception e) {
          }
        }
      }
      return;
    }
  }
  getProvider().getReportModuleHandle(getEditorInput());
  for (Iterator iter=formPageList.iterator(); iter.hasNext(); ) {
    FormPageDef pagedef=(FormPageDef)iter.next();
    try {
      addPage(pagedef.createPage(),pagedef.displayName);
    }
 catch (    Exception e) {
      error=true;
    }
  }
  if (error) {
    setActivePage(XMLSourcePage_ID);
  }
}

Fixed version (ground truth):
protected void addPages(){
  List formPageList=EditorContributorManager.getInstance().getEditorContributor(getEditorSite().getId()).formPageList;
  boolean error=false;
  String fileName=getProvider().getInputPath(getEditorInput()).toOSString();
  List message=ModuleUtil.checkVersion(fileName);
  if (message.size() > 0) {
    IVersionInfo info=(IVersionInfo)message.get(0);
    if (!MessageDialog.openConfirm(UIUtil.getDefaultShell(),Messages.getString("String_Node_Str"),info.getLocalizedMessage())) {
      for (Iterator iter=formPageList.iterator(); iter.hasNext(); ) {
        FormPageDef pagedef=(FormPageDef)iter.next();
        if (XMLSourcePage_ID.equals(pagedef.id)) {
          try {
            addPage(pagedef.createPage(),pagedef.displayName);
            break;
          }
 catch (          Exception e) {
          }
        }
      }
      return;
    }
  }
  UIUtil.processSessionResourceFolder(getEditorInput(),UIUtil.getProjectFromInput(getEditorInput()),null);
  getProvider().getReportModuleHandle(getEditorInput());
  for (Iterator iter=formPageList.iterator(); iter.hasNext(); ) {
    FormPageDef pagedef=(FormPageDef)iter.next();
    try {
      addPage(pagedef.createPage(),pagedef.displayName);
    }
 catch (    Exception e) {
      error=true;
    }
  }
  if (error) {
    setActivePage(XMLSourcePage_ID);
  }
}
Program: 68052
Project: 68052
Buggy source:
/** 
 * Populate all dimensions.
 * @param cubeMaterializer
 * @param dimHandles
 * @param stopSign
 * @return
 * @throws AdapterException 
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private IDimension[] populateDimensions(CubeMaterializer cubeMaterializer,TabularCubeHandle cubeHandle,Map appContext,Map<ReportElementHandle,QueryDefinition> queryMap,Map<ReportElementHandle,List<ColumnMeta>> metaMap,SecurityListener sl) throws AdapterException {
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  List result=new ArrayList();
  for (int i=0; i < dimHandles.size(); i++) {
    DimensionHandle dh=(DimensionHandle)dimHandles.get(i);
    IDimension dim=createdDimensions.get(dh.getName());
    if (dim == null) {
      dim=populateDimension(cubeMaterializer,dh,cubeHandle,appContext,queryMap,metaMap,sl);
      TabularDimensionHandle dimHandle=(TabularDimensionHandle)cubeHandle.getDimension(dim.getName());
      TabularHierarchyHandle hier=(TabularHierarchyHandle)dimHandle.getDefaultHierarchy();
      if (cubeHandle.getDataSet().equals(hier.getDataSet()) || hier.getDataSet() == null) {
        String[] keyNames=dim.getHierarchy().getLevels()[dim.getHierarchy().getLevels().length - 1].getKeyNames();
        for (int j=0; j < keyNames.length; j++) {
          keyNames[j]=dim.getName() + "String_Node_Str" + keyNames[j];
        }
      }
      createdDimensions.put(dh.getName(),dim);
    }
    result.add(dim);
  }
  IDimension[] dimArray=new IDimension[dimHandles.size()];
  for (int i=0; i < result.size(); i++) {
    dimArray[i]=(IDimension)result.get(i);
  }
  return dimArray;
}

Fixed version (ground truth):
/** 
 * Populate all dimensions.
 * @param cubeMaterializer
 * @param dimHandles
 * @param stopSign
 * @return
 * @throws AdapterException 
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private IDimension[] populateDimensions(CubeMaterializer cubeMaterializer,TabularCubeHandle cubeHandle,Map appContext,Map<ReportElementHandle,QueryDefinition> queryMap,Map<ReportElementHandle,List<ColumnMeta>> metaMap,SecurityListener sl) throws AdapterException {
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  List result=new ArrayList();
  for (int i=0; i < dimHandles.size(); i++) {
    DimensionHandle dh=(DimensionHandle)dimHandles.get(i);
    IDimension dim=createdDimensions.get(dh.getName());
    if (dim == null) {
      dim=populateDimension(cubeMaterializer,dh,cubeHandle,appContext,queryMap,metaMap,sl);
      createdDimensions.put(dh.getName(),dim);
    }
    result.add(dim);
  }
  IDimension[] dimArray=new IDimension[dimHandles.size()];
  for (int i=0; i < result.size(); i++) {
    dimArray[i]=(IDimension)result.get(i);
  }
  return dimArray;
}
Program: 68057
Project: 68057
Buggy source:
public void cancel(){
  this.session.getStopSign().stop();
}

Fixed version (ground truth):
public void cancel(){
  this.session.cancel();
}
Program: 68058
Project: 68058
Buggy source:
public void cancel(){
  this.stopSign.stop();
}

Fixed version (ground truth):
public void cancel(){
  this.stopSign.stop();
  this.stopSign=new StopSign();
}
Program: 68063
Project: 68063
Buggy source:
private final void fillPathImage(Path path,org.eclipse.birt.chart.model.attribute.Image g) throws ChartException {
  org.eclipse.swt.graphics.Image img=null;
  if (g instanceof EmbeddedImage) {
    try {
      String imageData=((EmbeddedImage)g).getData();
      if (imageData != null) {
        ByteArrayInputStream bis=new ByteArrayInputStream(Base64.decodeBase64(((EmbeddedImage)g).getData().getBytes()));
        img=new org.eclipse.swt.graphics.Image(((SwtDisplayServer)_ids).getDevice(),bis);
      }
 else {
        img=new org.eclipse.swt.graphics.Image(((SwtDisplayServer)_ids).getDevice(),10,10);
      }
    }
 catch (    Exception ilex) {
      throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,ilex);
    }
  }
 else {
    final String sUrl=g.getURL();
    try {
      img=(org.eclipse.swt.graphics.Image)_ids.loadImage(SecurityUtil.newURL(sUrl));
    }
 catch (    MalformedURLException muex) {
      throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,muex);
    }
  }
  Pattern pattern=new Pattern(_gc.getDevice(),img);
  _gc.setBackgroundPattern(pattern);
  _gc.fillPath(path);
  pattern.dispose();
  img.dispose();
}

Fixed version (ground truth):
private final void fillPathImage(Path path,org.eclipse.birt.chart.model.attribute.Image g) throws ChartException {
  org.eclipse.swt.graphics.Image img=null;
  if (g instanceof EmbeddedImage) {
    try {
      String imageData=((EmbeddedImage)g).getData();
      if (imageData != null) {
        ByteArrayInputStream bis=new ByteArrayInputStream(Base64.decodeBase64(((EmbeddedImage)g).getData().getBytes()));
        img=new org.eclipse.swt.graphics.Image(((SwtDisplayServer)_ids).getDevice(),bis);
      }
 else {
        img=new org.eclipse.swt.graphics.Image(((SwtDisplayServer)_ids).getDevice(),10,10);
      }
    }
 catch (    Exception ilex) {
      throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,ilex);
    }
  }
 else   if (g instanceof PatternImage) {
    PatternImage patternImage=(PatternImage)g;
    img=createImageFromPattern(patternImage);
  }
 else {
    final String sUrl=g.getURL();
    try {
      img=(org.eclipse.swt.graphics.Image)_ids.loadImage(SecurityUtil.newURL(sUrl));
    }
 catch (    MalformedURLException muex) {
      throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,muex);
    }
  }
  Pattern pattern=new Pattern(_gc.getDevice(),img);
  _gc.setBackgroundPattern(pattern);
  _gc.fillPath(path);
  pattern.dispose();
  img.dispose();
}
Program: 68064
Project: 68064
Buggy source:
protected void loadVariableLazily(){
  if (globalVariables != null) {
    ClassLoader loader=getClassLoader();
    ReportDocumentCoreInfo documentInfo=loadParametersAndVariables(loader);
    this.globalVariables=documentInfo.globalVariables;
    this.parameters=documentInfo.parameters;
  }
}

Fixed version (ground truth):
protected void loadVariableLazily(){
  if (globalVariables == null) {
    ClassLoader loader=getClassLoader();
    ReportDocumentCoreInfo documentInfo=loadParametersAndVariables(loader);
    this.globalVariables=documentInfo.globalVariables;
    this.parameters=documentInfo.parameters;
  }
}
Program: 68065
Project: 68065
Buggy source:
public Object get(int index){
  RangeCheck(index);
  if (index / cacheSize != this.currentCacheNo) {
    try {
      saveToDisk();
    }
 catch (    DataException e) {
      e.printStackTrace();
    }
    this.currentCacheNo=index / cacheSize;
    try {
      loadFromDisk();
    }
 catch (    DataException e) {
      e.printStackTrace();
    }
  }
  return this.currentCache.get(index - this.currentCacheNo * cacheSize);
}

Fixed version (ground truth):
public Object get(int index){
  RangeCheck(index);
  if (index / cacheSize != this.currentCacheNo) {
    try {
      saveToDisk();
    }
 catch (    DataException e) {
    }
    this.currentCacheNo=index / cacheSize;
    try {
      loadFromDisk();
    }
 catch (    DataException e) {
    }
  }
  return this.currentCache.get(index - this.currentCacheNo * cacheSize);
}
Program: 68066
Project: 68066
Buggy source:
/** 
 * @param imageName
 * @param imageTitle
 * @param width
 * @param height
 * @param x
 * @param y
 */
private void exportImageDefn(String imageName,String imageTitle,double width,double height,double x,double y,HyperlinkDef link){
  println("String_Node_Str" + (shapeCount) + "String_Node_Str");
  if (link != null) {
    String hyperlink=link.getLink();
    String tooltip=link.getTooltip();
    if (tooltip != null) {
      tooltip=codeLink(tooltip);
      print("String_Node_Str" + tooltip + "String_Node_Str");
    }
    if (hyperlink != null) {
      hyperlink=codeLink(hyperlink);
      print("String_Node_Str" + link + "String_Node_Str");
    }
  }
  println("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str" + imageName + "String_Node_Str"+ imageTitle+ "String_Node_Str");
  println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param imageName
 * @param imageTitle
 * @param width
 * @param height
 * @param x
 * @param y
 */
private void exportImageDefn(String imageName,String imageTitle,double width,double height,double x,double y,HyperlinkDef link){
  println("String_Node_Str" + (shapeCount) + "String_Node_Str");
  if (link != null) {
    String hyperlink=link.getLink();
    String tooltip=link.getTooltip();
    if (tooltip != null) {
      tooltip=codeLink(tooltip);
      print("String_Node_Str" + tooltip + "String_Node_Str");
    }
    if (hyperlink != null) {
      hyperlink=codeLink(hyperlink);
      print("String_Node_Str" + hyperlink + "String_Node_Str");
    }
  }
  println("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ width+ "String_Node_Str"+ height+ "String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str" + imageName + "String_Node_Str"+ imageTitle+ "String_Node_Str");
  println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  println("String_Node_Str");
}