Program: 54549
Project: 54549
Buggy source:
@Override public DataSource getConfiguredDataSource(DerbyDbBackendConfiguration configuration,String poolName){
  DataSource dataSource;
  if (configuration.embedded()) {
    EmbeddedDataSource embeddedDataSource=new EmbeddedDataSource();
    embeddedDataSource.setCreateDatabase("String_Node_Str");
    if (configuration.inMemory()) {
      embeddedDataSource.setDatabaseName("String_Node_Str" + configuration.getDbName());
    }
 else {
      embeddedDataSource.setDatabaseName(configuration.getDbName());
    }
    try {
      embeddedDataSource.getConnection();
    }
 catch (    SQLException ex) {
      throw new SystemException(ex);
    }
    embeddedDataSource.setCreateDatabase(null);
    dataSource=embeddedDataSource;
  }
 else {
    ClientDataSource clientDataSource=new ClientDataSource();
    clientDataSource.setServerName(configuration.getDbHost());
    clientDataSource.setPortNumber(configuration.getDbPort());
    clientDataSource.setUser(configuration.getUsername());
    clientDataSource.setPassword(configuration.getPassword());
    if (configuration.inMemory()) {
      clientDataSource.setDatabaseName("String_Node_Str" + configuration.getDbName());
    }
 else {
      clientDataSource.setDatabaseName(configuration.getDbName());
    }
    dataSource=clientDataSource;
  }
  if (LOGGER.isTraceEnabled()) {
    try {
      dataSource.setLogWriter(LOGGER_WRITER);
    }
 catch (    SQLException sqlException) {
      throw new SystemException(sqlException);
    }
  }
  Statement stat=null;
  ResultSet rs=null;
  Connection conn=null;
  try {
    conn=dataSource.getConnection();
    stat=conn.createStatement();
    rs=stat.executeQuery("String_Node_Str");
    rs.next();
  }
 catch (  SQLException ex) {
    throw new SystemException(ex);
  }
 finally {
    try {
      if (rs != null)       rs.close();
    }
 catch (    SQLException ex) {
    }
    try {
      if (stat != null)       stat.close();
    }
 catch (    SQLException ex) {
    }
    try {
      if (conn != null)       conn.close();
    }
 catch (    SQLException ex) {
    }
  }
  return dataSource;
}

Fixed version (ground truth):
@Override public DataSource getConfiguredDataSource(DerbyDbBackendConfiguration configuration,String poolName){
  DataSource dataSource;
  if (configuration.embedded()) {
    EmbeddedDataSource embeddedDataSource=new EmbeddedDataSource();
    embeddedDataSource.setCreateDatabase("String_Node_Str");
    if (configuration.inMemory()) {
      embeddedDataSource.setDatabaseName("String_Node_Str" + configuration.getDbName());
    }
 else {
      embeddedDataSource.setDatabaseName(configuration.getDbName());
    }
    try (Connection connection=embeddedDataSource.getConnection()){
      LOGGER.debug("String_Node_Str");
    }
 catch (    SQLException ex) {
      throw new SystemException(ex);
    }
    embeddedDataSource.setCreateDatabase(null);
    dataSource=embeddedDataSource;
  }
 else {
    ClientDataSource clientDataSource=new ClientDataSource();
    clientDataSource.setServerName(configuration.getDbHost());
    clientDataSource.setPortNumber(configuration.getDbPort());
    clientDataSource.setUser(configuration.getUsername());
    clientDataSource.setPassword(configuration.getPassword());
    if (configuration.inMemory()) {
      clientDataSource.setDatabaseName("String_Node_Str" + configuration.getDbName());
    }
 else {
      clientDataSource.setDatabaseName(configuration.getDbName());
    }
    dataSource=clientDataSource;
  }
  if (LOGGER.isTraceEnabled()) {
    try {
      dataSource.setLogWriter(LOGGER_WRITER);
    }
 catch (    SQLException sqlException) {
      throw new SystemException(sqlException);
    }
  }
  Statement stat=null;
  ResultSet rs=null;
  Connection conn=null;
  try {
    conn=dataSource.getConnection();
    stat=conn.createStatement();
    rs=stat.executeQuery("String_Node_Str");
    rs.next();
  }
 catch (  SQLException ex) {
    throw new SystemException(ex);
  }
 finally {
    try {
      if (rs != null)       rs.close();
    }
 catch (    SQLException ex) {
    }
    try {
      if (stat != null)       stat.close();
    }
 catch (    SQLException ex) {
    }
    try {
      if (conn != null)       conn.close();
    }
 catch (    SQLException ex) {
    }
  }
  return dataSource;
}