nus-yam/ex-repair huggingface dataset:
Program: 10098
Project: 10098
Buggy source:
/** 
 * Get array of files for dependency artfacts for given scope
 * @param scope for which to get files
 * @return Array of dependency artifact files
 * @throws MojoExecutionException
 */
protected File[] getDependenciesPath(String scope) throws MojoExecutionException {
  if (scope == null)   return null;
  List<File> files=new ArrayList<File>();
  for (  Artifact a : getDependencyArtifacts(scope)) {
    files.add(MavenUtils.getArtifactFile(a,scope,build));
  }
  return files.toArray(new File[files.size()]);
}

Fixed version (ground truth):
/** 
 * Get array of files for dependency artfacts for given scope
 * @param scope for which to get files
 * @return Array of dependency artifact files
 * @throws MojoExecutionException
 */
protected File[] getDependenciesPath(String scope) throws MojoExecutionException {
  if (scope == null)   return null;
  List<File> files=new ArrayList<File>();
  for (  Artifact a : getDependencyArtifacts(scope)) {
    if (a.getGroupId().equals("String_Node_Str") && a.getArtifactId().equals("String_Node_Str")) {
      files.add(MavenUtils.getArtifactFile(a,scope,build));
    }
 else {
      files.add(a.getFile());
    }
  }
  return files.toArray(new File[files.size()]);
}
Program: 10099
Project: 10099
Buggy source:
protected void run() throws MojoExecutionException, MojoFailureException {
  List<String> args=new ArrayList<String>();
  addDocSources(args);
  addSourcePath(args);
  addLibraries(args);
  addConfigFile(args);
  addFontsSnapshot(args);
  addTemplates(args);
  addOutput(args);
  System.out.println(args);
  ASDoc.asdoc(args.toArray(new String[args.size()]));
}

Fixed version (ground truth):
protected void run() throws MojoExecutionException, MojoFailureException {
  if (docSources == null || docSources.length == 0) {
    getLog().warn("String_Node_Str");
    return;
  }
  List<String> args=new ArrayList<String>();
  addDocSources(args);
  addSourcePath(args);
  addLibraries(args);
  addConfigFile(args);
  addFontsSnapshot(args);
  addTemplates(args);
  addCompatibility(args);
  addOutput(args);
  System.out.println(args);
  ASDoc.asdoc(args.toArray(new String[args.size()]));
}
Program: 10100
Project: 10100
Buggy source:
private void linuxPatch() throws MojoExecutionException {
  if (!isWindows()) {
    Runtime runtime=Runtime.getRuntime();
    String statement=String.format("String_Node_Str",templatesPath.getAbsolutePath(),"String_Node_Str");
    try {
      Process p=runtime.exec(statement);
      if (0 != p.waitFor()) {
        throw new MojoExecutionException(String.format("String_Node_Str"));
      }
    }
 catch (    Exception e) {
      throw new MojoExecutionException(String.format("String_Node_Str",statement));
    }
  }
}

Fixed version (ground truth):
private void linuxPatch(File templates) throws MojoExecutionException {
  if (!isWindows()) {
    Runtime runtime=Runtime.getRuntime();
    String statement=String.format("String_Node_Str",templates.getAbsolutePath(),"String_Node_Str");
    try {
      Process p=runtime.exec(statement);
      if (0 != p.waitFor()) {
        throw new MojoExecutionException(String.format("String_Node_Str"));
      }
    }
 catch (    Exception e) {
      throw new MojoExecutionException(String.format("String_Node_Str",statement));
    }
  }
}
Program: 10101
Project: 10101
Buggy source:
/** 
 * Return a boolean to show if we are running on Windows.
 * @return true if we are running on Windows.
 */
