nus-yam/ex-repair huggingface dataset:
Program: 42549
Project: 42549
Buggy source:
private void persistModel(long modelId,String modelName,MLModel model) throws MLModelBuilderException {
  try {
    MLStorage storage=databaseService.getModelStorage(modelId);
    String storageType=storage.getType();
    String storageLocation=storage.getLocation();
    MLIOFactory ioFactory=new MLIOFactory(mlProperties);
    MLOutputAdapter outputAdapter=ioFactory.getOutputAdapter(storageType + MLConstants.OUT_SUFFIX);
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    ObjectOutputStream oos=new ObjectOutputStream(baos);
    oos.writeObject(model);
    oos.flush();
    oos.close();
    InputStream is=new ByteArrayInputStream(baos.toByteArray());
    String outPath=storageLocation + File.separator + modelName+ "String_Node_Str"+ MLUtils.getDate();
    outputAdapter.write(outPath,is);
    databaseService.updateModelStorage(modelId,storageType,outPath);
  }
 catch (  Exception e) {
    throw new MLModelBuilderException("String_Node_Str" + modelId,e);
  }
}

Fixed version (ground truth):
private void persistModel(long modelId,String modelName,MLModel model) throws MLModelBuilderException {
  try {
    MLStorage storage=databaseService.getModelStorage(modelId);
    String storageType=storage.getType();
    String storageLocation=storage.getLocation();
    MLIOFactory ioFactory=new MLIOFactory(mlProperties);
    MLOutputAdapter outputAdapter=ioFactory.getOutputAdapter(storageType + MLConstants.OUT_SUFFIX);
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    ObjectOutputStream oos=new ObjectOutputStream(baos);
    oos.writeObject(model);
    oos.flush();
    oos.close();
    InputStream is=new ByteArrayInputStream(baos.toByteArray());
    String outPath=storageLocation + File.separator + modelName;
    outputAdapter.write(outPath,is);
    databaseService.updateModelStorage(modelId,storageType,outPath);
  }
 catch (  Exception e) {
    throw new MLModelBuilderException("String_Node_Str" + modelId,e);
  }
}
Program: 42550
Project: 42550
Buggy source:
/** 
 * Create a new model.
 * @param model model to be created.
 * @throws MLModelHandlerException
 */
public void createModel(MLModelNew model) throws MLModelHandlerException {
  try {
    ModelStorage modelStorage=MLCoreServiceValueHolder.getInstance().getModelStorage();
    model.setStorageType(modelStorage.getStorageType());
    model.setStorageDirectory(modelStorage.getStorageDirectory());
    databaseService.insertModel(model);
    log.info(String.format("String_Node_Str",model));
  }
 catch (  DatabaseHandlerException e) {
    throw new MLModelHandlerException(e);
  }
}

Fixed version (ground truth):
/** 
 * Create a new model.
 * @param model model to be created.
 * @throws MLModelHandlerException
 */
public MLModelNew createModel(MLModelNew model) throws MLModelHandlerException {
  try {
    ModelStorage modelStorage=MLCoreServiceValueHolder.getInstance().getModelStorage();
    model.setStorageType(modelStorage.getStorageType());
    model.setStorageDirectory(modelStorage.getStorageDirectory());
    String modelName=databaseService.getAnalysis(model.getTenantId(),model.getUserName(),model.getAnalysisId()).getName();
    modelName=modelName + "String_Node_Str" + MLConstants.MODEL_NAME+ "String_Node_Str"+ MLUtils.getDate();
    model.setName(modelName);
    model.setStatus(MLConstants.MODEL_STATUS_NOT_STARTED);
    databaseService.insertModel(model);
    log.info(String.format("String_Node_Str",model));
    return model;
  }
 catch (  DatabaseHandlerException e) {
    throw new MLModelHandlerException(e);
  }
}
Program: 42551
Project: 42551
Buggy source:
/** 
 * Get the Analysis having the given analysis name
 * @param tenantId      tenant id
 * @param userName      username
 * @param analysisName  analysis name
 * @return
 * @throws DatabaseHandlerException
 */
public MLAnalysis getAnalysis(int tenantId,String userName,String analysisName) throws DatabaseHandlerException ;

Fixed version (ground truth):
MLAnalysis getAnalysis(int tenantId,String userName,long analysisId) throws DatabaseHandlerException ;
Program: 42552
Project: 42552
Buggy source:
@Override public MLAnalysis getAnalysis(int tenantId,String userName,String analysisName) throws DatabaseHandlerException {
  Connection connection=null;
  ResultSet result=null;
  PreparedStatement statement=null;
  try {
    connection=dbh.getDataSource().getConnection();
    statement=connection.prepareStatement(SQLQueries.GET_ANALYSIS);
    statement.setString(1,analysisName);
    statement.setInt(2,tenantId);
    statement.setString(3,userName);
    result=statement.executeQuery();
    if (result.first()) {
      MLAnalysis analysis=new MLAnalysis();
      analysis.setId(result.getLong(1));
      analysis.setProjectId(result.getLong(2));
      analysis.setComments(MLDatabaseUtils.toString(result.getClob(3)));
      analysis.setName(analysisName);
      analysis.setTenantId(tenantId);
      analysis.setUserName(userName);
      return analysis;
    }
 else {
      return null;
    }
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + analysisName + "String_Node_Str"+ tenantId+ "String_Node_Str"+ userName,e);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,statement,result);
  }
}

