nus-yam/ex-repair huggingface dataset:
Program: 47663
Project: 47663
Buggy source:
public static List<PublicKey> parsePublicKeys(InputStream is,Base64Decoder base64Decoder) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException, NoSuchProviderException {
  if (is == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<PublicKey> keys=new ArrayList<>();
  BufferedReader reader=new BufferedReader(new InputStreamReader(is));
  while (reader.ready()) {
    String keyLine=reader.readLine();
    String[] parts=keyLine.split("String_Node_Str");
    String name=null;
    String keyEncoded=null;
    if (parts.length > 2 && parts.length <= 3) {
      name=parts[0];
      keyEncoded=parts[1];
    }
    if (keyEncoded != null) {
      byte[] keyBytes=base64Decoder.decode(keyEncoded);
      PublicKey key=null;
      if (NAME_RSA.equals(name)) {
        key=parsePublicKeyRsa(keyBytes);
      }
 else       if (NAME_DSA.equals(name)) {
        key=parsePublicKeyDsa(keyBytes);
      }
 else       if (NAME_ECDSA_256.equals(name)) {
        key=parsePublicKeyEcdsa(name,keyBytes);
      }
 else       if (NAME_ECDSA_384.equals(name)) {
        key=parsePublicKeyEcdsa(name,keyBytes);
      }
 else       if (NAME_ECDSA_521.equals(name)) {
        key=parsePublicKeyEcdsa(name,keyBytes);
      }
      if (key != null) {
        keys.add(key);
      }
    }
  }
  return keys;
}

Fixed version (ground truth):
public static List<PublicKey> parsePublicKeys(InputStream is,Base64Decoder base64Decoder) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException, NoSuchProviderException {
  if (is == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<PublicKey> keys=new ArrayList<>();
  BufferedReader reader=new BufferedReader(new InputStreamReader(is));
  while (reader.ready()) {
    String keyLine=reader.readLine();
    String[] parts=keyLine.split("String_Node_Str");
    String name=null;
    String keyEncoded=null;
    if (parts.length >= 2) {
      name=parts[0];
      keyEncoded=parts[1];
    }
    if (keyEncoded != null) {
      byte[] keyBytes=base64Decoder.decode(keyEncoded);
      PublicKey key=null;
      if (NAME_RSA.equals(name)) {
        key=parsePublicKeyRsa(keyBytes);
      }
 else       if (NAME_DSA.equals(name)) {
        key=parsePublicKeyDsa(keyBytes);
      }
 else       if (NAME_ECDSA_256.equals(name)) {
        key=parsePublicKeyEcdsa(name,keyBytes);
      }
 else       if (NAME_ECDSA_384.equals(name)) {
        key=parsePublicKeyEcdsa(name,keyBytes);
      }
 else       if (NAME_ECDSA_521.equals(name)) {
        key=parsePublicKeyEcdsa(name,keyBytes);
      }
      if (key != null) {
        keys.add(key);
      }
    }
  }
  return keys;
}
Program: 47664
Project: 47664
Buggy source:
@Override public int compare(File file1,File file2){
  Long time1=Long.valueOf(file1.lastModified());
  Long time2=Long.valueOf(file2.lastModified());
  return time2.compareTo(time1);
}

Fixed version (ground truth):
@Override public int compare(File file1,File file2){
  Long time1=Long.valueOf(file1.lastModified());
  Long time2=Long.valueOf(file2.lastModified());
  return time1.compareTo(time2);
}
Program: 47665
Project: 47665
Buggy source:
private void cleanOldFiles(File dir){
  File[] currentFiles=dir.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File dir,    String name){
      return name.startsWith(LOGFILE_BASENAME);
    }
  }
);
  if (currentFiles.length >= NUM_LOGFILES_TO_KEEP) {
    SortedSet<File> sorted=new TreeSet<File>(new Comparator<File>(){
      @Override public int compare(      File file1,      File file2){
        Long time1=Long.valueOf(file1.lastModified());
        Long time2=Long.valueOf(file2.lastModified());
        return time2.compareTo(time1);
      }
    }
);
    for (    File file : currentFiles) {
      sorted.add(file);
    }
    int i=0;
    Iterator<File> iterator=sorted.iterator();
    while (iterator.hasNext()) {
      if (i < NUM_LOGFILES_TO_KEEP) {
        iterator.next().delete();
      }
 else {
        break;
      }
      i++;
    }
  }
}

Fixed version (ground truth):
private void cleanOldFiles(File dir){
  File[] currentFiles=dir.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File dir,    String name){
      return name.startsWith(LOGFILE_BASENAME);
    }
  }
);
  if (currentFiles.length >= NUM_LOGFILES_TO_KEEP) {
    SortedSet<File> sorted=new TreeSet<File>(new Comparator<File>(){
      @Override public int compare(      File file1,      File file2){
        Long time1=Long.valueOf(file1.lastModified());
        Long time2=Long.valueOf(file2.lastModified());
        return time1.compareTo(time2);
      }
    }
);
    for (    File file : currentFiles) {
      sorted.add(file);
    }
    int i=currentFiles.length;
    Iterator<File> iterator=sorted.iterator();
    while (iterator.hasNext()) {
      if (i >= NUM_LOGFILES_TO_KEEP) {
        iterator.next().delete();
      }
 else {
        break;
      }
      i--;
    }
  }
}
Program: 47666
Project: 47666
Buggy source:
public static void sendRequestQueryCondition(Context context){
  final Intent intent=new Intent();
  final Bundle resultBundle=generateBundle(context);
  intent.putExtra(EXTRA_BUNDLE,resultBundle);
  intent.putExtra(EXTRA_STRING_ACTIVITY_CLASS_NAME,TaskerEditConditionActivity.class.getName());
  context.sendBroadcast(intent);
}

