Program: 67630
Project: 67630
Buggy source:
/** 
 * Override the default login creation method. If persistenceInfo is available, use the information from it to setup the login and possibly to set readConnectionPool.
 */
protected void updateLogins(Map m){
  DatasourceLogin login=session.getLogin();
  String user=getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_USER,m,session);
  String password=getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_PASSWORD,m,session);
  if (user != null) {
    login.setUserName(user);
  }
  if (password != null) {
    login.setPassword(securableObjectHolder.getSecurableObject().decryptPassword(password));
  }
  String eclipselinkPlatform=PropertiesHandler.getPropertyValueLogDebug(PersistenceUnitProperties.TARGET_DATABASE,m,session);
  if (eclipselinkPlatform != null) {
    login.setPlatformClassName(eclipselinkPlatform,persistenceUnitInfo.getClassLoader());
  }
  PersistenceUnitTransactionType transactionType=persistenceUnitInfo.getTransactionType();
  String transTypeString=getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.TRANSACTION_TYPE,m,session);
  if (transTypeString != null) {
    transactionType=PersistenceUnitTransactionType.valueOf(transTypeString);
  }
  javax.sql.DataSource jtaDatasource=getDatasourceFromProperties(m,PersistenceUnitProperties.JTA_DATASOURCE,persistenceUnitInfo.getJtaDataSource());
  javax.sql.DataSource nonjtaDatasource=getDatasourceFromProperties(m,PersistenceUnitProperties.NON_JTA_DATASOURCE,persistenceUnitInfo.getNonJtaDataSource());
  if (isValidationOnly(m,false) && transactionType == PersistenceUnitTransactionType.JTA && jtaDatasource == null) {
    updateLoginDefaultConnector(login,m);
    return;
  }
  if (session.getProject().usesSequencing()) {
    session.getSequencingControl().setShouldUseSeparateConnection(nonjtaDatasource != null);
  }
  login.setUsesExternalTransactionController(transactionType == PersistenceUnitTransactionType.JTA);
  javax.sql.DataSource mainDatasource=null;
  javax.sql.DataSource readDatasource=null;
  if (login.shouldUseExternalTransactionController()) {
    mainDatasource=jtaDatasource;
    readDatasource=nonjtaDatasource;
  }
 else {
    if (jtaDatasource != null) {
      session.log(SessionLog.WARNING,SessionLog.TRANSACTION,"String_Node_Str",persistenceUnitInfo.getPersistenceUnitName());
    }
    if (nonjtaDatasource != null) {
      mainDatasource=nonjtaDatasource;
    }
 else {
      updateLoginDefaultConnector(login,m);
      return;
    }
  }
  if (!(login.getConnector() instanceof JNDIConnector)) {
    JNDIConnector jndiConnector;
    if (mainDatasource instanceof DataSourceImpl) {
      jndiConnector=new JNDIConnector(((DataSourceImpl)mainDatasource).getName());
    }
 else {
      jndiConnector=new JNDIConnector(mainDatasource);
    }
    login.setConnector(jndiConnector);
    login.setUsesExternalConnectionPooling(true);
  }
  if (readDatasource != null) {
    DatasourceLogin readLogin=(DatasourceLogin)login.clone();
    readLogin.dontUseExternalTransactionController();
    JNDIConnector jndiConnector;
    if (readDatasource instanceof DataSourceImpl) {
      jndiConnector=new JNDIConnector(((DataSourceImpl)readDatasource).getName());
    }
 else {
      jndiConnector=new JNDIConnector(readDatasource);
    }
    readLogin.setConnector(jndiConnector);
    session.setReadConnectionPool(readLogin);
  }
}

Fixed version (ground truth):
/** 
 * Override the default login creation method. If persistenceInfo is available, use the information from it to setup the login and possibly to set readConnectionPool.
 */
protected void updateLogins(Map m){
  DatasourceLogin login=session.getLogin();
  String user=getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_USER,m,session);
  String password=getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.JDBC_PASSWORD,m,session);
  if (user != null) {
    login.setUserName(user);
  }
  if (password != null) {
    login.setPassword(securableObjectHolder.getSecurableObject().decryptPassword(password));
  }
  String eclipselinkPlatform=PropertiesHandler.getPropertyValueLogDebug(PersistenceUnitProperties.TARGET_DATABASE,m,session);
  if (eclipselinkPlatform != null) {
    login.setPlatformClassName(eclipselinkPlatform,persistenceUnitInfo.getClassLoader());
  }
  PersistenceUnitTransactionType transactionType=persistenceUnitInfo.getTransactionType();
  String transTypeString=getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.TRANSACTION_TYPE,m,session);
  if (transTypeString != null) {
    transactionType=PersistenceUnitTransactionType.valueOf(transTypeString);
  }
  javax.sql.DataSource jtaDatasource=getDatasourceFromProperties(m,PersistenceUnitProperties.JTA_DATASOURCE,persistenceUnitInfo.getJtaDataSource());
  javax.sql.DataSource nonjtaDatasource=getDatasourceFromProperties(m,PersistenceUnitProperties.NON_JTA_DATASOURCE,persistenceUnitInfo.getNonJtaDataSource());
  if (isValidationOnly(m,false) && transactionType == PersistenceUnitTransactionType.JTA && jtaDatasource == null) {
    updateLoginDefaultConnector(login,m);
    return;
  }
  login.setUsesExternalTransactionController(transactionType == PersistenceUnitTransactionType.JTA);
  javax.sql.DataSource mainDatasource=null;
  javax.sql.DataSource readDatasource=null;
  if (login.shouldUseExternalTransactionController()) {
    mainDatasource=jtaDatasource;
    readDatasource=nonjtaDatasource;
  }
 else {
    if (jtaDatasource != null) {
      session.log(SessionLog.WARNING,SessionLog.TRANSACTION,"String_Node_Str",persistenceUnitInfo.getPersistenceUnitName());
    }
    if (nonjtaDatasource != null) {
      mainDatasource=nonjtaDatasource;
    }
 else {
      updateLoginDefaultConnector(login,m);
      return;
    }
  }
  if (!(login.getConnector() instanceof JNDIConnector)) {
    JNDIConnector jndiConnector;
    if (mainDatasource instanceof DataSourceImpl) {
      jndiConnector=new JNDIConnector(((DataSourceImpl)mainDatasource).getName());
    }
 else {
      jndiConnector=new JNDIConnector(mainDatasource);
    }
    login.setConnector(jndiConnector);
    login.setUsesExternalConnectionPooling(true);
  }
  if (readDatasource != null) {
    DatasourceLogin readLogin=(DatasourceLogin)login.clone();
    readLogin.dontUseExternalTransactionController();
    JNDIConnector jndiConnector;
    if (readDatasource instanceof DataSourceImpl) {
      jndiConnector=new JNDIConnector(((DataSourceImpl)readDatasource).getName());
    }
 else {
      jndiConnector=new JNDIConnector(readDatasource);
    }
    readLogin.setConnector(jndiConnector);
    session.setReadConnectionPool(readLogin);
  }
}