Fixed version (ground truth):
@Override public MLAnalysis getAnalysis(int tenantId,String userName,long analysisId) throws DatabaseHandlerException {
  Connection connection=null;
  ResultSet result=null;
  PreparedStatement statement=null;
  try {
    connection=dbh.getDataSource().getConnection();
    statement=connection.prepareStatement(SQLQueries.GET_ANALYSIS_BY_ID);
    statement.setLong(1,analysisId);
    statement.setInt(2,tenantId);
    statement.setString(3,userName);
    result=statement.executeQuery();
    if (result.first()) {
      MLAnalysis analysis=new MLAnalysis();
      analysis.setId(analysisId);
      analysis.setName(result.getString(1));
      analysis.setProjectId(result.getLong(2));
      analysis.setComments(MLDatabaseUtils.toString(result.getClob(3)));
      analysis.setTenantId(tenantId);
      analysis.setUserName(userName);
      return analysis;
    }
 else {
      return null;
    }
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + analysisId + "String_Node_Str"+ tenantId+ "String_Node_Str"+ userName,e);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,statement,result);
  }
}
Program: 42553
Project: 42553
Buggy source:
@Override public void insertModel(MLModelNew model) throws DatabaseHandlerException {
  Connection connection=null;
  PreparedStatement insertStatement=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(false);
    insertStatement=connection.prepareStatement(SQLQueries.INSERT_MODEL);
    insertStatement.setString(1,model.getName());
    insertStatement.setLong(2,model.getAnalysisId());
    insertStatement.setLong(3,model.getVersionSetId());
    insertStatement.setInt(4,model.getTenantId());
    insertStatement.setString(5,model.getUserName());
    insertStatement.setString(6,model.getStorageType());
    insertStatement.setString(7,model.getStorageDirectory());
    insertStatement.setString(8,MLConstants.MODEL_STATUS_NOT_STARTED);
    insertStatement.execute();
    connection.commit();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    MLDatabaseUtils.rollBack(connection);
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.enableAutoCommit(connection);
    MLDatabaseUtils.closeDatabaseResources(connection,insertStatement);
  }
}

Fixed version (ground truth):
@Override public void insertModel(MLModelNew model) throws DatabaseHandlerException {
  Connection connection=null;
  PreparedStatement insertStatement=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(false);
    insertStatement=connection.prepareStatement(SQLQueries.INSERT_MODEL);
    insertStatement.setString(1,model.getName());
    insertStatement.setLong(2,model.getAnalysisId());
    insertStatement.setLong(3,model.getVersionSetId());
    insertStatement.setInt(4,model.getTenantId());
    insertStatement.setString(5,model.getUserName());
    insertStatement.setString(6,model.getStorageType());
    insertStatement.setString(7,model.getStorageDirectory());
    insertStatement.setString(8,model.getStatus());
    insertStatement.execute();
    connection.commit();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    MLDatabaseUtils.rollBack(connection);
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.enableAutoCommit(connection);
    MLDatabaseUtils.closeDatabaseResources(connection,insertStatement);
  }
}
Program: 42554
Project: 42554
Buggy source:
/** 
 * Create a new Model.
 */
@POST @Produces("String_Node_Str") @Consumes("String_Node_Str") public Response createModel(MLModelNew model){
  if (model.getName() == null || model.getName().isEmpty() || model.getAnalysisId() == 0 || model.getVersionSetId() == 0) {
    logger.error("String_Node_Str");
    return Response.status(Response.Status.BAD_REQUEST).entity("String_Node_Str").build();
  }
  PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
  try {
    int tenantId=carbonContext.getTenantId();
    String userName=carbonContext.getUsername();
    model.setTenantId(tenantId);
    model.setUserName(userName);
    mlModelHandler.createModel(model);
    return Response.ok().build();
  }
 catch (  MLModelHandlerException e) {
    logger.error("String_Node_Str" + model,e);
    return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
  }
}

Fixed version (ground truth):
/** 
 * Create a new Model.
 */
@POST @Produces("String_Node_Str") @Consumes("String_Node_Str") public Response createModel(MLModelNew model){
  if (model.getAnalysisId() == 0 || model.getVersionSetId() == 0) {
    logger.error("String_Node_Str");
    return Response.status(Response.Status.BAD_REQUEST).entity("String_Node_Str").build();
  }
  PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
  try {
    int tenantId=carbonContext.getTenantId();
    String userName=carbonContext.getUsername();
    model.setTenantId(tenantId);
    model.setUserName(userName);
    MLModelNew insertedModel=mlModelHandler.createModel(model);
    return Response.ok(insertedModel).build();
  }
 catch (  MLModelHandlerException e) {
    logger.error("String_Node_Str" + model,e);
    return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
  }
}
Program: 42555
Project: 42555
Buggy source:
@Override public void insertModel(MLModelNew model) throws DatabaseHandlerException {
  Connection connection=null;
  PreparedStatement insertStatement=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(false);
    insertStatement=connection.prepareStatement(SQLQueries.INSERT_MODEL);
    insertStatement.setString(1,model.getName());
    insertStatement.setLong(2,model.getAnalysisId());
    insertStatement.setLong(3,model.getVersionSetId());
    insertStatement.setInt(4,model.getTenantId());
    insertStatement.setString(5,model.getUserName());
    insertStatement.setString(6,model.getStorageType());
    insertStatement.setString(7,model.getStorageDirectory());
    insertStatement.setString(7,MLConstants.MODEL_STATUS_NOT_STARTED);
    insertStatement.execute();
    connection.commit();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    MLDatabaseUtils.rollBack(connection);
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.enableAutoCommit(connection);
    MLDatabaseUtils.closeDatabaseResources(connection,insertStatement);
  }
}

