Program: 124070
Project: 124070
Buggy source:
public static SessionTreeNode getSessionTreeNode(DatabaseConnection dbconnection,RepositoryNode repositoryNode,String selectedContext) throws Exception {
  IMetadataConnection iMetadataConnection=null;
  iMetadataConnection=ConvertionHelper.convert(dbconnection,false,selectedContext);
  String url=dbconnection.getURL();
  if (url == null || url.equals("String_Node_Str")) {
    url=iMetadataConnection.getUrl();
  }
  SQLConnection connection=null;
  DriverShim wapperDriver=null;
  List list=createSQLConnection(dbconnection,selectedContext,iMetadataConnection);
  if (list != null && list.size() > 0) {
    for (int i=0; i < list.size(); i++) {
      if (list.get(i) instanceof SQLConnection) {
        connection=(SQLConnection)list.get(i);
      }
      if (list.get(i) instanceof DriverShim) {
        wapperDriver=(DriverShim)list.get(i);
      }
    }
  }
  ISQLAlias alias=createSQLAlias("String_Node_Str",url,dbconnection.getUsername(),dbconnection.getPassword(),dbconnection.getSID().length() == 0 ? (dbconnection.getDatasourceName().length() == 0 ? "String_Node_Str" : dbconnection.getDatasourceName()) : dbconnection.getSID());
  SessionTreeModel stm=new SessionTreeModel();
  SessionTreeNode session;
  if (wapperDriver != null && (iMetadataConnection.getDriverClass().equals(EDatabase4DriverClassName.JAVADB_EMBEDED.getDriverClass()) || iMetadataConnection.getDbType().equals(EDatabaseTypeName.JAVADB_EMBEDED.getDisplayName()) || iMetadataConnection.getDbType().equals(EDatabaseTypeName.JAVADB_DERBYCLIENT.getDisplayName())|| iMetadataConnection.getDbType().equals(EDatabaseTypeName.JAVADB_JCCJDBC.getDisplayName())|| iMetadataConnection.getDbType().equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName()))) {
    session=stm.createSessionTreeNode(new SQLConnection[]{connection,connection},alias,null,dbconnection.getPassword(),repositoryNode,wapperDriver);
  }
 else {
    session=stm.createSessionTreeNode(new SQLConnection[]{connection,connection},alias,null,dbconnection.getPassword(),repositoryNode);
  }
  return session;
}

Fixed version (ground truth):
public static SessionTreeNode getSessionTreeNode(DatabaseConnection dbconnection,RepositoryNode repositoryNode,String selectedContext) throws Exception {
  IMetadataConnection iMetadataConnection=null;
  iMetadataConnection=ConvertionHelper.convert(dbconnection,false,selectedContext);
  String url=dbconnection.getURL();
  if (url == null || url.equals("String_Node_Str")) {
    url=iMetadataConnection.getUrl();
  }
  SQLConnection connection=null;
  DriverShim wapperDriver=null;
  List list=createSQLConnection(dbconnection,selectedContext,iMetadataConnection);
  if (list != null && list.size() > 0) {
    for (int i=0; i < list.size(); i++) {
      if (list.get(i) instanceof SQLConnection) {
        connection=(SQLConnection)list.get(i);
      }
      if (list.get(i) instanceof DriverShim) {
        wapperDriver=(DriverShim)list.get(i);
      }
    }
  }
  ISQLAlias alias=createSQLAlias("String_Node_Str",url,dbconnection.getUsername(),dbconnection.getPassword(),dbconnection.getSID() == null || dbconnection.getSID().length() == 0 ? (dbconnection.getDatasourceName() == null || dbconnection.getDatasourceName().length() == 0 ? "String_Node_Str" : dbconnection.getDatasourceName()) : dbconnection.getSID());
  SessionTreeModel stm=new SessionTreeModel();
  SessionTreeNode session;
  if (wapperDriver != null && (iMetadataConnection.getDriverClass().equals(EDatabase4DriverClassName.JAVADB_EMBEDED.getDriverClass()) || iMetadataConnection.getDbType().equals(EDatabaseTypeName.JAVADB_EMBEDED.getDisplayName()) || iMetadataConnection.getDbType().equals(EDatabaseTypeName.JAVADB_DERBYCLIENT.getDisplayName())|| iMetadataConnection.getDbType().equals(EDatabaseTypeName.JAVADB_JCCJDBC.getDisplayName())|| iMetadataConnection.getDbType().equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName()))) {
    session=stm.createSessionTreeNode(new SQLConnection[]{connection,connection},alias,null,dbconnection.getPassword(),repositoryNode,wapperDriver);
  }
 else {
    session=stm.createSessionTreeNode(new SQLConnection[]{connection,connection},alias,null,dbconnection.getPassword(),repositoryNode);
  }
  return session;
}