nus-yam/ex-repair huggingface dataset:
Program: 178925
Project: 178925
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    XWikiEclipsePageIndex pageIndex=XWikiEclipsePageIndex.getDefault();
    monitor.beginTask(String.format("String_Node_Str"),IProgressMonitor.UNKNOWN);
    if (monitor.isCanceled() || !connection.isConnected()) {
      return Status.CANCEL_STATUS;
    }
    IXWikiConnection workingConnection=XWikiConnectionFactory.createPlainConnection(connection.getServerUrl(),connection.getUserName());
    workingConnection.connect(XWikiConnectionManager.getDefault().getPasswordForConnection(connection));
    if (monitor.isCanceled() || !connection.isConnected()) {
      return Status.CANCEL_STATUS;
    }
    Collection<IXWikiSpace> spaces=workingConnection.getSpaces();
    for (    IXWikiSpace space : spaces) {
      if (monitor.isCanceled() || !connection.isConnected()) {
        return Status.CANCEL_STATUS;
      }
      Collection<IXWikiPage> pages=space.getPages();
      for (      IXWikiPage page : pages) {
        pageIndex.addPage(page);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    return new Status(IStatus.ERROR,XWikiEclipsePlugin.PLUGIN_ID,String.format("String_Node_Str",e.getMessage()));
  }
 finally {
    monitor.done();
    if (reschedule) {
      schedule(1200000);
    }
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    XWikiEclipsePageIndex pageIndex=XWikiEclipsePageIndex.getDefault();
    monitor.beginTask(String.format("String_Node_Str"),IProgressMonitor.UNKNOWN);
    if (monitor.isCanceled() || !connection.isConnected()) {
      return Status.CANCEL_STATUS;
    }
    IXWikiConnection workingConnection=XWikiConnectionFactory.createPlainConnection(connection.getServerUrl(),connection.getUserName());
    workingConnection.connect(XWikiConnectionManager.getDefault().getPasswordForConnection(connection));
    if (monitor.isCanceled() || !connection.isConnected()) {
      return Status.CANCEL_STATUS;
    }
    Collection<IXWikiSpace> spaces=workingConnection.getSpaces();
    for (    IXWikiSpace space : spaces) {
      if (monitor.isCanceled() || !connection.isConnected()) {
        return Status.CANCEL_STATUS;
      }
      Collection<IXWikiPage> pages=space.getPages();
      for (      IXWikiPage page : pages) {
        pageIndex.addPage(page);
      }
    }
    workingConnection.disconnect();
    workingConnection.dispose();
    workingConnection=null;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return new Status(IStatus.ERROR,XWikiEclipsePlugin.PLUGIN_ID,String.format("String_Node_Str",e.getMessage()));
  }
 finally {
    monitor.done();
    if (reschedule) {
      schedule(1200000);
    }
  }
  return Status.OK_STATUS;
}
Program: 178926
Project: 178926
Buggy source:
@Override protected void fillContentProvider(AbstractContentProvider contentProvider,ItemsFilter itemsFilter,IProgressMonitor progressMonitor) throws CoreException {
  progressMonitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
  for (  IXWikiPage page : XWikiEclipsePageIndex.getDefault().getPages()) {
    if (page.isCached() || page.getConnection().isConnected()) {
      contentProvider.add(page,itemsFilter);
    }
  }
  progressMonitor.done();
}