Fixed version (ground truth):
public static void sendRequestQueryCondition(Context context){
  final Intent intent=new Intent(ACTION_REQUEST_QUERY);
  intent.putExtra(EXTRA_STRING_ACTIVITY_CLASS_NAME,TaskerEditConditionActivity.class.getName());
  logger.debug("String_Node_Str");
  context.sendBroadcast(intent);
}
Program: 47667
Project: 47667
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String blurb=intent.getExtras().getString(EXTRA_STRING_BLURB);
  if (ACTION_FIRE_SETTING.equals(intent.getAction())) {
    TaskerAction action=TaskerAction.byBlurb(blurb);
    if (action != null) {
      ServersRunningBean runningBean=ServicesStartStopUtil.checkServicesRunning(context);
      boolean running=runningBean.atLeastOneRunning();
switch (action) {
case START:
        if (!running) {
          startServer(context);
        }
      break;
case STOP:
    if (running) {
      stopServer(context);
    }
  break;
case TOGGLE:
if (running) {
  stopServer(context);
}
 else {
  startServer(context);
}
break;
}
}
}
 else if (ACTION_QUERY_CONDITION.equals(intent.getAction())) {
TaskerCondition condition=TaskerCondition.byBlurb(blurb);
if (condition != null) {
ServersRunningBean runningBean=ServicesStartStopUtil.checkServicesRunning(context);
boolean running=runningBean.atLeastOneRunning();
switch (condition) {
case IS_SERVER_RUNNING:
int conditionResult=running ? RESULT_CONDITION_SATISFIED : RESULT_CONDITION_UNSATISFIED;
final PendingResult result=goAsync();
result.setResultCode(conditionResult);
result.finish();
break;
}
}
}
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String blurb=intent.getExtras().getString(EXTRA_STRING_BLURB);
  if (ACTION_FIRE_SETTING.equals(intent.getAction())) {
    TaskerAction action=TaskerAction.byBlurb(blurb);
    if (action != null) {
      ServersRunningBean runningBean=ServicesStartStopUtil.checkServicesRunning(context);
      boolean running=runningBean.atLeastOneRunning();
switch (action) {
case START:
        if (!running) {
          startServer(context);
        }
      break;
case STOP:
    if (running) {
      stopServer(context);
    }
  break;
case TOGGLE:
if (running) {
  stopServer(context);
}
 else {
  startServer(context);
}
break;
}
}
}
 else if (ACTION_QUERY_CONDITION.equals(intent.getAction())) {
TaskerCondition condition=TaskerCondition.byBlurb(blurb);
if (condition != null) {
ServersRunningBean runningBean=ServicesStartStopUtil.checkServicesRunning(context);
boolean running=runningBean.atLeastOneRunning();
switch (condition) {
case IS_SERVER_RUNNING:
int conditionResult=running ? RESULT_CONDITION_SATISFIED : RESULT_CONDITION_UNSATISFIED;
logger.debug("String_Node_Str",blurb,Boolean.valueOf(running));
setResultCode(conditionResult);
break;
}
}
}
}
Program: 47668
Project: 47668
Buggy source:
public List<PublicKey> readKeyAuthKeys(String path,boolean ignoreErrors){
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(path);
    return KeyParser.parsePublicKeys(fis,new Base64Decoder(){
      @Override public byte[] decode(      String str){
        return Base64.decode(str,Base64.DEFAULT);
      }
    }
);
  }
 catch (  Exception e) {
    if (!ignoreErrors) {
      logger.error("String_Node_Str",e);
    }
  }
 finally {
    try {
      if (fis != null) {
        fis.close();
      }
    }
 catch (    IOException e) {
    }
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
public List<PublicKey> readKeyAuthKeys(String path,boolean ignoreErrors){
  List<PublicKey> keys=null;
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(path);
    keys=KeyParser.parsePublicKeys(fis,new Base64Decoder(){
      @Override public byte[] decode(      String str){
        return Base64.decode(str,Base64.DEFAULT);
      }
    }
);
  }
 catch (  Exception e) {
    if (!ignoreErrors) {
      logger.error("String_Node_Str",e);
    }
  }
 finally {
    try {
      if (fis != null) {
        fis.close();
      }
    }
 catch (    IOException e) {
      if (!ignoreErrors) {
        logger.error("String_Node_Str",e);
      }
    }
  }
  return keys != null ? keys : new ArrayList<PublicKey>();
}
Program: 47669
Project: 47669
Buggy source:
public boolean changeWorkingDirectory(String dir){
  logger.trace("String_Node_Str",dir);
  File dirObj=new File(dir);
  if (!dirObj.isDirectory()) {
    logger.trace("String_Node_Str");
    return false;
  }
  String currentAbsPath=workingDir.getAbsolutePath();
  String paraAbs=dirObj.getAbsolutePath();
  if (currentAbsPath.length() * 2 == paraAbs.length()) {
    String pathDoubled=currentAbsPath + currentAbsPath;
    if (pathDoubled.equals(paraAbs)) {
      logger.trace("String_Node_Str",currentAbsPath);
      return true;
    }
  }
  String path=dir;
  if (!dirObj.isAbsolute()) {
    path=currentAbsPath + File.separator + dir;
  }
  logger.trace("String_Node_Str",currentAbsPath,path);
  workingDir=createFile(new File(path));
  return true;
}

Fixed version (ground truth):
public boolean changeWorkingDirectory(String dir){
  logger.trace("String_Node_Str",dir);
  File dirObj=new File(dir);
  String currentAbsPath=workingDir.getAbsolutePath();
  String path=dir;
  if (!dirObj.isAbsolute()) {
    path=currentAbsPath + File.separator + dir;
  }
  logger.trace("String_Node_Str",path);
  dirObj=new File(path);
  if (!dirObj.isDirectory()) {
    logger.trace("String_Node_Str");
    return false;
  }
  String paraAbs=dirObj.getAbsolutePath();
  if (currentAbsPath.length() * 2 == paraAbs.length()) {
    String pathDoubled=currentAbsPath + currentAbsPath;
    if (pathDoubled.equals(paraAbs)) {
      logger.trace("String_Node_Str",currentAbsPath);
      return true;
    }
  }
  logger.trace("String_Node_Str",currentAbsPath,path);
  workingDir=createFile(new File(path));
  return true;
}
Program: 47670
Project: 47670
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
  Intent intent=null;
switch (item.getItemId()) {
case android.R.id.home:
    intent=new Intent(this,PrimitiveFtpdActivity.class);
  startActivity(intent);
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case android.R.id.home:
    FtpPrefsActivity.this.finish();
  break;
}
return true;
}
Program: 47671
Project: 47671
Buggy source:
@BeforeClass public static void startServer() throws Exception {
  orchestrator.resetData();
  createReportsWithAbsolutePath();
  SonarScanner build=SonarScanner.create().setProjectDir(PROJECT_DIR).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs(SOURCE_DIR).setTestDirs(TESTS_DIR).setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProfile("String_Node_Str");
  orchestrator.executeBuild(build);
}

