Program: 73985
Project: 73985
Buggy source:
/** 
 * Invoke a subprocess, read the <i>input</i> data (if any) and wait for the subprocess to terminate before sending any output or error data to the appropriate ports. <p>If there is no data on the <i>input</i> port, then the subprocess executes without reading any input. If there is no output or error data from the subprocess, then the empty string is sent to the appropriate port(s).</p>
 * @exception IllegalActionException If the subprocess cannot bestarted, if the input of the subprocess cannot be written, if the subprocess gets interrupted, or if the return value of the process is non-zero.
 */
public void fire() throws IllegalActionException {
  super.fire();
  String line=null;
  _exec();
  if ((input.numberOfSources() > 0) && input.hasToken(0)) {
    if ((line=((StringToken)input.get(0)).stringValue()) != null) {
      if (_debugging) {
        _debug("String_Node_Str" + line + "String_Node_Str");
      }
      if (_inputBufferedWriter != null) {
        try {
          _inputBufferedWriter.write(line);
          _inputBufferedWriter.flush();
        }
 catch (        IOException ex) {
          throw new IllegalActionException(this,ex,"String_Node_Str" + command + "String_Node_Str");
        }
      }
    }
  }
  try {
    _process.getOutputStream().close();
    boolean waitForProcessValue=((BooleanToken)waitForProcess.getToken()).booleanValue();
    if (waitForProcessValue) {
      int processReturnCode=_process.waitFor();
      if (processReturnCode != 0) {
        String outputString="String_Node_Str";
        String errorString="String_Node_Str";
        try {
          errorString=_errorGobbler.getAndReset();
        }
 catch (        Exception ex) {
          errorString=ex.toString();
        }
        try {
          outputString=_outputGobbler.getAndReset();
        }
 catch (        Exception ex) {
          outputString=ex.toString();
        }
        boolean throwExceptionOnNonZeroReturnValue=((BooleanToken)throwExceptionOnNonZeroReturn.getToken()).booleanValue();
        if (throwExceptionOnNonZeroReturnValue) {
          throw new IllegalActionException(this,"String_Node_Str" + ((StringToken)command.getToken()).stringValue() + "String_Node_Str"+ processReturnCode+ "String_Node_Str"+ line+ "String_Node_Str"+ outputString+ "String_Node_Str"+ errorString);
        }
 else {
          error.send(0,new StringToken(errorString));
          output.send(0,new StringToken(outputString));
        }
      }
      exitCode.send(0,new IntToken(processReturnCode));
    }
  }
 catch (  InterruptedException interrupted) {
    throw new InternalErrorException(this,interrupted,"String_Node_Str");
  }
catch (  IOException io) {
    throw new IllegalActionException(this,io,"String_Node_Str");
  }
  String outputString=_outputGobbler.getAndReset();
  String errorString=_errorGobbler.getAndReset();
  if (_debugging) {
    _debug("String_Node_Str" + errorString + "String_Node_Str");
    _debug("String_Node_Str" + outputString + "String_Node_Str");
  }
  error.send(0,new StringToken(errorString));
  output.send(0,new StringToken(outputString));
}

Fixed version (ground truth):
/** 
 * Invoke a subprocess, read the <i>input</i> data (if any) and wait for the subprocess to terminate before sending any output or error data to the appropriate ports. <p>If there is no data on the <i>input</i> port, then the subprocess executes without reading any input. If there is no output or error data from the subprocess, then the empty string is sent to the appropriate port(s).</p>
 * @exception IllegalActionException If the subprocess cannot bestarted, if the input of the subprocess cannot be written, if the subprocess gets interrupted, or if the return value of the process is non-zero.
 */
public void fire() throws IllegalActionException {
  super.fire();
  String line=null;
  _exec();
  if ((input.numberOfSources() > 0) && input.hasToken(0)) {
    if ((line=((StringToken)input.get(0)).stringValue()) != null) {
      if (_debugging) {
        _debug("String_Node_Str" + line + "String_Node_Str");
      }
      if (_inputBufferedWriter != null) {
        try {
          _inputBufferedWriter.write(line);
          _inputBufferedWriter.flush();
        }
 catch (        IOException ex) {
          throw new IllegalActionException(this,ex,"String_Node_Str" + command + "String_Node_Str");
        }
      }
    }
  }
  boolean alreadySentOutput=false;
  try {
    _process.getOutputStream().close();
    boolean waitForProcessValue=((BooleanToken)waitForProcess.getToken()).booleanValue();
    if (waitForProcessValue) {
      int processReturnCode=_process.waitFor();
      if (processReturnCode != 0) {
        String outputString="String_Node_Str";
        String errorString="String_Node_Str";
        try {
          errorString=_errorGobbler.getAndReset();
        }
 catch (        Exception ex) {
          errorString=ex.toString();
        }
        try {
          outputString=_outputGobbler.getAndReset();
        }
 catch (        Exception ex) {
          outputString=ex.toString();
        }
        boolean throwExceptionOnNonZeroReturnValue=((BooleanToken)throwExceptionOnNonZeroReturn.getToken()).booleanValue();
        if (throwExceptionOnNonZeroReturnValue) {
          throw new IllegalActionException(this,"String_Node_Str" + ((StringToken)command.getToken()).stringValue() + "String_Node_Str"+ processReturnCode+ "String_Node_Str"+ line+ "String_Node_Str"+ outputString+ "String_Node_Str"+ errorString);
        }
 else {
          error.send(0,new StringToken(errorString));
          output.send(0,new StringToken(outputString));
          alreadySentOutput=true;
        }
      }
      exitCode.send(0,new IntToken(processReturnCode));
    }
  }
 catch (  InterruptedException interrupted) {
    throw new InternalErrorException(this,interrupted,"String_Node_Str");
  }
catch (  IOException io) {
    throw new IllegalActionException(this,io,"String_Node_Str");
  }
  if (!alreadySentOutput) {
    String outputString=_outputGobbler.getAndReset();
    String errorString=_errorGobbler.getAndReset();
    if (_debugging) {
      _debug("String_Node_Str" + errorString + "String_Node_Str");
      _debug("String_Node_Str" + outputString + "String_Node_Str");
    }
    error.send(0,new StringToken(errorString));
    output.send(0,new StringToken(outputString));
  }
}