nus-yam/ex-repair huggingface dataset:
Program: 64820
Project: 64820
Buggy source:
@Inject public IRCBot(BotBackend backend,RecommendationsManager manager,BotInfo botInfo,UserDataManager userDataManager,Pinger pinger,@Named("String_Node_Str") boolean silent,ThreadLocalAutoCommittingEntityManager em,EntityManagerFactory emf,IrcNameResolver resolver,OsutrackDownloader osutrackDownloader,@Named("String_Node_Str") ExecutorService exec,RateLimiter rateLimiter){
  this.backend=backend;
  this.botInfo=botInfo;
  this.userDataManager=userDataManager;
  this.pinger=pinger;
  this.silent=silent;
  this.em=em;
  this.emf=emf;
  this.resolver=resolver;
  this.osutrackDownloader=osutrackDownloader;
  this.exec=exec;
  this.rateLimiter=rateLimiter;
  commandHandlers.add(new ResetHandler(manager));
  commandHandlers.add(new OptionsHandler(manager));
  commandHandlers.add(new AccHandler(backend));
  commandHandlers.add(new WithHandler(backend));
  commandHandlers.add(new RecommendHandler(manager));
  commandHandlers.add(new RecentHandler(backend));
  commandHandlers.add(new DebugHandler(backend,resolver));
  commandHandlers.add(new HelpHandler());
  commandHandlers.add(new ComplaintHandler(manager));
  commandHandlers.add(new OsuTrackHandler(osutrackDownloader));
}

Fixed version (ground truth):
@Inject public IRCBot(BotBackend backend,RecommendationsManager manager,BotInfo botInfo,UserDataManager userDataManager,Pinger pinger,@Named("String_Node_Str") boolean silent,ThreadLocalAutoCommittingEntityManager em,EntityManagerFactory emf,IrcNameResolver resolver,OsutrackDownloader osutrackDownloader,@Named("String_Node_Str") ExecutorService exec,RateLimiter rateLimiter){
  this.backend=backend;
  this.botInfo=botInfo;
  this.userDataManager=userDataManager;
  this.pinger=pinger;
  this.silent=silent;
  this.em=em;
  this.emf=emf;
  this.resolver=resolver;
  this.osutrackDownloader=osutrackDownloader;
  this.exec=exec;
  this.rateLimiter=rateLimiter;
  commandHandlers.add(new ResetHandler(manager));
  commandHandlers.add(new OptionsHandler(new RecommendationRequestParser(backend)));
  commandHandlers.add(new AccHandler(backend));
  commandHandlers.add(new WithHandler(backend));
  commandHandlers.add(new RecommendHandler(manager));
  commandHandlers.add(new RecentHandler(backend));
  commandHandlers.add(new DebugHandler(backend,resolver));
  commandHandlers.add(new HelpHandler());
  commandHandlers.add(new ComplaintHandler(manager));
  commandHandlers.add(new OsuTrackHandler(osutrackDownloader));
}
Program: 64821
Project: 64821
Buggy source:
@Override public boolean message(String msg,boolean success){
  try {
    senderSemaphore.acquire();
  }
 catch (  InterruptedException e) {
    return false;
  }
  try {
    pinger.ping((CloseableBot)user.getBot());
    user.send().message(msg);
    MDC.put(MDC_STATE,"String_Node_Str");
    if (success) {
      MDC.put(MDC_DURATION,System.currentTimeMillis() - event.getTimestamp() + "String_Node_Str");
      MDC.put(MDC_SUCCESS,"String_Node_Str");
      MDC.put(MCD_OSU_API_RATE_BLOCKED_TIME,String.valueOf(rateLimiter.blockedTime()));
      if (Objects.equals(MDC.get(MDC_HANDLER),RecommendHandler.MDC_FLAG)) {
        botInfo.setLastRecommendation(System.currentTimeMillis());
      }
    }
    log.debug("String_Node_Str" + msg);
    botInfo.setLastSentMessage(System.currentTimeMillis());
    return true;
  }
 catch (  IOException|InterruptedException e) {
    log.error("String_Node_Str" + e.getMessage());
    return false;
  }
 finally {
    MDC.remove(MDC_DURATION);
    MDC.remove(MDC_SUCCESS);
    MDC.remove(MCD_OSU_API_RATE_BLOCKED_TIME);
    senderSemaphore.release();
  }
}

Fixed version (ground truth):
@Override public boolean message(String msg,boolean success){
  try {
    senderSemaphore.acquire();
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    return false;
  }
  try {
    pinger.ping((CloseableBot)user.getBot());
    user.send().message(msg);
    MDC.put(MDC_STATE,"String_Node_Str");
    if (success) {
      MDC.put(MDC_DURATION,System.currentTimeMillis() - event.getTimestamp() + "String_Node_Str");
      MDC.put(MDC_SUCCESS,"String_Node_Str");
      MDC.put(MCD_OSU_API_RATE_BLOCKED_TIME,String.valueOf(rateLimiter.blockedTime()));
      if (Objects.equals(MDC.get(MDC_HANDLER),RecommendHandler.MDC_FLAG)) {
        botInfo.setLastRecommendation(System.currentTimeMillis());
      }
    }
    log.debug("String_Node_Str" + msg);
    botInfo.setLastSentMessage(System.currentTimeMillis());
    return true;
  }
 catch (  IOException|InterruptedException e) {
    log.error("String_Node_Str" + e.getMessage());
    return false;
  }
 finally {
    MDC.remove(MDC_DURATION);
    MDC.remove(MDC_SUCCESS);
    MDC.remove(MCD_OSU_API_RATE_BLOCKED_TIME);
    senderSemaphore.release();
  }
}
Program: 64822
Project: 64822
Buggy source:
@Override public void onJoin(JoinEvent event) throws Exception {
  if (silent) {
    return;
  }
  IRCBotUser user=fromIRC(event.getUser(),event);
  welcomeIfDonator(user);
}