Fixed version (ground truth):
@Override public void insertModel(MLModelNew model) throws DatabaseHandlerException {
  Connection connection=null;
  PreparedStatement insertStatement=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(false);
    insertStatement=connection.prepareStatement(SQLQueries.INSERT_MODEL);
    insertStatement.setString(1,model.getName());
    insertStatement.setLong(2,model.getAnalysisId());
    insertStatement.setLong(3,model.getVersionSetId());
    insertStatement.setInt(4,model.getTenantId());
    insertStatement.setString(5,model.getUserName());
    insertStatement.setString(6,model.getStorageType());
    insertStatement.setString(7,model.getStorageDirectory());
    insertStatement.setString(8,MLConstants.MODEL_STATUS_NOT_STARTED);
    insertStatement.execute();
    connection.commit();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    MLDatabaseUtils.rollBack(connection);
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.enableAutoCommit(connection);
    MLDatabaseUtils.closeDatabaseResources(connection,insertStatement);
  }
}
Program: 42556
Project: 42556
Buggy source:
/** 
 */
@Override public InputStream readDataset(URI uri) throws MLInputAdapterException {
  try {
    if (!uri.isAbsolute()) {
      String uriString=uri.toString();
      if (!uriString.startsWith("String_Node_Str")) {
        uriString="String_Node_Str" + uriString;
        try {
          uri=new URI(uriString);
        }
 catch (        URISyntaxException ignore) {
        }
      }
    }
    Configuration conf=new Configuration();
    conf.set("String_Node_Str",org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
    FileSystem file=FileSystem.get(uri,conf);
    FSDataInputStream inputStream=file.open(new Path(uri));
    return inputStream;
  }
 catch (  Exception e) {
    throw new MLInputAdapterException(String.format("String_Node_Str",uri,e),e);
  }
}

Fixed version (ground truth):
/** 
 */
@Override public InputStream readDataset(URI uri) throws MLInputAdapterException {
  try {
    if (!uri.isAbsolute()) {
      String uriString=uri.toString();
      if (!uriString.startsWith("String_Node_Str")) {
        if (MLCoreServiceValueHolder.getInstance().getHdfsUrl() != null) {
          uriString=MLCoreServiceValueHolder.getInstance().getHdfsUrl().concat(uriString);
        }
 else {
          uriString="String_Node_Str".concat(uriString);
        }
        try {
          uri=new URI(uriString);
        }
 catch (        URISyntaxException ignore) {
        }
      }
    }
    Configuration conf=new Configuration();
    conf.set("String_Node_Str",org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
    FileSystem file=FileSystem.get(uri,conf);
    FSDataInputStream inputStream=file.open(new Path(uri));
    return inputStream;
  }
 catch (  Exception e) {
    throw new MLInputAdapterException(String.format("String_Node_Str",uri,e),e);
  }
}
Program: 42557
Project: 42557
Buggy source:
@Override public List<MLHyperParameter> getHyperParametersOfModel(long modelId) throws DatabaseHandlerException {
  List<MLHyperParameter> hyperParams=new ArrayList<MLHyperParameter>();
  Connection connection=null;
  PreparedStatement getFeatues=null;
  ResultSet result=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(true);
    getFeatues=connection.prepareStatement(SQLQueries.GET_HYPER_PARAMETERS_OF_MODEL);
    getFeatues.setLong(1,modelId);
    result=getFeatues.executeQuery();
    while (result.next()) {
      MLHyperParameter param=new MLHyperParameter();
      param.setKey(result.getString(1));
      param.setValue(result.getString(2));
      hyperParams.add(param);
    }
    return hyperParams;
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + modelId + "String_Node_Str"+ e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,getFeatues,result);
  }
}

Fixed version (ground truth):
@Override public List<MLHyperParameter> getHyperParametersOfModel(long modelId) throws DatabaseHandlerException {
  List<MLHyperParameter> hyperParams=new ArrayList<MLHyperParameter>();
  Connection connection=null;
  PreparedStatement getFeatues=null;
  ResultSet result=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(true);
    getFeatues=connection.prepareStatement(SQLQueries.GET_HYPER_PARAMETERS_OF_ANALYSIS);
    getFeatues.setLong(1,modelId);
    result=getFeatues.executeQuery();
    while (result.next()) {
      MLHyperParameter param=new MLHyperParameter();
      param.setKey(result.getString(1));
      param.setValue(result.getString(2));
      hyperParams.add(param);
    }
    return hyperParams;
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + modelId + "String_Node_Str"+ e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,getFeatues,result);
  }
}
Program: 42559
Project: 42559
Buggy source:
@Override public Map<String,String> getHyperParametersOfModelAsMap(long modelId) throws DatabaseHandlerException {
  Map<String,String> hyperParams=new HashMap<String,String>();
  Connection connection=null;
  PreparedStatement getFeatues=null;
  ResultSet result=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(true);
    getFeatues=connection.prepareStatement(SQLQueries.GET_HYPER_PARAMETERS_OF_MODEL);
    getFeatues.setLong(1,modelId);
    result=getFeatues.executeQuery();
    while (result.next()) {
      hyperParams.put(result.getString(1),result.getString(2));
    }
    return hyperParams;
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + modelId + "String_Node_Str"+ e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,getFeatues,result);
  }
}

Fixed version (ground truth):
@Override public Map<String,String> getHyperParametersOfModelAsMap(long analysisId) throws DatabaseHandlerException {
  Map<String,String> hyperParams=new HashMap<String,String>();
  Connection connection=null;
  PreparedStatement getFeatues=null;
  ResultSet result=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(true);
    getFeatues=connection.prepareStatement(SQLQueries.GET_HYPER_PARAMETERS_OF_ANALYSIS);
    getFeatues.setLong(1,analysisId);
    result=getFeatues.executeQuery();
    while (result.next()) {
      hyperParams.put(result.getString(1),result.getString(2));
    }
    return hyperParams;
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + analysisId + "String_Node_Str"+ e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,getFeatues,result);
  }
}
Program: 42560
Project: 42560
Buggy source:
/** 
 * Test Creating a new version of an existing dataset
 * @throws ClientProtocolException
 * @throws IOException
 * @throws URISyntaxException
 * @throws MLIntegrationBaseTestException 
 */
