nus-yam/ex-repair huggingface dataset:
Program: 8455
Project: 8455
Buggy source:
/** 
 * This test demonstrates how to use SeLion for running tests against ANDROID browser using appium. <ul> <li> An appium instance/server should be installed and running where selenium host and port should be  pointed to this instance.</li> <li> For setting up Appium Android refer http://appium.io/slate/en/master/?ruby#system-setup-(android) </li> </ul> 
 */
@Test @MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") public void testWithBrowser(){
  RemoteWebDriver driver=Grid.driver();
  assertNotNull(driver);
  driver.get("String_Node_Str");
  WebElement element=driver.findElement(By.name("String_Node_Str"));
  element.sendKeys("String_Node_Str");
  element.submit();
  MobileReporter.log("String_Node_Str",true);
}

Fixed version (ground truth):
/** 
 * This test demonstrates how to use SeLion for running tests against ANDROID browser using appium. <ul> <li> An appium instance/server should be installed and running where selenium host and port should be  pointed to this instance.</li> <li> For setting up Appium Android refer http://appium.io/slate/en/master/?ruby#system-setup-(android) </li> </ul> 
 */
@Test @MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") public void testWithBrowser(){
  RemoteWebDriver driver=Grid.driver();
  assertNotNull(driver);
  driver.get("String_Node_Str");
  WebElement element=driver.findElement(By.name("String_Node_Str"));
  element.sendKeys("String_Node_Str");
  element.submit();
  SeLionReporter.log("String_Node_Str",true);
}
Program: 8456
Project: 8456
Buggy source:
/** 
 * This test demonstrates how to use SeLion for running tests against IOS safari using appium. <ul> <li> An appium instance/server should be installed and running where selenium host and port should be  configured to the same appium instance.</li>  <li> For setting up Appium iOS refer http://appium.io/slate/en/master/?ruby#system-setup-(ios) </li> </ul>
 */
@Test @MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") public void testWithSafari(){
  RemoteWebDriver driver=Grid.driver();
  assertNotNull(driver);
  driver.get("String_Node_Str");
  WebElement element=driver.findElement(By.name("String_Node_Str"));
  element.sendKeys("String_Node_Str");
  element.submit();
  MobileReporter.log("String_Node_Str",true);
}

Fixed version (ground truth):
/** 
 * This test demonstrates how to use SeLion for running tests against IOS safari using appium. <ul> <li> An appium instance/server should be installed and running where selenium host and port should be  configured to the same appium instance.</li>  <li> For setting up Appium iOS refer http://appium.io/slate/en/master/?ruby#system-setup-(ios) </li> </ul>
 */
@Test @MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") public void testWithSafari(){
  RemoteWebDriver driver=Grid.driver();
  assertNotNull(driver);
  driver.get("String_Node_Str");
  WebElement element=driver.findElement(By.name("String_Node_Str"));
  element.sendKeys("String_Node_Str");
  element.submit();
  SeLionReporter.log("String_Node_Str",true);
}
Program: 8457
Project: 8457
Buggy source:
/** 
 * This test demonstrates how to use SeLion for running tests against a Native IOS app using appium. <ul> <li> An appium instance/server should be locally installed and running and point SeLion to this server using any of the following options.  <ol> <li>Through the JVM arguments -DSELION_SELENIUM_HOST and -DSELION_SELENIUM_PORT </li> (or) <li>Through suite file &lt;parameter name="seleniumhost" value=""/&gt; and &lt;parameter name="seleniumport" value=""/&gt;</li> </ol></li> For setting up Appium iOS refer http://appium.io/slate/en/master/?ruby#system-setup-(ios) </li> <li> The app InternationalMountains.app to be tested should be placed in the  Current Working directory(src/test/resources).</li> </ul>
 */
@MobileTest(appPath="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testWithNativeApp() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Reporter.log(text.getAttribute("String_Node_Str"),true);
}

Fixed version (ground truth):
/** 
 * This test demonstrates how to use SeLion for running tests against a Native IOS app using appium. <ul> <li> An appium instance/server should be locally installed and running and point SeLion to this server using any of the following options.  <ol> <li>Through the JVM arguments -DSELION_SELENIUM_HOST and -DSELION_SELENIUM_PORT </li> (or) <li>Through suite file &lt;parameter name="seleniumhost" value=""/&gt; and &lt;parameter name="seleniumport" value=""/&gt;</li> </ol></li> For setting up Appium iOS refer http://appium.io/slate/en/master/?ruby#system-setup-(ios) </li> <li> The app InternationalMountains.app to be tested should be placed in the  Current Working directory(src/test/resources).</li> </ul>
 */
@MobileTest(appPath="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testWithNativeApp() throws InterruptedException {
  SeLionReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  SeLionReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Reporter.log(text.getAttribute("String_Node_Str"),true);
}
Program: 8458
Project: 8458
Buggy source:
@Test @MobileTest(appPath="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str",additionalCapabilities={"String_Node_Str"}) public void testWithNativeIOSApp() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
}

Fixed version (ground truth):
@Test @MobileTest(appPath="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str",additionalCapabilities={"String_Node_Str"}) public void testWithNativeIOSApp() throws InterruptedException {
  SeLionReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  SeLionReporter.log("String_Node_Str",true);
}
Program: 8459
Project: 8459
Buggy source:
/** 
 * This test demonstrates how to use SeLion for running tests against a Native IOS app using appium. This test case needs an local IOS simulator spawned. 
 */