Fixed version (ground truth):
@Override public void onJoin(JoinEvent event) throws Exception {
  if (silent) {
    return;
  }
  IRCBotUser user=fromIRC(event.getUser(),event);
  try {
    welcomeIfDonator(user);
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
  }
catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}
Program: 64823
Project: 64823
Buggy source:
void welcomeIfDonator(IRCBotUser user){
  try {
    Integer userid;
    try {
      userid=resolver.resolveIRCName(user.getNick());
    }
 catch (    IOException e) {
      if (isTimeout(e)) {
        log.debug("String_Node_Str",user.getNick());
        return;
      }
      throw e;
    }
    if (userid == null)     return;
    OsuApiUser apiUser;
    try {
      apiUser=backend.getUser(userid,0);
    }
 catch (    IOException e) {
      if (isTimeout(e)) {
        log.debug("String_Node_Str",userid);
        return;
      }
      throw e;
    }
    if (apiUser == null)     return;
    if (backend.getDonator(apiUser) > 0) {
      UserData data=userDataManager.getData(userid);
      if (!data.isShowWelcomeMessage())       return;
      long inactiveTime=System.currentTimeMillis() - backend.getLastActivity(apiUser);
      Response welcome=data.getLanguage().welcomeUser(apiUser,inactiveTime);
      sendResponse(welcome,user);
      if (data.isOsuTrackWelcomeEnabled()) {
        UpdateResult update=osutrackDownloader.getUpdate(user.getNick());
        Response updateResponse=OsuTrackHandler.updateResultToResponse(update);
        sendResponse(updateResponse,user);
      }
      checkVersionInfo(user);
    }
  }
 catch (  InterruptedException e) {
  }
catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
void welcomeIfDonator(IRCBotUser user) throws SQLException, InterruptedException, IOException, UserException {
  Integer userid;
  try {
    userid=resolver.resolveIRCName(user.getNick());
  }
 catch (  IOException e) {
    if (isTimeout(e)) {
      log.debug("String_Node_Str",user.getNick());
      return;
    }
    throw e;
  }
  if (userid == null)   return;
  OsuApiUser apiUser;
  try {
    apiUser=backend.getUser(userid,0);
  }
 catch (  IOException e) {
    if (isTimeout(e)) {
      log.debug("String_Node_Str",userid);
      return;
    }
    throw e;
  }
  if (apiUser == null)   return;
  if (backend.getDonator(apiUser) > 0) {
    UserData data=userDataManager.getData(userid);
    if (!data.isShowWelcomeMessage())     return;
    long inactiveTime=System.currentTimeMillis() - backend.getLastActivity(apiUser);
    Response welcome=data.getLanguage().welcomeUser(apiUser,inactiveTime);
    sendResponse(welcome,user);
    if (data.isOsuTrackWelcomeEnabled()) {
      UpdateResult update=osutrackDownloader.getUpdate(user.getNick());
      Response updateResponse=OsuTrackHandler.updateResultToResponse(update);
      sendResponse(updateResponse,user);
    }
    checkVersionInfo(user);
  }
}
Program: 64824
Project: 64824
Buggy source:
@Override public JsonElement get(String command,String... parameters) throws IOException {
  try {
    limiter.limitRate();
  }
 catch (  InterruptedException e) {
    throw new ServiceUnavailableException();
  }
  return super.get(command,parameters);
}

Fixed version (ground truth):
@Override public JsonElement get(String command,String... parameters) throws IOException {
  try {
    limiter.limitRate();
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new ServiceUnavailableException();
  }
  return super.get(command,parameters);
}
Program: 64825
Project: 64825
Buggy source:
@Override public void onEvent(Event event) throws Exception {
  MDC.put("String_Node_Str","String_Node_Str" + lastSerial.incrementAndGet());
  em.setThreadLocalEntityManager(emf.createEntityManager());
  try {
    botInfo.setLastInteraction(System.currentTimeMillis());
    if (lastListTime < System.currentTimeMillis() - 60 * 60 * 1000) {
      lastListTime=System.currentTimeMillis();
      event.getBot().sendRaw().rawLine("String_Node_Str");
    }
    if (event instanceof GenericUserEvent<?>) {
      String nick=((GenericUserEvent)event).getUser().getNick();
      MDC.put("String_Node_Str",nick);
      scheduleRegisterActivity(nick);
    }
    super.onEvent(event);
  }
  finally {
    em.close();
    MDC.clear();
  }
}

Fixed version (ground truth):
@Override public void onEvent(Event event) throws Exception {
  MDC.put("String_Node_Str","String_Node_Str" + lastSerial.incrementAndGet());
  em.setThreadLocalEntityManager(emf.createEntityManager());
  try {
    botInfo.setLastInteraction(System.currentTimeMillis());
    if (lastListTime < System.currentTimeMillis() - 60 * 60 * 1000) {
      lastListTime=System.currentTimeMillis();
      event.getBot().sendRaw().rawLine("String_Node_Str");
    }
    if (event instanceof GenericUserEvent<?>) {
      User user=((GenericUserEvent)event).getUser();
      if (user != null) {
        String nick=user.getNick();
        MDC.put("String_Node_Str",nick);
        scheduleRegisterActivity(nick);
      }
    }
    super.onEvent(event);
  }
  finally {
    em.close();
    MDC.clear();
  }
}
Program: 64826
Project: 64826
Buggy source:
/** 
 * The user's IRC nick name could not be resolved to an osu user id. The message should suggest to contact @Tillerinobot or /u/Tillerino.
 * @param exceptionMarker a marker to reference the created log entry. six or eight characters.
 * @param name the irc nick which could not be resolved
 * @return
 */
public String unresolvableName(String exceptionMarker,String name){
  return "String_Node_Str" + exceptionMarker + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * The user's IRC nick name could not be resolved to an osu user id. The message should suggest to contact @Tillerinobot or /u/Tillerino.
 * @param exceptionMarker a marker to reference the created log entry. six or eight characters.
 * @param name the irc nick which could not be resolved
 * @return
 */
public String unresolvableName(String exceptionMarker,String name){
  return "String_Node_Str" + "String_Node_Str" + exceptionMarker + "String_Node_Str";
}
Program: 64828
Project: 64828
Buggy source:
public void pageActivated(){
  getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
  if (modelChanged) {
    modelChanged=false;
    dataSetHandle=((DataSetEditor)getContainer()).getHandle();
    int maxRow=this.getMaxRowPreference();
    if (dataSetHandle.getRowFetchLimit() <= 0 || dataSetHandle.getRowFetchLimit() > maxRow) {
      ModuleHandle moduleHandle=((Module)dataSetHandle.getRoot().copy()).getModuleHandle();
      SlotHandle dataSets=moduleHandle.getDataSets();
      for (int i=0; i < dataSets.getCount(); i++) {
        if (dataSetHandle.getName().equals(dataSets.get(i).getName())) {
          dataSetHandle=(DataSetHandle)dataSets.get(i);
          try {
            dataSetHandle.setRowFetchLimit(maxRow);
          }
 catch (          SemanticException e) {
          }
          break;
        }
      }
    }
    new UIJob("String_Node_Str"){
      public IStatus runInUIThread(      IProgressMonitor monitor){
        updateResultsProcess();
        return Status.OK_STATUS;
      }
    }
.schedule();
  }
}

Fixed version (ground truth):
public void pageActivated(){
  getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
  if (modelChanged) {
    modelChanged=false;
    dataSetHandle=((DataSetEditor)getContainer()).getHandle();
    int maxRow=this.getMaxRowPreference();
    if (dataSetHandle.getRowFetchLimit() <= 0) {
      ModuleHandle moduleHandle=((Module)dataSetHandle.getRoot().copy()).getModuleHandle();
      SlotHandle dataSets=moduleHandle.getDataSets();
      for (int i=0; i < dataSets.getCount(); i++) {
        if (dataSetHandle.getName().equals(dataSets.get(i).getName())) {
          dataSetHandle=(DataSetHandle)dataSets.get(i);
          try {
            dataSetHandle.setRowFetchLimit(maxRow);
          }
 catch (          SemanticException e) {
          }
          break;
        }
      }
    }
    new UIJob("String_Node_Str"){
      public IStatus runInUIThread(      IProgressMonitor monitor){
        updateResultsProcess();
        return Status.OK_STATUS;
      }
    }
.schedule();
  }
}
Program: 64829
Project: 64829
Buggy source:
/** 
 * @return the test
 */
public static Test suite(){
  TestSuite test=new TestSuite();
  test.addTestSuite(CoreJavaScriptWrapperTest.class);
  test.addTestSuite(NativeDateTimeSpanTest.class);
  test.addTestSuite(NativeFinanceTest.class);
  test.addTestSuite(NativeJavaMapTest.class);
  test.addTestSuite(NativeNamedListTest.class);
  test.addTestSuite(ScriptableParametersTest.class);
  test.addTestSuite(ScriptContextTest.class);
  test.addTestSuite(BirtCompTest.class);
  test.addTestSuite(BirtDateTimeTest.class);
  test.addTestSuite(BirtDurationTest.class);
  test.addTestSuite(BirtMathTest.class);
  test.addTestSuite(BirtStrTest.class);
  return test;
}

Fixed version (ground truth):
/** 
 * @return the test
 */
public static Test suite(){
  TestSuite test=new TestSuite();
  test.addTestSuite(CoreJavaScriptWrapperTest.class);
  test.addTestSuite(NativeDateTimeSpanTest.class);
  test.addTestSuite(NativeFinanceTest.class);
  test.addTestSuite(NativeJavaMapTest.class);
  test.addTestSuite(NativeNamedListTest.class);
  test.addTestSuite(ScriptableParametersTest.class);
  test.addTestSuite(ScriptContextTest.class);
  test.addTestSuite(BirtCompTest.class);
  test.addTestSuite(BirtDateTimeTest.class);
  test.addTestSuite(BirtDurationTest.class);
  test.addTestSuite(BirtMathTest.class);
  test.addTestSuite(BirtStrTest.class);
  test.addTestSuite(LocalFileTest.class);
  return test;
}
Program: 64830
Project: 64830
Buggy source:
@Override public boolean delete(){
  return file.delete();
}

Fixed version (ground truth):
@Override public boolean delete(){
  return deleteFile(file);
}
Program: 64831
Project: 64831
Buggy source:
/** 
 * Gets the cell handle copy to support row/column insert.
 * @param cellHandle
 * @return
 * @throws SemanticException
 */
public CellHandle getCellHandleCopy(CellHandle cellHandle) throws SemanticException {
  if (cellHandle == null) {
    return null;
  }
  CellHandle cell=cellHandle.getElementFactory().newCell();
  Iterator iter=cellHandle.getPropertyIterator();
  while (iter.hasNext()) {
    PropertyHandle handle=(PropertyHandle)iter.next();
    String key=handle.getDefn().getName();
    if (handle.isLocal() && (!(CellHandle.COL_SPAN_PROP.equals(key) || CellHandle.ROW_SPAN_PROP.equals(key)))) {
      cellHandle.copyPropertyTo(key,cell);
    }
  }
  return cell;
}

Fixed version (ground truth):
/** 
 * Gets the cell handle copy to support row/column insert.
 * @param cellHandle
 * @return
 * @throws SemanticException
 */
public CellHandle getCellHandleCopy(CellHandle cellHandle) throws SemanticException {
  if (cellHandle == null) {
    return null;
  }
  CellHandle cell=cellHandle.getElementFactory().newCell();
  Iterator iter=cellHandle.getPropertyIterator();
  while (iter.hasNext()) {
    PropertyHandle handle=(PropertyHandle)iter.next();
    if (handle.getDefn().getValueType() == IPropertyDefn.USER_PROPERTY) {
      continue;
    }
    String key=handle.getDefn().getName();
    if (handle.isLocal() && (!(CellHandle.COL_SPAN_PROP.equals(key) || CellHandle.ROW_SPAN_PROP.equals(key)))) {
      cellHandle.copyPropertyTo(key,cell);
    }
  }
  return cell;
}
Program: 64832
Project: 64832
Buggy source:
public Object execute(Object[] arguments,IScriptFunctionContext context) throws BirtException {
  scriptContext=context;
  if (scriptContext != null) {
    Object locale=scriptContext.findProperty(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE);
    if (!(locale instanceof ULocale)) {
      locale=ULocale.getDefault();
    }
    if (threadLocale.get() != locale) {
      threadLocale.set((ULocale)locale);
      List<SimpleDateFormat> sdfList=new ArrayList<SimpleDateFormat>();
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      threadSDFArray.set(sdfList);
    }
    Object timeZone=scriptContext.findProperty(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.TIMEZONE);
    if (!(timeZone instanceof TimeZone)) {
      timeZone=TimeZone.getDefault();
    }
    if (threadTimeZone.get() != timeZone) {
      threadTimeZone.set((TimeZone)timeZone);
    }
  }
  return this.executor.execute(arguments,context);
}

Fixed version (ground truth):
public Object execute(Object[] arguments,IScriptFunctionContext scriptContext) throws BirtException {
  if (scriptContext != null) {
    Object locale=scriptContext.findProperty(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE);
    if (!(locale instanceof ULocale)) {
      locale=ULocale.getDefault();
    }
    if (threadLocale.get() != locale) {
      threadLocale.set((ULocale)locale);
      List<SimpleDateFormat> sdfList=new ArrayList<SimpleDateFormat>();
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      sdfList.add(new SimpleDateFormat("String_Node_Str",threadLocale.get()));
      threadSDFArray.set(sdfList);
    }
    Object timeZone=scriptContext.findProperty(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.TIMEZONE);
    if (!(timeZone instanceof TimeZone)) {
      timeZone=TimeZone.getDefault();
    }
    if (threadTimeZone.get() != timeZone) {
      threadTimeZone.set((TimeZone)timeZone);
    }
  }
  return this.executor.execute(arguments,scriptContext);
}
Program: 64833
Project: 64833
Buggy source:
/** 
 * save the design into the stream.
 * @param design design handler
 */
public ReportRunnable saveDesign(ReportRunnable runnable,ReportRunnable originalRunnable) throws EngineException {
  RAOutputStream out=null;
  ReportRunnable newRunnable=runnable;
  try {
    ReportDesignHandle design=runnable.getReport();
    if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT.equals(design.getLayoutPreference())) {
      designType=FIXED_LAYOUT_DESIGN;
    }
    out=archive.createRandomAccessStream(DESIGN_STREAM);
    ReportDesignHandle newDesign=DocumentUtil.serialize(design,out);
    designName=design.getFileName();
    newRunnable=new ReportRunnable(engine,newDesign);
    newRunnable.setReportName(runnable.getReportName());
    newRunnable.cachedScripts=runnable.cachedScripts;
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException(MessageConstants.SAVE_DESIGN_ERROR,ex);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      Exception ex) {
      }
    }
    out=null;
  }
  return newRunnable;
}

