Program: 72808
Project: 72808
Buggy source:
/** 
 * If there is an input, then post to the specified URL the data on the input record, wait for a response, and output the response on the output port.
 * @exception IllegalActionException If an IO error occurs.
 */
public void fire() throws IllegalActionException {
  super.fire();
  url.update();
  if (input.hasToken(0)) {
    RecordToken record=(RecordToken)input.get(0);
    if (_debugging) {
      _debug("String_Node_Str" + record);
    }
    StringBuffer data=new StringBuffer();
    boolean first=true;
    for (    String field : record.labelSet()) {
      if (!first) {
        data.append("String_Node_Str");
      }
      first=false;
      try {
        data.append(URLEncoder.encode(field,"String_Node_Str"));
        data.append("String_Node_Str");
        Token value=record.get(field);
        String string=value.toString();
        if (value instanceof StringToken) {
          string=((StringToken)value).stringValue();
        }
        data.append(URLEncoder.encode(string,"String_Node_Str"));
      }
 catch (      UnsupportedEncodingException e) {
        throw new InternalErrorException(e);
      }
    }
    String urlValue=((StringToken)url.getToken()).stringValue();
    if (urlValue == null || urlValue.isEmpty()) {
      throw new IllegalActionException("String_Node_Str");
    }
    StringBuffer response=new StringBuffer();
    try {
      URL url=new URL(urlValue);
      URLConnection connection=url.openConnection();
      connection.setDoOutput(true);
      OutputStreamWriter writer=null;
      try {
        writer=new OutputStreamWriter(connection.getOutputStream());
        writer.write(data.toString());
        writer.flush();
        if (_debugging) {
          _debug("String_Node_Str" + data.toString());
          _debug("String_Node_Str" + url.toString());
          _debug("String_Node_Str");
        }
        BufferedReader reader=null;
        try {
          String line;
          while ((line=reader.readLine()) != null) {
            response.append(line);
            if (!line.endsWith("String_Node_Str")) {
              response.append("String_Node_Str");
            }
          }
          if (_debugging) {
            _debug("String_Node_Str" + response.toString());
          }
        }
  finally {
          if (reader != null) {
            reader.close();
          }
        }
      }
  finally {
        if (writer != null) {
          writer.close();
        }
      }
      output.send(0,new StringToken(response.toString()));
    }
 catch (    IOException ex) {
      throw new IllegalActionException(this,ex,"String_Node_Str");
    }
  }
 else   if (_debugging) {
    _debug("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * If there is an input, then post to the specified URL the data on the input record, wait for a response, and output the response on the output port.
 * @exception IllegalActionException If an IO error occurs.
 */
public void fire() throws IllegalActionException {
  super.fire();
  url.update();
  if (input.hasToken(0)) {
    RecordToken record=(RecordToken)input.get(0);
    if (_debugging) {
      _debug("String_Node_Str" + record);
    }
    StringBuffer data=new StringBuffer();
    boolean first=true;
    for (    String field : record.labelSet()) {
      if (!first) {
        data.append("String_Node_Str");
      }
      first=false;
      try {
        data.append(URLEncoder.encode(field,"String_Node_Str"));
        data.append("String_Node_Str");
        Token value=record.get(field);
        String string=value.toString();
        if (value instanceof StringToken) {
          string=((StringToken)value).stringValue();
        }
        data.append(URLEncoder.encode(string,"String_Node_Str"));
      }
 catch (      UnsupportedEncodingException e) {
        throw new InternalErrorException(e);
      }
    }
    String urlValue=((StringToken)url.getToken()).stringValue();
    if (urlValue == null || urlValue.isEmpty()) {
      throw new IllegalActionException("String_Node_Str");
    }
    try {
      URL url=new URL(urlValue);
      URLConnection connection=url.openConnection();
      connection.setDoOutput(true);
      OutputStreamWriter writer=new OutputStreamWriter(connection.getOutputStream());
      writer.write(data.toString());
      writer.flush();
      if (_debugging) {
        _debug("String_Node_Str" + data.toString());
        _debug("String_Node_Str" + url.toString());
        _debug("String_Node_Str");
      }
      BufferedReader reader=new BufferedReader(new InputStreamReader(connection.getInputStream()));
      StringBuffer response=new StringBuffer();
      String line;
      while ((line=reader.readLine()) != null) {
        response.append(line);
        if (!line.endsWith("String_Node_Str")) {
          response.append("String_Node_Str");
        }
      }
      if (_debugging) {
        _debug("String_Node_Str" + response.toString());
      }
      writer.close();
      reader.close();
      output.send(0,new StringToken(response.toString()));
    }
 catch (    IOException ex) {
      throw new IllegalActionException(this,ex,"String_Node_Str");
    }
  }
 else   if (_debugging) {
    _debug("String_Node_Str");
  }
}