private boolean isWindows(){
  String os=System.getProperty("String_Node_Str");
  if (os.startsWith(WINDOWS_OS)) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Return a boolean to show if we are running on Windows.
 * @return true if we are running on Windows.
 */
private static boolean isWindows(){
  String os=System.getProperty("String_Node_Str");
  if (os.startsWith(WINDOWS_OS)) {
    return true;
  }
 else {
    return false;
  }
}
Program: 10102
Project: 10102
Buggy source:
private File generateDefaultTemplate() throws MojoExecutionException {
  File templates=new File(build.getDirectory(),"String_Node_Str");
  templates.mkdirs();
  try {
    for (    Artifact artifact : pluginArtifacts) {
      if ("String_Node_Str".equals(artifact.getClassifier())) {
        UnzipUtils.unzip(new FileInputStream(artifact.getFile()),templates);
        return templates;
      }
    }
    throw new MojoExecutionException("String_Node_Str");
  }
 catch (  IOException e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
 finally {
    linuxPatch();
  }
}

Fixed version (ground truth):
private File generateDefaultTemplate() throws MojoExecutionException {
  File templates=new File(build.getDirectory(),"String_Node_Str");
  templates.mkdirs();
  try {
    for (    Artifact artifact : pluginArtifacts) {
      if ("String_Node_Str".equals(artifact.getClassifier())) {
        UnzipUtils.unzip(new FileInputStream(artifact.getFile()),templates);
        return templates;
      }
    }
    throw new MojoExecutionException("String_Node_Str");
  }
 catch (  IOException e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
 finally {
    linuxPatch(templates);
  }
}
Program: 10103
Project: 10103
Buggy source:
private File generateDefaultTemplate() throws MojoExecutionException {
  File templates=new File(build.getDirectory(),"String_Node_Str");
  templates.mkdirs();
  try {
    for (    Artifact artifact : pluginArtifacts) {
      if ("String_Node_Str".equals(artifact.getClassifier())) {
        UnzipUtils.unzip(new FileInputStream(artifact.getFile()),templates);
        return templates;
      }
    }
    throw new MojoExecutionException("String_Node_Str");
  }
 catch (  IOException e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
 finally {
    linuxPatch(templates);
  }
}

Fixed version (ground truth):
private File generateDefaultTemplate() throws MojoExecutionException {
  File templates=new File(build.getDirectory(),"String_Node_Str");
  templates.mkdirs();
  try {
    for (    Artifact artifact : pluginArtifacts) {
      if ("String_Node_Str".equals(artifact.getClassifier())) {
        UnzipUtils.unzip(new FileInputStream(artifact.getFile()),templates);
        return templates;
      }
    }
    throw new MojoExecutionException("String_Node_Str");
  }
 catch (  IOException e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
 finally {
    makeHelperExecutable(templates);
  }
}
Program: 10104
Project: 10104
Buggy source:
/** 
 * Perform compilation of Flex source
 */
public void run() throws MojoExecutionException, MojoFailureException {
  builder.setLogger(new CompileLogger(getLog()));
  builder.setConfiguration(configuration);
  getLog().info("String_Node_Str" + configuration.toString().replace("String_Node_Str","String_Node_Str"));
  long bytes;
  try {
    if (incremental && compilationData.exists()) {
      builder.load(loadCompilationData());
    }
    bytes=builder.build(incremental);
    if (incremental) {
      if (compilationData.exists()) {
        compilationData.delete();
        compilationData.createNewFile();
      }
      builder.save(saveCompilationData());
    }
  }
 catch (  IOException e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
catch (  MojoExecutionException e) {
    throw e;
  }
catch (  Exception e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
  if (bytes == 0) {
    throw new MojoFailureException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Perform compilation of Flex source
 */
public void run() throws MojoExecutionException, MojoFailureException {
  builder.setLogger(new CompileLogger(getLog()));
  builder.setConfiguration(configuration);
  getLog().info("String_Node_Str" + configuration.toString().replace("String_Node_Str","String_Node_Str"));
  build(builder);
}
Program: 10105
Project: 10105
Buggy source:
/** 
 * Writes a report to a file.
 * @param report Report containing info to write to file
 * @param type Type of report to write. Valid types are <code>link</code> and <code>config</code>.
 * @throws MojoExecutionException throw if an error occurs during writing of report to file
 */
private void writeReport(Report report,String type) throws MojoExecutionException {
  File fileReport=new File(build.getDirectory(),project.getArtifactId() + "String_Node_Str" + project.getVersion()+ "String_Node_Str"+ type+ "String_Node_Str");
  Writer writer=null;
  try {
    writer=new FileWriter(fileReport);
    if ("String_Node_Str".equals(type)) {
      report.writeLinkReport(writer);
    }
 else     if ("String_Node_Str".equals(type)) {
      report.writeConfigurationReport(writer);
    }
    getLog().info("String_Node_Str" + type + "String_Node_Str"+ fileReport);
  }
 catch (  IOException e) {
    throw new MojoExecutionException("String_Node_Str" + type + "String_Node_Str",e);
  }
 finally {
    try {
      if (null != writer) {
        writer.flush();
        writer.close();
      }
    }
 catch (    IOException e) {
      getLog().error("String_Node_Str",e);
    }
  }
  projectHelper.attachArtifact(project,"String_Node_Str",type + "String_Node_Str",fileReport);
}

Fixed version (ground truth):
/** 
 * Writes a report to a file.
 * @param report Report containing info to write to file
 * @param type Type of report to write. Valid types are <code>link</code> and <code>config</code>.
 * @throws MojoExecutionException throw if an error occurs during writing of report to file
 */
private void writeReport(Report report,String type) throws MojoExecutionException {
  File fileReport=new File(build.getDirectory(),project.getArtifactId() + "String_Node_Str" + project.getVersion()+ "String_Node_Str"+ type+ "String_Node_Str");
  Writer writer=null;
  try {
    writer=new FileWriter(fileReport);
    if ("String_Node_Str".equals(type)) {
      report.writeLinkReport(writer);
      linkReportFile=fileReport;
    }
 else     if ("String_Node_Str".equals(type)) {
      report.writeConfigurationReport(writer);
    }
    getLog().info("String_Node_Str" + type + "String_Node_Str"+ fileReport);
  }
 catch (  IOException e) {
    throw new MojoExecutionException("String_Node_Str" + type + "String_Node_Str",e);
  }
 finally {
    try {
      if (null != writer) {
        writer.flush();
        writer.close();
      }
    }
 catch (    IOException e) {
      getLog().error("String_Node_Str",e);
    }
  }
  projectHelper.attachArtifact(project,"String_Node_Str",type + "String_Node_Str",fileReport);
}
Program: 10106
Project: 10106
Buggy source:
@Override public void setUp() throws MojoExecutionException, MojoFailureException {
  File sourceDirectory=new File(build.getSourceDirectory());
  if (!sourceDirectory.exists()) {
    throw new MojoExecutionException("String_Node_Str" + sourceDirectory);
  }
  if (source == null) {
    source=resolveSourceFile(project,sourceFile);
  }
  if (source == null) {
    throw new MojoExecutionException("String_Node_Str");
  }
  if (!source.exists()) {
    throw new MojoFailureException("String_Node_Str" + sourceFile);
  }
  try {
    builder=new Application(source);
  }
 catch (  FileNotFoundException e) {
    throw new MojoFailureException("String_Node_Str" + source);
  }
  super.setUp();
  builder.setOutput(outputFile);
}

Fixed version (ground truth):
@Override public void setUp() throws MojoExecutionException, MojoFailureException {
  File sourceDirectory=new File(build.getSourceDirectory());
  if (!sourceDirectory.exists()) {
    throw new MojoExecutionException("String_Node_Str" + sourceDirectory);
  }
  if (source == null) {
    source=resolveSourceFile(project,sourceFile);
  }
  if (source == null) {
    throw new MojoExecutionException("String_Node_Str");
  }
  if (!source.exists()) {
    throw new MojoFailureException("String_Node_Str" + sourceFile);
  }
  try {
    builder=new Application(source);
  }
 catch (  FileNotFoundException e) {
    throw new MojoFailureException("String_Node_Str" + source);
  }
  if (moduleFiles != null) {
    modules=new ArrayList<File>();
    for (    String modulePath : moduleFiles) {
      File module=new File(sourceDirectory,modulePath);
      if (!module.exists()) {
        throw new MojoExecutionException("String_Node_Str" + module + "String_Node_Str");
      }
      modules.add(module);
    }
    if (loadExternsOnModules) {
      super.linkReport=true;
    }
  }
  super.setUp();
  builder.setOutput(outputFile);
}
Program: 10107
Project: 10107
Buggy source:
@Override protected void writeResourceBundle(String[] bundles,String locale,File localePath) throws MojoExecutionException {
  getLog().info("String_Node_Str" + locale);
  Library localized=new Library();
  localized.setConfiguration(configuration);
  localized.setLogger(new CompileLogger(getLog()));
  configuration.addLibraryPath(new File[]{outputFile});
  configuration.setLocale(new String[]{locale});
  configuration.setSourcePath(new File[]{localePath});
  for (  String bundle : bundles) {
    localized.addResourceBundle(bundle);
  }
  configuration.addLibraryPath(getResourcesBundles());
  File output=new File(build.getDirectory(),project.getArtifactId() + "String_Node_Str" + project.getVersion()+ "String_Node_Str"+ locale+ "String_Node_Str");
  localized.setOutput(output);
  long bytes;
  try {
    bytes=localized.build(false);
  }
 catch (  IOException e) {
    throw new MojoExecutionException("String_Node_Str",e);
  }
  if (bytes == 0) {
    throw new MojoExecutionException("String_Node_Str");
  }
  projectHelper.attachArtifact(project,"String_Node_Str",locale,output);
}

Fixed version (ground truth):
@Override protected void writeResourceBundle(String[] bundles,String locale,File localePath) throws MojoExecutionException {
  getLog().info("String_Node_Str" + locale);
  Library localized=new Library();
  localized.setConfiguration(configuration);
  localized.setLogger(new CompileLogger(getLog()));
  configuration.addLibraryPath(new File[]{outputFile});
  configuration.setLocale(new String[]{locale});
  configuration.setSourcePath(new File[]{localePath});
  for (  String bundle : bundles) {
    localized.addResourceBundle(bundle);
  }
  configuration.addLibraryPath(getResourcesBundles());
  File output=new File(build.getDirectory(),project.getArtifactId() + "String_Node_Str" + project.getVersion()+ "String_Node_Str"+ locale+ "String_Node_Str");
  localized.setOutput(output);
  build(localized);
  projectHelper.attachArtifact(project,"String_Node_Str",locale,output);
}
Program: 10114
Project: 10114
Buggy source:
public String doCleanLink(String link){
  if (link == null)   return null;
  try {
    if (link.endsWith("String_Node_Str"))     link=link + "String_Node_Str";
    link=URLDecoder.decode(link,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
  }
  return link;
}

Fixed version (ground truth):
public String doCleanLink(String link){
  if (link == null)   return null;
  try {
    link=URLDecoder.decode(link,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
  }
  return link;
}
Program: 10115
Project: 10115
Buggy source:
public String doClean(String text){
  if (text == null)   return null;
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  return this.cleanSimple(text);
}

Fixed version (ground truth):
public String doClean(String text){
  if (text == null)   return null;
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  return this.cleanSimple(text);
}
Program: 10116
Project: 10116
Buggy source:
public String cleanLink(String text){
  return super.doCleanLink(super.doClean(text));
}

Fixed version (ground truth):
public String cleanLink(String text){
  if (text == null)   return null;
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  return super.doCleanLink(super.doClean(text));
}
Program: 10117
Project: 10117
Buggy source:
public String doClean(String text){
  if (text == null)   return null;
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  return this.cleanSimple(text);
}

Fixed version (ground truth):
public String doClean(String text){
  if (text == null)   return null;
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  text=text.replaceAll("String_Node_Str","String_Node_Str");
  return this.cleanSimple(text);
}
Program: 10119
Project: 10119
Buggy source:
public synchronized void createTables() throws BoardInitException, SQLException {
  return;
}

Fixed version (ground truth):
public synchronized void createTables() throws BoardInitException, SQLException {
  PreparedStatement pst=conn.prepareStatement("String_Node_Str");
  ResultSet res=null;
  String commonSql=null;
  try {
    pst.setString(1,"String_Node_Str");
    res=pst.executeQuery();
    if (!res.isBeforeFirst()) {
      try {
        commonSql=Resources.toString(Resources.getResource("String_Node_Str"),Charsets.UTF_8);
      }
 catch (      IOException e) {
        throw new BoardInitException(e);
      }
catch (      IllegalArgumentException e) {
        throw new BoardInitException(e);
      }
    }
  }
  finally {
    pst.close();
    conn.commit();
  }
  pst=conn.prepareStatement("String_Node_Str");
  try {
    pst.setString(1,this.table);
    res=pst.executeQuery();
    if (res.isBeforeFirst())     return;
  }
  finally {
    pst.close();
    conn.commit();
  }
  String boardSql;
  try {
    boardSql=Resources.toString(Resources.getResource("String_Node_Str"),Charsets.UTF_8);
    boardSql=boardSql.replaceAll("String_Node_Str",table);
  }
 catch (  IOException e) {
    throw new BoardInitException(e);
  }
catch (  IllegalArgumentException e) {
    throw new BoardInitException(e);
  }
  String triggersSql;
  try {
    triggersSql=Resources.toString(Resources.getResource("String_Node_Str"),Charsets.UTF_8);
    triggersSql=triggersSql.replaceAll("String_Node_Str",table);
  }
 catch (  IOException e) {
    throw new BoardInitException(e);
  }
catch (  IllegalArgumentException e) {
    throw new BoardInitException(e);
  }
  Statement st=conn.createStatement();
  try {
    if (commonSql != null)     st.executeUpdate(commonSql);
    st.executeUpdate(boardSql);
    st.executeUpdate(triggersSql);
    conn.commit();
  }
  finally {
    st.close();
  }
}
Program: 10120
Project: 10120
Buggy source:
public synchronized void init(String connStr,String path,BoardSettings info) throws BoardInitException {
  this.table=info.getTable();
  if (this.insertQuery == null) {
    this.insertQuery=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",this.table,this.table);
  }
  this.updateQuery=String.format("String_Node_Str" + "String_Node_Str",table);
  String selectMediaQuery=String.format("String_Node_Str",table);
  try {
    conn=DriverManager.getConnection(connStr);
    conn.setAutoCommit(true);
    conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
    this.createTables();
    insertStmt=conn.prepareStatement(insertQuery);
    updateStmt=conn.prepareStatement(updateQuery);
    selectMediaStmt=conn.prepareStatement(selectMediaQuery);
  }
 catch (  SQLException e) {
    throw new BoardInitException(e);
  }
}

Fixed version (ground truth):
public synchronized void init(String connStr,String path,BoardSettings info) throws BoardInitException {
  this.table=info.getTable();
  if (this.insertQuery == null) {
    this.insertQuery=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",this.table,this.table);
  }
  this.updateQuery=String.format("String_Node_Str" + "String_Node_Str",table);
  String selectMediaQuery=String.format("String_Node_Str",table);
  try {
    conn=DriverManager.getConnection(connStr);
    conn.setAutoCommit(false);
    conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
    this.createTables();
    insertStmt=conn.prepareStatement(insertQuery);
    updateStmt=conn.prepareStatement(updateQuery);
    selectMediaStmt=conn.prepareStatement(selectMediaQuery);
  }
 catch (  SQLException e) {
    throw new BoardInitException(e);
  }
}
Program: 10121
Project: 10121
Buggy source:
public synchronized Media getMedia(Post post) throws ContentGetException {
  Media media=null;
  ResultSet mediaRs=null;
  try {
    selectMediaStmt.setString(1,post.getMediaHash());
    mediaRs=selectMediaStmt.executeQuery();
  }
 catch (  SQLException e) {
    throw new ContentGetException(e);
  }
  try {
    if (mediaRs.next()) {
      media=new Media(mediaRs.getInt("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getInt("String_Node_Str"),mediaRs.getInt("String_Node_Str"));
    }
  }
 catch (  SQLException e) {
    throw new ContentGetException(e);
  }
 finally {
    try {
      mediaRs.close();
    }
 catch (    SQLException e) {
      throw new ContentGetException(e);
    }
  }
  if (media == null) {
    throw new ContentGetException("String_Node_Str" + post.getMediaHash() + "String_Node_Str");
  }
  return media;
}

Fixed version (ground truth):
public synchronized Media getMedia(Post post) throws ContentGetException {
  Media media=null;
  ResultSet mediaRs=null;
  try {
    selectMediaStmt.setString(1,post.getMediaHash());
    mediaRs=selectMediaStmt.executeQuery();
  }
 catch (  SQLException e) {
    throw new ContentGetException(e);
  }
  try {
    conn.commit();
  }
 catch (  SQLException e) {
    try {
      conn.rollback();
    }
 catch (    SQLException e1) {
      e1.setNextException(e);
      throw new ContentGetException(e1);
    }
 finally {
      try {
        mediaRs.close();
      }
 catch (      SQLException e1) {
        throw new ContentGetException(e1);
      }
    }
    throw new ContentGetException(e);
  }
  try {
    if (mediaRs.next()) {
      media=new Media(mediaRs.getInt("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getString("String_Node_Str"),mediaRs.getInt("String_Node_Str"),mediaRs.getInt("String_Node_Str"));
    }
  }
 catch (  SQLException e) {
    throw new ContentGetException(e);
  }
 finally {
    try {
      mediaRs.close();
    }
 catch (    SQLException e) {
      throw new ContentGetException(e);
    }
  }
  if (media == null) {
    throw new ContentGetException("String_Node_Str" + post.getMediaHash() + "String_Node_Str");
  }
  return media;
}
Program: 10123
Project: 10123
Buggy source:
protected Column createColumn(ByteBuffer name,ByteBuffer value){
  Column column=new Column();
  column.setName(name);
  column.setValue(value);
  column.setTimestamp(getTimestamp());
  return column;
}

Fixed version (ground truth):
protected Column createColumn(ByteBuffer name,ByteBuffer value){
  Column column=new Column();
  column.setName(name);
  column.setValue(value);
  column.setTimestamp(getTimestamp() + 1);
  return column;
}
Program: 10124
Project: 10124
Buggy source:
protected long getTimestamp(){
  return System.currentTimeMillis() * 1000;
}

Fixed version (ground truth):
protected long getTimestamp(){
  return System.nanoTime() * 10;
}
Program: 10125
Project: 10125
Buggy source:
public dEntity getEntityFrom(dPlayer player,dNPC npc){
  dEntity entity=null;
  try {
    if (contains("String_Node_Str")) {
      String entityType=TagManager.tag((getString("String_Node_Str","String_Node_Str")),new BukkitTagContext(player,npc,false,null,shouldDebug(),new dScript(this)));
      entity=dEntity.valueOf(entityType);
    }
 else {
      throw new Exception("String_Node_Str");
    }
    Set<StringHolder> strings=getConfigurationSection("String_Node_Str").getKeys(false);
    for (    StringHolder string : strings) {
      if (!string.low.equals("String_Node_Str") && !string.low.equals("String_Node_Str")) {
        String value=TagManager.tag((getString(string.low,"String_Node_Str")),new BukkitTagContext(player,npc,false,null,shouldDebug(),new dScript(this)));
        entity.adjust(new Mechanism(new Element(string.low),new Element(value)));
      }
    }
    if (entity == null || entity.isUnique()) {
      return null;
    }
    entity.setEntityScript(getName());
  }
 catch (  Exception e) {
    dB.echoError("String_Node_Str");
    dB.echoError(e);
    entity=null;
  }
  return entity;
}

Fixed version (ground truth):
public dEntity getEntityFrom(dPlayer player,dNPC npc){
  dEntity entity=null;
  try {
    if (contains("String_Node_Str")) {
      String entityType=TagManager.tag((getString("String_Node_Str","String_Node_Str")),new BukkitTagContext(player,npc,false,null,shouldDebug(),new dScript(this)));
      entity=dEntity.valueOf(entityType);
    }
 else {
      throw new Exception("String_Node_Str");
    }
    Set<StringHolder> strings=getConfigurationSection("String_Node_Str").getKeys(false);
    for (    StringHolder string : strings) {
      if (!string.low.equals("String_Node_Str") && !string.low.equals("String_Node_Str") && !string.low.equals("String_Node_Str")) {
        String value=TagManager.tag((getString(string.low,"String_Node_Str")),new BukkitTagContext(player,npc,false,null,shouldDebug(),new dScript(this)));
        entity.adjust(new Mechanism(new Element(string.low),new Element(value)));
      }
    }
    if (entity == null || entity.isUnique()) {
      return null;
    }
    entity.setEntityScript(getName());
  }
 catch (  Exception e) {
    dB.echoError("String_Node_Str");
    dB.echoError(e);
    entity=null;
  }
  return entity;
}
Program: 10126
Project: 10126
Buggy source:
@Override public String identify(){
  for (  Field field : Color.class.getFields()) {
    try {
      if (((Color)field.get(null)).asRGB() == getColor().asRGB()) {
        return "String_Node_Str" + field.getName();
      }
    }
 catch (    Exception e) {
      dB.echoError("String_Node_Str");
    }
  }
  return "String_Node_Str" + getColor().getRed() + "String_Node_Str"+ getColor().getGreen()+ "String_Node_Str"+ getColor().getBlue();
}

Fixed version (ground truth):
@Override public String identify(){
  for (  Field field : Color.class.getFields()) {
    try {
      if (Color.class.isAssignableFrom(field.getType()) && ((Color)field.get(null)).asRGB() == getColor().asRGB()) {
        return "String_Node_Str" + field.getName();
      }
    }
 catch (    Exception e) {
      dB.echoError("String_Node_Str" + e.getClass().getCanonicalName() + "String_Node_Str"+ e.getMessage());
    }
  }
  return "String_Node_Str" + getColor().getRed() + "String_Node_Str"+ getColor().getGreen()+ "String_Node_Str"+ getColor().getBlue();
}
Program: 10127
Project: 10127
Buggy source:
@Override public String getAttribute(Attribute attribute){
  if (attribute == null) {
    return null;
  }
  if (attribute.startsWith("String_Node_Str") || attribute.startsWith("String_Node_Str")) {
    Material mat=item.getItemStack().getType();
    if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2) && (mat == Material.POTION || mat == Material.LINGERING_POTION || mat == Material.SPLASH_POTION)) {
      return new dColor(((PotionMeta)item.getItemStack().getItemMeta()).getColor()).getAttribute(attribute.fulfill((1)));
    }
    return new dColor(((LeatherArmorMeta)item.getItemStack().getItemMeta()).getColor()).getAttribute(attribute.fulfill(1));
  }
  return null;
}

Fixed version (ground truth):
@Override public String getAttribute(Attribute attribute){
  if (attribute == null) {
    return null;
  }
  if (attribute.startsWith("String_Node_Str") || attribute.startsWith("String_Node_Str")) {
    Material mat=item.getItemStack().getType();
    if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2) && (mat == Material.POTION || mat == Material.LINGERING_POTION || mat == Material.SPLASH_POTION)) {
      PotionMeta pm=(PotionMeta)item.getItemStack().getItemMeta();
      if (!pm.hasColor()) {
        return new dColor(Color.WHITE).getAttribute(attribute.fulfill((1)));
      }
      return new dColor(pm.getColor()).getAttribute(attribute.fulfill((1)));
    }
    return new dColor(((LeatherArmorMeta)item.getItemStack().getItemMeta()).getColor()).getAttribute(attribute.fulfill(1));
  }
  return null;
}
Program: 10128
Project: 10128
Buggy source:
@Override public String getPropertyString(){
  Material mat=item.getItemStack().getType();
  if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2) && (mat == Material.POTION || mat == Material.LINGERING_POTION || mat == Material.SPLASH_POTION)) {
    return new dColor(((PotionMeta)item.getItemStack().getItemMeta()).getColor()).identify();
  }
  return new dColor(((LeatherArmorMeta)item.getItemStack().getItemMeta()).getColor()).identify();
}

Fixed version (ground truth):
@Override public String getPropertyString(){
  Material mat=item.getItemStack().getType();
  if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2) && (mat == Material.POTION || mat == Material.LINGERING_POTION || mat == Material.SPLASH_POTION)) {
    PotionMeta pm=(PotionMeta)item.getItemStack().getItemMeta();
    if (!pm.hasColor()) {
      return null;
    }
    return new dColor(pm.getColor()).identify();
  }
  return new dColor(((LeatherArmorMeta)item.getItemStack().getItemMeta()).getColor()).identify();
}
Program: 10130
Project: 10130
Buggy source:
/** 
 * Get the location of this entity
 * @return The Location
 */
public dLocation getLocation(){
  if (isUnique() && entity != null) {
    return new dLocation(entity.getLocation());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the location of this entity
 * @return The Location
 */
public dLocation getLocation(){
  if (entity != null) {
    return new dLocation(entity.getLocation());
  }
  return null;
}
Program: 10131
Project: 10131
Buggy source:
public dItem getSpecialRecipeResult(ItemStack[] matrix,Player player){
  master:   for (  Map.Entry<ItemScriptContainer,List<dItem>> entry : ItemScriptContainer.specialrecipesMap.entrySet()) {
    for (int n=0; n < 9; n++) {
      dItem valueN=entry.getValue().get(n);
      dItem matrixN=matrix.length <= n || matrix[n] == null ? new dItem(Material.AIR) : new dItem(matrix[n].clone());
      if (valueN.isItemscript() != matrixN.isItemscript()) {
        continue master;
      }
      if (valueN.isItemscript() && matrixN.isItemscript()) {
        if (!valueN.getScriptName().equalsIgnoreCase(matrixN.getScriptName())) {
          continue master;
        }
      }
 else       if (!valueN.getMaterial().matchesMaterialData(matrixN.getMaterial().getMaterialData())) {
        continue master;
      }
    }
    return entry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
  }
  primary:   for (  Map.Entry<ItemScriptContainer,List<dItem>> entry : ItemScriptContainer.shapelessRecipesMap.entrySet()) {
    for (int i=0; i < entry.getValue().size(); i++) {
      if (!containsAny(entry.getValue().get(i),matrix)) {
        continue primary;
      }
    }
    int c=0;
    for (int i=0; i < matrix.length; i++) {
      if (matrix[i] != null && matrix[i].getType() != Material.AIR) {
        c++;
      }
    }
    if (c != entry.getValue().size()) {
      continue primary;
    }
    return entry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
  }
  return null;
}

Fixed version (ground truth):
public dItem getSpecialRecipeResult(ItemStack[] matrix,Player player){
  Map.Entry<ItemScriptContainer,List<dItem>> recipeEntry=getSpecialRecipeEntry(matrix);
  if (recipeEntry != null) {
    return recipeEntry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
  }
  return null;
}
Program: 10133
Project: 10133
Buggy source:
public boolean emulateSpecialRecipeResultShiftClick(CraftingInventory inventory,Player player){
  ItemStack[] matrix=inventory.getMatrix();
  for (int i=0; i < matrix.length; i++) {
    matrix[i]=matrix[i] == null ? new ItemStack(Material.AIR) : matrix[i].clone();
  }
  dItem result=getSpecialRecipeResult(matrix,player);
  if (result != null) {
    int lowestAmount=0;
    for (int n=0; n < matrix.length; n++) {
      if ((matrix[n].getAmount() > 0 && matrix[n].getAmount() < lowestAmount) || lowestAmount == 0) {
        lowestAmount=matrix[n].getAmount();
      }
    }
    for (int n=0; n < matrix.length; n++) {
      if (matrix[n].getAmount() > 0) {
        matrix[n].setAmount(matrix[n].getAmount() - lowestAmount);
        if (matrix[n].getAmount() <= 0) {
          matrix[n]=null;
        }
      }
    }
    if (lowestAmount > 1) {
      ItemStack resultStack=result.getItemStack().clone();
      resultStack.setAmount(lowestAmount * resultStack.getAmount());
      inventory.setMatrix(matrix);
      inventory.setResult(resultStack);
      player.updateInventory();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean emulateSpecialRecipeResultShiftClick(CraftingInventory inventory,Player player){
  ItemStack[] matrix=inventory.getMatrix();
  for (int i=0; i < matrix.length; i++) {
    matrix[i]=matrix[i] == null ? new ItemStack(Material.AIR) : matrix[i].clone();
  }
  Map.Entry<ItemScriptContainer,List<dItem>> recipeEntry=getSpecialRecipeEntry(matrix);
  if (recipeEntry != null) {
    List<dItem> recipe=recipeEntry.getValue();
    dItem result=recipeEntry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
    int lowestAmount=0;
    for (int n=0; n < matrix.length; n++) {
      if (matrix[n].getAmount() == 0 || recipe.get(n).getAmount() == 0)       continue;
      if ((matrix[n].getAmount() / recipe.get(n).getAmount() < lowestAmount) || lowestAmount == 0) {
        lowestAmount=matrix[n].getAmount() / recipe.get(n).getAmount();
      }
    }
    for (int n=0; n < matrix.length; n++) {
      if (matrix[n].getAmount() > 0) {
        matrix[n].setAmount(matrix[n].getAmount() - lowestAmount * recipe.get(n).getAmount());
        if (matrix[n].getAmount() <= 0) {
          matrix[n]=null;
        }
      }
    }
    if (lowestAmount > 1) {
      ItemStack resultStack=result.getItemStack().clone();
      resultStack.setAmount(lowestAmount * resultStack.getAmount());
      inventory.setMatrix(matrix);
      inventory.setResult(resultStack);
      player.updateInventory();
    }
    return true;
  }
  return false;
}
Program: 10134
Project: 10134
Buggy source:
public String getPropertyString(){
  ItemStack itemStack=item.getItemStack();
  if (itemStack.hasItemMeta() && itemStack.getItemMeta().spigot().isUnbreakable()) {
    return "String_Node_Str";
  }
  return null;
}

Fixed version (ground truth):
public String getPropertyString(){
  ItemStack itemStack=item.getItemStack();
  if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
    return (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) ? "String_Node_Str" : null;
  }
  return (itemStack.hasItemMeta() && itemStack.getItemMeta().spigot().isUnbreakable()) ? "String_Node_Str" : null;
}
Program: 10135
Project: 10135
Buggy source:
@Override public void render(MapView mapView,MapCanvas mapCanvas,Player player){
  if (active) {
    try {
      UUID uuid=player.getUniqueId();
      dPlayer p=dPlayer.mirrorBukkitPlayer(player);
      for (      MapObject object : mapObjects) {
        if (autoUpdate) {
          object.update(p,uuid);
        }
        if (object.isVisibleTo(p,uuid)) {
          object.render(mapView,mapCanvas,p,uuid);
        }
      }
    }
 catch (    Exception e) {
      dB.echoError(e);
      mapView.removeRenderer(this);
    }
  }
 else {
    mapView.removeRenderer(this);
  }
}

Fixed version (ground truth):
@Override public void render(MapView mapView,MapCanvas mapCanvas,Player player){
  if (!DenizenAPI.getCurrentInstance().isEnabled()) {
    return;
  }
  if (active) {
    try {
      UUID uuid=player.getUniqueId();
      dPlayer p=dPlayer.mirrorBukkitPlayer(player);
      for (      MapObject object : mapObjects) {
        if (autoUpdate) {
          object.update(p,uuid);
        }
        if (object.isVisibleTo(p,uuid)) {
          object.render(mapView,mapCanvas,p,uuid);
        }
      }
    }
 catch (    Exception e) {
      dB.echoError(e);
      mapView.removeRenderer(this);
    }
  }
 else {
    mapView.removeRenderer(this);
  }
}
Program: 10136
Project: 10136
Buggy source:
public dItem getSpecialRecipeResult(ItemStack[] matrix,Player player){
  master:   for (  Map.Entry<ItemScriptContainer,List<dItem>> entry : ItemScriptContainer.specialrecipesMap.entrySet()) {
    for (int n=0; n < 9; n++) {
      dItem valueN=entry.getValue().get(n);
      dItem matrixN=matrix.length <= n || matrix[n] == null ? new dItem(Material.AIR) : new dItem(matrix[n].clone());
      if (valueN.isItemscript() != matrixN.isItemscript()) {
        continue master;
      }
      if (valueN.isItemscript() && matrixN.isItemscript()) {
        if (!valueN.getScriptName().equalsIgnoreCase(matrixN.getScriptName())) {
          continue master;
        }
      }
 else       if (!valueN.getMaterial().matchesMaterialData(matrixN.getMaterial().getMaterialData())) {
        continue master;
      }
    }
    return entry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
  }
  primary:   for (  Map.Entry<ItemScriptContainer,List<dItem>> entry : ItemScriptContainer.shapelessRecipesMap.entrySet()) {
    for (int i=0; i < entry.getValue().size(); i++) {
      if (!containsAny(entry.getValue().get(i),matrix)) {
        continue primary;
      }
    }
    return entry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
  }
  return null;
}

Fixed version (ground truth):
public dItem getSpecialRecipeResult(ItemStack[] matrix,Player player){
  master:   for (  Map.Entry<ItemScriptContainer,List<dItem>> entry : ItemScriptContainer.specialrecipesMap.entrySet()) {
    for (int n=0; n < 9; n++) {
      dItem valueN=entry.getValue().get(n);
      dItem matrixN=matrix.length <= n || matrix[n] == null ? new dItem(Material.AIR) : new dItem(matrix[n].clone());
      if (valueN.isItemscript() != matrixN.isItemscript()) {
        continue master;
      }
      if (valueN.isItemscript() && matrixN.isItemscript()) {
        if (!valueN.getScriptName().equalsIgnoreCase(matrixN.getScriptName())) {
          continue master;
        }
      }
 else       if (!valueN.getMaterial().matchesMaterialData(matrixN.getMaterial().getMaterialData())) {
        continue master;
      }
    }
    return entry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
  }
  primary:   for (  Map.Entry<ItemScriptContainer,List<dItem>> entry : ItemScriptContainer.shapelessRecipesMap.entrySet()) {
    for (int i=0; i < entry.getValue().size(); i++) {
      if (!containsAny(entry.getValue().get(i),matrix)) {
        continue primary;
      }
    }
    int c=0;
    for (int i=0; i < matrix.length; i++) {
      if (matrix[i] != null && matrix[i].getType() != Material.AIR) {
        c++;
      }
    }
    if (c != entry.getValue().size()) {
      continue primary;
    }
    return entry.getKey().getItemFrom(dPlayer.mirrorBukkitPlayer(player),null);
  }
  return null;
}
Program: 10137
Project: 10137
Buggy source:
public static void updatePlayerProfiles(PacketPlayOutPlayerInfo packet){
  PacketPlayOutPlayerInfo.EnumPlayerInfoAction action=ReflectionHelper.getFieldValue(PacketPlayOutPlayerInfo.class,"String_Node_Str",packet);
  if (action != PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER) {
    return;
  }
  List<?> dataList=ReflectionHelper.getFieldValue(PacketPlayOutPlayerInfo.class,"String_Node_Str",packet);
  if (dataList != null) {
    try {
      for (      Object data : dataList) {
        GameProfile gameProfile=(GameProfile)playerInfoData_gameProfile.get(data);
        if (fakeProfiles.containsKey(gameProfile.getId())) {
          playerInfoData_gameProfile.set(data,getGameProfile(fakeProfiles.get(gameProfile.getId())));
        }
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public static void updatePlayerProfiles(PacketPlayOutPlayerInfo packet){
  PacketPlayOutPlayerInfo.EnumPlayerInfoAction action=ReflectionHelper.getFieldValue(PacketPlayOutPlayerInfo.class,"String_Node_Str",packet);
  if (action != PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER) {
    return;
  }
  List<PacketPlayOutPlayerInfo.PlayerInfoData> dataList=ReflectionHelper.getFieldValue(PacketPlayOutPlayerInfo.class,"String_Node_Str",packet);
  if (dataList != null) {
    try {
      for (      PacketPlayOutPlayerInfo.PlayerInfoData data : dataList) {
        GameProfile gameProfile=(GameProfile)playerInfoData_gameProfile.get(data);
        if (fakeProfiles.containsKey(gameProfile.getId())) {
          playerInfoData_gameProfile.set(data,getGameProfile(fakeProfiles.get(gameProfile.getId())));
        }
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 10138
Project: 10138
Buggy source:
public PacketOutChat_v1_12_R1(PacketPlayOutChat internal){
  this.internal=internal;
  try {
    IChatBaseComponent baseComponent=(IChatBaseComponent)MESSAGE.get(internal);
    if (baseComponent != null) {
      message=baseComponent.toPlainText();
      rawJson=IChatBaseComponent.ChatSerializer.a(baseComponent);
    }
 else {
      message=BaseComponent.toPlainText(internal.components);
      rawJson=ComponentSerializer.toString(internal.components);
      bungee=true;
    }
    position=POSITION.getInt(internal);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public PacketOutChat_v1_12_R1(PacketPlayOutChat internal){
  this.internal=internal;
  try {
    IChatBaseComponent baseComponent=(IChatBaseComponent)MESSAGE.get(internal);
    if (baseComponent != null) {
      message=baseComponent.toPlainText();
      rawJson=IChatBaseComponent.ChatSerializer.a(baseComponent);
    }
 else {
      message=BaseComponent.toPlainText(internal.components);
      rawJson=ComponentSerializer.toString(internal.components);
      bungee=true;
    }
    position=(ChatMessageType)POSITION.get(internal);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 10139
Project: 10139
Buggy source:
@Override public int getPosition(){
  return position;
}

Fixed version (ground truth):
@Override public int getPosition(){
  return position.ordinal();
}
Program: 10141
Project: 10141
Buggy source:
@Override public void run(){
  sendPacket(new PacketPlayOutMount(entity.getVehicle()));
}

Fixed version (ground truth):
@Override public void run(){
  sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER,fakePlayer));
}
Program: 10142
Project: 10142
Buggy source:
/** 
 * Listens for spawn of an NPC and updates its health with the max health information for this trait.
 */
@Override public void onSpawn(){
  dying=false;
  setHealth();
  void_watcher_task=Bukkit.getScheduler().scheduleSyncRepeatingTask(DenizenAPI.getCurrentInstance(),new Runnable(){
    @Override public void run(){
      if (!npc.isSpawned()) {
        Bukkit.getScheduler().cancelTask(void_watcher_task);
        return;
      }
      if (npc.getEntity().getLocation().getY() < -1000) {
        npc.despawn(DespawnReason.DEATH);
        if (respawn) {
          if (npc.isSpawned()) {
            npc.getEntity().teleport(getRespawnLocation());
          }
 else {
            npc.spawn(getRespawnLocation());
          }
        }
      }
    }
  }
,200,200);
}

Fixed version (ground truth):
/** 
 * Listens for spawn of an NPC and updates its health with the max health information for this trait.
 */
@Override public void onSpawn(){
  dying=false;
  setHealth();
  void_watcher_task=Bukkit.getScheduler().scheduleSyncRepeatingTask(DenizenAPI.getCurrentInstance(),new Runnable(){
    @Override public void run(){
      if (!npc.isSpawned()) {
        Bukkit.getScheduler().cancelTask(void_watcher_task);
        return;
      }
      if (npc.getEntity().getLocation().getY() < -1000) {
        npc.despawn(DespawnReason.DEATH);
        if (respawn) {
          Location res=getRespawnLocation();
          res.setY(res.getWorld().getHighestBlockYAt(res.getBlockX(),res.getBlockZ()));
          if (npc.isSpawned()) {
            npc.getEntity().teleport(res);
          }
 else {
            npc.spawn(res);
          }
        }
      }
    }
  }
,200,200);
}
Program: 10143
Project: 10143
Buggy source:
public EntityFakeArrow_v1_10_R1(CraftWorld craftWorld,Location location){
  super(craftWorld.getHandle());
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  world.addEntity(this);
  bukkitEntity=new CraftFakeArrow_v1_10_R1((CraftServer)Bukkit.getServer(),this);
}

Fixed version (ground truth):
public EntityFakeArrow_v1_10_R1(CraftWorld craftWorld,Location location){
  super(craftWorld.getHandle());
  bukkitEntity=new CraftFakeArrow_v1_10_R1((CraftServer)Bukkit.getServer(),this);
  setPositionRotation(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  world.addEntity(this);
}