@MobileTest(appName="String_Node_Str") @Test public void testMethod() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Reporter.log(text.getAttribute("String_Node_Str"),true);
}

Fixed version (ground truth):
/** 
 * This test demonstrates how to use SeLion for running tests against a Native IOS app using appium. This test case needs an local IOS simulator spawned. 
 */
@MobileTest(appName="String_Node_Str") @Test public void testMethod() throws InterruptedException {
  SeLionReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  SeLionReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Reporter.log(text.getAttribute("String_Node_Str"),true);
}
Program: 8460
Project: 8460
Buggy source:
@Override public List<ProcessInfo> potentialProcessToBeKilled() throws ProcessHandlerException {
  try {
    int ourProcessPID=CLibrary.INSTANCE.getpid();
    String cmd=String.format("String_Node_Str",Integer.toString(ourProcessPID),DELIMITER);
    return getProcessInfo(new String[]{"String_Node_Str","String_Node_Str",cmd},DELIMITER,OSPlatform.NONWINDOWS);
  }
 catch (  IOException|InterruptedException e) {
    throw new ProcessHandlerException(e);
  }
}

Fixed version (ground truth):
@Override public List<ProcessInfo> potentialProcessToBeKilled() throws ProcessHandlerException {
  int ourProcessPID=getCurrentProcessID();
  String cmd=String.format("String_Node_Str",Integer.toString(ourProcessPID),DELIMITER);
  try {
    return getProcessInfo(new String[]{"String_Node_Str","String_Node_Str",cmd},DELIMITER,OSPlatform.NONWINDOWS);
  }
 catch (  IOException|InterruptedException e) {
    throw new ProcessHandlerException(e);
  }
}
Program: 8461
Project: 8461
Buggy source:
@Override public List<ProcessInfo> potentialProcessToBeKilled() throws ProcessHandlerException {
  int ourPid=Kernel32.INSTANCE.GetCurrentProcessId();
  String cmd=String.format("String_Node_Str",String.valueOf(ourPid));
  try {
    return super.getProcessInfo(new String[]{"String_Node_Str","String_Node_Str",cmd},DELIMITER,OSPlatform.WINDOWS);
  }
 catch (  IOException|InterruptedException e) {
    throw new ProcessHandlerException(e);
  }
}