@Test(description="String_Node_Str",dependsOnMethods="String_Node_Str") public void testCreateDuplicateDatasetVersion() throws ClientProtocolException, IOException, URISyntaxException, MLIntegrationBaseTestException {
  CloseableHttpResponse response=uploadDatasetFromCSV(MLIntegrationTestConstants.DATASET_NAME,"String_Node_Str",MLIntegrationTestConstants.FOREST_COVER_DATASET_SAMPLE);
  Assert.assertEquals(MLIntegrationTestConstants.HTTP_INTERNAL_SERVER_ERROR,response.getStatusLine().getStatusCode());
  response.close();
}

Fixed version (ground truth):
/** 
 * Test Creating a new version of an existing dataset
 * @throws ClientProtocolException
 * @throws IOException
 * @throws URISyntaxException
 * @throws MLIntegrationBaseTestException 
 */
@Test(description="String_Node_Str",dependsOnMethods="String_Node_Str") public void testCreateDuplicateDatasetVersion() throws ClientProtocolException, IOException, URISyntaxException, MLIntegrationBaseTestException {
  CloseableHttpResponse response=uploadDatasetFromCSV(MLIntegrationTestConstants.DATASET_NAME,"String_Node_Str",MLIntegrationTestConstants.DIABETES_DATASET_SAMPLE);
  Assert.assertEquals(MLIntegrationTestConstants.HTTP_INTERNAL_SERVER_ERROR,response.getStatusLine().getStatusCode());
  response.close();
}
Program: 42561
Project: 42561
Buggy source:
/** 
 * Test creating a dataset from a valid csv file.
 * @throws ClientProtocolException
 * @throws IOException
 * @throws URISyntaxException
 * @throws MLIntegrationBaseTestException 
 */
@Test(description="String_Node_Str") public void testCreateDatasetFromFile() throws ClientProtocolException, IOException, URISyntaxException, MLIntegrationBaseTestException {
  CloseableHttpResponse response=uploadDatasetFromCSV(MLIntegrationTestConstants.DATASET_NAME,"String_Node_Str",MLIntegrationTestConstants.FOREST_COVER_DATASET_SAMPLE);
  Assert.assertEquals(MLIntegrationTestConstants.HTTP_OK,response.getStatusLine().getStatusCode());
  response.close();
}

Fixed version (ground truth):
/** 
 * Test creating a dataset from a valid csv file.
 * @throws ClientProtocolException
 * @throws IOException
 * @throws URISyntaxException
 * @throws MLIntegrationBaseTestException 
 */
@Test(description="String_Node_Str") public void testCreateDatasetFromFile() throws ClientProtocolException, IOException, URISyntaxException, MLIntegrationBaseTestException {
  CloseableHttpResponse response=uploadDatasetFromCSV(MLIntegrationTestConstants.DATASET_NAME,"String_Node_Str",MLIntegrationTestConstants.DIABETES_DATASET_SAMPLE);
  Assert.assertEquals(MLIntegrationTestConstants.HTTP_OK,response.getStatusLine().getStatusCode());
  response.close();
}
Program: 42562
Project: 42562
Buggy source:
/** 
 * Test Creating a new version of an existing dataset
 * @throws ClientProtocolException
 * @throws IOException
 * @throws URISyntaxException
 * @throws MLIntegrationBaseTestException 
 */
@Test(description="String_Node_Str",dependsOnMethods="String_Node_Str") public void testCreateNewDatasetVersion() throws ClientProtocolException, IOException, URISyntaxException, MLIntegrationBaseTestException {
  CloseableHttpResponse response=uploadDatasetFromCSV(MLIntegrationTestConstants.DATASET_NAME,"String_Node_Str",MLIntegrationTestConstants.FOREST_COVER_DATASET_SAMPLE);
  Assert.assertEquals(MLIntegrationTestConstants.HTTP_OK,response.getStatusLine().getStatusCode());
  response.close();
}

Fixed version (ground truth):
/** 
 * Test Creating a new version of an existing dataset
 * @throws ClientProtocolException
 * @throws IOException
 * @throws URISyntaxException
 * @throws MLIntegrationBaseTestException 
 */
@Test(description="String_Node_Str",dependsOnMethods="String_Node_Str") public void testCreateNewDatasetVersion() throws ClientProtocolException, IOException, URISyntaxException, MLIntegrationBaseTestException {
  CloseableHttpResponse response=uploadDatasetFromCSV(MLIntegrationTestConstants.DATASET_NAME,"String_Node_Str",MLIntegrationTestConstants.DIABETES_DATASET_SAMPLE);
  Assert.assertEquals(MLIntegrationTestConstants.HTTP_OK,response.getStatusLine().getStatusCode());
  response.close();
}
Program: 42565
Project: 42565
Buggy source:
public Workflow getWorkflow(long modelId,long analysisId) throws DatabaseHandlerException ;

