Program: 73317
Project: 73317
Buggy source:
/** 
 * Open a model with the provided model URL and wait for the user to request the execution of the simulation.
 * @param modelUrl The path to the model file
 * @param layoutUrl The path to a model's layout file
 * @exception IllegalActionException  If the model fails to load from the provided URL.
 * @return The user's reference to the simulation task
 */
public synchronized RemoteModelResponse open(String modelUrl,String layoutUrl) throws IllegalActionException {
  RemoteModelResponse response=null;
  Ticket ticket=null;
  try {
    ticket=Ticket.generateTicket(modelUrl,layoutUrl);
    while (_requests.contains(ticket)) {
      ticket=Ticket.generateTicket(modelUrl,layoutUrl);
    }
    RemoteModel clientModel=new RemoteModel(RemoteModelType.CLIENT);
    SimulationTask simulationTask=new SimulationTask(ticket);
    simulationTask.getRemoteModel().addRemoteModelListener(_remoteModelListener);
    String modelXML=new String(downloadModel(ticket.getLayoutUrl()));
    HashMap<String,Type> resolvedTypes=simulationTask.getRemoteModel().getResolvedTypes();
    String brokerUrl="String_Node_Str" + InetAddress.getLocalHost().getHostAddress() + "String_Node_Str"+ getBrokerPort();
    clientModel.initModel(modelXML,resolvedTypes);
    simulationTask.getRemoteModel().createRemoteAttributes(clientModel.getSettableAttributesMap().keySet());
    simulationTask.getRemoteModel().setUpInfrastructure(ticket,brokerUrl);
    response=new RemoteModelResponse();
    response.setTicket(ticket);
    response.setModelTypes(resolvedTypes);
    response.setModelXML(modelXML);
    response.setBrokerUrl(brokerUrl);
    _requests.put(ticket,simulationTask);
  }
 catch (  Exception e) {
    _handleException((ticket != null ? ticket.getTicketID() : null) + "String_Node_Str" + e.getMessage(),e);
  }
  return response;
}

Fixed version (ground truth):
/** 
 * Open a model with the provided model URL and wait for the user to request the execution of the simulation.
 * @param modelUrl The path to the model file
 * @param layoutUrl The path to a model's layout file
 * @exception IllegalActionException  If the model fails to load from the provided URL.
 * @return The user's reference to the simulation task
 */
public synchronized RemoteModelResponse open(String modelUrl,String layoutUrl) throws IllegalActionException {
  RemoteModelResponse response=null;
  Ticket ticket=null;
  try {
    ticket=Ticket.generateTicket(modelUrl,layoutUrl);
    while (_requests.contains(ticket)) {
      ticket=Ticket.generateTicket(modelUrl,layoutUrl);
    }
    RemoteModel clientModel=new RemoteModel(RemoteModelType.CLIENT);
    SimulationTask simulationTask=new SimulationTask(ticket);
    simulationTask.getRemoteModel().addRemoteModelListener(_remoteModelListener);
    String modelXML=new String(downloadModel(ticket.getLayoutUrl()));
    HashMap<String,String> resolvedTypes=simulationTask.getRemoteModel().getResolvedTypes();
    String brokerUrl="String_Node_Str" + InetAddress.getLocalHost().getHostAddress() + "String_Node_Str"+ getBrokerPort();
    clientModel.initModel(modelXML,resolvedTypes);
    simulationTask.getRemoteModel().createRemoteAttributes(clientModel.getSettableAttributesMap().keySet());
    simulationTask.getRemoteModel().setUpInfrastructure(ticket,brokerUrl);
    response=new RemoteModelResponse();
    response.setTicket(ticket);
    response.setModelTypes(resolvedTypes);
    response.setModelXML(modelXML);
    response.setBrokerUrl(brokerUrl);
    _requests.put(ticket,simulationTask);
  }
 catch (  Exception e) {
    _handleException((ticket != null ? ticket.getTicketID() : null) + "String_Node_Str" + e.getMessage(),e);
  }
  return response;
}