Program: 74647
Project: 74647
Buggy source:
/** 
 * Copy files to the code directory.  The optional <code>fileDependencies</code> codeBlock consists of one or more lines where each line names a file that should be copied to the directory named by the <i>codeDirectory</i> parameter of the code generator. The file is only copied if a file by that name does not exist in <i>codeDirectory</i> or if the source file was more recently modified than the destination file. <p>Using the <code>fileDependencies</code> code block allows actor writers to refer to code defined in other files.
 * @exception IOException If there is a problem reading the <i>codeDirectory</i> parameter.
 * @exception IllegalActionException If there is a problem reading the <i>codeDirectory</i> parameter.
 */
private void _copyFilesToCodeDirectory() throws IOException, IllegalActionException {
  _codeStream.clear();
  String fileDependencies=_generateBlockByName("String_Node_Str");
  _codeStream.clear();
  if (fileDependencies.length() > 0) {
    File codeDirectoryFile=_codeGenerator._codeDirectoryAsFile();
    BufferedReader bufferedReader=null;
    try {
      bufferedReader=new BufferedReader(new StringReader(fileDependencies));
      String necessaryFileName=null;
      while ((necessaryFileName=bufferedReader.readLine()) != null) {
        necessaryFileName=necessaryFileName.trim();
        if (necessaryFileName.length() == 0 || necessaryFileName.startsWith("String_Node_Str") || necessaryFileName.startsWith("String_Node_Str")) {
          continue;
        }
        URL necessaryURL=null;
        try {
          necessaryURL=FileUtilities.nameToURL(necessaryFileName,null,null);
        }
 catch (        IOException ex) {
          if (necessaryFileName.indexOf("String_Node_Str") == -1 || necessaryFileName.indexOf("String_Node_Str") == -1) {
            try {
              necessaryURL=FileUtilities.nameToURL("String_Node_Str" + necessaryFileName,null,null);
            }
 catch (            IOException ex2) {
              throw ex;
            }
          }
 else {
            throw ex;
          }
        }
        String necessaryFileShortName=necessaryURL.getPath();
        if (necessaryURL.getPath().lastIndexOf("String_Node_Str") > -1) {
          necessaryFileShortName=necessaryFileShortName.substring(necessaryFileShortName.lastIndexOf("String_Node_Str"));
        }
        File necessaryFileDestination=new File(codeDirectoryFile,necessaryFileShortName);
        File necessaryFileSource=new File(necessaryFileName);
        if (!necessaryFileDestination.exists() || (necessaryFileSource.exists() && necessaryFileSource.lastModified() > necessaryFileDestination.lastModified())) {
          System.out.println("String_Node_Str" + necessaryFileSource + "String_Node_Str"+ necessaryFileDestination);
          FileUtilities.binaryCopyURLToFile(necessaryURL,necessaryFileDestination);
        }
      }
    }
  finally {
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        }
 catch (        IOException ex) {
          ex.printStackTrace();
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Copy files to the code directory.  The optional <code>fileDependencies</code> codeBlock consists of one or more lines where each line names a file that should be copied to the directory named by the <i>codeDirectory</i> parameter of the code generator. The file is only copied if a file by that name does not exist in <i>codeDirectory</i> or if the source file was more recently modified than the destination file. <p>Using the <code>fileDependencies</code> code block allows actor writers to refer to code defined in other files.
 * @exception IOException If there is a problem reading the <i>codeDirectory</i> parameter.
 * @exception IllegalActionException If there is a problem reading the <i>codeDirectory</i> parameter.
 */
private void _copyFilesToCodeDirectory() throws IOException, IllegalActionException {
  CodeStream codeStream=new CodeStream(this);
  codeStream.appendCodeBlock("String_Node_Str",true);
  String fileDependencies=codeStream.toString();
  if (fileDependencies.length() > 0) {
    File codeDirectoryFile=_codeGenerator._codeDirectoryAsFile();
    BufferedReader bufferedReader=null;
    try {
      bufferedReader=new BufferedReader(new StringReader(fileDependencies));
      String necessaryFileName=null;
      while ((necessaryFileName=bufferedReader.readLine()) != null) {
        necessaryFileName=necessaryFileName.trim();
        if (necessaryFileName.length() == 0 || necessaryFileName.startsWith("String_Node_Str") || necessaryFileName.startsWith("String_Node_Str")) {
          continue;
        }
        URL necessaryURL=null;
        try {
          necessaryURL=FileUtilities.nameToURL(necessaryFileName,null,null);
        }
 catch (        IOException ex) {
          if (necessaryFileName.indexOf("String_Node_Str") == -1 || necessaryFileName.indexOf("String_Node_Str") == -1) {
            try {
              necessaryURL=FileUtilities.nameToURL("String_Node_Str" + necessaryFileName,null,null);
            }
 catch (            IOException ex2) {
              throw ex;
            }
          }
 else {
            throw ex;
          }
        }
        String necessaryFileShortName=necessaryURL.getPath();
        if (necessaryURL.getPath().lastIndexOf("String_Node_Str") > -1) {
          necessaryFileShortName=necessaryFileShortName.substring(necessaryFileShortName.lastIndexOf("String_Node_Str"));
        }
        File necessaryFileDestination=new File(codeDirectoryFile,necessaryFileShortName);
        File necessaryFileSource=new File(necessaryFileName);
        if (!necessaryFileDestination.exists() || (necessaryFileSource.exists() && necessaryFileSource.lastModified() > necessaryFileDestination.lastModified())) {
          System.out.println("String_Node_Str" + necessaryFileSource + "String_Node_Str"+ necessaryFileDestination);
          FileUtilities.binaryCopyURLToFile(necessaryURL,necessaryFileDestination);
        }
      }
    }
  finally {
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        }
 catch (        IOException ex) {
          ex.printStackTrace();
        }
      }
    }
  }
}