Fixed version (ground truth):
public Workflow getWorkflow(long analysisId) throws DatabaseHandlerException ;
Program: 42567
Project: 42567
Buggy source:
@Override public MLStorage getModelStorage(long modelId) throws DatabaseHandlerException {
  Connection connection=null;
  ResultSet result=null;
  PreparedStatement statement=null;
  MLStorage storage=new MLStorage();
  try {
    connection=dbh.getDataSource().getConnection();
    statement=connection.prepareStatement(SQLQueries.GET_MODEL_STORAGE);
    statement.setLong(1,modelId);
    result=statement.executeQuery();
    if (result.first()) {
      storage.setType(result.getString(1));
      storage.setLocation(result.getString(2));
      return storage;
    }
 else {
      return storage;
    }
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + modelId);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,statement,result);
  }
}

Fixed version (ground truth):
@Override public MLStorage getModelStorage(long modelId) throws DatabaseHandlerException {
  Connection connection=null;
  ResultSet result=null;
  PreparedStatement statement=null;
  MLStorage storage=new MLStorage();
  try {
    connection=dbh.getDataSource().getConnection();
    statement=connection.prepareStatement(SQLQueries.GET_MODEL_STORAGE);
    statement.setLong(1,modelId);
    result=statement.executeQuery();
    if (result.first()) {
      storage.setType(result.getString(1));
      storage.setLocation(result.getString(2));
      return storage;
    }
 else {
      return storage;
    }
  }
 catch (  SQLException e) {
    logger.error(e);
    throw new DatabaseHandlerException("String_Node_Str" + modelId);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,statement,result);
  }
}
Program: 42569
Project: 42569
Buggy source:
/** 
 * Close a given set of database resources.
 * @param preparedStatement PeparedStatement to be closed
 */
public static void closeDatabaseResources(PreparedStatement preparedStatement) throws DatabaseHandlerException {
  closeDatabaseResources(null,preparedStatement,null);
}

Fixed version (ground truth):
/** 
 * Close a given set of database resources.
 * @param preparedStatement
 * @param resultSet
 * @throws DatabaseHandlerException
 */
public static void closeDatabaseResources(PreparedStatement preparedStatement,ResultSet resultSet) throws DatabaseHandlerException {
  closeDatabaseResources(null,preparedStatement,resultSet);
}
Program: 42570
Project: 42570
Buggy source:
private void persistModel(long modelId,MLModel model) throws MLModelBuilderException {
  try {
    Map<String,String> storageMap=databaseService.getModelStorage(modelId);
    String storageType=storageMap.get(MLConstants.STORAGE_TYPE);
    String storageLocation=storageMap.get(MLConstants.STORAGE_LOCATION);
    MLIOFactory ioFactory=new MLIOFactory(mlProperties);
    MLOutputAdapter outputAdapter=ioFactory.getOutputAdapter(storageType + MLConstants.OUT_SUFFIX);
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    ObjectOutputStream oos=new ObjectOutputStream(baos);
    oos.writeObject(model);
    oos.flush();
    oos.close();
    InputStream is=new ByteArrayInputStream(baos.toByteArray());
    String outPath=storageLocation + File.separator + modelId;
    outputAdapter.writeDataset(outPath,is);
    databaseService.updateModelStorage(modelId,storageType,outPath);
  }
 catch (  Exception e) {
    throw new MLModelBuilderException("String_Node_Str" + modelId,e);
  }
}

Fixed version (ground truth):
private void persistModel(long modelId,MLModel model) throws MLModelBuilderException {
  try {
    MLStorage storage=databaseService.getModelStorage(modelId);
    String storageType=storage.getType();
    String storageLocation=storage.getLocation();
    MLIOFactory ioFactory=new MLIOFactory(mlProperties);
    MLOutputAdapter outputAdapter=ioFactory.getOutputAdapter(storageType + MLConstants.OUT_SUFFIX);
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    ObjectOutputStream oos=new ObjectOutputStream(baos);
    oos.writeObject(model);
    oos.flush();
    oos.close();
    InputStream is=new ByteArrayInputStream(baos.toByteArray());
    String outPath=storageLocation + File.separator + modelId;
    outputAdapter.writeDataset(outPath,is);
    databaseService.updateModelStorage(modelId,storageType,outPath);
  }
 catch (  Exception e) {
    throw new MLModelBuilderException("String_Node_Str" + modelId,e);
  }
}
Program: 42571
Project: 42571
Buggy source:
Map<String,String> getModelStorage(long modelId) throws DatabaseHandlerException ;

Fixed version (ground truth):
MLStorage getModelStorage(long modelId) throws DatabaseHandlerException ;
Program: 42572
Project: 42572
Buggy source:
@Override public void insertDefaultsIntoFeatureCustomized(long modelId,MLCustomizedFeature customizedValues) throws DatabaseHandlerException {
  Connection connection=null;
  PreparedStatement insertStatement=null;
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(false);
    int tenantId=customizedValues.getTenantId();
    String imputeOption=customizedValues.getImputeOption();
    boolean inclusion=customizedValues.isInclude();
    String lastModifiedUser=customizedValues.getLastModifiedUser();
    String userName=customizedValues.getUserName();
    insertStatement=connection.prepareStatement(SQLQueries.INSERT_DEFAULTS_INTO_FEATURE_CUSTOMIZED);
    insertStatement.setLong(1,modelId);
    insertStatement.setInt(2,tenantId);
    insertStatement.setString(3,imputeOption);
    insertStatement.setBoolean(4,inclusion);
    insertStatement.setString(5,lastModifiedUser);
    insertStatement.setString(6,userName);
    insertStatement.execute();
    connection.commit();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    MLDatabaseUtils.rollBack(connection);
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.enableAutoCommit(connection);
    MLDatabaseUtils.closeDatabaseResources(connection,insertStatement);
  }
}

