Program: 176615
Project: 176615
Buggy source:
/** 
 * Gets the pool config policy.
 * @param persistenceUnitMetadata the persistence unit metadata
 * @param puProperties
 * @return the pool config policy
 */
public static PoolConfiguration setPoolConfigPolicy(PersistenceUnitMetadata persistenceUnitMetadata,PoolConfiguration prop,Map<String,Object> puProperties){
  Properties props=persistenceUnitMetadata.getProperties();
  String maxActivePerNode=null;
  String maxIdlePerNode=null;
  String minIdlePerNode=null;
  String maxTotal=null;
  boolean testOnBorrow=false;
  boolean testWhileIdle=false;
  boolean testOnConnect=false;
  boolean testOnReturn=false;
  if (puProperties != null) {
    maxActivePerNode=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_ACTIVE);
    maxIdlePerNode=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_IDLE);
    minIdlePerNode=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MIN_IDLE);
    maxTotal=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_TOTAL);
  }
  if (maxActivePerNode == null) {
    maxActivePerNode=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_ACTIVE);
  }
  if (maxIdlePerNode == null) {
    maxIdlePerNode=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_IDLE);
  }
  if (minIdlePerNode == null) {
    minIdlePerNode=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MIN_IDLE);
  }
  if (maxTotal == null) {
    maxTotal=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_TOTAL);
  }
  try {
    if (!StringUtils.isEmpty(maxActivePerNode)) {
      prop.setInitialSize(Integer.parseInt(maxActivePerNode));
    }
    if (!StringUtils.isEmpty(maxIdlePerNode)) {
      prop.setMaxIdle(Integer.parseInt(maxIdlePerNode));
    }
    if (!StringUtils.isEmpty(minIdlePerNode)) {
      prop.setMinIdle(Integer.parseInt(minIdlePerNode));
    }
    if (!StringUtils.isEmpty(maxTotal)) {
      prop.setMaxActive(Integer.parseInt(maxTotal));
    }
    CassandraSchemaMetadata csm=CassandraPropertyReader.csmd;
    Properties connProps=csm.getConnectionProperties();
    if (connProps != null) {
      testOnBorrow=Boolean.parseBoolean(connProps.getProperty(CassandraConstants.TEST_ON_BORROW));
      testOnConnect=Boolean.parseBoolean(connProps.getProperty(CassandraConstants.TEST_ON_CONNECT));
      testOnReturn=Boolean.parseBoolean(connProps.getProperty(CassandraConstants.TEST_ON_RETURN));
      testWhileIdle=Boolean.parseBoolean(connProps.getProperty(CassandraConstants.TEST_WHILE_IDLE));
    }
    prop.setTestOnBorrow(testOnBorrow);
    prop.setTestOnConnect(testOnConnect);
    prop.setTestOnReturn(testOnReturn);
    prop.setTestWhileIdle(testWhileIdle);
  }
 catch (  NumberFormatException e) {
    logger.warn("String_Node_Str" + persistenceUnitMetadata.getPersistenceUnitName() + "String_Node_Str");
    prop=null;
  }
  return prop;
}

Fixed version (ground truth):
/** 
 * Gets the pool config policy.
 * @param persistenceUnitMetadata the persistence unit metadata
 * @param puProperties
 * @return the pool config policy
 */
public static PoolConfiguration setPoolConfigPolicy(PersistenceUnitMetadata persistenceUnitMetadata,PoolConfiguration prop,Map<String,Object> puProperties){
  Properties props=persistenceUnitMetadata.getProperties();
  String maxActivePerNode=null;
  String maxIdlePerNode=null;
  String minIdlePerNode=null;
  String maxTotal=null;
  String testOnBorrow=null;
  String testWhileIdle=null;
  String testOnConnect=null;
  String testOnReturn=null;
  String socketTimeOut=null;
  if (puProperties != null) {
    maxActivePerNode=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_ACTIVE);
    maxIdlePerNode=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_IDLE);
    minIdlePerNode=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MIN_IDLE);
    maxTotal=(String)puProperties.get(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_TOTAL);
    testOnBorrow=(String)puProperties.get(CassandraConstants.TEST_ON_BORROW);
    testOnConnect=(String)puProperties.get(CassandraConstants.TEST_ON_CONNECT);
    testOnReturn=(String)puProperties.get(CassandraConstants.TEST_ON_RETURN);
    testWhileIdle=(String)puProperties.get(CassandraConstants.TEST_WHILE_IDLE);
    socketTimeOut=(String)puProperties.get(CassandraConstants.SOCKET_TIMEOUT);
  }
  if (maxActivePerNode == null) {
    maxActivePerNode=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_ACTIVE);
  }
  if (maxIdlePerNode == null) {
    maxIdlePerNode=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_IDLE);
  }
  if (minIdlePerNode == null) {
    minIdlePerNode=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MIN_IDLE);
  }
  if (maxTotal == null) {
    maxTotal=props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_TOTAL);
  }
  try {
    if (!StringUtils.isEmpty(maxActivePerNode)) {
      prop.setInitialSize(Integer.parseInt(maxActivePerNode));
    }
    if (!StringUtils.isEmpty(maxIdlePerNode)) {
      prop.setMaxIdle(Integer.parseInt(maxIdlePerNode));
    }
    if (!StringUtils.isEmpty(minIdlePerNode)) {
      prop.setMinIdle(Integer.parseInt(minIdlePerNode));
    }
    if (!StringUtils.isEmpty(maxTotal)) {
      prop.setMaxActive(Integer.parseInt(maxTotal));
    }
    CassandraSchemaMetadata csm=CassandraPropertyReader.csmd;
    Properties connProps=csm.getConnectionProperties();
    if (connProps != null) {
      if (testOnBorrow == null) {
        testOnBorrow=connProps.getProperty(CassandraConstants.TEST_ON_BORROW);
      }
      if (testOnConnect == null) {
        testOnConnect=connProps.getProperty(CassandraConstants.TEST_ON_CONNECT);
      }
      if (testOnReturn == null) {
        testOnReturn=connProps.getProperty(CassandraConstants.TEST_ON_RETURN);
      }
      if (testWhileIdle == null) {
        testWhileIdle=connProps.getProperty(CassandraConstants.TEST_WHILE_IDLE);
      }
      if (socketTimeOut == null) {
        socketTimeOut=connProps.getProperty(CassandraConstants.SOCKET_TIMEOUT);
      }
    }
    prop.setTestOnBorrow(Boolean.parseBoolean(testOnBorrow));
    prop.setTestOnConnect(Boolean.parseBoolean(testOnConnect));
    prop.setTestOnReturn(Boolean.parseBoolean(testOnReturn));
    prop.setTestWhileIdle(Boolean.parseBoolean(testWhileIdle));
    if (!StringUtils.isEmpty(socketTimeOut)) {
      prop.setSocketTimeout(Integer.parseInt(socketTimeOut));
    }
 else {
      prop.setSocketTimeout(_DEFAULT_SHOCKET_TIMEOUT);
    }
  }
 catch (  NumberFormatException e) {
    logger.warn("String_Node_Str" + persistenceUnitMetadata.getPersistenceUnitName() + "String_Node_Str");
    prop=null;
  }
  return prop;
}