Fixed version (ground truth):
@Override public List<ProcessInfo> potentialProcessToBeKilled() throws ProcessHandlerException {
  int ourPid=getCurrentProcessID();
  String cmd=String.format("String_Node_Str",String.valueOf(ourPid));
  try {
    return super.getProcessInfo(new String[]{"String_Node_Str","String_Node_Str",cmd},DELIMITER,OSPlatform.WINDOWS);
  }
 catch (  IOException|InterruptedException e) {
    throw new ProcessHandlerException(e);
  }
}
Program: 8462
Project: 8462
Buggy source:
public void boot(AbstractTestSession testSession){
  logger.entering(testSession.getPlatform());
  if (testSession instanceof MobileTestSession && ((MobileTestSession)testSession).getMobileNodeType() != MobileNodeType.IOS_DRIVER) {
    return;
  }
  if (isRunning) {
    logger.exiting();
    return;
  }
  String host="String_Node_Str";
  String hubPort=Config.getConfigProperty(ConfigProperty.SELENIUM_PORT);
  String registrationUrl=String.format("String_Node_Str",host,hubPort);
  try {
    int port=new LocalGridConfigFileParser().getPort() + 1;
    startIOSDriverNode(port);
    waitForNodeToComeUp(port,"String_Node_Str");
    isRunning=true;
    logger.log(Level.INFO,"String_Node_Str" + registrationUrl);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw new GridException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void boot(AbstractTestSession testSession){
  logger.entering(testSession.getPlatform());
  if ((testSession.getPlatform() != WebDriverPlatform.IOS) && !(testSession instanceof MobileTestSession)) {
    return;
  }
  if (((MobileTestSession)testSession).getMobileNodeType() != MobileNodeType.IOS_DRIVER) {
    return;
  }
  if (isRunning) {
    logger.exiting();
    return;
  }
  String host="String_Node_Str";
  String hubPort=Config.getConfigProperty(ConfigProperty.SELENIUM_PORT);
  String registrationUrl=String.format("String_Node_Str",host,hubPort);
  try {
    int port=new LocalGridConfigFileParser().getPort() + 1;
    startIOSDriverNode(port);
    waitForNodeToComeUp(port,"String_Node_Str");
    isRunning=true;
    logger.log(Level.INFO,"String_Node_Str" + registrationUrl);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw new GridException("String_Node_Str",e);
  }
}
Program: 8463
Project: 8463
Buggy source:
@Override public void boot(AbstractTestSession testSession){
  logger.entering(testSession.getPlatform());
  if (testSession instanceof MobileTestSession && ((MobileTestSession)testSession).getMobileNodeType() != MobileNodeType.SELENDROID) {
    return;
  }
  if (isRunning) {
    logger.exiting();
    return;
  }
  String host="String_Node_Str";
  String hubPort=Config.getConfigProperty(ConfigProperty.SELENIUM_PORT);
  String registrationUrl=String.format("String_Node_Str",host,hubPort);
  try {
    int port=new LocalGridConfigFileParser().getPort() + 2;
    startSelendroidDriverNode(port);
    waitForNodeToComeUp(port,"String_Node_Str");
    isRunning=true;
    logger.log(Level.INFO,"String_Node_Str" + registrationUrl);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw new GridException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void boot(AbstractTestSession testSession){
  logger.entering(testSession.getPlatform());
  if ((testSession.getPlatform() != WebDriverPlatform.ANDROID) && !(testSession instanceof MobileTestSession)) {
    return;
  }
  if (((MobileTestSession)testSession).getMobileNodeType() != MobileNodeType.SELENDROID) {
    return;
  }
  if (isRunning) {
    logger.exiting();
    return;
  }
  String host="String_Node_Str";
  String hubPort=Config.getConfigProperty(ConfigProperty.SELENIUM_PORT);
  String registrationUrl=String.format("String_Node_Str",host,hubPort);
  try {
    int port=new LocalGridConfigFileParser().getPort() + 2;
    startSelendroidDriverNode(port);
    waitForNodeToComeUp(port,"String_Node_Str");
    isRunning=true;
    logger.log(Level.INFO,"String_Node_Str" + registrationUrl);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
    throw new GridException("String_Node_Str",e);
  }
}
Program: 8464
Project: 8464
Buggy source:
private DesiredCapabilities appendSauceLabsCredentials(DesiredCapabilities caps){
  logger.entering(caps);
  String sauceUserName=Config.getConfigProperty(ConfigProperty.SAUCELAB_USER_NAME);
  String sauceApiKey=Config.getConfigProperty(ConfigProperty.SAUCELAB_API_KEY);
  String tunnelUserId=Config.getConfigProperty(ConfigProperty.TUNNEL_USER_ID);
  if (sauceUserName != null && sauceApiKey != null) {
    caps.setCapability(USER_NAME,sauceUserName);
    caps.setCapability(ACCESS_KEY,sauceApiKey);
    caps.setCapability(PARENT_TUNNEL,tunnelUserId);
  }
  logger.exiting(caps);
  return caps;
}

Fixed version (ground truth):
private DesiredCapabilities appendSauceLabsCredentials(DesiredCapabilities caps){
  logger.entering(caps);
  String sauceUserName=Config.getConfigProperty(ConfigProperty.SAUCELAB_USER_NAME);
  String sauceApiKey=Config.getConfigProperty(ConfigProperty.SAUCELAB_API_KEY);
  String tunnelUserId=Config.getConfigProperty(ConfigProperty.SAUCELAB_TUNNEL_USER_ID);
  if (sauceUserName != null && sauceApiKey != null) {
    caps.setCapability(USER_NAME,sauceUserName);
    caps.setCapability(ACCESS_KEY,sauceApiKey);
    caps.setCapability(PARENT_TUNNEL,tunnelUserId);
  }
  logger.exiting(caps);
  return caps;
}
Program: 8465
Project: 8465
Buggy source:
@Override public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities){
  MobileTestSession mobileSession=Grid.getMobileTestSession();
  capabilities=SelendroidCapabilities.android();
  capabilities.setBrowserName(SELENDROID);
  capabilities.setCapability(MOBILE_NODE_TYPE,SELENDROID);
  capabilities.setCapability(SelendroidCapabilities.AUT,mobileSession.getAppName());
  capabilities.setCapability(SelendroidCapabilities.LOCALE,mobileSession.getAppLocale());
  if (StringUtils.isNotBlank(mobileSession.getDeviceType())) {
    capabilities.setCapability(SelendroidCapabilities.MODEL,mobileSession.getDeviceType());
  }
  if (StringUtils.isNotBlank(mobileSession.getPlatformVersion())) {
    capabilities.setCapability(SelendroidCapabilities.PLATFORM_VERSION,mobileSession.getPlatformVersion());
  }
  if (StringUtils.isNotBlank(mobileSession.getdeviceSerial())) {
    capabilities.setCapability(SelendroidCapabilities.SERIAL,mobileSession.getdeviceSerial());
  }
  return capabilities;
}

Fixed version (ground truth):
@Override public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities){
  MobileTestSession mobileSession=Grid.getMobileTestSession();
  capabilities=SelendroidCapabilities.android();
  if ((new File(mobileSession.getAppLocation()).exists()) && ((new File(mobileSession.getAppLocation() + File.separator + mobileSession.getAppName())).exists())) {
    capabilities.setBrowserName(SELENDROID);
  }
 else {
    capabilities.setBrowserName(ANDROID);
  }
  capabilities.setCapability(MOBILE_NODE_TYPE,SELENDROID);
  capabilities.setCapability(SelendroidCapabilities.AUT,mobileSession.getAppName());
  capabilities.setCapability(SelendroidCapabilities.LOCALE,mobileSession.getAppLocale());
  if (StringUtils.isNotBlank(mobileSession.getDeviceType())) {
    capabilities.setCapability(SelendroidCapabilities.MODEL,mobileSession.getDeviceType());
  }
  if (StringUtils.isNotBlank(mobileSession.getPlatformVersion())) {
    capabilities.setCapability(SelendroidCapabilities.PLATFORM_VERSION,mobileSession.getPlatformVersion());
  }
  if (StringUtils.isNotBlank(mobileSession.getdeviceSerial())) {
    capabilities.setCapability(SelendroidCapabilities.SERIAL,mobileSession.getdeviceSerial());
  }
  return capabilities;
}
Program: 8466
Project: 8466
Buggy source:
@MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testIOSDefaultsIphone6() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
}

Fixed version (ground truth):
@MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testIOSDefaultsIphone6() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Assert.assertNotNull(text.getAttribute("String_Node_Str"));
}
Program: 8467
Project: 8467
Buggy source:
@MobileTest(appName="String_Node_Str",device="String_Node_Str") @Test public void testIOSDefaults() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
}