Fixed version (ground truth):
@Override public void insertDefaultsIntoFeatureCustomized(long modelId,MLCustomizedFeature customizedValues) throws DatabaseHandlerException {
  Connection connection=null;
  PreparedStatement insertStatement=null;
  long datasetVersionId=getDatasetVersionIdFromModelId(modelId);
  try {
    connection=dbh.getDataSource().getConnection();
    connection.setAutoCommit(false);
    int tenantId=customizedValues.getTenantId();
    String imputeOption=customizedValues.getImputeOption();
    boolean inclusion=customizedValues.isInclude();
    String lastModifiedUser=customizedValues.getLastModifiedUser();
    String userName=customizedValues.getUserName();
    insertStatement=connection.prepareStatement(SQLQueries.INSERT_DEFAULTS_INTO_FEATURE_CUSTOMIZED);
    insertStatement.setLong(1,modelId);
    insertStatement.setInt(2,tenantId);
    insertStatement.setString(3,imputeOption);
    insertStatement.setBoolean(4,inclusion);
    insertStatement.setString(5,lastModifiedUser);
    insertStatement.setString(6,userName);
    insertStatement.setLong(7,datasetVersionId);
    insertStatement.execute();
    connection.commit();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    MLDatabaseUtils.rollBack(connection);
    throw new DatabaseHandlerException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
 finally {
    MLDatabaseUtils.enableAutoCommit(connection);
    MLDatabaseUtils.closeDatabaseResources(connection,insertStatement);
  }
}
Program: 42573
Project: 42573
Buggy source:
@Override public Map<String,String> getModelStorage(long modelId) throws DatabaseHandlerException {
  Connection connection=null;
  ResultSet result=null;
  PreparedStatement statement=null;
  Map<String,String> map=new HashMap<String,String>();
  try {
    connection=dbh.getDataSource().getConnection();
    statement=connection.prepareStatement(SQLQueries.GET_MODEL_STORAGE);
    statement.setLong(1,modelId);
    result=statement.executeQuery();
    if (result.first()) {
      map.put(MLConstants.STORAGE_TYPE,result.getString(1));
      map.put(MLConstants.STORAGE_LOCATION,result.getString(2));
      return map;
    }
 else {
      throw new DatabaseHandlerException("String_Node_Str" + modelId);
    }
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + modelId);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,statement,result);
  }
}

Fixed version (ground truth):
@Override public MLStorage getModelStorage(long modelId) throws DatabaseHandlerException {
  Connection connection=null;
  ResultSet result=null;
  PreparedStatement statement=null;
  MLStorage storage=new MLStorage();
  try {
    connection=dbh.getDataSource().getConnection();
    statement=connection.prepareStatement(SQLQueries.GET_MODEL_STORAGE);
    statement.setLong(1,modelId);
    result=statement.executeQuery();
    if (result.first()) {
      storage.setType(result.getString(1));
      storage.setLocation(result.getString(2));
      return storage;
    }
 else {
      return storage;
    }
  }
 catch (  SQLException e) {
    throw new DatabaseHandlerException("String_Node_Str" + modelId);
  }
 finally {
    MLDatabaseUtils.closeDatabaseResources(connection,statement,result);
  }
}
Program: 42575
Project: 42575
Buggy source:
/** 
 * Returns a absolute path of a given data source.
 * @param datasetID     Unique Identifier of the data-set
 * @return              Absolute path of a given data-set
 * @throws DatasetServiceException
 */