Fixed version (ground truth):
@Override protected void fillContentProvider(AbstractContentProvider contentProvider,ItemsFilter itemsFilter,IProgressMonitor progressMonitor) throws CoreException {
  progressMonitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
  for (  IXWikiPage page : XWikiEclipsePageIndex.getDefault().getPages()) {
    List<IXWikiConnection> actualConnections=XWikiConnectionManager.getDefault().getConnections();
    IXWikiConnection actualConnection=null;
    for (    IXWikiConnection connection : actualConnections) {
      if (connection.equals(page.getConnection())) {
        actualConnection=connection;
        break;
      }
    }
    if (actualConnection != null) {
      if (page.isCached() || actualConnection.isConnected()) {
        contentProvider.add(page,itemsFilter);
      }
    }
  }
  progressMonitor.done();
}
Program: 178927
Project: 178927
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    XWikiEclipsePageIndex pageIndex=XWikiEclipsePageIndex.getDefault();
    monitor.beginTask(String.format("String_Node_Str"),IProgressMonitor.UNKNOWN);
    if (monitor.isCanceled()) {
      return Status.CANCEL_STATUS;
    }
    Collection<IXWikiSpace> spaces=connection.getSpaces();
    for (    IXWikiSpace space : spaces) {
      if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
      }
      Collection<IXWikiPage> pages=space.getPages();
      for (      IXWikiPage page : pages) {
        pageIndex.addPage(page);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    return new Status(IStatus.ERROR,XWikiEclipsePlugin.PLUGIN_ID,String.format("String_Node_Str",e.getMessage()));
  }
 finally {
    monitor.done();
    if (reschedule) {
      schedule(1200000);
    }
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    XWikiEclipsePageIndex pageIndex=XWikiEclipsePageIndex.getDefault();
    monitor.beginTask(String.format("String_Node_Str"),IProgressMonitor.UNKNOWN);
    if (monitor.isCanceled() || !connection.isConnected()) {
      return Status.CANCEL_STATUS;
    }
    IXWikiConnection workingConnection=XWikiConnectionFactory.createPlainConnection(connection.getServerUrl(),connection.getUserName());
    workingConnection.connect(XWikiConnectionManager.getDefault().getPasswordForConnection(connection));
    if (monitor.isCanceled() || !connection.isConnected()) {
      return Status.CANCEL_STATUS;
    }
    Collection<IXWikiSpace> spaces=workingConnection.getSpaces();
    for (    IXWikiSpace space : spaces) {
      if (monitor.isCanceled() || !connection.isConnected()) {
        return Status.CANCEL_STATUS;
      }
      Collection<IXWikiPage> pages=space.getPages();
      for (      IXWikiPage page : pages) {
        pageIndex.addPage(page);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    return new Status(IStatus.ERROR,XWikiEclipsePlugin.PLUGIN_ID,String.format("String_Node_Str",e.getMessage()));
  }
 finally {
    monitor.done();
    if (reschedule) {
      schedule(1200000);
    }
  }
  return Status.OK_STATUS;
}
Program: 178928
Project: 178928
Buggy source:
/** 
 * {@inheritDoc}
 * @throws XWikiConnectionException
 */
public void disconnect() throws XWikiConnectionException {
  assertNotDisposed();
  if (!isConnected()) {
    return;
  }
  try {
    remoteDAO.close();
    remoteDAO=null;
  }
 catch (  XWikiDAOException e) {
    e.printStackTrace();
  }
  XWikiEclipseNotificationCenter.getDefault().fireEvent(this,XWikiEclipseEvent.CONNECTION_CLOSED,this);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @throws XWikiConnectionException
 */
public void disconnect() throws XWikiConnectionException {
  assertNotDisposed();
  if (!isConnected()) {
    return;
  }
  try {
    remoteDAO.close();
    remoteDAO=null;
  }
 catch (  XWikiDAOException e) {
    e.printStackTrace();
  }
}
Program: 178929
Project: 178929
Buggy source:
/** 
 * {@inheritDoc}
 */
public void connect(String password) throws XWikiConnectionException {
  assertNotDisposed();
  if (isConnected()) {
    return;
  }
  try {
    remoteDAO=new XWikiRemoteDAO(getServerUrl(),getUserName(),password);
  }
 catch (  XWikiDAOException e) {
    if (remoteDAO != null) {
      try {
        remoteDAO.close();
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
    }
    remoteDAO=null;
    throw new XWikiConnectionException(e);
  }
  XWikiEclipseNotificationCenter.getDefault().fireEvent(this,XWikiEclipseEvent.CONNECTION_ESTABLISHED,this);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void connect(String password) throws XWikiConnectionException {
  assertNotDisposed();
  if (isConnected()) {
    return;
  }
  try {
    remoteDAO=new XWikiRemoteDAO(getServerUrl(),getUserName(),password);
  }
 catch (  XWikiDAOException e) {
    if (remoteDAO != null) {
      try {
        remoteDAO.close();
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
    }
    remoteDAO=null;
    throw new XWikiConnectionException(e);
  }
}
Program: 178930
Project: 178930
Buggy source:
/** 
 * Stores a page in the cache.
 * @param page The page information to be stored.
 * @throws XWikiDAOException
 */
public void storePage(Page page) throws XWikiDAOException {
  try {
    String dataFileName=String.format("String_Node_Str",page.getId());
    ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(new File(cacheDir,dataFileName)));
    oos.writeObject(page.toMap());
    oos.close();
    indexAggregate.getPageToDataFileNameIndex().put(page.getId(),dataFileName);
    Set<String> pagesInSpace=indexAggregate.getSpaceToPagesIndex().get(page.getSpace());
    if (pagesInSpace == null) {
      pagesInSpace=new HashSet<String>();
      indexAggregate.getSpaceToPagesIndex().put(page.getSpace(),pagesInSpace);
    }
    pagesInSpace.add(page.getId());
  }
 catch (  Exception e) {
    throw new XWikiDAOException(e);
  }
}

Fixed version (ground truth):
/** 
 * Stores a page in the cache.
 * @param page The page information to be stored.
 * @throws XWikiDAOException
 */
public void storePage(Page page) throws XWikiDAOException {
  try {
    String dataFileName=String.format("String_Node_Str",page.getId());
    ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(new File(cacheDir,dataFileName)));
    oos.writeObject(page.toMap());
    oos.close();
    indexAggregate.getPageToDataFileNameIndex().put(page.getId(),dataFileName);
    indexAggregate.getPageToSpaceIndex().put(page.getId(),page.getSpace());
    Set<String> pagesInSpace=indexAggregate.getSpaceToPagesIndex().get(page.getSpace());
    if (pagesInSpace == null) {
      pagesInSpace=new HashSet<String>();
      indexAggregate.getSpaceToPagesIndex().put(page.getSpace(),pagesInSpace);
    }
    pagesInSpace.add(page.getId());
  }
 catch (  Exception e) {
    throw new XWikiDAOException(e);
  }
}
Program: 178932
Project: 178932
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
 */
public void stop(BundleContext context) throws Exception {
  for (  IXWikiConnection con : XWikiConnectionManager.getInstance().getAllConnections()) {
    try {
      con.disconnect();
    }
 catch (    Exception e) {
    }
  }
  File connections=new File(getStateLocation().toFile(),"String_Node_Str");
  org.xwiki.xeclipse.XWikiConnectionManager.getDefault().saveConnections(connections);
  plugin=null;
  super.stop(context);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
 */
public void stop(BundleContext context) throws Exception {
  for (  IXWikiConnection con : XWikiConnectionManager.getInstance().getAllConnections()) {
    try {
      con.disconnect();
    }
 catch (    Exception e) {
    }
  }
  File connections=new File(getStateLocation().toFile(),"String_Node_Str");
  org.xwiki.xeclipse.XWikiConnectionManager.getDefault().saveConnections(connections);
  org.xwiki.xeclipse.XWikiConnectionManager.getDefault().dispose();
  plugin=null;
  super.stop(context);
}
Program: 178933
Project: 178933
Buggy source:
/** 
 * Dispose the connection manager by releasing all the resources associated with it. This method should be called whenever the connection manager is not used anymore.
 * @throws XWikiConnectionException 
 */
public void dispose() throws XWikiConnectionException ;

Fixed version (ground truth):
/** 
 * Dispose the connection manager by releasing all the resources associated with it. This method should be called whenever the connection is not used anymore.
 * @throws XWikiConnectionException 
 */
public void dispose() throws XWikiConnectionException ;
Program: 178934
Project: 178934
Buggy source:
/** 
 * @param spaceKey The space key.
 * @return The page summaries for all the pages available in the given space. 
 * @throws XWikiDAOException
 */
public List<PageSummary> getPages(String spaceKey) throws XWikiDAOException {
  List<PageSummary> result=new ArrayList<PageSummary>();
  try {
    for (    String pageId : indexAggregate.getSpaceToPagesIndex().get(spaceKey)) {
      String dataFileName=indexAggregate.pageToDataFileNameIndex.get(pageId);
      ObjectInputStream ois=new ObjectInputStream(new FileInputStream(new File(cacheDir,dataFileName)));
      Map map=(Map)ois.readObject();
      ois.close();
      result.add(new PageSummary(map));
    }
  }
 catch (  Exception e) {
    throw new XWikiDAOException(e);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param spaceKey The space key.
 * @return The page summaries for all the pages available in the given space.
 * @throws XWikiDAOException
 */
public List<PageSummary> getPages(String spaceKey) throws XWikiDAOException {
  List<PageSummary> result=new ArrayList<PageSummary>();
  try {
    Set<String> pageIds=indexAggregate.getSpaceToPagesIndex().get(spaceKey);
    if (pageIds != null) {
      for (      String pageId : pageIds) {
        String dataFileName=indexAggregate.pageToDataFileNameIndex.get(pageId);
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream(new File(cacheDir,dataFileName)));
        Map map=(Map)ois.readObject();
        ois.close();
        result.add(new PageSummary(map));
      }
    }
  }
 catch (  Exception e) {
    throw new XWikiDAOException(e);
  }
  return result;
}
Program: 178935
Project: 178935
Buggy source:
/** 
 * Dispose the connection manager by releasing all the resources associated with it. This method should be called whenever the connection is not used anymore.
 * @throws XWikiConnectionException 
 */
public void dispose() throws XWikiConnectionException ;

Fixed version (ground truth):
/** 
 * Dispose the connection manager by releasing all the resources associated with it. This method must be called whenever the connection is not used anymore.
 * @throws XWikiConnectionException 
 */
public void dispose() throws XWikiConnectionException ;
Program: 178936
Project: 178936
Buggy source:
/** 
 * {@inheritDoc}
 */
public void connect(String password) throws XWikiConnectionException {
  assertNotDisposed();
  if (isConnected()) {
    return;
  }
  try {
    remoteDAO=new XWikiRemoteDAO(getServerUrl(),getUserName(),password);
    synchronizeAll();
  }
 catch (  XWikiDAOException e) {
    if (remoteDAO != null) {
      try {
        remoteDAO.close();
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
    }
    remoteDAO=null;
    cacheDAO=null;
    throw new XWikiConnectionException(e);
  }
  fireConnectionEstablished();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void connect(String password) throws XWikiConnectionException {
  assertNotDisposed();
  if (isConnected()) {
    return;
  }
  try {
    remoteDAO=new XWikiRemoteDAO(getServerUrl(),getUserName(),password);
    synchronizeAll();
  }
 catch (  XWikiDAOException e) {
    if (remoteDAO != null) {
      try {
        remoteDAO.close();
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
    }
    remoteDAO=null;
    throw new XWikiConnectionException(e);
  }
  fireConnectionEstablished();
}
Program: 178937
Project: 178937
Buggy source:
@Override public Resource[] getResources(String locationPattern) throws IOException {
  if (jarCon != null || ClassUtils.isInJar(this.jarClass)) {
    return findPathMatchingJarResources(locationPattern);
  }
 else {
    Resource classRoot=ClassUtils.getClassesRootResource(this.jarClass);
    String directory=determineRootDir(locationPattern);
    String pattern=locationPattern.replaceAll(directory,"String_Node_Str");
    Resource dirRoot=classRoot.createRelative(directory);
    if (dirRoot.exists()) {
      List<Resource> finder=new ArrayList<Resource>();
      Collection<?> files=FileUtils.listFiles(dirRoot.getFile(),null,true);
      for (      Object object : files) {
        if (!(object instanceof File)) {
          continue;
        }
        File file=(File)object;
        String filename=file.getName();
        if (getPathMatcher().match(pattern,filename)) {
          finder.add(new FileSystemResource(file));
        }
      }
      return finder.toArray(new Resource[finder.size()]);
    }
 else {
      return null;
    }
  }
}

Fixed version (ground truth):
@Override public Resource[] getResources(String locationPattern) throws IOException {
  if (!locationPattern.startsWith("String_Node_Str")) {
    locationPattern="String_Node_Str" + locationPattern;
  }
  if (jarCon != null || ClassUtils.isInJar(this.jarClass)) {
    return findPathMatchingJarResources(locationPattern);
  }
 else {
    Resource classRoot=ClassUtils.getClassesRootResource(this.jarClass);
    String rootPath=ResourceUtils.getAbsolutePath(classRoot);
    String directory=determineRootDir(locationPattern);
    Resource dirRoot=classRoot.createRelative(directory);
    if (dirRoot.exists()) {
      List<Resource> finder=new ArrayList<Resource>();
      boolean recursive=getPathMatcher().isPattern(locationPattern);
      Collection<?> files=FileUtils.listFiles(dirRoot.getFile(),null,recursive);
      for (      Object object : files) {
        if (!(object instanceof File)) {
          continue;
        }
        File file=(File)object;
        String absolutePath=StringUtils.cleanPath(file.getAbsolutePath());
        String relativePath=absolutePath.substring(rootPath.length());
        if (getPathMatcher().match(locationPattern,relativePath)) {
          finder.add(new FileSystemResource(file));
        }
      }
      return finder.toArray(new Resource[finder.size()]);
    }
 else {
      return null;
    }
  }
}
Program: 178938
Project: 178938
Buggy source:
public static Resource[] getSubResources(String rootPath,String path,boolean all){
  if (path == null || "String_Node_Str".equals(path)) {
    return new Resource[0];
  }
  if (!path.startsWith("String_Node_Str")) {
    log.warn("String_Node_Str" + path);
    return new Resource[0];
  }
  String jarPath=path;
  String dir=jarPath;
  if (matcher.isPattern(dir)) {
    dir=StringUtils.getPatternRoot(dir);
  }
  if (rootPath == null) {
    List<Resource> jarSubs=getSubResourcesForJar(dir,jarPath);
    return jarSubs.toArray(new Resource[jarSubs.size()]);
  }
  rootPath=StringUtils.cleanPath(rootPath);
  List<Resource> fileSubs=getSubResourcesForFile(rootPath,dir,jarPath);
  if (!all) {
    return fileSubs.toArray(new Resource[fileSubs.size()]);
  }
  fileSubs.addAll(getSubResourcesForJar(dir,jarPath));
  return fileSubs.toArray(new Resource[fileSubs.size()]);
}

Fixed version (ground truth):
/** 
 * 获取指定path路径下的资源信息。如果rootPath为null，直接从jar中相对path中获取。 如果rootPath不为null：如果all为false，直接从rootPath对应的path中获取； 如果all为true，合并返回从jar包中相对path资源信息加上rootPath对应的path资源信息
 * @param rootPath 指定物理文件夹路径
 * @param path 相当资源路径，必须以'/'开始，例如：/images/**, /images/*.jpg
 * @param all 是否合并获取资源
 * @return
 * @author 黄国庆 2012-5-11 下午3:31:00
 */
public static Resource[] getSubResources(String rootPath,String path,boolean all){
  if (path == null || "String_Node_Str".equals(path)) {
    return new Resource[0];
  }
  if (!path.startsWith("String_Node_Str")) {
    log.warn("String_Node_Str" + path);
    return new Resource[0];
  }
  String jarPath=path;
  String dir=jarPath;
  if (matcher.isPattern(dir)) {
    dir=StringUtils.getPatternRoot(dir);
  }
  if (rootPath == null) {
    List<Resource> jarSubs=getSubResourcesForJar(dir,jarPath);
    return jarSubs.toArray(new Resource[jarSubs.size()]);
  }
  rootPath=StringUtils.cleanPath(rootPath);
  if (rootPath.endsWith("String_Node_Str")) {
    rootPath=rootPath.substring(0,rootPath.length() - 1);
  }
  List<Resource> fileSubs=getSubResourcesForFile(rootPath,dir,jarPath);
  if (!all) {
    return fileSubs.toArray(new Resource[fileSubs.size()]);
  }
  fileSubs.addAll(getSubResourcesForJar(dir,jarPath));
  return fileSubs.toArray(new Resource[fileSubs.size()]);
}
Program: 178939
Project: 178939
Buggy source:
/** 
 * 获取指定path路径下的资源信息。如果rootPath为null，直接从jar中相对path中获取。 如果rootPath不为null：如果all为false，直接从rootPath对应的path中获取； 如果all为true，合并返回从jar包中相对path资源信息加上rootPath对应的path资源信息
 * @param rootPath 指定物理文件夹路径
 * @param path 相当资源路径，例如：/images/**, /images/*.jpg
 * @param all 是否合并获取资源
 * @return 不为null的数组集合
 * @author 黄国庆 2012-5-8 下午3:29:00
 */
public static String[] getSubs(String rootPath,String path,boolean all){
  if (path == null || "String_Node_Str".equals(path)) {
    return new String[0];
  }
  if (!path.startsWith("String_Node_Str")) {
    log.warn("String_Node_Str" + path);
    return new String[0];
  }
  String jarPath=path.substring(1);
  String dir=jarPath;
  if (matcher.isPattern(jarPath)) {
    dir=StringUtils.getPatternRoot(jarPath);
  }
  if (rootPath == null) {
    Set<String> jarSubs=getSubsForJar(dir,jarPath);
    return jarSubs.toArray(new String[jarSubs.size()]);
  }
  if (!rootPath.endsWith("String_Node_Str")) {
    rootPath=rootPath + "String_Node_Str";
  }
  rootPath=StringUtils.cleanPath(rootPath);
  Set<String> fileSubs=getSubsForFile(rootPath,dir,jarPath);
  if (!all) {
    return fileSubs.toArray(new String[fileSubs.size()]);
  }
  fileSubs.addAll(getSubsForJar(dir,jarPath));
  return fileSubs.toArray(new String[fileSubs.size()]);
}

Fixed version (ground truth):
/** 
 * 获取指定path路径下的资源信息。如果rootPath为null，直接从jar中相对path中获取。 如果rootPath不为null：如果all为false，直接从rootPath对应的path中获取； 如果all为true，合并返回从jar包中相对path资源信息加上rootPath对应的path资源信息
 * @param rootPath 指定物理文件夹路径
 * @param path 相当资源路径，必须以'/'开始，例如：/images/**, /images/*.jpg
 * @param all 是否合并获取资源
 * @return 不为null的数组集合
 * @author 黄国庆 2012-5-8 下午3:29:00
 */
public static String[] getSubs(String rootPath,String path,boolean all){
  if (path == null || "String_Node_Str".equals(path)) {
    return new String[0];
  }
  if (!path.startsWith("String_Node_Str")) {
    log.warn("String_Node_Str" + path);
    return new String[0];
  }
  String jarPath=path.substring(1);
  String dir=jarPath;
  if (matcher.isPattern(jarPath)) {
    dir=StringUtils.getPatternRoot(jarPath);
  }
  if (rootPath == null) {
    Set<String> jarSubs=getSubsForJar(dir,jarPath);
    return jarSubs.toArray(new String[jarSubs.size()]);
  }
  rootPath=StringUtils.cleanPath(rootPath);
  if (!rootPath.endsWith("String_Node_Str")) {
    rootPath=rootPath + "String_Node_Str";
  }
  Set<String> fileSubs=getSubsForFile(rootPath,dir,jarPath);
  if (!all) {
    return fileSubs.toArray(new String[fileSubs.size()]);
  }
  fileSubs.addAll(getSubsForJar(dir,jarPath));
  return fileSubs.toArray(new String[fileSubs.size()]);
}
Program: 178940
Project: 178940
Buggy source:
private static List<Resource> getSubResourcesForFile(String rootPath,String dir,String jarPath){
  File file=new File(rootPath + dir);
  List<Resource> subs=new ArrayList<Resource>();
  if (file.exists() && file.isDirectory()) {
    boolean recursive=false;
    if (!dir.equals(jarPath)) {
      recursive=true;
    }
    Collection<?> files=FileUtils.listFiles(file,null,recursive);
    for (    Object object : files) {
      if (!(object instanceof File)) {
        continue;
      }
      File child=(File)object;
      String absolutePath=StringUtils.cleanPath(child.getAbsolutePath());
      String relativePath=absolutePath.substring(rootPath.length());
      if (recursive) {
        if (matcher.match(jarPath,relativePath)) {
          subs.add(new FileSystemResource(child));
        }
      }
 else {
        subs.add(new FileSystemResource(child));
      }
    }
  }
  removeFolder(subs);
  return subs;
}

Fixed version (ground truth):
/** 
 * 获取物理文件夹资源集合
 * @param rootPath 不能以'/'结尾，根目录
 * @param dir 必须以'/'开始，相对文件夹
 * @param jarPath 必须以'/'开始，匹配符
 * @return
 * @author 黄国庆 2012-5-11 下午3:23:25
 */
private static List<Resource> getSubResourcesForFile(String rootPath,String dir,String jarPath){
  File file=new File(rootPath + dir);
  List<Resource> subs=new ArrayList<Resource>();
  if (file.exists() && file.isDirectory()) {
    boolean recursive=false;
    if (!dir.equals(jarPath)) {
      recursive=true;
    }
    Collection<?> files=FileUtils.listFiles(file,null,recursive);
    for (    Object object : files) {
      if (!(object instanceof File)) {
        continue;
      }
      File child=(File)object;
      String absolutePath=StringUtils.cleanPath(child.getAbsolutePath());
      String relativePath=absolutePath.substring(rootPath.length());
      if (recursive) {
        if (matcher.match(jarPath,relativePath)) {
          subs.add(new FileSystemResource(child));
        }
      }
 else {
        subs.add(new FileSystemResource(child));
      }
    }
  }
  removeFolder(subs);
  return subs;
}
Program: 178941
Project: 178941
Buggy source:
private static List<Resource> getSubResourcesForJar(String dir,String jarPath){
  List<Resource> subs=new ArrayList<Resource>();
  try {
    if (dir.startsWith("String_Node_Str")) {
      dir=dir.substring(1);
    }
    Enumeration<URL> dirs=classLoader.getResources(dir);
    while (dirs.hasMoreElements()) {
      URL url=dirs.nextElement();
      URLConnection urlConnection=url.openConnection();
      if (urlConnection instanceof JarURLConnection) {
        JarURLConnection jarURLConnection=(JarURLConnection)urlConnection;
        JarResourcePatternResolver patternResolver=JarResourcePatternResolver.getInstance(jarURLConnection);
        subs.addAll(Arrays.asList(patternResolver.getResources(jarPath)));
      }
    }
  }
 catch (  IOException e) {
  }
  removeFolder(subs);
  return subs;
}

Fixed version (ground truth):
/** 
 * 从jar包中搜索资源集合
 * @param dir 相对jar文件路径，如果以'/'开始，自动去除'/'
 * @param jarPath 匹配符，如果没有以'/'开始，自动补上'/'
 * @return
 * @author 黄国庆 2012-5-11 下午3:26:51
 */
private static List<Resource> getSubResourcesForJar(String dir,String jarPath){
  List<Resource> subs=new ArrayList<Resource>();
  try {
    if (dir.startsWith("String_Node_Str")) {
      dir=dir.substring(1);
    }
    Enumeration<URL> dirs=classLoader.getResources(dir);
    while (dirs.hasMoreElements()) {
      URL url=dirs.nextElement();
      URLConnection urlConnection=url.openConnection();
      if (urlConnection instanceof JarURLConnection) {
        JarURLConnection jarURLConnection=(JarURLConnection)urlConnection;
        JarResourcePatternResolver patternResolver=JarResourcePatternResolver.getInstance(jarURLConnection);
        subs.addAll(Arrays.asList(patternResolver.getResources(jarPath)));
      }
    }
  }
 catch (  IOException e) {
  }
  removeFolder(subs);
  return subs;
}
Program: 178942
Project: 178942
Buggy source:
/** 
 * Test method for   {@link org.webframe.support.util.ResourceUtils#getUrls(java.lang.String)}.
 * @throws IOException 
 */
@Test public void testGetUrls() throws IOException {
  List<URL> lists=ResourceUtils.getUrls("String_Node_Str");
  Assert.assertEquals("String_Node_Str",1,lists.size());
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.webframe.support.util.ResourceUtils#getUrls(java.lang.String)}.
 * @throws IOException
 */
@Test public void testGetUrls() throws IOException {
  List<URL> lists=ResourceUtils.getUrls("String_Node_Str");
  Assert.assertEquals("String_Node_Str",1,lists.size());
}
Program: 178943
Project: 178943
Buggy source:
/** 
 * Test method for   {@link org.webframe.support.util.ResourceUtils#getSubResources(java.lang.String,java.lang.String,boolean)}.
 */
@Test public void testGetSubResources() throws IOException {
  String rootPath=ClassUtils.getClassesRootResource(ResourceUtils.class).getFile().getAbsolutePath();
  String path="String_Node_Str";
  Resource[] resources=ResourceUtils.getSubResources(rootPath,path,true);
  Assert.assertEquals("String_Node_Str",resources.length,ResourceUtils.getSubs(rootPath,path,true).length);
  System.out.println(path + "String_Node_Str" + resources.length);
  for (  Resource resource : resources) {
    System.out.println("String_Node_Str" + resource);
  }
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.webframe.support.util.ResourceUtils#getSubResources(java.lang.String,java.lang.String,boolean)}.
 */
@Test public void testGetSubResources() throws IOException {
  String rootPath=ResourceUtils.getAbsolutePath(ClassUtils.getClassesRootResource(ResourceUtils.class));
  String path="String_Node_Str";
  Resource[] resources=ResourceUtils.getSubResources(rootPath,path,true);
  Assert.assertEquals("String_Node_Str",resources.length,ResourceUtils.getSubs(rootPath,path,true).length);
  System.out.println(path + "String_Node_Str" + resources.length);
  for (  Resource resource : resources) {
    System.out.println("String_Node_Str" + resource);
  }
}
Program: 178944
Project: 178944
Buggy source:
/** 
 * Test method for  {@link org.webframe.support.util.ResourceUtils#getSubs(java.lang.String,java.lang.String,boolean)}.
 * @throws IOException
 */
@Test public void testGetSubs() throws IOException {
  String rootPath=ClassUtils.getClassesRootResource(ResourceUtils.class).getFile().getAbsolutePath();
  String path="String_Node_Str";
  String[] subs=ResourceUtils.getSubs(rootPath,path,true);
  Assert.assertEquals("String_Node_Str",subs.length,ResourceUtils.getSubResources(rootPath,path,true).length);
  System.out.println(path + "String_Node_Str" + subs.length);
  for (  String sub : subs) {
    System.out.println("String_Node_Str" + sub);
  }
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.webframe.support.util.ResourceUtils#getSubs(java.lang.String,java.lang.String,boolean)}.
 * @throws IOException
 */
@Test public void testGetSubs() throws IOException {
  String rootPath=ResourceUtils.getAbsolutePath(ClassUtils.getClassesRootResource(ResourceUtils.class)) + "String_Node_Str";
  String path="String_Node_Str";
  String[] subs=ResourceUtils.getSubs(rootPath,path,true);
  Assert.assertEquals("String_Node_Str",subs.length,ResourceUtils.getSubResources(rootPath,path,true).length);
  System.out.println(path + "String_Node_Str" + subs.length);
  for (  String sub : subs) {
    System.out.println("String_Node_Str" + sub);
  }
}
Program: 178945
Project: 178945
Buggy source:
/** 
 * Test method for   {@link org.webframe.support.util.StringUtils#getPatternRoot(java.lang.String)}.
 */
@Test public void testGetPatternRoot(){
  String[] strs={"String_Node_Str","String_Node_Str","String_Node_Str"};
  System.out.println("String_Node_Str");
  for (  String string : strs) {
    System.out.println(StringUtils.getPatternRoot(string));
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.webframe.support.util.StringUtils#getPatternRoot(java.lang.String)}.
 */
@Test public void testGetPatternRoot(){
  String[] strs={"String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String string : strs) {
    System.out.println("String_Node_Str" + string + "String_Node_Str"+ StringUtils.getPatternRoot(string));
  }
}
Program: 178946
Project: 178946
Buggy source:
/** 
 * Test method for   {@link org.webframe.support.util.StringUtils#getFileDirectory(java.lang.String)}.
 */
@Test public void testGetFileDirectory(){
  String[] strs={"String_Node_Str","String_Node_Str","String_Node_Str"};
  System.out.println("String_Node_Str");
  for (  String string : strs) {
    System.out.println(StringUtils.getFileDirectory(string));
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.webframe.support.util.StringUtils#getFileDirectory(java.lang.String)}.
 */
@Test public void testGetFileDirectory(){
  String[] strs={"String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String string : strs) {
    System.out.println("String_Node_Str" + string + "String_Node_Str"+ StringUtils.getFileDirectory(string));
  }
}
Program: 178947
Project: 178947
Buggy source:
/** 
 * Test method for   {@link org.webframe.support.util.StringUtils#getArtifactId(java.lang.String)}.
 */
@Test public void testGetArtifactId(){
  String[] strs={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  System.out.println("String_Node_Str");
  for (  String string : strs) {
    System.out.println(StringUtils.getArtifactId(string));
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.webframe.support.util.StringUtils#getArtifactId(java.lang.String)}.
 */
@Test public void testGetArtifactId(){
  String[] strs={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String string : strs) {
    System.out.println("String_Node_Str" + string + "String_Node_Str"+ StringUtils.getArtifactId(string));
  }
}
Program: 178948
Project: 178948
Buggy source:
public Set<String> getEntryFilesByDir(String directory){
  if (directory == null)   return null;
  return entryFilesPathMap.get(resolveJarEntryPath(directory));
}

Fixed version (ground truth):
public Set<String> getEntryFilesByDir(String directory,PathMatcher matcher){
  if (directory == null)   return null;
  String pattern=resolveJarEntryPath(directory);
  if (!matcher.isPattern(pattern))   return entryFilesPathMap.get(pattern);
  Set<String> matches=new HashSet<String>();
  for (  String key : entryFilesPathMap.keySet()) {
    if (matcher.match(pattern,key)) {
      matches.addAll(entryFilesPathMap.get(key));
    }
  }
  return matches;
}
Program: 178949
Project: 178949
Buggy source:
public Set<String> getEntryFilesByDir(String directory){
  return jarResource.getEntryFilesByDir(directory);
}

Fixed version (ground truth):
public Set<String> getEntryFilesByDir(String directory,PathMatcher matcher){
  return jarResource.getEntryFilesByDir(directory,matcher);
}
Program: 178950
Project: 178950
Buggy source:
protected Resource[] findPathMatchingJarResources(String locationPattern){
  List<Resource> result=new ArrayList<Resource>(16);
  JarResourceLoader jarResourceLoader=(JarResourceLoader)getResourceLoader();
  String directory=StringUtils.getFileDirectory(locationPattern);
  Set<String> entriesPath=jarResourceLoader.getEntryFilesByDir(directory);
  if (entriesPath == null)   return result.toArray(new Resource[result.size()]);
  for (  String entryPath : entriesPath) {
    String path="String_Node_Str" + entryPath;
    if (getPathMatcher().match(locationPattern,path)) {
      Resource resource=getResource(path);
      if (resource == null)       continue;
      result.add(resource);
    }
  }
  return result.toArray(new Resource[result.size()]);
}

Fixed version (ground truth):
protected Resource[] findPathMatchingJarResources(String locationPattern){
  List<Resource> result=new ArrayList<Resource>(16);
  JarResourceLoader jarResourceLoader=(JarResourceLoader)getResourceLoader();
  String directory=StringUtils.getFileDirectory(locationPattern);
  Set<String> entriesPath=jarResourceLoader.getEntryFilesByDir(directory,getPathMatcher());
  if (entriesPath == null)   return result.toArray(new Resource[result.size()]);
  for (  String entryPath : entriesPath) {
    String path="String_Node_Str" + entryPath;
    if (getPathMatcher().match(locationPattern,path)) {
      Resource resource=getResource(path);
      if (resource == null)       continue;
      result.add(resource);
    }
  }
  return result.toArray(new Resource[result.size()]);
}
Program: 178951
Project: 178951
Buggy source:
/** 
 * Test method for  {@link org.webframe.support.driver.resource.jar.JarResourcePatternResolver#getResources(java.lang.String)}.
 */
@Test public void testGetResourcesString(){
  try {
    JarResourcePatternResolver resolver=new JarResourcePatternResolver(getClass());
    Resource resource=resolver.getResource("String_Node_Str");
    Assert.assertTrue("String_Node_Str",resource instanceof FileSystemResource);
    resolver=new JarResourcePatternResolver(Test.class);
    resource=resolver.getResource("String_Node_Str");
    Assert.assertTrue("String_Node_Str",resource.exists());
    Assert.assertTrue("String_Node_Str",resource instanceof JarResource);
    Resource[] resources=resolver.getResources("String_Node_Str");
    Assert.assertEquals("String_Node_Str",12,resources.length);
  }
 catch (  IOException e) {
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.webframe.support.driver.resource.jar.JarResourcePatternResolver#getResources(java.lang.String)}.
 */
@Test public void testGetResourcesString(){
  try {
    JarResourcePatternResolver resolver=new JarResourcePatternResolver(getClass());
    Resource resource=resolver.getResource("String_Node_Str");
    Assert.assertTrue("String_Node_Str",resource instanceof FileSystemResource);
    resolver=new JarResourcePatternResolver(Test.class);
    resource=resolver.getResource("String_Node_Str");
    Assert.assertTrue("String_Node_Str",resource.exists());
    Assert.assertTrue("String_Node_Str",resource instanceof JarResource);
    Resource[] resources=resolver.getResources("String_Node_Str");
    Assert.assertEquals("String_Node_Str",12,resources.length);
    resolver=new JarResourcePatternResolver(ClassUtils.class);
    resources=resolver.getResources("String_Node_Str");
    Assert.assertEquals("String_Node_Str",92,resources.length);
    SystemLogUtils.println("String_Node_Str" + resources.length + "String_Node_Str");
  }
 catch (  IOException e) {
    Assert.fail(e.getMessage());
  }
}
Program: 178952
Project: 178952
Buggy source:
public NettyRpcClient(final InetSocketAddress remoteAddress,final Map<Class<?>,Object> implementations,final ExceptionListener[] listeners,final ClassResolver classResolver,final long keepalivePeriod){
  this.implementations=implementations;
  this.listeners=listeners;
  this.classResolver=classResolver;
  bootstrap=new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool()));
  bootstrap.setPipelineFactory(new ChannelPipelineFactory(){
    public ChannelPipeline getPipeline() throws Exception {
      return Channels.pipeline(new ObjectEncoder(),new ObjectDecoder(classResolver),new RpcHandler());
    }
  }
);
  final ChannelFuture future=bootstrap.connect(remoteAddress);
  channel=future.awaitUninterruptibly().getChannel();
  if (!future.isSuccess()) {
    bootstrap.releaseExternalResources();
    throw new TransportException("String_Node_Str" + remoteAddress,future.getCause());
  }
  latch=new CountDownLatch(1);
  channel.write(new HandshakeFromClient(foldClassesToStrings(implementations.keySet())));
  try {
    latch.await();
  }
 catch (  InterruptedException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  keepAliveTimer=new KeepAliveTimer(Collections.singleton(remote),keepalivePeriod);
}

Fixed version (ground truth):
public NettyRpcClient(final InetSocketAddress remoteAddress,final Map<Class<?>,Object> implementations,final ExceptionListener[] listeners,final ClassResolver classResolver,final long keepalivePeriod){
  this.implementations=implementations;
  this.listeners=listeners;
  this.classResolver=classResolver;
  bootstrap=new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool()));
  bootstrap.setPipelineFactory(new ChannelPipelineFactory(){
    public ChannelPipeline getPipeline() throws Exception {
      return Channels.pipeline(new ObjectEncoder(),new ObjectDecoder(classResolver),new RpcHandler());
    }
  }
);
  final ChannelFuture future=bootstrap.connect(remoteAddress);
  channel=future.awaitUninterruptibly().getChannel();
  if (!future.isSuccess()) {
    bootstrap.releaseExternalResources();
    throw new TransportException("String_Node_Str" + remoteAddress,future.getCause());
  }
  latch=new CountDownLatch(1);
  channel.write(new HandshakeFromClient(foldClassesToStrings(new ArrayList<Class<?>>(implementations.keySet()))));
  try {
    latch.await();
  }
 catch (  InterruptedException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  keepAliveTimer=new KeepAliveTimer(Collections.singleton(remote),keepalivePeriod);
}
Program: 178953
Project: 178953
Buggy source:
@Override public void acceptHandshakeFromServer(HandshakeFromServer msg){
  try {
    remote=new NettyRemote(channel,msg.clientId,unfoldStringToClasses(classResolver,msg.classNames));
  }
 catch (  ClassNotFoundException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    latch.countDown();
  }
}

Fixed version (ground truth):
@Override public void acceptHandshakeFromServer(HandshakeFromServer msg){
  try {
    remote=new NettyRemote(channel,msg.clientId,new HashSet<Class<?>>(unfoldStringToClasses(classResolver,msg.classNames)));
  }
 catch (  ClassNotFoundException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    latch.countDown();
  }
}
Program: 178954
Project: 178954
Buggy source:
@Override public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  channel.write(new InvocationRequest(method.getDeclaringClass().getName(),method.getName(),toSerializable(args),foldClassesToStrings(new HashSet<Class<?>>(Arrays.asList(method.getParameterTypes())))));
  return null;
}

Fixed version (ground truth):
@Override public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  channel.write(new InvocationRequest(method.getDeclaringClass().getName(),method.getName(),toSerializable(args),foldClassesToStrings(Arrays.asList(method.getParameterTypes()))));
  return null;
}
Program: 178955
Project: 178955
Buggy source:
public static String[] foldClassesToStrings(Set<Class<?>> classes){
  String[] result=new String[classes.size()];
  int i=0;
  for (  Class<?> clazz : classes) {
    result[i++]=clazz.getName();
  }
  return result;
}

Fixed version (ground truth):
public static String[] foldClassesToStrings(List<Class<?>> classes){
  String[] result=new String[classes.size()];
  int i=0;
  for (  Class<?> clazz : classes) {
    result[i++]=clazz.getName();
  }
  return result;
}
Program: 178956
Project: 178956
Buggy source:
public static Set<Class<?>> unfoldStringToClasses(ClassResolver classResolver,String[] classNames) throws ClassNotFoundException {
  Set<Class<?>> result=new HashSet<Class<?>>(classNames.length);
  for (  String name : classNames) {
    result.add(classResolver.resolve(name));
  }
  return result;
}

Fixed version (ground truth):
public static List<Class<?>> unfoldStringToClasses(ClassResolver classResolver,String[] classNames) throws ClassNotFoundException {
  List<Class<?>> result=new ArrayList<Class<?>>(classNames.length);
  for (  String name : classNames) {
    result.add(classResolver.resolve(name));
  }
  return result;
}
Program: 178957
Project: 178957
Buggy source:
@Override public void acceptHandshakeFromClient(HandshakeFromClient msg){
  try {
    remote=new NettyRemote(channel,new NettyId(channel.getId()),unfoldStringToClasses(classResolver,msg.classNames));
    channel.write(new HandshakeFromServer(remote.getId(),foldClassesToStrings(implementations.keySet())));
    clients.addClient(remote);
    fireClientConnect(remote);
  }
 catch (  ClassNotFoundException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void acceptHandshakeFromClient(HandshakeFromClient msg){
  try {
    remote=new NettyRemote(channel,new NettyId(channel.getId()),new HashSet<Class<?>>(unfoldStringToClasses(classResolver,msg.classNames)));
    channel.write(new HandshakeFromServer(remote.getId(),foldClassesToStrings(new ArrayList<Class<?>>(implementations.keySet()))));
    clients.addClient(remote);
    fireClientConnect(remote);
  }
 catch (  ClassNotFoundException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 178958
Project: 178958
Buggy source:
@Test public void buildersCreateClientAndServerWhichCanTalk() throws Exception {
  final ServerRemote mock=mockery.mock(ServerRemote.class);
  mockery.checking(new Expectations(){
{
      one(mock).call();
    }
  }
);
  final NettyRpcServerBuilder serverBuilder=new NettyRpcServerBuilder(Config.BIND_ADDRESS);
  final NettyRpcClientBuilder clientBuilder=new NettyRpcClientBuilder(Config.BIND_ADDRESS);
  RpcServer server=serverBuilder.setClassResolver(ClassResolvers.cacheDisabled(this.getClass().getClassLoader())).addObject(ServerRemote.class,mock).setKeepAlive(50l).build();
  RpcClient client=clientBuilder.setClassResolver(ClassResolvers.cacheDisabled(this.getClass().getClassLoader())).setKeepAlive(50l).build();
  try {
    ServerRemote proxy=client.getRemote().getProxy(ServerRemote.class);
    proxy.call();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void buildersCreateClientAndServerWhichCanTalk() throws Exception {
  final ServerRemote mock=mockery.mock(ServerRemote.class);
  mockery.checking(new Expectations(){
{
      one(mock).call();
    }
  }
);
  final NettyRpcServerBuilder serverBuilder=new NettyRpcServerBuilder(Config.BIND_ADDRESS);
  final NettyRpcClientBuilder clientBuilder=new NettyRpcClientBuilder(Config.BIND_ADDRESS);
  RpcServer server=serverBuilder.addObject(ServerRemote.class,mock).setKeepAlive(50l).build();
  RpcClient client=clientBuilder.setKeepAlive(50l).build();
  try {
    ServerRemote proxy=client.getRemote().getProxy(ServerRemote.class);
    proxy.call();
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}
Program: 178959
Project: 178959
Buggy source:
@Test(timeout=Config.TIMEOUT) public void choosesOverloadedMethodByCompileTimeTypesAsOpposedToRuntimeTypes() throws Exception {
  final OverloadedString impl=mockery.mock(OverloadedString.class);
  final String s="String_Node_Str";
  mockery.checking(new Expectations(){
{
      one(impl).go(with(any(Serializable.class)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(OverloadedString.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final OverloadedString proxy=client.getRemote().getProxy(OverloadedString.class);
  try {
    proxy.go((Serializable)s);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}

Fixed version (ground truth):
@Test(timeout=TIMEOUT) public void choosesOverloadedMethodByCompileTimeTypesAsOpposedToRuntimeTypes() throws Exception {
  final OverloadedString impl=mockery.mock(OverloadedString.class);
  final String s="String_Node_Str";
  mockery.checking(new Expectations(){
{
      one(impl).go(with(any(Serializable.class)));
    }
  }
);
  final RpcServer server=new NettyRpcServerBuilder(BIND_ADDRESS).addObject(OverloadedString.class,impl).build();
  final RpcClient client=new NettyRpcClientBuilder(BIND_ADDRESS).build();
  final OverloadedString proxy=client.getRemote().getProxy(OverloadedString.class);
  try {
    proxy.go((Serializable)s);
    giveTimeForMessagesToBeProcessed();
  }
  finally {
    client.shutdown();
    server.shutdown();
  }
}