Fixed version (ground truth):
/** 
 * save the design into the stream.
 * @param design design handler
 */
public ReportRunnable saveDesign(ReportRunnable runnable,ReportRunnable originalRunnable) throws EngineException {
  RAOutputStream out=null;
  ReportRunnable newRunnable=runnable;
  try {
    ReportDesignHandle design=runnable.getReport();
    if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT.equals(design.getLayoutPreference())) {
      designType=FIXED_LAYOUT_DESIGN;
    }
    out=archive.createRandomAccessStream(DESIGN_STREAM);
    ReportDesignHandle newDesign=DocumentUtil.serialize(design,out);
    designName=design.getFileName();
    newRunnable=new ReportRunnable(engine,newDesign);
    newRunnable.setReportName(runnable.getReportName());
    newRunnable.cachedScripts=runnable.cachedScripts;
    newDesign.getModule().close();
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException(MessageConstants.SAVE_DESIGN_ERROR,ex);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      Exception ex) {
      }
    }
    out=null;
  }
  return newRunnable;
}
Program: 64834
Project: 64834
Buggy source:
public void close(){
  if (designClassLoader != null) {
    designClassLoader.close();
    designClassLoader=null;
  }
}

Fixed version (ground truth):
public void close(){
  if (this.appContext != null) {
    this.appContext.clear();
    this.appContext=null;
  }
  if (designClassLoader != null) {
    designClassLoader.close();
    designClassLoader=null;
  }
}
Program: 64836
Project: 64836
Buggy source:
/** 
 * Close this module.
 */