Fixed version (ground truth):
@MobileTest(appName="String_Node_Str",device="String_Node_Str") @Test public void testIOSDefaults() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Assert.assertNotNull(text.getAttribute("String_Node_Str"));
}
Program: 8468
Project: 8468
Buggy source:
@MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testSDKDeviceVariation4s() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
}

Fixed version (ground truth):
@MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testSDKDeviceVariation4s() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Assert.assertNotNull(text.getAttribute("String_Node_Str"));
}
Program: 8469
Project: 8469
Buggy source:
@MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testSDKDeviceVariation5s() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
}

Fixed version (ground truth):
@MobileTest(appName="String_Node_Str",device="String_Node_Str",deviceType="String_Node_Str") @Test public void testSDKDeviceVariation5s() throws InterruptedException {
  MobileReporter.log("String_Node_Str",true);
  List<WebElement> cells=Grid.driver().findElements(By.className("String_Node_Str"));
  Assert.assertEquals(9,cells.size());
  WebElement first=cells.get(0);
  first.click();
  Thread.sleep(10 * 1000);
  MobileReporter.log("String_Node_Str",true);
  By selector=By.xpath("String_Node_Str");
  WebElement text=Grid.driver().findElement(selector);
  Assert.assertNotNull(text.getAttribute("String_Node_Str"));
}
Program: 8470
Project: 8470
Buggy source:
@Test(groups={"String_Node_Str"}) public void testlocalGridManagerStartHub() throws MalformedURLException, IOException, JSONException {
  String runLocally=Config.getConfigProperty(ConfigProperty.SELENIUM_RUN_LOCALLY);
  Config.setConfigProperty(ConfigProperty.SELENIUM_RUN_LOCALLY,"String_Node_Str");
  AbstractTestSession testSession=new AbstractTestSession(){
    @Override public SeLionSession startSession(    Map<String,SeLionSession> sessions){
      return null;
    }
    @Override public SeLionSession startSesion(){
      return null;
    }
    @Override public void initializeTestSession(    InvokedMethodInformation method){
    }
    @Override public void initializeTestSession(    InvokedMethodInformation method,    Map<String,SeLionSession> sessionMap){
    }
    @Override public WebDriverPlatform getPlatform(){
      return WebDriverPlatform.WEB;
    }
    @Override public void closeCurrentSession(    Map<String,SeLionSession> sessionMap,    InvokedMethodInformation result){
    }
    @Override public void closeAllSessions(    Map<String,SeLionSession> sessionMap){
    }
  }
;
  String msg="String_Node_Str";
  try {
    LocalGridManager.spawnLocalHub(testSession);
    assertTrue(getHubStatus(),"String_Node_Str");
    JSONObject nodeStatus=getNodeStatus();
    assertNotNull(nodeStatus,"String_Node_Str");
    assertTrue(nodeStatus.getBoolean("String_Node_Str"),"String_Node_Str");
    assertTrue(nodeStatus.getString("String_Node_Str").contains(msg),"String_Node_Str");
  }
  finally {
    LocalGridManager.shutDownHub();
    Config.setConfigProperty(ConfigProperty.SELENIUM_RUN_LOCALLY,runLocally);
    assertFalse(getHubStatus(),"String_Node_Str");
  }
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testlocalGridManagerStartHub() throws MalformedURLException, IOException, JSONException {
  String runLocally=Config.getConfigProperty(ConfigProperty.SELENIUM_RUN_LOCALLY);
  Config.setConfigProperty(ConfigProperty.SELENIUM_RUN_LOCALLY,"String_Node_Str");
  String msg="String_Node_Str";
  try {
    WebTestSession testSession=new WebTestSession();
    LocalGridManager.spawnLocalHub(testSession);
    assertTrue(getHubStatus(),"String_Node_Str");
    JSONObject nodeStatus=getNodeStatus();
    assertNotNull(nodeStatus,"String_Node_Str");
    assertTrue(nodeStatus.getBoolean("String_Node_Str"),"String_Node_Str");
    assertTrue(nodeStatus.getString("String_Node_Str").contains(msg),"String_Node_Str");
  }
  finally {
    LocalGridManager.shutDownHub();
    Config.setConfigProperty(ConfigProperty.SELENIUM_RUN_LOCALLY,runLocally);
    assertFalse(getHubStatus(),"String_Node_Str");
  }
}
Program: 8472
Project: 8472
Buggy source:
/** 
 * A utility method to provide additional information to the user when a NoSuchElementException is thrown.
 * @param cause The associated cause for the exception.
 */
private void addInfoForNoSuchElementException(NoSuchElementException cause){
  if (parent == null) {
    throw cause;
  }
  BasicPageImpl page=this.parent.getCurrentPage();
  if (page == null) {
    throw cause;
  }
  String resolvedPageName=page.getClass().getSimpleName();
  boolean pageExists=page.hasExpectedPageTitle();
  if (!pageExists) {
    throw new ParentNotFoundException(resolvedPageName + "String_Node_Str" + page.getActualPageTitle()+ "String_Node_Str",cause);
  }
  StringBuilder msg=new StringBuilder("String_Node_Str");
  if (this.controlName != null) {
    msg.append(this.controlName).append("String_Node_Str");
  }
  if (resolvedPageName != null) {
    msg.append(resolvedPageName);
  }
  msg.append("String_Node_Str").append(locator).append("String_Node_Str");
  throw new NoSuchElementException(msg.toString(),cause);
}

Fixed version (ground truth):
/** 
 * A utility method to provide additional information to the user when a NoSuchElementException is thrown.
 * @param cause The associated cause for the exception.
 */
private void addInfoForNoSuchElementException(NoSuchElementException cause){
  if (parent == null) {
    throw cause;
  }
  BasicPageImpl page=this.parent.getCurrentPage();
  if (page == null) {
    throw cause;
  }
  String resolvedPageName=page.getClass().getSimpleName();
  boolean pageExists=false;
  try {
    pageExists=page.hasExpectedPageTitle();
  }
 catch (  PageYamlException ex) {
  }
  if (!pageExists) {
    throw new ParentNotFoundException(resolvedPageName + "String_Node_Str" + page.getActualPageTitle()+ "String_Node_Str",cause);
  }
  StringBuilder msg=new StringBuilder("String_Node_Str");
  if (this.controlName != null) {
    msg.append(this.controlName).append("String_Node_Str");
  }
  if (resolvedPageName != null) {
    msg.append(resolvedPageName);
  }
  msg.append("String_Node_Str").append(locator).append("String_Node_Str");
  throw new NoSuchElementException(msg.toString(),cause);
}
Program: 8473
Project: 8473
Buggy source:
/** 
 * Validates whether the actual current page title equals to expected page title.
 * @return true if the actual page title is equal to any of the titles represented by this page object otherwisereturns false
 */
public boolean hasExpectedPageTitle(){
  List<String> pageTitles=Arrays.asList(getPage().pageTitle.split("String_Node_Str"));
  for (  String title : pageTitles) {
    if (RegexUtils.wildCardMatch(getPage().getActualPageTitle(),title)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Validates whether the actual current page title equals to expected page title.
 * @return true if the actual page title is equal to any of the titles represented by this page object otherwisereturns false
 */
public boolean hasExpectedPageTitle(){
  if (getPage().pageTitle == null) {
    throw new PageYamlException(getPage().getClass().getName() + "String_Node_Str");
  }
  List<String> pageTitles=Arrays.asList(getPage().pageTitle.split("String_Node_Str"));
  for (  String title : pageTitles) {
    if (RegexUtils.wildCardMatch(getPage().getActualPageTitle(),title)) {
      return true;
    }
  }
  return false;
}
Program: 8474
Project: 8474
Buggy source:
/** 
 * Waits until element is present on the DOM of a page and visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0.
 * @param elementLocator identifier of element to be visible
 */
public static void waitUntilElementIsVisible(final String elementLocator){
  logger.entering(elementLocator);
  Preconditions.checkState(Grid.driver() != null,INVALID_STATE_ERR_MSG);
  By by=HtmlElementUtils.getFindElementType(elementLocator);
  ExpectedCondition<WebElement> condition=ExpectedConditions.visibilityOfElementLocated(by);
  waitForCondition(condition);
  logger.exiting();
}

Fixed version (ground truth):
/** 
 * Waits until element is present on the DOM of a page and visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0.
 * @param elementLocator identifier of element to be visible
 */
public static void waitUntilElementIsVisible(final String elementLocator){
  logger.entering(elementLocator);
  Preconditions.checkState(Grid.driver() != null,INVALID_STATE_ERR_MSG);
  By by=HtmlElementUtils.resolveByType(elementLocator);
  ExpectedCondition<WebElement> condition=ExpectedConditions.visibilityOfElementLocated(by);
  waitForCondition(condition);
  logger.exiting();
}
Program: 8475
Project: 8475
Buggy source:
/** 
 * Waits until element element is present on the DOM of a page. This does not necessarily mean that the element is visible.
 * @param elementLocator identifier of element to be found
 */
public static void waitUntilElementIsPresent(final String elementLocator){
  logger.entering(elementLocator);
  Preconditions.checkState(Grid.driver() != null,INVALID_STATE_ERR_MSG);
  By by=HtmlElementUtils.getFindElementType(elementLocator);
  ExpectedCondition<WebElement> condition=ExpectedConditions.presenceOfElementLocated(by);
  waitForCondition(condition);
  logger.exiting();
}

Fixed version (ground truth):
/** 
 * Waits until element element is present on the DOM of a page. This does not necessarily mean that the element is visible.
 * @param elementLocator identifier of element to be found
 */
public static void waitUntilElementIsPresent(final String elementLocator){
  logger.entering(elementLocator);
  Preconditions.checkState(Grid.driver() != null,INVALID_STATE_ERR_MSG);
  By by=HtmlElementUtils.resolveByType(elementLocator);
  ExpectedCondition<WebElement> condition=ExpectedConditions.presenceOfElementLocated(by);
  waitForCondition(condition);
  logger.exiting();
}
Program: 8476
Project: 8476
Buggy source:
/** 
 * Waits until element is either invisible or not present on the DOM.
 * @param elementLocator identifier of element to be found
 */
public static void waitUntilElementIsInvisible(final String elementLocator){
  logger.entering(elementLocator);
  Preconditions.checkState(Grid.driver() != null,INVALID_STATE_ERR_MSG);
  By by=HtmlElementUtils.getFindElementType(elementLocator);
  ExpectedCondition<Boolean> condition=ExpectedConditions.invisibilityOfElementLocated(by);
  waitForCondition(condition);
  logger.exiting();
}

Fixed version (ground truth):
/** 
 * Waits until element is either invisible or not present on the DOM.
 * @param elementLocator identifier of element to be found
 */
public static void waitUntilElementIsInvisible(final String elementLocator){
  logger.entering(elementLocator);
  Preconditions.checkState(Grid.driver() != null,INVALID_STATE_ERR_MSG);
  By by=HtmlElementUtils.resolveByType(elementLocator);
  ExpectedCondition<Boolean> condition=ExpectedConditions.invisibilityOfElementLocated(by);
  waitForCondition(condition);
  logger.exiting();
}
Program: 8477
Project: 8477
Buggy source:
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilElementVisiblePos(){
  Grid.driver().get(url);
  try {
    WebDriverWaitUtils.waitUntilElementIsVisible(locator);
    assertTrue(true);
  }
 catch (  WaitTimedOutException e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilElementVisiblePos(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilElementIsVisible(locator);
}
Program: 8478
Project: 8478
Buggy source:
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilPageTitlePresentPos(){
  Grid.driver().get(url);
  try {
    WebDriverWaitUtils.waitUntilPageTitleContains(pageTitle);
    assertTrue(true);
  }
 catch (  WaitTimedOutException e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilPageTitlePresentPos(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilPageTitleContains(pageTitle);
}
Program: 8479
Project: 8479
Buggy source:
@Test(groups={"String_Node_Str"},expectedExceptions={WaitTimedOutException.class}) @WebTest public void testWaitUntilElementVisibleNeg(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilElementIsVisible(badLocator);
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},expectedExceptions={TimeoutException.class}) @WebTest public void testWaitUntilElementVisibleNeg(){
  String origTimeout=Config.getConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT);
  try {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,"String_Node_Str");
    Grid.driver().get(url);
    WebDriverWaitUtils.waitUntilElementIsVisible(badLocator);
  }
  finally {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,origTimeout);
  }
}
Program: 8480
Project: 8480
Buggy source:
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilTextPresentPos(){
  Grid.driver().get(url);
  try {
    WebDriverWaitUtils.waitUntilTextPresent(text);
    assertTrue(true);
  }
 catch (  WaitTimedOutException e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilTextPresentPos(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilTextPresent(text);
}
Program: 8481
Project: 8481
Buggy source:
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilElementPresentPos(){
  Grid.driver().get(url);
  try {
    WebDriverWaitUtils.waitUntilElementIsPresent(locator);
    assertTrue(true);
  }
 catch (  WaitTimedOutException e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilElementPresentPos(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilElementIsPresent(locator);
}
Program: 8482
Project: 8482
Buggy source:
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilElementDisapearPos(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilPageTitleContains(pageTitle);
  Button btn=new Button(disappearElement);
  btn.click();
  try {
    WebDriverWaitUtils.waitUntilElementIsInvisible(disappearElement);
    assertTrue(true);
  }
 catch (  WaitTimedOutException e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) @WebTest public void testWaitUntilElementDisapearPos(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilPageTitleContains(pageTitle);
  Button btn=new Button(disappearElement);
  btn.click();
  WebDriverWaitUtils.waitUntilElementIsInvisible(disappearElement);
}
Program: 8483
Project: 8483
Buggy source:
@Test(groups={"String_Node_Str"},expectedExceptions={TimeoutException.class}) @WebTest public void testWaitUntilTextPresentNeg(){
  Grid.driver().get(url);
  String origTimeout=Config.getConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT);
  try {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,"String_Node_Str");
    WebDriverWaitUtils.waitUntilTextPresent(badLocator);
  }
  finally {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,origTimeout);
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},expectedExceptions={TimeoutException.class}) @WebTest public void testWaitUntilTextPresentNeg(){
  Grid.driver().get(url);
  String origTimeout=Config.getConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT);
  try {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,"String_Node_Str");
    WebDriverWaitUtils.waitUntilTextPresent(badLocator);
  }
  finally {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,origTimeout);
  }
}
Program: 8484
Project: 8484
Buggy source:
@Test(groups={"String_Node_Str"},expectedExceptions={TimeoutException.class}) @WebTest public void testWaitUntilElementPresentNeg(){
  Grid.driver().get(url);
  String origTimeout=Config.getConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT);
  try {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,"String_Node_Str");
    WebDriverWaitUtils.waitUntilElementIsPresent(badLocator);
  }
  finally {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,origTimeout);
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},expectedExceptions={TimeoutException.class}) @WebTest public void testWaitUntilElementPresentNeg(){
  Grid.driver().get(url);
  String origTimeout=Config.getConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT);
  try {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,"String_Node_Str");
    WebDriverWaitUtils.waitUntilElementIsPresent(badLocator);
  }
  finally {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,origTimeout);
  }
}
Program: 8485
Project: 8485
Buggy source:
@Test(groups={"String_Node_Str"},expectedExceptions={WaitTimedOutException.class}) @WebTest public void testWaitUntilPageTitlePresentNeg(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilPageTitleContains(badLocator);
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},expectedExceptions={TimeoutException.class}) @WebTest public void testWaitUntilPageTitlePresentNeg(){
  String origTimeout=Config.getConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT);
  try {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,"String_Node_Str");
    Grid.driver().get(url);
    WebDriverWaitUtils.waitUntilPageTitleContains(badLocator);
  }
  finally {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,origTimeout);
  }
}
Program: 8486
Project: 8486
Buggy source:
@Test(groups={"String_Node_Str"},expectedExceptions={RuntimeException.class}) @WebTest public void testWaitUntilElementDisapearNeg(){
  Grid.driver().get(url);
  WebDriverWaitUtils.waitUntilElementIsInvisible(disappearElement);
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},expectedExceptions={RuntimeException.class}) @WebTest public void testWaitUntilElementDisapearNeg(){
  String origTimeout=Config.getConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT);
  try {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,"String_Node_Str");
    Grid.driver().get(url);
    WebDriverWaitUtils.waitUntilElementIsInvisible(disappearElement);
  }
  finally {
    Config.setConfigProperty(Config.ConfigProperty.EXECUTION_TIMEOUT,origTimeout);
  }
}
Program: 8487
Project: 8487
Buggy source:
/** 
 * Create and return a session, connected.
 * @return JSch session
 * @throws IOException If some IO problem inside
 */
