Program: 90444
Project: 90444
Buggy source:
@Override public RouteInfo select(EnumDBMasterSlave masterSlave,String tableName,IShardingKey<?> value) throws DBRouteException {
  RouteInfo dbRouteInfo=new RouteInfo();
  long shardingValue=getShardingValue(value);
  String clusterName=value.getClusterName();
  DBClusterInfo dbClusterInfo=this.dbCluster.getDBClusterInfo(clusterName);
  if (dbClusterInfo == null) {
    throw new IllegalStateException("String_Node_Str" + clusterName);
  }
  List<DBRegionInfo> regionInfos=dbClusterInfo.getDbRegions();
  if (regionInfos == null || regionInfos.isEmpty()) {
    throw new DBRouteException("String_Node_Str" + clusterName);
  }
  DBRegionInfo regionInfo=null;
  int regionIndex=0;
  for (  DBRegionInfo region : regionInfos) {
    if (region.isMatch(shardingValue)) {
      regionInfo=region;
      break;
    }
    regionIndex++;
  }
  if (regionInfo == null) {
    throw new DBRouteException("String_Node_Str" + clusterName + "String_Node_Str"+ shardingValue);
  }
  List<DBInfo> dbInfos=null;
switch (masterSlave) {
case MASTER:
    dbInfos=regionInfo.getMasterDBInfos();
  break;
case AUTO:
List<List<DBInfo>> multiSlaveDBInfos=regionInfo.getSlaveDBInfos();
if (multiSlaveDBInfos == null || multiSlaveDBInfos.isEmpty()) {
throw new DBRouteException("String_Node_Str" + clusterName);
}
int slaveIndex=AbstractDBCluster.r.nextInt(multiSlaveDBInfos.size() - 1);
dbInfos=multiSlaveDBInfos.get(slaveIndex);
break;
default :
multiSlaveDBInfos=regionInfo.getSlaveDBInfos();
if (multiSlaveDBInfos == null || multiSlaveDBInfos.isEmpty()) {
throw new DBRouteException("String_Node_Str" + clusterName);
}
slaveIndex=masterSlave.getValue();
dbInfos=multiSlaveDBInfos.get(slaveIndex);
break;
}
if (dbInfos == null || dbInfos.isEmpty()) {
throw new DBRouteException("String_Node_Str" + clusterName);
}
DBInfo dbInfo=doSelect(dbInfos,value);
dbRouteInfo.setDbInfo(dbInfo);
dbRouteInfo.setClusterName(clusterName);
dbRouteInfo.setRegionIndex(regionIndex);
try {
int tableNum=tableCluster.getTableNumber(clusterName,tableName);
int tableIndex=(int)shardingValue % tableNum;
dbRouteInfo.setTableName(tableName);
dbRouteInfo.setTableIndex(tableIndex);
}
 catch (Exception e) {
throw new DBRouteException("String_Node_Str" + dbRouteInfo.getClusterName() + "String_Node_Str"+ dbRouteInfo.getDbInfo().getDbName()+ "String_Node_Str"+ tableName);
}
return dbRouteInfo;
}

Fixed version (ground truth):
@Override public RouteInfo select(EnumDBMasterSlave masterSlave,String tableName,IShardingKey<?> value) throws DBRouteException {
  RouteInfo dbRouteInfo=new RouteInfo();
  long shardingValue=getShardingValue(value);
  String clusterName=value.getClusterName();
  DBClusterInfo dbClusterInfo=this.dbCluster.getDBClusterInfo(clusterName);
  if (dbClusterInfo == null) {
    throw new IllegalStateException("String_Node_Str" + clusterName);
  }
  List<DBRegionInfo> regionInfos=dbClusterInfo.getDbRegions();
  if (regionInfos == null || regionInfos.isEmpty()) {
    throw new DBRouteException("String_Node_Str" + clusterName);
  }
  DBRegionInfo regionInfo=null;
  int regionIndex=0;
  for (  DBRegionInfo region : regionInfos) {
    if (region.isMatch(shardingValue)) {
      regionInfo=region;
      break;
    }
    regionIndex++;
  }
  if (regionInfo == null) {
    throw new DBRouteException("String_Node_Str" + clusterName + "String_Node_Str"+ shardingValue);
  }
  List<DBInfo> dbInfos=null;
switch (masterSlave) {
case MASTER:
    dbInfos=regionInfo.getMasterDBInfos();
  break;
case AUTO:
List<List<DBInfo>> multiSlaveDBInfos=regionInfo.getSlaveDBInfos();
if (multiSlaveDBInfos == null || multiSlaveDBInfos.isEmpty()) {
throw new DBRouteException("String_Node_Str" + clusterName);
}
int slaveIndex=AbstractDBCluster.r.nextInt(multiSlaveDBInfos.size());
dbInfos=multiSlaveDBInfos.get(slaveIndex);
break;
default :
multiSlaveDBInfos=regionInfo.getSlaveDBInfos();
if (multiSlaveDBInfos == null || multiSlaveDBInfos.isEmpty()) {
throw new DBRouteException("String_Node_Str" + clusterName);
}
slaveIndex=masterSlave.getValue();
dbInfos=multiSlaveDBInfos.get(slaveIndex);
break;
}
if (dbInfos == null || dbInfos.isEmpty()) {
throw new DBRouteException("String_Node_Str" + clusterName);
}
DBInfo dbInfo=doSelect(dbInfos,value);
dbRouteInfo.setDbInfo(dbInfo);
dbRouteInfo.setClusterName(clusterName);
dbRouteInfo.setRegionIndex(regionIndex);
try {
int tableNum=tableCluster.getTableNumber(clusterName,tableName);
int tableIndex=(int)shardingValue % tableNum;
dbRouteInfo.setTableName(tableName);
dbRouteInfo.setTableIndex(tableIndex);
}
 catch (Exception e) {
throw new DBRouteException("String_Node_Str" + dbRouteInfo.getClusterName() + "String_Node_Str"+ dbRouteInfo.getDbInfo().getDbName()+ "String_Node_Str"+ tableName);
}
return dbRouteInfo;
}