public final void close(){
  isValid=false;
  if (!isReadOnly()) {
    saveState=activityStack.getCurrentTransNo();
    session.drop(getModule());
  }
}

Fixed version (ground truth):
/** 
 * Close this module.
 */
public void close(){
  isValid=false;
  if (options != null) {
    options.close();
  }
  if (!isReadOnly()) {
    saveState=activityStack.getCurrentTransNo();
    session.drop(getModule());
  }
}
Program: 64837
Project: 64837
Buggy source:
public Object wrap(Context cx,Scriptable scope,Object javaObject,Class staticType){
  if (javaObject instanceof LinkedHashMap) {
    return new NativeJavaLinkedHashMap(scope,javaObject,staticType);
  }
  if (javaObject instanceof BirtHashMap) {
    return new NativeJavaMap(scope,javaObject,staticType);
  }
  if (javaObject instanceof List) {
    return new NativeJavaList(scope,javaObject,staticType);
  }
  return javaObject;
}

Fixed version (ground truth):
public Object wrap(Context cx,Scriptable scope,Object javaObject,Class staticType){
  if (javaObject instanceof LinkedHashMap) {
    return new NativeJavaLinkedHashMap(scope,javaObject,staticType);
  }
  if (javaObject instanceof BirtHashMap) {
    return new NativeJavaMap(scope,javaObject,staticType);
  }
  if (javaObject instanceof List) {
    if (!(javaObject instanceof org.mozilla.javascript.NativeArray)) {
      return new NativeJavaList(scope,javaObject,staticType);
    }
  }
  return javaObject;
}
Program: 64838
Project: 64838
Buggy source:
public String getNodeDisplayName(Object element){
  PropertyHandle handle=((CrosstabPropertyHandleWrapper)element).getModel();
  String propertyName=handle.getPropertyDefn().getName();
  if (propertyName.equals(ICrosstabReportItemConstants.COLUMNS_PROP))   return Messages.getString("String_Node_Str");
  if (propertyName.equals(ICrosstabReportItemConstants.ROWS_PROP))   return Messages.getString("String_Node_Str");
  if (propertyName.equals(ICrosstabReportItemConstants.MEASURES_PROP))   return Messages.getString("String_Node_Str");
  if (propertyName.equals(ICrosstabReportItemConstants.HEADER_PROP))   return "String_Node_Str";
  return null;
}

