Program: 45379
Project: 45379
Buggy source:
/** 
 * Load ant set the database properties from this database's (database) info table.
 */
public void loadDatabaseProperties(){
  if (this.getProperty(STARTING_ID) != null)   return;
  int iStartID=1;
  if ((this.getDatabaseType() & (DBConstants.SHARED_DATA | DBConstants.USER_DATA)) != DBConstants.SHARED_DATA)   return;
  RecordOwner recordOwner=null;
  DatabaseInfo recDatabaseInfo=new DatabaseInfo();
  recDatabaseInfo.setTable(this.doMakeTable(recDatabaseInfo));
  String dbName=this.getDatabaseName(true);
  if (dbName.endsWith(SHARED_SUFFIX))   dbName=dbName.substring(0,dbName.length() - SHARED_SUFFIX.length());
 else   if (dbName.endsWith(USER_SUFFIX))   dbName=dbName.substring(0,dbName.length() - USER_SUFFIX.length());
  recDatabaseInfo.setDatabaseName(dbName);
  int iOldOpenMode=recDatabaseInfo.getOpenMode();
  recDatabaseInfo.setOpenMode(recDatabaseInfo.getOpenMode() | DBConstants.OPEN_DONT_CREATE);
  recDatabaseInfo.init(recordOwner);
  recDatabaseInfo.setOpenMode(iOldOpenMode);
  if (recDatabaseInfo.getEditMode() == DBConstants.EDIT_CURRENT) {
    iStartID=(int)recDatabaseInfo.getField(DatabaseInfo.kStartID).getValue();
    if (!recDatabaseInfo.getField(DatabaseInfo.kEndID).isNull())     this.addDatabaseProperty(ENDING_ID,Integer.toString((int)recDatabaseInfo.getField(DatabaseInfo.kEndID).getValue()));
    if (!recDatabaseInfo.getField(DatabaseInfo.kBaseDatabase).isNull())     this.addDatabaseProperty(BaseDatabase.BASE_DATABASE,recDatabaseInfo.getField(DatabaseInfo.kBaseDatabase).toString());
  }
  if (iStartID <= 0)   iStartID=1;
  recDatabaseInfo.free();
  this.addDatabaseProperty(STARTING_ID,Integer.toString(iStartID));
  if (m_databaseBase == null)   if (this.getProperty(BASE_DATABASE) != null) {
    Map<String,Object> properties=new HashMap<String,Object>();
    properties.putAll(this.getProperties());
    properties.remove(BASE_DATABASE);
    properties.put(DBConstants.DB_USER_PREFIX,DBConstants.BLANK);
    properties.put(DBConstants.SUB_SYSTEM_LN_SUFFIX,DBConstants.BLANK);
    m_databaseBase=m_databaseOwner.getDatabase(this.getProperty(BASE_DATABASE),this.getDatabaseType() & DBConstants.TABLE_MASK,properties);
  }
}

Fixed version (ground truth):
/** 
 * Load ant set the database properties from this database's (database) info table.
 */
public void loadDatabaseProperties(){
  if (this.getProperty(STARTING_ID) != null)   return;
  int iStartID=1;
  if ((this.getDatabaseType() & (DBConstants.SHARED_DATA | DBConstants.USER_DATA)) != DBConstants.SHARED_DATA)   return;
  RecordOwner recordOwner=null;
  DatabaseInfo recDatabaseInfo=new DatabaseInfo();
  recDatabaseInfo.setTable(this.doMakeTable(recDatabaseInfo));
  String dbName=this.getDatabaseName(true);
  if (dbName.endsWith(SHARED_SUFFIX))   dbName=dbName.substring(0,dbName.length() - SHARED_SUFFIX.length());
 else   if (dbName.endsWith(USER_SUFFIX))   dbName=dbName.substring(0,dbName.length() - USER_SUFFIX.length());
  recDatabaseInfo.setDatabaseName(dbName);
  int iOldOpenMode=recDatabaseInfo.getOpenMode();
  recDatabaseInfo.setOpenMode(recDatabaseInfo.getOpenMode() | DBConstants.OPEN_DONT_CREATE);
  recDatabaseInfo.init(recordOwner);
  recDatabaseInfo.setOpenMode(iOldOpenMode);
  if (recDatabaseInfo.getEditMode() == DBConstants.EDIT_CURRENT) {
    iStartID=(int)recDatabaseInfo.getField(DatabaseInfo.kStartID).getValue();
    if (!recDatabaseInfo.getField(DatabaseInfo.kEndID).isNull())     this.addDatabaseProperty(ENDING_ID,Integer.toString((int)recDatabaseInfo.getField(DatabaseInfo.kEndID).getValue()));
    if (!recDatabaseInfo.getField(DatabaseInfo.kBaseDatabase).isNull())     this.addDatabaseProperty(BaseDatabase.BASE_DATABASE,recDatabaseInfo.getField(DatabaseInfo.kBaseDatabase).toString());
  }
  if (iStartID <= 0)   iStartID=1;
  recDatabaseInfo.free();
  this.addDatabaseProperty(STARTING_ID,Integer.toString(iStartID));
  if (m_databaseBase == null)   if (this.getProperty(BASE_DATABASE) != null) {
    Map<String,Object> properties=new HashMap<String,Object>();
    properties.putAll(this.getProperties());
    properties.remove(BASE_DATABASE);
    properties.remove(SQLParams.JDBC_DRIVER_PARAM);
    properties.put(DBConstants.DB_USER_PREFIX,DBConstants.BLANK);
    properties.put(DBConstants.SUB_SYSTEM_LN_SUFFIX,DBConstants.BLANK);
    m_databaseBase=m_databaseOwner.getDatabase(this.getProperty(BASE_DATABASE),this.getDatabaseType() & DBConstants.TABLE_MASK,properties);
  }
}