Fixed version (ground truth):
@BeforeClass public static void startServer() throws Exception {
  orchestrator.resetData();
  createReportsWithAbsolutePath();
  SonarScanner build=SonarScanner.create().setProjectDir(PROJECT_DIR).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs(SOURCE_DIR).setTestDirs(TESTS_DIR).setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProfile("String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
}
Program: 47672
Project: 47672
Buggy source:
@BeforeClass public static void prepare() throws InterruptedException {
  orchestrator.resetData();
  SonarScanner build=SonarScanner.create().setProjectDir(Tests.projectDirectoryFor("String_Node_Str")).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs("String_Node_Str");
  orchestrator.getServer().provisionProject("String_Node_Str","String_Node_Str");
  orchestrator.getServer().associateProjectToQualityProfile("String_Node_Str","String_Node_Str","String_Node_Str");
  orchestrator.executeBuild(build);
  issueClient=orchestrator.getServer().wsClient().issueClient();
}

Fixed version (ground truth):
@BeforeClass public static void prepare() throws InterruptedException {
  orchestrator.resetData();
  SonarScanner build=SonarScanner.create().setProjectDir(Tests.projectDirectoryFor("String_Node_Str")).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs("String_Node_Str");
  orchestrator.getServer().provisionProject("String_Node_Str","String_Node_Str");
  orchestrator.getServer().associateProjectToQualityProfile("String_Node_Str","String_Node_Str","String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
  issueClient=orchestrator.getServer().wsClient().issueClient();
}
Program: 47673
Project: 47673
Buggy source:
@BeforeClass public static void startServer() throws IOException, URISyntaxException, InterruptedException {
  orchestrator.resetData();
  SonarScanner build=SonarScanner.create().setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceEncoding("String_Node_Str").setSourceDirs("String_Node_Str").setProjectDir(PROJECT_DIR).setProfile("String_Node_Str");
  orchestrator.executeBuild(build);
}

Fixed version (ground truth):
@BeforeClass public static void startServer() throws IOException, URISyntaxException, InterruptedException {
  orchestrator.resetData();
  SonarScanner build=SonarScanner.create().setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceEncoding("String_Node_Str").setSourceDirs("String_Node_Str").setProjectDir(PROJECT_DIR).setProfile("String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
}
Program: 47674
Project: 47674
Buggy source:
@BeforeClass public static void startServer() throws IOException, URISyntaxException, InterruptedException {
  orchestrator.resetData();
  SonarScanner build=SonarScanner.create().setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceEncoding("String_Node_Str").setSourceDirs("String_Node_Str").setProjectDir(FileLocation.of("String_Node_Str").getFile()).setProfile("String_Node_Str").setProperty("String_Node_Str","String_Node_Str");
  orchestrator.executeBuild(build);
}

Fixed version (ground truth):
@BeforeClass public static void startServer() throws IOException, URISyntaxException, InterruptedException {
  orchestrator.resetData();
  SonarScanner build=SonarScanner.create().setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceEncoding("String_Node_Str").setSourceDirs("String_Node_Str").setProjectDir(FileLocation.of("String_Node_Str").getFile()).setProfile("String_Node_Str").setProperty("String_Node_Str","String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
}
Program: 47675
Project: 47675
Buggy source:
/** 
 * SONARPLUGINS-1657
 */
@Test public void should_import_sources_with_user_defined_file_suffixes(){
  SonarScanner build=SonarScanner.create().setProjectDir(Tests.projectDirectoryFor("String_Node_Str")).setProfile("String_Node_Str").setProperty("String_Node_Str","String_Node_Str");
  orchestrator.executeBuild(build);
  assertThat(getMeasureAsInt(SEVERAL_EXTENSIONS_PROJECT_KEY,"String_Node_Str")).isEqualTo(3);
  assertThat(getMeasureAsInt(getResourceKey(SEVERAL_EXTENSIONS_PROJECT_KEY,"String_Node_Str"),"String_Node_Str")).isGreaterThan(1);
  assertThat(getComponent(SEVERAL_EXTENSIONS_PROJECT_KEY,getResourceKey(SEVERAL_EXTENSIONS_PROJECT_KEY,"String_Node_Str"))).isNull();
}

Fixed version (ground truth):
/** 
 * SONARPLUGINS-1657
 */
@Test public void should_import_sources_with_user_defined_file_suffixes(){
  SonarScanner build=SonarScanner.create().setProjectDir(Tests.projectDirectoryFor("String_Node_Str")).setProfile("String_Node_Str").setProperty("String_Node_Str","String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
  assertThat(getMeasureAsInt(SEVERAL_EXTENSIONS_PROJECT_KEY,"String_Node_Str")).isEqualTo(3);
  assertThat(getMeasureAsInt(getResourceKey(SEVERAL_EXTENSIONS_PROJECT_KEY,"String_Node_Str"),"String_Node_Str")).isGreaterThan(1);
  assertThat(getComponent(SEVERAL_EXTENSIONS_PROJECT_KEY,getResourceKey(SEVERAL_EXTENSIONS_PROJECT_KEY,"String_Node_Str"))).isNull();
}
Program: 47676
Project: 47676
Buggy source:
/** 
 * SONARPLUGINS-943
 */
@Test public void should_support_multimodule_projects(){
  SonarScanner build=SonarScanner.create().setProjectDir(Tests.projectDirectoryFor("String_Node_Str")).setProfile("String_Node_Str");
  orchestrator.executeBuild(build);
  assertThat(getMeasureAsInt(MULTIMODULE_PROJET_KEY + "String_Node_Str","String_Node_Str")).isEqualTo(4);
  assertThat(getMeasureAsInt(MULTIMODULE_PROJET_KEY + "String_Node_Str","String_Node_Str")).isEqualTo(2);
  assertThat(getMeasureAsInt(MULTIMODULE_PROJET_KEY,"String_Node_Str")).isEqualTo(4 + 2);
}

Fixed version (ground truth):
/** 
 * SONARPLUGINS-943
 */
@Test public void should_support_multimodule_projects(){
  SonarScanner build=SonarScanner.create().setProjectDir(Tests.projectDirectoryFor("String_Node_Str")).setProfile("String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
  assertThat(getMeasureAsInt(MULTIMODULE_PROJET_KEY + "String_Node_Str","String_Node_Str")).isEqualTo(4);
  assertThat(getMeasureAsInt(MULTIMODULE_PROJET_KEY + "String_Node_Str","String_Node_Str")).isEqualTo(2);
  assertThat(getMeasureAsInt(MULTIMODULE_PROJET_KEY,"String_Node_Str")).isEqualTo(4 + 2);
}
Program: 47677
Project: 47677
Buggy source:
/** 
 * SONARPHP-667
 */
@Test public void should_not_fail_on_empty_file(){
  SonarScanner build=SonarScanner.create().setProjectKey(EMPTY_FILE_PROJET_KEY).setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceEncoding("String_Node_Str").setSourceDirs("String_Node_Str").setProjectDir(Tests.projectDirectoryFor("String_Node_Str"));
  orchestrator.executeBuild(build);
  assertThat(getMeasureAsInt(EMPTY_FILE_PROJET_KEY,"String_Node_Str")).isEqualTo(3);
}

Fixed version (ground truth):
/** 
 * SONARPHP-667
 */
@Test public void should_not_fail_on_empty_file(){
  SonarScanner build=SonarScanner.create().setProjectKey(EMPTY_FILE_PROJET_KEY).setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceEncoding("String_Node_Str").setSourceDirs("String_Node_Str").setProjectDir(Tests.projectDirectoryFor("String_Node_Str"));
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
  assertThat(getMeasureAsInt(EMPTY_FILE_PROJET_KEY,"String_Node_Str")).isEqualTo(3);
}
Program: 47678
Project: 47678
Buggy source:
@BeforeClass public static void startServer() throws Exception {
  orchestrator.resetData();
  createReportsWithAbsolutePath();
  SonarScanner build=SonarScanner.create().setProjectDir(PROJECT_DIR).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs(SOURCE_DIR).setTestDirs(TESTS_DIR).setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str");
  orchestrator.executeBuild(build);
}

Fixed version (ground truth):
@BeforeClass public static void startServer() throws Exception {
  orchestrator.resetData();
  createReportsWithAbsolutePath();
  SonarScanner build=SonarScanner.create().setProjectDir(PROJECT_DIR).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs(SOURCE_DIR).setTestDirs(TESTS_DIR).setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
}
Program: 47679
Project: 47679
Buggy source:
@BeforeClass public static void startServer() throws Exception {
  orchestrator.resetData();
  createReportsWithAbsolutePath();
  SonarScanner build=SonarScanner.create().setProjectDir(PROJECT_DIR).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs(SOURCE_DIR).setTestDirs(TESTS_DIR).setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str" + REPORTS_DIR+ "String_Node_Str"+ REPORTS_DIR+ "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str");
  orchestrator.executeBuild(build);
}

Fixed version (ground truth):
@BeforeClass public static void startServer() throws Exception {
  orchestrator.resetData();
  createReportsWithAbsolutePath();
  SonarScanner build=SonarScanner.create().setProjectDir(PROJECT_DIR).setProjectKey("String_Node_Str").setProjectName("String_Node_Str").setProjectVersion("String_Node_Str").setSourceDirs(SOURCE_DIR).setTestDirs(TESTS_DIR).setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str" + REPORTS_DIR+ "String_Node_Str"+ REPORTS_DIR+ "String_Node_Str").setProperty("String_Node_Str",REPORTS_DIR + "String_Node_Str");
  Tests.executeBuildWithExpectedWarnings(orchestrator,build);
}
Program: 47680
Project: 47680
Buggy source:
@Test public void test_analyze() throws Exception {
  PHPCheck check=new DummyCheck();
  PHPAnalyzer analyzer=new PHPAnalyzer(UTF_8,ImmutableList.of(check));
  File file=tmpFolder.newFile();
  FileUtils.write(file,"String_Node_Str",UTF_8);
  analyzer.nextFile(file);
  List<PhpIssue> issues=analyzer.analyze();
  assertThat(issues).hasSize(1);
  assertThat(((PreciseIssue)issues.get(0)).primaryLocation().startLine()).isEqualTo(1);
  assertThat(issues.get(0).check()).isEqualTo(check);
  assertThat(((PreciseIssue)issues.get(0)).primaryLocation().message()).isEqualTo(DummyCheck.MESSAGE);
  FileMeasures measures=analyzer.computeMeasures(mock(FileLinesContext.class),new HashMap<File,Integer>());
  assertThat(measures.getLinesOfCodeNumber()).isEqualTo(1);
}

Fixed version (ground truth):
@Test public void test_analyze() throws Exception {
  PHPCheck check=new DummyCheck();
  PHPAnalyzer analyzer=new PHPAnalyzer(UTF_8,ImmutableList.of(check));
  File file=tmpFolder.newFile();
  FileUtils.write(file,"String_Node_Str",UTF_8);
  analyzer.nextFile(file);
  List<PhpIssue> issues=analyzer.analyze();
  assertThat(issues).hasSize(1);
  assertThat(((PreciseIssue)issues.get(0)).primaryLocation().startLine()).isEqualTo(1);
  assertThat(issues.get(0).check()).isEqualTo(check);
  assertThat(((PreciseIssue)issues.get(0)).primaryLocation().message()).isEqualTo(DummyCheck.MESSAGE);
  FileMeasures measures=analyzer.computeMeasures(mock(FileLinesContext.class),new HashMap<File,Integer>(),true);
  assertThat(measures.getLinesOfCodeNumber()).isEqualTo(1);
}
Program: 47681
Project: 47681
Buggy source:
@Test public void test() throws Exception {
  PhpCheckTest.check(new AliasFunctionUsageCheck(),TestUtils.getCheckFile("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  PHPCheckTest.check(new AliasFunctionUsageCheck(),TestUtils.getCheckFile("String_Node_Str"));
}
Program: 47682
Project: 47682
Buggy source:
@Test public void should_create_sonar_way_profile(){
  ValidationMessages validation=ValidationMessages.create();
  RuleFinder ruleFinder=ruleFinder();
  PHPProfile definition=new PHPProfile(ruleFinder);
  RulesProfile profile=definition.createProfile(validation);
  assertThat(profile.getLanguage()).isEqualTo(Php.KEY);
  assertThat(profile.getName()).isEqualTo(CheckList.SONAR_WAY_PROFILE);
  assertThat(profile.getActiveRulesByRepository(CheckList.REPOSITORY_KEY)).hasSize(64);
  assertThat(validation.hasErrors()).isFalse();
  assertThat(profile.getActiveRules()).hasSize(65);
  assertThat(profile.getActiveRules()).extracting("String_Node_Str").contains("String_Node_Str");
}

Fixed version (ground truth):
@Test public void should_create_sonar_way_profile(){
  ValidationMessages validation=ValidationMessages.create();
  RuleFinder ruleFinder=ruleFinder();
  PHPProfile definition=new PHPProfile(ruleFinder);
  RulesProfile profile=definition.createProfile(validation);
  assertThat(profile.getLanguage()).isEqualTo(Php.KEY);
  assertThat(profile.getName()).isEqualTo(CheckList.SONAR_WAY_PROFILE);
  assertThat(profile.getActiveRulesByRepository(CheckList.REPOSITORY_KEY)).hasSize(63);
  assertThat(validation.hasErrors()).isFalse();
  assertThat(profile.getActiveRules()).hasSize(64);
  assertThat(profile.getActiveRules()).extracting("String_Node_Str").contains("String_Node_Str");
}
Program: 47683
Project: 47683
Buggy source:
@Override public void visitFunctionCall(FunctionCallTree functionCall){
  ExpressionTree callee=functionCall.callee();
  if (callee.is(Kind.NAMESPACED_NAME) && "String_Node_Str".equals(((NamespaceNameTree)callee).fullName())) {
    SeparatedList<ExpressionTree> arguments=functionCall.arguments();
    if (!arguments.isEmpty()) {
      ExpressionTree firstArgument=arguments.get(0);
      if (firstArgument.is(Kind.REGULAR_STRING_LITERAL)) {
        String constantName=((LiteralTree)firstArgument).value();
        checkConstantName(firstArgument,constantName.substring(1,constantName.length() - 1));
      }
    }
  }
  super.visitFunctionCall(functionCall);
}

Fixed version (ground truth):
@Override public void visitFunctionCall(FunctionCallTree functionCall){
  ExpressionTree callee=functionCall.callee();
  if (callee.is(Kind.NAMESPACE_NAME) && "String_Node_Str".equals(((NamespaceNameTree)callee).fullName())) {
    SeparatedList<ExpressionTree> arguments=functionCall.arguments();
    if (!arguments.isEmpty()) {
      ExpressionTree firstArgument=arguments.get(0);
      if (firstArgument.is(Kind.REGULAR_STRING_LITERAL)) {
        String constantName=((LiteralTree)firstArgument).value();
        checkConstantName(firstArgument,constantName.substring(1,constantName.length() - 1));
      }
    }
  }
  super.visitFunctionCall(functionCall);
}
Program: 47684
Project: 47684
Buggy source:
@Test public void test(){
  matches("String_Node_Str");
  matches("String_Node_Str");
}

Fixed version (ground truth):
@Test public void test(){
  matches("String_Node_Str");
  matches("String_Node_Str");
  matches("String_Node_Str");
}
Program: 47685
Project: 47685
Buggy source:
@Test public void test(){
  matches("String_Node_Str");
}

Fixed version (ground truth):
@Test public void test(){
  matches("String_Node_Str");
  matches("String_Node_Str");
}
Program: 47686
Project: 47686
Buggy source:
@Override public void init(){
  subscribeTo(PHPGrammar.FOR_STATEMENT,PHPGrammar.STATEMENT,PHPGrammar.ASSIGNMENT_EXPR,PHPPunctuator.INC,PHPPunctuator.DEC);
}

Fixed version (ground truth):
@Override public void init(){
  subscribeTo(PHPGrammar.FOR_STATEMENT,PHPGrammar.STATEMENT,PHPGrammar.ASSIGNMENT_EXPR,PHPGrammar.ASSIGNMENT_BY_REFERENCE,PHPPunctuator.INC,PHPPunctuator.DEC);
}
Program: 47687
Project: 47687
Buggy source:
@Override public void visitNode(AstNode astNode){
  if (astNode.is(PHPGrammar.FOR_STATEMENT)) {
    pendingCounters=getLoopsCounters(astNode);
  }
 else   if (astNode.is(PHPGrammar.STATEMENT)) {
    counters.addAll(pendingCounters);
    pendingCounters=Collections.emptySet();
  }
 else   if (!counters.isEmpty() && astNode.is(PHPGrammar.ASSIGNMENT_EXPR,PHPPunctuator.INC,PHPPunctuator.DEC)) {
    check(astNode);
  }
}

Fixed version (ground truth):
@Override public void visitNode(AstNode astNode){
  if (astNode.is(PHPGrammar.FOR_STATEMENT)) {
    pendingCounters=getLoopsCounters(astNode);
  }
 else   if (astNode.is(PHPGrammar.STATEMENT)) {
    counters.addAll(pendingCounters);
    pendingCounters=Collections.emptySet();
  }
 else   if (!counters.isEmpty() && astNode.is(ASSIGNMENT_EXPR,ASSIGNMENT_BY_REFERENCE,PHPPunctuator.INC,PHPPunctuator.DEC)) {
    check(astNode);
  }
}
Program: 47688
Project: 47688
Buggy source:
private void check(AstNode astNode){
  AstNode varNode;
  if (astNode.is(PHPGrammar.ASSIGNMENT_EXPR)) {
    varNode=astNode.getFirstChild();
  }
 else {
    varNode=isPostUnaryExpr(astNode) ? astNode.getNextAstNode() : astNode.getPreviousAstNode();
  }
  String varName=CheckUtils.getExpressionAsString(varNode);
  if (counters.contains(varName)) {
    reportIssue(astNode,varName);
  }
}

Fixed version (ground truth):
private void check(AstNode astNode){
  AstNode varNode;
  if (astNode.is(ASSIGNMENT_EXPR,ASSIGNMENT_BY_REFERENCE)) {
    varNode=astNode.getFirstChild();
  }
 else {
    varNode=isPostUnaryExpr(astNode) ? astNode.getNextAstNode() : astNode.getPreviousAstNode();
  }
  String varName=CheckUtils.getExpressionAsString(varNode);
  if (counters.contains(varName)) {
    reportIssue(astNode,varName);
  }
}
Program: 47689
Project: 47689
Buggy source:
private void checkExpression(AstNode exprStmt){
  AstNode nextStmt=exprStmt.getNextAstNode().getFirstChild();
  if (nextStmt == null || nextStmt.isNot(PHPGrammar.RETURN_STATEMENT,PHPGrammar.THROW_STATEMENT) || isInnerIfStatement(exprStmt)) {
    return;
  }
  AstNode expression=exprStmt.getFirstChild(PHPGrammar.EXPRESSION).getFirstChild();
  if (expression.is(PHPGrammar.ASSIGNMENT_EXPR)) {
    checkAssignedVariable(expression,nextStmt);
  }
 else {
    AstNode exprChild=expression.getFirstChild();
    if (exprChild.is(PHPGrammar.LIST_ASSIGNMENT_EXPR)) {
      checkListVariables(exprChild,nextStmt);
    }
  }
}

Fixed version (ground truth):
private void checkExpression(AstNode exprStmt){
  AstNode nextStmt=exprStmt.getNextAstNode().getFirstChild();
  if (nextStmt == null || nextStmt.isNot(PHPGrammar.RETURN_STATEMENT,PHPGrammar.THROW_STATEMENT) || isInnerIfStatement(exprStmt)) {
    return;
  }
  AstNode expression=exprStmt.getFirstChild(PHPGrammar.EXPRESSION).getFirstChild();
  if (expression.is(PHPGrammar.ASSIGNMENT_EXPR,PHPGrammar.ASSIGNMENT_BY_REFERENCE)) {
    checkAssignedVariable(expression,nextStmt);
  }
 else {
    AstNode exprChild=expression.getFirstChild();
    if (exprChild.is(PHPGrammar.LIST_ASSIGNMENT_EXPR)) {
      checkListVariables(exprChild,nextStmt);
    }
  }
}
Program: 47690
Project: 47690
Buggy source:
@Override public void init(){
  pattern=Pattern.compile(format);
  subscribeTo(FunctionUtils.functions());
  subscribeTo(PHPGrammar.ASSIGNMENT_EXPR);
}

Fixed version (ground truth):
@Override public void init(){
  pattern=Pattern.compile(format);
  subscribeTo(FunctionUtils.functions());
  subscribeTo(PHPGrammar.ASSIGNMENT_EXPR,PHPGrammar.ASSIGNMENT_BY_REFERENCE);
}
Program: 47691
Project: 47691
Buggy source:
@Override public void init(){
  subscribeTo(PHPGrammar.CLASS_DECLARATION,PHPGrammar.METHOD_DECLARATION,PHPGrammar.FUNCTION_EXPRESSION,PHPGrammar.ASSIGNMENT_EXPR);
}

Fixed version (ground truth):
@Override public void init(){
  subscribeTo(PHPGrammar.CLASS_DECLARATION,PHPGrammar.METHOD_DECLARATION,PHPGrammar.FUNCTION_EXPRESSION,PHPGrammar.ASSIGNMENT_EXPR,PHPGrammar.ASSIGNMENT_BY_REFERENCE);
}
Program: 47692
Project: 47692
Buggy source:
@Override public void init(){
  subscribeTo(FunctionUtils.functions());
  subscribeTo(PHPGrammar.GLOBAL_STATEMENT,PHPGrammar.STATIC_STATEMENT,PHPGrammar.LEXICAL_VAR_LIST,PHPGrammar.VAR_IDENTIFIER,PHPGrammar.SIMPLE_ENCAPS_VARIABLE,PHPGrammar.SEMI_COMPLEX_ENCAPS_VARIABLE,PHPGrammar.ASSIGNMENT_EXPR,PHPGrammar.LIST_EXPR);
}

Fixed version (ground truth):
@Override public void init(){
  subscribeTo(FunctionUtils.functions());
  subscribeTo(PHPGrammar.GLOBAL_STATEMENT,PHPGrammar.STATIC_STATEMENT,PHPGrammar.LEXICAL_VAR_LIST,PHPGrammar.VAR_IDENTIFIER,PHPGrammar.SIMPLE_ENCAPS_VARIABLE,PHPGrammar.SEMI_COMPLEX_ENCAPS_VARIABLE,PHPGrammar.ASSIGNMENT_EXPR,PHPGrammar.ASSIGNMENT_BY_REFERENCE,PHPGrammar.LIST_EXPR);
}
Program: 47693
Project: 47693
Buggy source:
@Override public void visitNode(AstNode astNode){
  if (astNode.is(FunctionUtils.functions())) {
    scopes.push(new LocalVariableScope());
    getCurrentScope().declareParameters(astNode);
  }
 else   if (!scopes.isEmpty()) {
    if (astNode.is(PHPGrammar.GLOBAL_STATEMENT)) {
      getCurrentScope().declareGlobals(astNode);
    }
 else     if (astNode.is(PHPGrammar.STATIC_STATEMENT)) {
      getCurrentScope().declareStaticVariables(astNode);
    }
 else     if (astNode.is(PHPGrammar.LEXICAL_VAR_LIST)) {
      getCurrentScope().declareLexicalVariable(astNode,getOuterScope());
    }
 else     if (astNode.is(PHPGrammar.VAR_IDENTIFIER) && !isDeclaration(astNode)) {
      getCurrentScope().useVariable(astNode);
    }
 else     if (astNode.is(PHPGrammar.SEMI_COMPLEX_ENCAPS_VARIABLE)) {
      getCurrentScope().useVariale("String_Node_Str" + astNode.getFirstChild(PHPGrammar.EXPRESSION).getTokenOriginalValue());
    }
 else     if (astNode.is(PHPGrammar.ASSIGNMENT_EXPR)) {
      declareNewLocalVariable(astNode);
    }
 else     if (astNode.is(PHPGrammar.LIST_EXPR)) {
      getCurrentScope().declareListVariable(astNode);
    }
  }
}

Fixed version (ground truth):
@Override public void visitNode(AstNode astNode){
  if (astNode.is(FunctionUtils.functions())) {
    scopes.push(new LocalVariableScope());
    getCurrentScope().declareParameters(astNode);
  }
 else   if (!scopes.isEmpty()) {
    if (astNode.is(PHPGrammar.GLOBAL_STATEMENT)) {
      getCurrentScope().declareGlobals(astNode);
    }
 else     if (astNode.is(PHPGrammar.STATIC_STATEMENT)) {
      getCurrentScope().declareStaticVariables(astNode);
    }
 else     if (astNode.is(PHPGrammar.LEXICAL_VAR_LIST)) {
      getCurrentScope().declareLexicalVariable(astNode,getOuterScope());
    }
 else     if (astNode.is(PHPGrammar.VAR_IDENTIFIER) && !isDeclaration(astNode)) {
      getCurrentScope().useVariable(astNode);
    }
 else     if (astNode.is(PHPGrammar.SEMI_COMPLEX_ENCAPS_VARIABLE)) {
      getCurrentScope().useVariale("String_Node_Str" + astNode.getFirstChild(PHPGrammar.EXPRESSION).getTokenOriginalValue());
    }
 else     if (astNode.is(PHPGrammar.ASSIGNMENT_EXPR,PHPGrammar.ASSIGNMENT_BY_REFERENCE)) {
      declareNewLocalVariable(astNode);
    }
 else     if (astNode.is(PHPGrammar.LIST_EXPR)) {
      getCurrentScope().declareListVariable(astNode);
    }
  }
}
Program: 47694
Project: 47694
Buggy source:
@Test public void test() throws Exception {
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new ForLoopCounterChangedCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(4).withMessage("String_Node_Str").next().atLine(8).next().atLine(12).next().atLine(13).next().atLine(18).next().atLine(21).next().atLine(22).next().atLine(24).next().atLine(31).next().atLine(32).next().atLine(42).next().atLine(43).next().atLine(44).next().atLine(45).next().atLine(49).next().atLine(58).next().atLine(60).next().atLine(66).next().atLine(79).noMore();
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new ForLoopCounterChangedCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(4).withMessage("String_Node_Str").next().atLine(8).next().atLine(12).next().atLine(13).next().atLine(18).next().atLine(21).next().atLine(22).next().atLine(24).next().atLine(31).next().atLine(32).next().atLine(42).next().atLine(43).next().atLine(44).next().atLine(45).next().atLine(49).next().atLine(58).next().atLine(60).next().atLine(66).next().atLine(79).next().atLine(87).noMore();
}
Program: 47695
Project: 47695
Buggy source:
@Test public void test() throws Exception {
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new LocalVariableShadowsClassFieldCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(26).withMessage("String_Node_Str").next().atLine(29).next().atLine(32).next().atLine(36).noMore();
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new LocalVariableShadowsClassFieldCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(26).withMessage("String_Node_Str").next().atLine(29).next().atLine(32).next().atLine(36).next().atLine(42).noMore();
}
Program: 47696
Project: 47696
Buggy source:
@Override public void visitNode(AstNode astNode){
  AstNode caller=astNode.getPreviousAstNode();
  if ("String_Node_Str".equals(caller.getTokenOriginalValue())) {
    getContext().createLineViolation(this,"String_Node_Str",caller);
  }
}

Fixed version (ground truth):
@Override public void visitNode(AstNode astNode){
  if (astNode.getFirstAncestor(PHPGrammar.CLASS_VARIABLE_DECLARATION) != null) {
    return;
  }
  AstNode caller=astNode.getPreviousAstNode();
  if ("String_Node_Str".equals(caller.getTokenOriginalValue())) {
    getContext().createLineViolation(this,"String_Node_Str",caller);
  }
}
Program: 47697
Project: 47697
Buggy source:
@Test public void test() throws Exception {
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new SelfKeywordUsageCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(8).withMessage("String_Node_Str").noMore();
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new SelfKeywordUsageCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(14).withMessage("String_Node_Str").noMore();
}
Program: 47698
Project: 47698
Buggy source:
@Override public void visitNode(AstNode astNode){
  if (!"String_Node_Str".equals(astNode.getTokenOriginalValue().trim())) {
    getContext().createFileViolation(this,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void visitNode(AstNode astNode){
  if (!"String_Node_Str".equals(astNode.getTokenOriginalValue().trim()) && !fileHasIssue) {
    getContext().createFileViolation(this,"String_Node_Str");
    fileHasIssue=true;
  }
}
Program: 47699
Project: 47699
Buggy source:
private void saveViolations(org.sonar.api.resources.File sonarFile,SourceFile squidFile){
  Collection<CheckMessage> messages=squidFile.getCheckMessages();
  if (messages != null) {
    for (    CheckMessage message : messages) {
      RuleKey ruleKey=checks.ruleKey(message.getCheck());
      Issuable issuable=resourcePerspectives.as(Issuable.class,sonarFile);
      if (issuable != null) {
        Issue issue=issuable.newIssueBuilder().ruleKey(ruleKey).line(message.getLine()).message(message.getText(Locale.ENGLISH)).build();
        issuable.addIssue(issue);
      }
    }
  }
}

Fixed version (ground truth):
private void saveViolations(org.sonar.api.resources.File sonarFile,SourceFile squidFile){
  Collection<CheckMessage> messages=squidFile.getCheckMessages();
  if (messages != null) {
    for (    CheckMessage message : messages) {
      RuleKey ruleKey=checks.ruleKey(message.getCheck());
      Issuable issuable=resourcePerspectives.as(Issuable.class,sonarFile);
      if (issuable != null) {
        Issue issue=issuable.newIssueBuilder().ruleKey(ruleKey).line(message.getLine()).message(message.getText(Locale.ENGLISH)).effortToFix(message.getCost()).build();
        issuable.addIssue(issue);
      }
    }
  }
}
Program: 47700
Project: 47700
Buggy source:
@Test public void test_real_life(){
  matches("String_Node_Str");
  matches("String_Node_Str");
  matches("String_Node_Str");
  matches("String_Node_Str");
}

Fixed version (ground truth):
@Test public void test_real_life(){
  matches("String_Node_Str");
  matches("String_Node_Str");
  matches("String_Node_Str");
  matches("String_Node_Str");
  matches("String_Node_Str");
}
Program: 47701
Project: 47701
Buggy source:
private boolean isCorrectlySplittedOnLines(int referenceLine,List<AstNode> items){
  int expectedLine=referenceLine + 1;
  for (  AstNode item : items) {
    if (item.getTokenLine() != expectedLine) {
      return false;
    }
    expectedLine++;
  }
  return true;
}

Fixed version (ground truth):
private boolean isCorrectlySplittedOnLines(int referenceLine,List<AstNode> items){
  int expectedLine=referenceLine + 1;
  for (  AstNode item : items) {
    if (item.getTokenLine() < expectedLine) {
      return false;
    }
    expectedLine++;
  }
  return true;
}
Program: 47702
Project: 47702
Buggy source:
@Test public void defaultValue() throws IllegalAccessException {
  activeOnly("String_Node_Str","String_Node_Str");
  SourceFile file=PHPAstScanner.scanSingleFile(TEST_FILE,check);
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(6).withMessage("String_Node_Str").next().atLine(11).withMessage("String_Node_Str").next().atLine(15).withMessage("String_Node_Str").next().atLine(16).withMessage("String_Node_Str").next().atLine(18).next().atLine(41).withMessage("String_Node_Str").next().atLine(47).withMessage("String_Node_Str").next().atLine(52).withMessage("String_Node_Str").next().atLine(53).withMessage("String_Node_Str").noMore();
}

Fixed version (ground truth):
@Test public void defaultValue() throws IllegalAccessException {
  activeOnly("String_Node_Str","String_Node_Str");
  SourceFile file=PHPAstScanner.scanSingleFile(TEST_FILE,check);
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(6).withMessage("String_Node_Str").next().atLine(11).withMessage("String_Node_Str").next().atLine(15).withMessage("String_Node_Str").next().atLine(16).withMessage("String_Node_Str").next().atLine(18).next().atLine(50).withMessage("String_Node_Str").next().atLine(56).withMessage("String_Node_Str").next().atLine(61).withMessage("String_Node_Str").next().atLine(62).withMessage("String_Node_Str").noMore();
}
Program: 47703
Project: 47703
Buggy source:
private boolean hasNoBreakComment(AstNode astNode){
  for (  Trivia trivia : astNode.getNextAstNode().getToken().getTrivia()) {
    if (trivia.isComment() && "String_Node_Str".equals(trivia.toString().trim())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean hasNoBreakComment(AstNode astNode){
  for (  Trivia trivia : astNode.getNextSibling().getToken().getTrivia()) {
    if (trivia.isComment() && trivia.toString().trim().contains("String_Node_Str")) {
      return true;
    }
  }
  return false;
}
Program: 47704
Project: 47704
Buggy source:
@Override public void visitNode(AstNode astNode){
  if (!isLastCase(astNode) && !isEmpty(astNode) && (!isLastCaseStmtAnException(astNode) || hasNoBreakComment(astNode))) {
    getContext().createLineViolation(this,"String_Node_Str",astNode);
  }
}

Fixed version (ground truth):
@Override public void visitNode(AstNode astNode){
  if (!isLastCase(astNode) && !isEmpty(astNode) && (!isLastCaseStmtAnException(astNode) && !hasNoBreakComment(astNode))) {
    getContext().createLineViolation(this,"String_Node_Str",astNode);
  }
}
Program: 47705
Project: 47705
Buggy source:
@Test public void test(){
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new NonEmptyCaseWithoutBreakCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(5).withMessage("String_Node_Str").next().atLine(7).next().atLine(16).noMore();
}

Fixed version (ground truth):
@Test public void test(){
  SourceFile file=PHPAstScanner.scanSingleFile(TestUtils.getCheckFile("String_Node_Str"),new NonEmptyCaseWithoutBreakCheck());
  checkMessagesVerifier.verify(file.getCheckMessages()).next().atLine(5).withMessage("String_Node_Str").next().atLine(7).next().atLine(17).noMore();
}
Program: 47706
Project: 47706
Buggy source:
private void retrieveTypeFromDoc(AstNode varDeclaration){
  Token varDecToken=varDeclaration.getToken();
  for (  Trivia comment : varDecToken.getTrivia()) {
    for (    String line : comment.getToken().getValue().split("String_Node_Str")) {
      retrieveTypeFromCOmmentLine(line);
    }
  }
}

Fixed version (ground truth):
private void retrieveTypeFromDoc(AstNode varDeclaration){
  Token varDecToken=varDeclaration.getToken();
  for (  Trivia comment : varDecToken.getTrivia()) {
    for (    String line : comment.getToken().getValue().split("String_Node_Str" + PHPLexer.LINE_TERMINATOR + "String_Node_Str")) {
      retrieveTypeFromCommentLine(line);
    }
  }
}
Program: 47707
Project: 47707
Buggy source:
private void retrieveCoupledTypes(AstNode classDeclaration){
  for (  AstNode classStatement : classDeclaration.getChildren(PHPGrammar.CLASS_STATEMENT)) {
    AstNode stmt=classStatement.getFirstChild();
    if (stmt.is(PHPGrammar.CLASS_VARIABLE_DECLARATION)) {
      retrieveTypeFromDoc(stmt);
    }
 else     if (stmt.is(PHPGrammar.METHOD_DECLARATION)) {
      retrieveTypeFromDoc(stmt);
      retrieveTypeFromParameter(stmt);
    }
  }
}

Fixed version (ground truth):
private void retrieveCoupledTypes(AstNode classDeclaration){
  for (  AstNode classStatement : classDeclaration.getChildren(PHPGrammar.CLASS_STATEMENT)) {
    AstNode stmt=classStatement.getFirstChild();
    if (stmt.is(PHPGrammar.CLASS_VARIABLE_DECLARATION,PHPGrammar.CLASS_CONSTANT_DECLARATION)) {
      retrieveTypeFromDoc(stmt);
    }
 else     if (stmt.is(PHPGrammar.METHOD_DECLARATION)) {
      retrieveTypeFromDoc(stmt);
      retrieveTypeFromParameter(stmt);
    }
 else {
      continue;
    }
  }
}
Program: 47708
Project: 47708
Buggy source:
private void retrieveTypeFromParameter(AstNode methodDeclaration){
  AstNode parameterList=methodDeclaration.getFirstChild(PHPGrammar.PARAMETER_LIST);
  if (parameterList != null) {
    for (    AstNode parameter : parameterList.getChildren(PHPGrammar.PARAMETER)) {
      AstNode classType=parameter.getFirstChild(PHPGrammar.OPTIONAL_CLASS_TYPE);
      if (classType != null && classType.getFirstChild().is(PHPGrammar.FULLY_QUALIFIED_NAME)) {
        types.add(getClassName(classType.getFirstChild()));
      }
    }
  }
}

Fixed version (ground truth):
private void retrieveTypeFromParameter(AstNode methodDeclaration){
  AstNode parameterList=methodDeclaration.getFirstChild(PHPGrammar.PARAMETER_LIST);
  if (parameterList != null) {
    for (    AstNode parameter : parameterList.getChildren(PHPGrammar.PARAMETER)) {
      AstNode classType=parameter.getFirstChild(PHPGrammar.OPTIONAL_CLASS_TYPE);
      if (classType != null && classType.getFirstChild().is(PHPGrammar.FULLY_QUALIFIED_CLASS_NAME)) {
        types.add(getClassName(classType.getFirstChild()));
      }
    }
  }
}
Program: 47709
Project: 47709
Buggy source:
@Override public void visitNode(AstNode astNode){
  if (astNode.is(PHPGrammar.CLASS_DECLARATION)) {
    retrieveCoupledTypes(astNode);
  }
 else {
    types.add(getInstantiatedClassName(astNode));
  }
}

Fixed version (ground truth):
@Override public void visitNode(AstNode astNode){
  if (astNode.is(PHPGrammar.CLASS_DECLARATION)) {
    retrieveCoupledTypes(astNode);
  }
 else {
    retrieveInstantiatedClassName(astNode);
  }
}