Fixed version (ground truth):
public String getNodeDisplayName(Object element){
  PropertyHandle handle=((CrosstabPropertyHandleWrapper)element).getModel();
  String propertyName=handle.getPropertyDefn().getName();
  if (propertyName.equals(ICrosstabReportItemConstants.COLUMNS_PROP))   return Messages.getString("String_Node_Str");
  if (propertyName.equals(ICrosstabReportItemConstants.ROWS_PROP))   return Messages.getString("String_Node_Str");
  if (propertyName.equals(ICrosstabReportItemConstants.MEASURES_PROP))   return Messages.getString("String_Node_Str");
  if (propertyName.equals(ICrosstabReportItemConstants.HEADER_PROP))   return Messages.getString("String_Node_Str");
  return null;
}
Program: 64839
Project: 64839
Buggy source:
public Object getAggregatedValue(){
switch (getDataType()) {
case NUMBER:
    return new Double(((double)max) - (double)min);
case BIGDECIMAL:
  return ((BigDecimal)max).subtract((BigDecimal)min);
default :
return null;
}
}

Fixed version (ground truth):
public Object getAggregatedValue(){
switch (getDataType()) {
case NUMBER:
    return new Double(((Number)max).doubleValue() - ((Number)min).doubleValue());
case BIGDECIMAL:
  return ((BigDecimal)max).subtract((BigDecimal)min);
default :
return null;
}
}
Program: 64840
Project: 64840
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(org.eclipse.birt.report.engine.emitter.prototype.excel.DateSymbolTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(org.eclipse.birt.report.engine.emitter.prototype.excel.DateSymbolTest.class);
  suite.addTestSuite(org.eclipse.birt.report.engine.emitter.prototype.excel.ExcelWriterTest.class);
  return suite;
}
Program: 64841
Project: 64841
Buggy source:
public void testParse(){
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,null,ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void testParse(){
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,null,ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
  assertEquals("String_Node_Str",ExcelUtil.parse(null,"String_Node_Str",ULocale.US));
}
Program: 64842
Project: 64842
Buggy source:
public void testStartSheet() throws IOException {
  ExcelContext context=new ExcelContext();
  ExcelWriter writer=new ExcelWriter(context);
  writer.start(null,new HashMap<StyleEntry,Integer>(),new HashMap<String,BookmarkDef>());
  writer.startSheet("String_Node_Str");
  writer.startRow();
  writer.outputData(1,1,SheetData.NUMBER,1);
  writer.endRow();
  writer.endSheet();
  writer.end();
}

Fixed version (ground truth):
public void testStartSheet(){
  try {
    ExcelEmitter emitter=new ExcelEmitter();
    EXCELRenderOption renderOption=new EXCELRenderOption();
    new File("String_Node_Str").mkdir();
    renderOption.setOutputFileName("String_Node_Str");
    EngineEmitterServices services=new EngineEmitterServices(null,renderOption,null);
    ExcelContext context=new ExcelContext();
    context.initialize(services);
    ExcelWriter writer=new ExcelWriter(context);
    writer.start(null,new HashMap<StyleEntry,Integer>(),new HashMap<String,BookmarkDef>());
    writer.startSheet("String_Node_Str");
    writer.startRow();
    writer.outputData(1,1,SheetData.NUMBER,1);
    writer.endRow();
    writer.endSheet();
    writer.end();
  }
 catch (  Exception ex) {
    fail("String_Node_Str" + ex.toString());
  }
}
Program: 64843
Project: 64843
Buggy source:
public void initialize(IEmitterServices service) throws EngineException {
  if (service == null) {
    return;
  }
  out=EmitterUtil.getOuputStream(service,"String_Node_Str");
  this.tempFileDir=service.getReportEngine().getConfig().getTempDir();
  IReportContext reportContext=service.getReportContext();
  if (reportContext != null) {
    Locale locale=reportContext.getLocale();
    this.locale=locale == null ? ULocale.getDefault() : ULocale.forLocale(locale);
    this.timeZone=reportContext.getTimeZone();
    if (timeZone == null) {
      timeZone=TimeZone.getDefault();
    }
  }
  IRenderOption renderOption=service.getRenderOption();
  Object option=renderOption.getOption(IExcelRenderOption.OPTION_MULTIPLE_SHEET);
  if (option instanceof Boolean)   enableMultipleSheet=(Boolean)option;
  this.reportContext=service.getReportContext();
}

Fixed version (ground truth):
public void initialize(IEmitterServices service) throws EngineException {
  if (service == null) {
    return;
  }
  out=EmitterUtil.getOuputStream(service,"String_Node_Str");
  if (service.getReportEngine() != null) {
    this.tempFileDir=service.getReportEngine().getConfig().getTempDir();
  }
  IReportContext reportContext=service.getReportContext();
  if (reportContext != null) {
    Locale locale=reportContext.getLocale();
    this.locale=locale == null ? ULocale.getDefault() : ULocale.forLocale(locale);
    this.timeZone=reportContext.getTimeZone();
    if (timeZone == null) {
      timeZone=TimeZone.getDefault();
    }
  }
  IRenderOption renderOption=service.getRenderOption();
  Object option=renderOption.getOption(IExcelRenderOption.OPTION_MULTIPLE_SHEET);
  if (option instanceof Boolean)   enableMultipleSheet=(Boolean)option;
  this.reportContext=service.getReportContext();
}
Program: 64845
Project: 64845
Buggy source:
public void start(){
  super.start();
  sum=0D;
}

Fixed version (ground truth):
public void start(){
  super.start();
  sum=BigDecimal.ZERO;
}
Program: 64846
Project: 64846
Buggy source:
public Object getSummaryValue(){
  return new BigDecimal(sum.toString());
}

Fixed version (ground truth):
public Object getSummaryValue(){
  return sum;
}
Program: 64847
Project: 64847
Buggy source:
public void start(){
  super.start();
  sum=new BigDecimal(new char[]{'0'},0,1);
}

Fixed version (ground truth):
public void start(){
  super.start();
  sum=0D;
}
Program: 64848
Project: 64848
Buggy source:
public Object getSummaryValue(){
  return sum;
}

Fixed version (ground truth):
public Object getSummaryValue(){
  return new BigDecimal(sum.toString());
}
Program: 64849
Project: 64849
Buggy source:
public void testTotalSum() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_SUM_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(82.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(new BigDecimal("String_Node_Str"),ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  try {
    for (int i=0; i < str2.length; i++) {
      ac.onRow(new Object[]{str2[i]});
    }
    fail();
  }
 catch (  DataException e) {
    assertTrue(true);
  }
  ac.finish();
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i]});
  }
  ac.finish();
  assertEquals(new BigDecimal("String_Node_Str"),ac.getValue());
}