@Override public String getDatasetUrl(String datasetID) throws DatasetServiceException {
  try {
    DatabaseService dbService=MLDatasetServiceValueHolder.getDatabaseService();
    return dbService.getDatasetUrl(datasetID);
  }
 catch (  DatabaseHandlerException e) {
    throw new DatasetServiceException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Returns a absolute path of a given data source.
 * @param valueSetId     Unique Identifier of the value-set
 * @return              Absolute path of a given value-set
 * @throws DatasetServiceException
 */
@Override public String getDatasetUrl(String valueSetId) throws DatasetServiceException {
  try {
    DatabaseService dbService=MLDatasetServiceValueHolder.getDatabaseService();
    return dbService.getValueSetUri(valueSetId);
  }
 catch (  DatabaseHandlerException e) {
    throw new DatasetServiceException("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 42577
Project: 42577
Buggy source:
/** 
 * Function to transform double array into labeled point
 * @param tokens double array of tokens
 * @return Labeled point
 * @throws org.wso2.carbon.ml.model.exceptions.ModelServiceException
 */
@Override public LabeledPoint call(double[] tokens) throws ModelServiceException {
  try {
    double response=tokens[responseIndex];
    double[] features=new double[tokens.length];
    for (int i=0; i < tokens.length; ++i) {
      if (responseIndex != i) {
        features[i]=tokens[i];
      }
    }
    return new LabeledPoint(response,Vectors.dense(features));
  }
 catch (  Exception e) {
    throw new ModelServiceException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Function to transform double array into labeled point
 * @param tokens double array of tokens
 * @return Labeled point
 * @throws org.wso2.carbon.ml.model.exceptions.ModelServiceException
 */
@Override public LabeledPoint call(double[] tokens) throws ModelServiceException {
  try {
    double response=tokens[responseIndex];
    double[] features=new double[tokens.length - 1];
    for (int i=0; i < tokens.length - 1; i++) {
      if (responseIndex != i) {
        features[i]=tokens[i];
      }
    }
    return new LabeledPoint(response,Vectors.dense(features));
  }
 catch (  Exception e) {
    throw new ModelServiceException("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 42579
Project: 42579
Buggy source:
@Test public void testLogisticRegression() throws Exception {
  String jsonString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  RunLogisticRegression runLogisticRegression=new RunLogisticRegression(jsonString);
  ExecutorService executorService=Executors.newSingleThreadExecutor();
  CompletionService<LogisticRegressionModel> completionService=new ExecutorCompletionService<LogisticRegressionModel>(executorService);
  completionService.submit(runLogisticRegression);
  LogisticRegressionModel model=completionService.take().get();
  System.out.println(model.intercept());
}

Fixed version (ground truth):
@Test public void testLogisticRegression() throws Exception {
  String jsonString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  RunLogisticRegression runLogisticRegression=new RunLogisticRegression(jsonString);
  ExecutorService executorService=Executors.newSingleThreadExecutor();
  CompletionService<LogisticRegressionModel> completionService=new ExecutorCompletionService<LogisticRegressionModel>(executorService);
  completionService.submit(runLogisticRegression);
  LogisticRegressionModel model=completionService.take().get();
  System.out.println(model.intercept());
}
Program: 42580
Project: 42580
Buggy source:
/** 
 * Create the json string with summary stat for a given column
 * @param column
 * @param type
 * @param graphFrequencies
 * @param missing
 * @param unique
 * @param descriptiveStats
 * @return
 */
private JSONObject createJson(int column,FeatureType[] type,List<SortedMap<?,Integer>> graphFrequencies,int[] missing,int[] unique,List<DescriptiveStatistics> descriptiveStats){
  JSONObject json=new JSONObject();
  JSONArray freqs=new JSONArray();
  Object[] categoryNames=graphFrequencies.get(column).keySet().toArray();
  for (int i=0; i < graphFrequencies.get(column).size(); i++) {
    JSONObject temp=new JSONObject();
    temp.put("String_Node_Str",categoryNames[i].toString());
    temp.put("String_Node_Str",graphFrequencies.get(column).get(categoryNames[i]));
    freqs.put(temp);
  }
  json.put("String_Node_Str",type[column].toString());
  json.put("String_Node_Str",unique[column]);
  json.put("String_Node_Str",missing[column]);
  DecimalFormat decimalFormat=new DecimalFormat("String_Node_Str");
  if (descriptiveStats.get(column).getN() != 0) {
    json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getMean()));
    json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getPercentile(50)));
    json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getStandardDeviation()));
    json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getSkewness()));
  }
  json.put("String_Node_Str",freqs);
  return json;
}

Fixed version (ground truth):
/** 
 * Create the json string with summary stat for a given column
 * @param column
 * @param type
 * @param graphFrequencies
 * @param missing
 * @param unique
 * @param descriptiveStats
 * @return
 */
private JSONObject createJson(int column,FeatureType[] type,List<SortedMap<?,Integer>> graphFrequencies,int[] missing,int[] unique,List<DescriptiveStatistics> descriptiveStats){
  JSONObject json=new JSONObject();
  JSONArray freqs=new JSONArray();
  Object[] categoryNames=graphFrequencies.get(column).keySet().toArray();
  for (int i=0; i < graphFrequencies.get(column).size(); i++) {
    JSONObject temp=new JSONObject();
    temp.put("String_Node_Str",categoryNames[i].toString());
    temp.put("String_Node_Str",graphFrequencies.get(column).get(categoryNames[i]));
    freqs.put(temp);
  }
  json.put("String_Node_Str",type[column].toString());
  json.put("String_Node_Str",unique[column]);
  json.put("String_Node_Str",missing[column]);
  DecimalFormat decimalFormat=new DecimalFormat("String_Node_Str");
  if (descriptiveStats.get(column).getN() != 0) {
    json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getMean()));
    json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getPercentile(50)));
    json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getStandardDeviation()));
    if (type[column].equals(FeatureType.NUMERICAL)) {
      json.put("String_Node_Str",decimalFormat.format(descriptiveStats.get(column).getSkewness()));
    }
  }
  json.put("String_Node_Str",freqs);
  return json;
}
Program: 42581
Project: 42581
Buggy source:
public Feature[] getFeatures(int dataSet,int startPoint,int numberOfFeatures) throws DatabaseHandlerException {
  List<Feature> features=new ArrayList<Feature>();
  try {
    ResultSet result=connection.createStatement().executeQuery("String_Node_Str" + dataSet + "String_Node_Str"+ numberOfFeatures+ "String_Node_Str"+ (startPoint - 1)+ "String_Node_Str");
    FeatureType featureType=FeatureType.NUMERICAL;
    ImputeOption imputeOperation=ImputeOption.DISCARD;
    while (result.next()) {
      if ("String_Node_Str".equals(result.getNString(3))) {
        featureType=FeatureType.CATEGORICAL;
      }
      if ("String_Node_Str".equals(result.getNString(5))) {
        imputeOperation=ImputeOption.REPLACE_WTH_MEAN;
      }
 else       if ("String_Node_Str".equals(result.getNString(5))) {
        imputeOperation=ImputeOption.REPLACE_WTH_MEAN;
      }
      features.add(new Feature(result.getNString(1),result.getBoolean(6),featureType,imputeOperation,result.getNString(4)));
    }
  }
 catch (  SQLException e) {
    String msg="String_Node_Str" + dataSet + "String_Node_Str"+ e.getMessage();
    LOGGER.error(msg,e);
    throw new DatabaseHandlerException(msg);
  }
  return features.toArray(new Feature[features.size()]);
}

