Program: 76691
Project: 76691
Buggy source:
/** 
 * Creates a new debugger template in the database.
 * @param provider SQL provider of the new debugger template.
 * @param name Name of the new debugger template. This argument must be non-empty.
 * @param host Host of the new debugger template. This argument must be non-empty.
 * @param port Port of the new debugger template. This argument must be a valid port number.
 * @return The new debugger template.
 * @throws CouldntSaveDataException Thrown if the new debugger template could not be written tothe database.
 */
public static DebuggerTemplate createDebuggerTemplate(final AbstractSQLProvider provider,final String name,final String host,final int port) throws CouldntSaveDataException {
  Preconditions.checkNotNull(name,"String_Node_Str");
  Preconditions.checkArgument(!name.isEmpty(),"String_Node_Str");
  Preconditions.checkNotNull(host,"String_Node_Str");
  Preconditions.checkArgument(!host.isEmpty(),"String_Node_Str");
  Preconditions.checkArgument((port > 0) && (port <= 65535),"String_Node_Str");
  NaviLogger.info("String_Node_Str",name,host,port);
  final CConnection connection=provider.getConnection();
  final String query="String_Node_Str" + CTableNames.DEBUGGERS_TABLE + "String_Node_Str";
  try (PreparedStatement statement=connection.getConnection().prepareStatement(query);ResultSet resultSet=statement.executeQuery()){
    statement.setString(1,name);
    statement.setString(2,host);
    statement.setInt(3,port);
    int id=-1;
    while (resultSet.next()) {
      id=resultSet.getInt("String_Node_Str");
    }
    return new DebuggerTemplate(id,name,host,port,provider);
  }
 catch (  final SQLException e) {
    throw new CouldntSaveDataException(e);
  }
}

Fixed version (ground truth):
/** 
 * Creates a new debugger template in the database.
 * @param provider SQL provider of the new debugger template.
 * @param name Name of the new debugger template. This argument must be non-empty.
 * @param host Host of the new debugger template. This argument must be non-empty.
 * @param port Port of the new debugger template. This argument must be a valid port number.
 * @return The new debugger template.
 * @throws CouldntSaveDataException Thrown if the new debugger template could not be written tothe database.
 */
public static DebuggerTemplate createDebuggerTemplate(final AbstractSQLProvider provider,final String name,final String host,final int port) throws CouldntSaveDataException {
  Preconditions.checkNotNull(name,"String_Node_Str");
  Preconditions.checkArgument(!name.isEmpty(),"String_Node_Str");
  Preconditions.checkNotNull(host,"String_Node_Str");
  Preconditions.checkArgument(!host.isEmpty(),"String_Node_Str");
  Preconditions.checkArgument((port > 0) && (port <= 65535),"String_Node_Str");
  NaviLogger.info("String_Node_Str",name,host,port);
  final CConnection connection=provider.getConnection();
  final String query="String_Node_Str" + CTableNames.DEBUGGERS_TABLE + "String_Node_Str";
  try (PreparedStatement statement=connection.getConnection().prepareStatement(query)){
    statement.setString(1,name);
    statement.setString(2,host);
    statement.setInt(3,port);
    int id=-1;
    try (ResultSet resultSet=statement.executeQuery()){
      while (resultSet.next()) {
        id=resultSet.getInt("String_Node_Str");
      }
    }
     return new DebuggerTemplate(id,name,host,port,provider);
  }
 catch (  final SQLException e) {
    throw new CouldntSaveDataException(e);
  }
}