Fixed version (ground truth):
public void testTotalSum() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_SUM_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(82.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(new Double(0.0),ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  try {
    for (int i=0; i < str2.length; i++) {
      ac.onRow(new Object[]{str2[i]});
    }
    fail();
  }
 catch (  DataException e) {
    assertTrue(true);
  }
  ac.finish();
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i]});
  }
  ac.finish();
  assertEquals(new BigDecimal("String_Node_Str"),ac.getValue());
}
Program: 64850
Project: 64850
Buggy source:
public void start(){
  super.start();
  sum=0D;
}

Fixed version (ground truth):
public void start(){
  super.start();
  sum=new BigDecimal(new char[]{'0'},0,1);
}
Program: 64851
Project: 64851
Buggy source:
public Object getSummaryValue(){
  return new BigDecimal(sum.toString());
}

Fixed version (ground truth):
public Object getSummaryValue(){
  return sum;
}
Program: 64852
Project: 64852
Buggy source:
public void testTotalSum() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_SUM_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(82.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(new Double(0.0),ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  try {
    for (int i=0; i < str2.length; i++) {
      ac.onRow(new Object[]{str2[i]});
    }
    fail();
  }
 catch (  DataException e) {
    assertTrue(true);
  }
  ac.finish();
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i]});
  }
  ac.finish();
  assertEquals(new BigDecimal("String_Node_Str"),ac.getValue());
}

Fixed version (ground truth):
public void testTotalSum() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_SUM_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(82.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(new Double(69.0),ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(new BigDecimal("String_Node_Str"),ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  try {
    for (int i=0; i < str2.length; i++) {
      ac.onRow(new Object[]{str2[i]});
    }
    fail();
  }
 catch (  DataException e) {
    assertTrue(true);
  }
  ac.finish();
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i]});
  }
  ac.finish();
  assertEquals(new BigDecimal("String_Node_Str"),ac.getValue());
}
Program: 64853
Project: 64853
Buggy source:
/** 
 * Test method for <code>org.eclipse.birt.core.script.function.bre.BirtDateTime.Function_FirstDayOfFiscalQuarter</code>
 */
