Program: 175956
Project: 175956
Buggy source:
/** 
 * On cql3 create keyspace.
 * @throws InvalidRequestException the invalid request exception
 * @throws UnavailableException the unavailable exception
 * @throws TimedOutException the timed out exception
 * @throws SchemaDisagreementException the schema disagreement exception
 * @throws TException the t exception
 * @throws UnsupportedEncodingException the unsupported encoding exception
 */
private void onCql3CreateKeyspace() throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException, UnsupportedEncodingException {
  String createKeyspace=CQLTranslator.CREATE_KEYSPACE;
  String placement_strategy=csmd.getPlacement_strategy(databaseName);
  String replication_conf=CQLTranslator.SIMPLE_REPLICATION;
  createKeyspace=createKeyspace.replace("String_Node_Str",Constants.ESCAPE_QUOTE + databaseName + Constants.ESCAPE_QUOTE);
  Schema schema=CassandraPropertyReader.csmd.getSchema(databaseName);
  if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName) && schema.getSchemaProperties() != null) {
    Properties schemaProperties=schema.getSchemaProperties();
    if (placement_strategy.equalsIgnoreCase(SimpleStrategy.class.getSimpleName()) || placement_strategy.equalsIgnoreCase(SimpleStrategy.class.getName())) {
      String replicationFactor=schemaProperties.getProperty(CassandraConstants.REPLICATION_FACTOR,CassandraConstants.DEFAULT_REPLICATION_FACTOR);
      replication_conf=replication_conf.replace("String_Node_Str",replicationFactor);
      createKeyspace=createKeyspace.replace("String_Node_Str",placement_strategy);
    }
 else     if (placement_strategy.equalsIgnoreCase(NetworkTopologyStrategy.class.getSimpleName()) || placement_strategy.equalsIgnoreCase(NetworkTopologyStrategy.class.getName())) {
      if (schema.getDataCenters() != null && !schema.getDataCenters().isEmpty()) {
        StringBuilder builder=new StringBuilder();
        for (        DataCenter dc : schema.getDataCenters()) {
          builder.append(CQLTranslator.QUOTE_STR);
          builder.append(dc.getName());
          builder.append(CQLTranslator.QUOTE_STR);
          builder.append("String_Node_Str");
          builder.append(dc.getValue());
          builder.append(CQLTranslator.COMMA_STR);
        }
        builder.delete(builder.lastIndexOf(CQLTranslator.COMMA_STR),builder.length());
        replication_conf=builder.toString();
      }
    }
    createKeyspace=createKeyspace.replace("String_Node_Str",placement_strategy);
    createKeyspace=createKeyspace.replace("String_Node_Str",replication_conf);
    boolean isDurableWrites=Boolean.parseBoolean(schemaProperties.getProperty(CassandraConstants.DURABLE_WRITES,"String_Node_Str"));
    createKeyspace=createKeyspace.replace("String_Node_Str",isDurableWrites + "String_Node_Str");
  }
 else {
    createKeyspace=createKeyspace.replace("String_Node_Str",placement_strategy);
    replication_conf=replication_conf.replace("String_Node_Str",CassandraConstants.DEFAULT_REPLICATION_FACTOR);
    createKeyspace=createKeyspace.replace("String_Node_Str",replication_conf);
    createKeyspace=createKeyspace.replace("String_Node_Str","String_Node_Str");
  }
  cassandra_client.execute_cql3_query(ByteBuffer.wrap(createKeyspace.getBytes(Constants.CHARSET_UTF8)),Compression.NONE,ConsistencyLevel.ONE);
  KunderaCoreUtils.printQuery(createKeyspace,showQuery);
}

Fixed version (ground truth):
/** 
 * On cql3 create keyspace.
 * @throws InvalidRequestException the invalid request exception
 * @throws UnavailableException the unavailable exception
 * @throws TimedOutException the timed out exception
 * @throws SchemaDisagreementException the schema disagreement exception
 * @throws TException the t exception
 * @throws UnsupportedEncodingException the unsupported encoding exception
 */
private void onCql3CreateKeyspace() throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException, UnsupportedEncodingException {
  String createKeyspace=CQLTranslator.CREATE_KEYSPACE;
  String placement_strategy=csmd.getPlacement_strategy(databaseName);
  String replication_conf=CQLTranslator.SIMPLE_REPLICATION;
  createKeyspace=createKeyspace.replace("String_Node_Str",Constants.ESCAPE_QUOTE + databaseName + Constants.ESCAPE_QUOTE);
  Schema schema=CassandraPropertyReader.csmd.getSchema(databaseName);
  if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName) && schema.getSchemaProperties() != null) {
    Properties schemaProperties=schema.getSchemaProperties();
    if (placement_strategy.equalsIgnoreCase(SimpleStrategy.class.getSimpleName()) || placement_strategy.equalsIgnoreCase(SimpleStrategy.class.getName())) {
      String replicationFactor=schemaProperties.getProperty(CassandraConstants.REPLICATION_FACTOR,CassandraConstants.DEFAULT_REPLICATION_FACTOR);
      replication_conf=replication_conf.replace("String_Node_Str",replicationFactor);
      createKeyspace=createKeyspace.replace("String_Node_Str",placement_strategy);
    }
 else     if (placement_strategy.equalsIgnoreCase(NetworkTopologyStrategy.class.getSimpleName()) || placement_strategy.equalsIgnoreCase(NetworkTopologyStrategy.class.getName())) {
      if (schema.getDataCenters() != null && !schema.getDataCenters().isEmpty()) {
        StringBuilder builder=new StringBuilder();
        for (        DataCenter dc : schema.getDataCenters()) {
          builder.append(CQLTranslator.QUOTE_STR);
          builder.append(dc.getName());
          builder.append(CQLTranslator.QUOTE_STR);
          builder.append("String_Node_Str");
          builder.append(dc.getValue());
          builder.append(CQLTranslator.COMMA_STR);
        }
        builder.delete(builder.lastIndexOf(CQLTranslator.COMMA_STR),builder.length());
        replication_conf=builder.toString();
      }
    }
    createKeyspace=createKeyspace.replace("String_Node_Str",placement_strategy);
    createKeyspace=createKeyspace.replace("String_Node_Str",replication_conf);
    boolean isDurableWrites=Boolean.parseBoolean(schemaProperties.getProperty(CassandraConstants.DURABLE_WRITES,"String_Node_Str"));
    createKeyspace=createKeyspace.replace("String_Node_Str",isDurableWrites + "String_Node_Str");
  }
 else {
    createKeyspace=createKeyspace.replace("String_Node_Str",placement_strategy);
    replication_conf=replication_conf.replace("String_Node_Str",(CharSequence)externalProperties.getOrDefault(CassandraConstants.REPLICATION_FACTOR,CassandraConstants.DEFAULT_REPLICATION_FACTOR));
    createKeyspace=createKeyspace.replace("String_Node_Str",replication_conf);
    createKeyspace=createKeyspace.replace("String_Node_Str","String_Node_Str");
  }
  cassandra_client.execute_cql3_query(ByteBuffer.wrap(createKeyspace.getBytes(Constants.CHARSET_UTF8)),Compression.NONE,ConsistencyLevel.ONE);
  KunderaCoreUtils.printQuery(createKeyspace,showQuery);
}