@RetryOnFailure(attempts=Tv.SEVEN,delay=1,unit=TimeUnit.MINUTES,verbose=false,randomize=true,types=IOException.class) private Session session() throws IOException {
  try {
    JSch.setConfig("String_Node_Str","String_Node_Str");
    JSch.setLogger(new JschLogger());
    final JSch jsch=new JSch();
    final File file=File.createTempFile("String_Node_Str","String_Node_Str");
    FileUtils.forceDeleteOnExit(file);
    FileUtils.write(file,this.key.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim(),CharEncoding.UTF_8);
    jsch.setHostKeyRepository(new EasyRepo());
    jsch.addIdentity(file.getAbsolutePath());
    Logger.debug(this,"String_Node_Str",this.login,this.addr,this.port,file.length());
    final Session session=jsch.getSession(this.login,this.addr,this.port);
    session.setServerAliveInterval((int)TimeUnit.SECONDS.toMillis((long)Tv.TEN));
    session.setServerAliveCountMax(Tv.MILLION);
    session.connect();
    FileUtils.deleteQuietly(file);
    return session;
  }
 catch (  final JSchException ex) {
    throw new IOException(ex);
  }
}

Fixed version (ground truth):
@Override @RetryOnFailure(attempts=Tv.SEVEN,delay=1,unit=TimeUnit.MINUTES,verbose=false,randomize=true,types=IOException.class) public Session session() throws IOException {
  try {
    JSch.setConfig("String_Node_Str","String_Node_Str");
    JSch.setLogger(new JschLogger());
    final JSch jsch=new JSch();
    final File file=File.createTempFile("String_Node_Str","String_Node_Str");
    FileUtils.forceDeleteOnExit(file);
    FileUtils.write(file,this.key.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").trim(),CharEncoding.UTF_8);
    jsch.setHostKeyRepository(new EasyRepo());
    jsch.addIdentity(file.getAbsolutePath());
    Logger.debug(this,"String_Node_Str",this.getLogin(),this.getAddr(),this.getPort(),file.length());
    final Session session=jsch.getSession(this.getLogin(),this.getAddr(),this.getPort());
    session.setServerAliveInterval((int)TimeUnit.SECONDS.toMillis(Tv.TEN));
    session.setServerAliveCountMax(Tv.MILLION);
    session.connect();
    FileUtils.deleteQuietly(file);
    return session;
  }
 catch (  final JSchException ex) {
    throw new IOException(ex);
  }
}
Program: 8488
Project: 8488
Buggy source:
/** 
 * Constructor.
 * @param adr IP address
 * @param prt Port of server
 * @param user Login
 * @param priv Private SSH key
 * @throws UnknownHostException If fails
 * @checkstyle ParameterNumberCheck (6 lines)
 */
public SSH(final String adr,final int prt,final String user,final String priv) throws UnknownHostException {
  this.addr=InetAddress.getByName(adr).getHostAddress();
  Validate.matchesPattern(this.addr,"String_Node_Str","String_Node_Str",this.addr);
  this.login=user;
  Validate.notEmpty(this.login,"String_Node_Str");
  this.key=priv;
  this.port=prt;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param adr IP address
 * @param prt Port of server
 * @param user Login
 * @param priv Private SSH key
 * @throws UnknownHostException If fails
 * @checkstyle ParameterNumberCheck (6 lines)
 */
public SSH(final String adr,final int prt,final String user,final String priv) throws UnknownHostException {
  super(adr,prt,user);
  this.key=priv;
}
Program: 8489
Project: 8489
Buggy source:
/** 
 * Create and return a session, connected.
 * @return JSch session
 * @throws IOException If some IO problem inside
 */
@RetryOnFailure(attempts=Tv.SEVEN,delay=1,unit=TimeUnit.MINUTES,verbose=false,randomize=true,types=IOException.class) private Session session() throws IOException {
  try {
    JSch.setConfig("String_Node_Str","String_Node_Str");
    JSch.setLogger(new JschLogger());
    final JSch jsch=new JSch();
    Logger.debug(this,"String_Node_Str",this.login,this.addr,this.port);
    final Session session=jsch.getSession(this.login,this.addr,this.port);
    session.setPassword(this.password);
    session.setServerAliveInterval((int)TimeUnit.SECONDS.toMillis((long)Tv.TEN));
    session.setServerAliveCountMax(Tv.MILLION);
    session.connect();
    return session;
  }
 catch (  final JSchException ex) {
    throw new IOException(ex);
  }
}

Fixed version (ground truth):
@Override @RetryOnFailure(attempts=Tv.SEVEN,delay=1,unit=TimeUnit.MINUTES,verbose=false,randomize=true,types=IOException.class) public Session session() throws IOException {
  try {
    JSch.setConfig("String_Node_Str","String_Node_Str");
    JSch.setLogger(new JschLogger());
    final JSch jsch=new JSch();
    Logger.debug(this,"String_Node_Str",this.getLogin(),this.getAddr(),this.getPort());
    final Session session=jsch.getSession(this.getLogin(),this.getAddr(),this.getPort());
    session.setPassword(this.password);
    session.setServerAliveInterval((int)TimeUnit.SECONDS.toMillis(Tv.TEN));
    session.setServerAliveCountMax(Tv.MILLION);
    session.connect();
    return session;
  }
 catch (  final JSchException ex) {
    throw new IOException(ex);
  }
}
Program: 8490
Project: 8490
Buggy source:
/** 
 * Constructor.
 * @param adr IP address
 * @param prt Port of server
 * @param user Login
 * @param passwd Password
 * @throws UnknownHostException If fails
 * @checkstyle ParameterNumberCheck (6 lines)
 */
public SSHByPassword(final String adr,final int prt,final String user,final String passwd) throws UnknownHostException {
  this.addr=InetAddress.getByName(adr).getHostAddress();
  Validate.matchesPattern(this.addr,"String_Node_Str","String_Node_Str",this.addr);
  this.port=prt;
  this.login=user;
  Validate.notEmpty(this.login,"String_Node_Str");
  this.password=passwd;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param adr IP address
 * @param prt Port of server
 * @param user Login
 * @param passwd Password
 * @throws UnknownHostException If fails
 * @checkstyle ParameterNumberCheck (6 lines)
 */
public SSHByPassword(final String adr,final int prt,final String user,final String passwd) throws UnknownHostException {
  super(adr,prt,user);
  this.password=passwd;
}
Program: 8491
Project: 8491
Buggy source:
/** 
 * 更新索引 Map
 */
private Map<Character,Integer> updateIndex(List<ContactItem> list){
  Character lastCharcter='#';
  Map<Character,Integer> map=new HashMap<>();
  for (int i=0; i < list.size(); i++) {
    Character curChar=Character.toLowerCase(list.get(i).sortContent.charAt(0));
    if (!lastCharcter.equals(curChar)) {
      map.put(curChar,i);
    }
    lastCharcter=curChar;
  }
  return map;
}

Fixed version (ground truth):
/** 
 * 更新索引 Map
 */
private Map<Character,Integer> updateIndex(List<ContactItem> list){
  Character lastCharcter='#';
  Map<Character,Integer> map=new HashMap<>();
  for (int i=0; i < list.size(); i++) {
    if (!TextUtils.isEmpty(list.get(i).sortContent)) {
      Character curChar=Character.toLowerCase(list.get(i).sortContent.charAt(0));
      if (!lastCharcter.equals(curChar)) {
        map.put(curChar,i);
      }
      lastCharcter=curChar;
    }
  }
  return map;
}
Program: 8492
Project: 8492
Buggy source:
/** 
 * 处理 LetterView 发送过来的 MemberLetterEvent 会通过 MembersAdapter 获取应该要跳转到的位置，然后跳转
 */
public void onEvent(MemberLetterEvent event){
  Character targetChar=Character.toLowerCase(event.letter);
  if (itemAdapter.getIndexMap().containsKey(targetChar)) {
    int index=itemAdapter.getIndexMap().get(targetChar);
    if (index > 0 && index < itemAdapter.getItemCount()) {
      layoutManager.scrollToPositionWithOffset(index,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * 处理 LetterView 发送过来的 MemberLetterEvent 会通过 MembersAdapter 获取应该要跳转到的位置，然后跳转
 */
public void onEvent(MemberLetterEvent event){
  Character targetChar=Character.toLowerCase(event.letter);
  if (itemAdapter.getIndexMap().containsKey(targetChar)) {
    int index=itemAdapter.getIndexMap().get(targetChar);
    if (index > 0 && index < itemAdapter.getItemCount()) {
      layoutManager.scrollToPositionWithOffset(index + 1,0);
    }
  }
}