public void testFirstDayOfFiscalQuarter() throws BirtException {
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  Calendar c=Calendar.getInstance();
  c.clear();
  Date[] values=new Date[]{date(c,2015,3,1),date(c,2015,3,1),date(c,2015,0,15),date(c,2015,6,10),date(c,2015,3,10),date(c,2013,10,10),date(c,2014,8,30)};
  for (int i=0; i < values.length; i++) {
    Object result=cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null);
    assertEquals(String.valueOf(i),values[i],result);
  }
}

Fixed version (ground truth):
/** 
 * Test method for <code>org.eclipse.birt.core.script.function.bre.BirtDateTime.Function_FirstDayOfFiscalQuarter</code>
 */
public void testFirstDayOfFiscalQuarter() throws BirtException {
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  Calendar c=Calendar.getInstance();
  c.clear();
  Date[] values=new Date[]{date(c,2015,3,1),date(c,CURRENT_YEAR,9,1),date(c,2015,3,1),date(c,2015,0,15),date(c,2015,6,10),date(c,2015,3,10),date(c,2013,10,10),date(c,2014,8,30)};
  for (int i=0; i < values.length; i++) {
    Object result=cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null);
    assertEquals(String.valueOf(i),values[i],result);
  }
}
Program: 64854
Project: 64854
Buggy source:
/** 
 * Test method for <code>org.eclipse.birt.core.script.function.bre.BirtDateTime.Function_FirstDayOfFiscalMonth</code>
 */
public void testFirstDayOfFiscalMonth() throws BirtException {
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  Calendar c=Calendar.getInstance();
  c.clear();
  Date[] values=new Date[]{date(c,2015,5,1),date(c,2015,5,1),date(c,2014,7,15),date(c,2015,6,10),date(c,2015,5,10),date(c,2013,11,10),date(c,2014,0,31),date(c,2014,8,30)};
  for (int i=0; i < values.length; i++) {
    Object result=cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null);
    assertEquals(String.valueOf(i),values[i],result);
  }
}

Fixed version (ground truth):
/** 
 * Test method for <code>org.eclipse.birt.core.script.function.bre.BirtDateTime.Function_FirstDayOfFiscalMonth</code>
 */
public void testFirstDayOfFiscalMonth() throws BirtException {
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  Calendar c=Calendar.getInstance();
  c.clear();
  Date[] values=new Date[]{date(c,2015,5,1),date(c,CURRENT_YEAR,9,1),date(c,2015,5,1),date(c,2014,7,15),date(c,2015,6,10),date(c,2015,5,10),date(c,2013,11,10),date(c,2014,0,31),date(c,2014,8,30)};
  for (int i=0; i < values.length; i++) {
    Object result=cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null);
    assertEquals(String.valueOf(i),values[i],result);
  }
}
Program: 64855
Project: 64855
Buggy source:
protected Object getValue(Object[] args,IScriptFunctionContext context) throws BirtException {
  if (existNullValue(args)) {
    return null;
  }
  Calendar current=null;
  if (args[0] instanceof Integer) {
    current=getFiscalYearStateDate(context,args);
    current.set(Calendar.YEAR,(Integer)args[0]);
    if (current.get(Calendar.DAY_OF_YEAR) > 1) {
      current.add(Calendar.YEAR,-1);
    }
  }
 else {
    current=getCalendar(DataTypeUtil.toDate(args[0]));
    Calendar start=getFiscalYearStateDate(context,args);
    adjustFiscalYear(current,start);
    current.set(Calendar.MONTH,start.get(Calendar.MONTH));
    current.set(Calendar.DATE,Math.min(start.get(Calendar.DATE),current.getActualMaximum(Calendar.DATE)));
  }
  return current.getTime();
}

Fixed version (ground truth):
protected Object getValue(Object[] args,IScriptFunctionContext context) throws BirtException {
  if (existNullValue(args)) {
    return null;
  }
  Calendar current=null;
  if (args[0] instanceof Number) {
    current=getFiscalYearStateDate(context,args);
    current.set(Calendar.YEAR,((Number)args[0]).intValue());
    if (current.get(Calendar.DAY_OF_YEAR) > 1) {
      current.add(Calendar.YEAR,-1);
    }
  }
 else {
    current=getCalendar(DataTypeUtil.toDate(args[0]));
    Calendar start=getFiscalYearStateDate(context,args);
    adjustFiscalYear(current,start);
    current.set(Calendar.MONTH,start.get(Calendar.MONTH));
    current.set(Calendar.DATE,Math.min(start.get(Calendar.DATE),current.getActualMaximum(Calendar.DATE)));
  }
  return current.getTime();
}
Program: 64856
Project: 64856
Buggy source:
private static String encode(String location){
  try {
    return new File(location).toURI().toASCIIString().replace(new File("String_Node_Str").toURI().toASCIIString(),"String_Node_Str");
  }
 catch (  Exception e) {
    return location;
  }
}

