Program: 72588
Project: 72588
Buggy source:
/** 
 * Get the string text contained in the specified file. The argument is first interpreted using findFile(), so file names relative to the current working directory, the user's home directory, or the classpath are understood. If the file contains text that is a valid expression in the expression language, then that text can interpreted using the eval() function in ptolemy.data.expr.ASTPtFunctionApplicationNode. For example: <code>eval(readFile("<i>filename</i>"))</code><p> Note that readFile() does not work inside applets, use  {@link #readResource(String)} instead.
 * @param filename The name of the file to read from.
 * @return A StringToken containing the text contained inthe specified file.
 * @exception IllegalActionException If the file cannot be opened.
 * @see ptolemy.data.expr.ASTPtFunctionApplicationNode
 * @see #readResource(String)
 */
public static StringToken readFile(String filename) throws IllegalActionException {
  File file=new File(findFile(filename));
  BufferedReader fin=null;
  String line;
  StringBuffer result=new StringBuffer("String_Node_Str");
  String newline=System.getProperty("String_Node_Str");
  try {
    fin=new BufferedReader(new FileReader(file));
    while (true) {
      try {
        line=fin.readLine();
      }
 catch (      IOException e) {
        break;
      }
      if (line == null) {
        break;
      }
      result.append(line + newline);
    }
  }
 catch (  FileNotFoundException ex) {
    throw new IllegalActionException(null,ex,"String_Node_Str");
  }
 finally {
    if (fin != null) {
      try {
        fin.close();
      }
 catch (      IOException ex) {
        throw new IllegalActionException(null,ex,"String_Node_Str" + file + "String_Node_Str");
      }
    }
  }
  return new StringToken(result.toString());
}

Fixed version (ground truth):
/** 
 * Get the string text contained in the specified file. The argument is first interpreted using findFile(), so file names relative to the current working directory, the user's home directory, or the classpath are understood. If the file contains text that is a valid expression in the expression language, then that text can interpreted using the eval() function in ptolemy.data.expr.ASTPtFunctionApplicationNode. For example: <code>eval(readFile("<i>filename</i>"))</code><p> Note that readFile() does not work inside applets, use  {@link #readResource(String)} instead.
 * @param filename The name of the file to read from.
 * @return A StringToken containing the text contained inthe specified file.
 * @exception IllegalActionException If the file cannot be opened.
 * @see ptolemy.data.expr.ASTPtFunctionApplicationNode
 * @see #readResource(String)
 */
public static StringToken readFile(String filename) throws IllegalActionException {
  File file=new File(findFile(filename));
  BufferedReader fin=null;
  String line;
  StringBuffer result=new StringBuffer("String_Node_Str");
  String newline=System.getProperty("String_Node_Str");
  try {
    fin=new BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file),java.nio.charset.Charset.defaultCharset()));
    while (true) {
      try {
        line=fin.readLine();
      }
 catch (      IOException e) {
        break;
      }
      if (line == null) {
        break;
      }
      result.append(line + newline);
    }
  }
 catch (  FileNotFoundException ex) {
    throw new IllegalActionException(null,ex,"String_Node_Str");
  }
 finally {
    if (fin != null) {
      try {
        fin.close();
      }
 catch (      IOException ex) {
        throw new IllegalActionException(null,ex,"String_Node_Str" + file + "String_Node_Str");
      }
    }
  }
  return new StringToken(result.toString());
}