Fixed version (ground truth):
public Feature[] getFeatures(int dataSet,int startPoint,int numberOfFeatures) throws DatabaseHandlerException {
  List<Feature> features=new ArrayList<Feature>();
  try {
    ResultSet result=connection.createStatement().executeQuery("String_Node_Str" + dataSet + "String_Node_Str"+ numberOfFeatures+ "String_Node_Str"+ (startPoint - 1)+ "String_Node_Str");
    while (result.next()) {
      FeatureType featureType=FeatureType.NUMERICAL;
      if ("String_Node_Str".equals(result.getNString(3))) {
        featureType=FeatureType.CATEGORICAL;
      }
      ImputeOption imputeOperation=ImputeOption.DISCARD;
      if ("String_Node_Str".equals(result.getNString(5))) {
        imputeOperation=ImputeOption.REPLACE_WTH_MEAN;
      }
 else       if ("String_Node_Str".equals(result.getNString(5))) {
        imputeOperation=ImputeOption.REPLACE_WTH_MEAN;
      }
      features.add(new Feature(result.getNString(1),result.getBoolean(6),featureType,imputeOperation,result.getNString(4)));
    }
  }
 catch (  SQLException e) {
    String msg="String_Node_Str" + dataSet + "String_Node_Str"+ e.getMessage();
    LOGGER.error(msg,e);
    throw new DatabaseHandlerException(msg);
  }
  return features.toArray(new Feature[features.size()]);
}
Program: 42582
Project: 42582
Buggy source:
private String createJson(int column,FeatureType[] type,List<Map<String,Integer>> graphFrequencies,List<Integer> missing,List<Integer> unique,List<DescriptiveStatistics> descriptiveStats){
  String json="String_Node_Str";
  String freqs="String_Node_Str";
  Object[] categoryNames=graphFrequencies.get(column).keySet().toArray();
  for (int i=0; i < graphFrequencies.get(column).size(); i++) {
    freqs=freqs + "String_Node_Str" + categoryNames[i].toString()+ "String_Node_Str"+ graphFrequencies.get(column).get(categoryNames[i].toString())+ "String_Node_Str";
  }
  freqs=freqs.replaceFirst("String_Node_Str","String_Node_Str") + "String_Node_Str";
  json=json + "String_Node_Str" + type[column].toString()+ "String_Node_Str"+ unique.get(column)+ "String_Node_Str"+ missing.get(column)+ "String_Node_Str"+ descriptiveStats.get(column).getMean()+ "String_Node_Str"+ descriptiveStats.get(column).getPercentile(50)+ "String_Node_Str"+ descriptiveStats.get(column).getStandardDeviation()+ "String_Node_Str"+ descriptiveStats.get(column).getSkewness()+ "String_Node_Str"+ freqs+ "String_Node_Str";
  return json;
}

Fixed version (ground truth):
private String createJson(int column,FeatureType[] type,List<Map<String,Integer>> graphFrequencies,List<Integer> missing,List<Integer> unique,List<DescriptiveStatistics> descriptiveStats){
  String json="String_Node_Str";
  String freqs="String_Node_Str";
  Object[] categoryNames=graphFrequencies.get(column).keySet().toArray();
  for (int i=0; i < graphFrequencies.get(column).size(); i++) {
    freqs=freqs + "String_Node_Str" + categoryNames[i].toString()+ "String_Node_Str"+ graphFrequencies.get(column).get(categoryNames[i].toString())+ "String_Node_Str";
  }
  freqs=freqs.replaceFirst("String_Node_Str","String_Node_Str") + "String_Node_Str";
  json=json + "String_Node_Str" + type[column].toString()+ "String_Node_Str"+ "String_Node_Str"+ unique.get(column)+ "String_Node_Str"+ missing.get(column)+ "String_Node_Str"+ descriptiveStats.get(column).getMean()+ "String_Node_Str"+ descriptiveStats.get(column).getPercentile(50)+ "String_Node_Str"+ descriptiveStats.get(column).getStandardDeviation()+ "String_Node_Str"+ descriptiveStats.get(column).getSkewness()+ "String_Node_Str"+ freqs+ "String_Node_Str";
  return json;
}
Program: 42583
Project: 42583
Buggy source:
/** 
 * This private method is used by the  {@link #populateDatatable(HttpServletResponse,HttpServletRequest,Feature[])}method build selected boxes.
 * @param types :
 * @param selectedOption : already selected option
 * @param cssClass : css class assigned to this selection buttons.
 * @return : HTML code for rendering this selection boxes
 */
private String buildSectionBox(String[] types,String selectedOption,String cssClass){
  StringBuilder selection=new StringBuilder();
  selection.append("String_Node_Str" + cssClass + "String_Node_Str");
  for (  String ft : types) {
    if (selectedOption.equals(ft)) {
      selection.append("String_Node_Str" + ft.toString() + "String_Node_Str"+ ft.toString()+ "String_Node_Str");
    }
 else {
      selection.append("String_Node_Str" + ft.toString() + "String_Node_Str"+ ft.toString()+ "String_Node_Str");
    }
  }
  selection.append("String_Node_Str");
  return selection.toString();
}

Fixed version (ground truth):
/** 
 * This private method is used by the  {@link #populateDatatable(HttpServletResponse,HttpServletRequest,Feature[])}method build selected boxes.
 * @param types :
 * @param selectedOption : already selected option
 * @param cssClass : css class assigned to this selection buttons.
 * @return : HTML code for rendering this selection boxes
 */
private String buildSectionBox(String[] types,String selectedOption,String cssClass){
  StringBuilder selection=new StringBuilder();
  selection.append("String_Node_Str" + cssClass + "String_Node_Str");
  for (  String ft : types) {
    if (selectedOption.equalsIgnoreCase(ft)) {
      selection.append("String_Node_Str" + ft.toString() + "String_Node_Str"+ ft.toString()+ "String_Node_Str");
    }
 else {
      selection.append("String_Node_Str" + ft.toString() + "String_Node_Str"+ ft.toString()+ "String_Node_Str");
    }
  }
  selection.append("String_Node_Str");
  return selection.toString();
}