Fixed version (ground truth):
private static String encode(String location){
  try {
    return new File(location).toURI().toASCIIString();
  }
 catch (  Exception e) {
    return location;
  }
}
Program: 64857
Project: 64857
Buggy source:
IConnection openConnection() throws OdaException {
  if (connection != null) {
    return connection;
  }
  IDriver jdbcDriver=JDBCDriverManager.getInstance().getDriver(dataSourceDesign.getEffectiveOdaExtensionId());
  try {
    connection=jdbcDriver.getConnection(dataSourceDesign.getEffectiveOdaExtensionId());
    Properties prop=DesignSessionUtil.getEffectiveDataSourceProperties(dataSourceDesign);
    connection.open(prop);
  }
 catch (  OdaException e) {
    connection=null;
    throw e;
  }
  return connection;
}

Fixed version (ground truth):
IConnection openConnection() throws OdaException {
  if (connection != null) {
    return connection;
  }
  IDriver jdbcDriver=JDBCDriverManager.getInstance().getDriver(dataSourceDesign.getEffectiveOdaExtensionId());
  try {
    connection=jdbcDriver.getConnection(dataSourceDesign.getEffectiveOdaExtensionId());
    Map appContext=new HashMap();
    ResourceIdentifiers resourceIdentifiers=dataSourceDesign.getHostResourceIdentifiers();
    if (resourceIdentifiers != null) {
      appContext.put(org.eclipse.datatools.connectivity.oda.util.ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS,DesignSessionUtil.createRuntimeResourceIdentifiers(resourceIdentifiers));
    }
    connection.setAppContext(appContext);
    Properties prop=DesignSessionUtil.getEffectiveDataSourceProperties(dataSourceDesign);
    connection.open(prop);
  }
 catch (  OdaException e) {
    connection=null;
    throw e;
  }
  return connection;
}
Program: 64858
Project: 64858
Buggy source:
/** 
 * Tests to extends for the oda datasource <ul> <li>dataSource1 has extendsion id, dataSource1 hasn't. Exception is thrown. <li>if both have extension id, no exception. </ul>
 * @throws Exception
 */
public void testSetExtends() throws Exception {
  sessionHandle=DesignEngine.newSession(ULocale.ENGLISH);
  designHandle=sessionHandle.createDesign();
  OdaDataSourceHandle dataSource1=designHandle.getElementFactory().newOdaDataSource("String_Node_Str",DATASOURCE_EXTENSION_ID);
  designHandle.getDataSources().add(dataSource1);
  OdaDataSourceHandle dataSource2=designHandle.getElementFactory().newOdaDataSource("String_Node_Str",null);
  designHandle.getDataSources().add(dataSource2);
  try {
    dataSource2.setExtends(dataSource1);
    fail();
  }
 catch (  ExtendsException e) {
    assertEquals(ExtendsException.DESIGN_EXCEPTION_WRONG_EXTENSION_TYPE,e.getErrorCode());
  }
  try {
    dataSource1.setExtends(dataSource2);
    fail();
  }
 catch (  ExtendsException e) {
    assertEquals(ExtendsException.DESIGN_EXCEPTION_WRONG_EXTENSION_TYPE,e.getErrorCode());
  }
  dataSource2.getElement().setProperty(IOdaExtendableElementModel.EXTENSION_ID_PROP,DATASOURCE_EXTENSION_ID);
  dataSource2.setExtends(dataSource1);
}

Fixed version (ground truth):
/** 
 * Tests to extends for the oda datasource <ul> <li>dataSource1 has extendsion id, dataSource1 hasn't. Exception is thrown. <li>if both have extension id, no exception. </ul>
 * @throws Exception
 */
public void testSetExtends() throws Exception {
  sessionHandle=DesignEngine.newSession(ULocale.ENGLISH);
  designHandle=sessionHandle.createDesign();
  OdaDataSourceHandle dataSource1=designHandle.getElementFactory().newOdaDataSource("String_Node_Str",DATASOURCE_EXTENSION_ID);
  designHandle.getDataSources().add(dataSource1);
  OdaDataSourceHandle dataSource2=designHandle.getElementFactory().newOdaDataSource("String_Node_Str",null);
  designHandle.getDataSources().add(dataSource2);
  try {
    dataSource2.setExtends(dataSource1);
    fail();
  }
 catch (  ExtendsException e) {
    assertEquals(ExtendsException.DESIGN_EXCEPTION_WRONG_TYPE,e.getErrorCode());
  }
  try {
    dataSource1.setExtends(dataSource2);
    fail();
  }
 catch (  ExtendsException e) {
    assertEquals(ExtendsException.DESIGN_EXCEPTION_WRONG_TYPE,e.getErrorCode());
  }
  dataSource2.getElement().setProperty(IOdaExtendableElementModel.EXTENSION_ID_PROP,DATASOURCE_EXTENSION_ID);
  dataSource2.setExtends(dataSource1);
}
Program: 64859
Project: 64859
Buggy source:
private void doAddContent(IContent content){
  if (contents.size() == CONTENTS_CONVERTION_THRESHOLD) {
    contents=new TreeSet<IContent>(contents);
  }
  contents.add(content);
}

Fixed version (ground truth):
private void doAddContent(IContent content){
  if (contents.size() == CONTENTS_CONVERTION_THRESHOLD) {
    contents=new LinkedHashSet<IContent>(contents);
  }
  contents.add(content);
}
Program: 64860
Project: 64860
Buggy source:
@Override public Set<IBaseLinkDefinition> getLinks(){
  return this.links;
}

Fixed version (ground truth):
public Set<IBaseLinkDefinition> getLinks(){
  return this.links;
}
Program: 64861
Project: 64861
Buggy source:
@Override public void addLink(IBaseLinkDefinition link){
  this.links.add(link);
}

Fixed version (ground truth):
public void addLink(IBaseLinkDefinition link){
  this.links.add(link);
}