Program: 29708
Project: 29708
Buggy source:
/** 
 * {@inheritDoc}
 */
public void loadXAResourcesAndItsConnections(List xaresList,List connList){
  ConnectorRuntime crt=connectorRuntimeProvider.get();
  Collection<JdbcResource> jdbcResources=getAllJdbcResources();
  if (jdbcResources == null || jdbcResources.size() == 0) {
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.finest("String_Node_Str");
    }
    return;
  }
  List<JdbcConnectionPool> jdbcPools=new ArrayList<JdbcConnectionPool>();
  for (  Resource resource : jdbcResources) {
    JdbcResource jdbcResource=(JdbcResource)resource;
    if (getResourcesUtil().isEnabled(jdbcResource)) {
      ResourceInfo resourceInfo=ConnectorsUtil.getResourceInfo(jdbcResource);
      JdbcConnectionPool pool=ResourcesUtil.createInstance().getJdbcConnectionPoolOfResource(resourceInfo);
      if (pool != null && "String_Node_Str".equals(pool.getResType())) {
        jdbcPools.add(pool);
      }
      if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("String_Node_Str" + "String_Node_Str" + (jdbcResource.getPoolName()));
      }
    }
  }
  loadAllJdbcResources();
  Properties XAResourceWrappers=new Properties();
  XAResourceWrappers.put("String_Node_Str","String_Node_Str");
  if (txService == null) {
    txService=config.getExtensionByType(txService.getClass());
  }
  List<Property> properties=txService.getProperty();
  if (properties != null) {
    for (    Property property : properties) {
      String name=property.getName();
      String value=property.getValue();
      if (name.equals("String_Node_Str")) {
        if ("String_Node_Str".equals(value)) {
          XAResourceWrappers.remove("String_Node_Str");
        }
      }
 else       if (name.equals("String_Node_Str")) {
        if (value.equals("String_Node_Str")) {
          XAResourceWrappers.put("String_Node_Str","String_Node_Str");
        }
      }
    }
  }
  for (  JdbcConnectionPool jdbcConnectionPool : jdbcPools) {
    if (jdbcConnectionPool.getResType() == null || jdbcConnectionPool.getName() == null || !jdbcConnectionPool.getResType().equals("String_Node_Str")) {
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.finest("String_Node_Str" + jdbcConnectionPool.getName());
      }
      continue;
    }
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.finest("String_Node_Str" + jdbcConnectionPool.getName());
    }
    PoolInfo poolInfo=ConnectorsUtil.getPoolInfo(jdbcConnectionPool);
    try {
      String[] dbUserPassword=getdbUserPasswordOfJdbcConnectionPool(jdbcConnectionPool);
      String dbUser=dbUserPassword[0];
      String dbPassword=dbUserPassword[1];
      if (dbPassword == null) {
        dbPassword="String_Node_Str";
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str",poolInfo);
        }
      }
      if (dbUser == null) {
        dbUser="String_Node_Str";
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str",poolInfo);
        }
      }
      ManagedConnectionFactory fac=crt.obtainManagedConnectionFactory(poolInfo);
      Subject subject=new Subject();
      PasswordCredential pc=new PasswordCredential(dbUser,dbPassword.toCharArray());
      pc.setManagedConnectionFactory(fac);
      Principal prin=new ResourcePrincipal(dbUser,dbPassword);
      subject.getPrincipals().add(prin);
      subject.getPrivateCredentials().add(pc);
      ManagedConnection mc=fac.createManagedConnection(subject,null);
      connList.add(mc);
      try {
        XAResource xares=mc.getXAResource();
        if (xares != null) {
          String datasourceClassname=jdbcConnectionPool.getDatasourceClassname();
          String wrapperclass=(String)XAResourceWrappers.get(datasourceClassname);
          if (wrapperclass != null) {
            XAResourceWrapper xaresWrapper=null;
            xaresWrapper=(XAResourceWrapper)crt.getConnectorClassLoader().loadClass(wrapperclass).newInstance();
            xaresWrapper.init(mc,subject);
            if (_logger.isLoggable(Level.FINEST)) {
              _logger.finest("String_Node_Str" + poolInfo + "String_Node_Str"+ xaresWrapper);
            }
            xaresList.add(xaresWrapper);
          }
 else {
            if (_logger.isLoggable(Level.FINEST)) {
              _logger.finest("String_Node_Str" + poolInfo + "String_Node_Str"+ xares);
            }
            xaresList.add(xares);
          }
        }
      }
 catch (      ResourceException ex) {
        _logger.log(Level.WARNING,"String_Node_Str",poolInfo);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str",ex);
        }
      }
    }
 catch (    Exception ex) {
      _logger.log(Level.WARNING,"String_Node_Str",poolInfo);
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str",ex);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void loadXAResourcesAndItsConnections(List xaresList,List connList){
  ConnectorRuntime crt=connectorRuntimeProvider.get();
  Collection<JdbcResource> jdbcResources=getAllJdbcResources();
  if (jdbcResources == null || jdbcResources.size() == 0) {
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.finest("String_Node_Str");
    }
    return;
  }
  List<JdbcConnectionPool> jdbcPools=new ArrayList<JdbcConnectionPool>();
  for (  Resource resource : jdbcResources) {
    JdbcResource jdbcResource=(JdbcResource)resource;
    if (getResourcesUtil().isEnabled(jdbcResource)) {
      ResourceInfo resourceInfo=ConnectorsUtil.getResourceInfo(jdbcResource);
      JdbcConnectionPool pool=ResourcesUtil.createInstance().getJdbcConnectionPoolOfResource(resourceInfo);
      if (pool != null && "String_Node_Str".equals(pool.getResType())) {
        jdbcPools.add(pool);
      }
      if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("String_Node_Str" + "String_Node_Str" + (jdbcResource.getPoolName()));
      }
    }
  }
  loadAllJdbcResources();
  Properties XAResourceWrappers=new Properties();
  XAResourceWrappers.put("String_Node_Str","String_Node_Str");
  txService=config.getExtensionByType(txService.getClass());
  List<Property> properties=txService.getProperty();
  if (properties != null) {
    for (    Property property : properties) {
      String name=property.getName();
      String value=property.getValue();
      if (name.equals("String_Node_Str")) {
        if ("String_Node_Str".equals(value)) {
          XAResourceWrappers.remove("String_Node_Str");
        }
      }
 else       if (name.equals("String_Node_Str")) {
        if (value.equals("String_Node_Str")) {
          XAResourceWrappers.put("String_Node_Str","String_Node_Str");
        }
      }
    }
  }
  for (  JdbcConnectionPool jdbcConnectionPool : jdbcPools) {
    if (jdbcConnectionPool.getResType() == null || jdbcConnectionPool.getName() == null || !jdbcConnectionPool.getResType().equals("String_Node_Str")) {
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.finest("String_Node_Str" + jdbcConnectionPool.getName());
      }
      continue;
    }
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.finest("String_Node_Str" + jdbcConnectionPool.getName());
    }
    PoolInfo poolInfo=ConnectorsUtil.getPoolInfo(jdbcConnectionPool);
    try {
      String[] dbUserPassword=getdbUserPasswordOfJdbcConnectionPool(jdbcConnectionPool);
      String dbUser=dbUserPassword[0];
      String dbPassword=dbUserPassword[1];
      if (dbPassword == null) {
        dbPassword="String_Node_Str";
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str",poolInfo);
        }
      }
      if (dbUser == null) {
        dbUser="String_Node_Str";
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str",poolInfo);
        }
      }
      ManagedConnectionFactory fac=crt.obtainManagedConnectionFactory(poolInfo);
      Subject subject=new Subject();
      PasswordCredential pc=new PasswordCredential(dbUser,dbPassword.toCharArray());
      pc.setManagedConnectionFactory(fac);
      Principal prin=new ResourcePrincipal(dbUser,dbPassword);
      subject.getPrincipals().add(prin);
      subject.getPrivateCredentials().add(pc);
      ManagedConnection mc=fac.createManagedConnection(subject,null);
      connList.add(mc);
      try {
        XAResource xares=mc.getXAResource();
        if (xares != null) {
          String datasourceClassname=jdbcConnectionPool.getDatasourceClassname();
          String wrapperclass=(String)XAResourceWrappers.get(datasourceClassname);
          if (wrapperclass != null) {
            XAResourceWrapper xaresWrapper=null;
            xaresWrapper=(XAResourceWrapper)crt.getConnectorClassLoader().loadClass(wrapperclass).newInstance();
            xaresWrapper.init(mc,subject);
            if (_logger.isLoggable(Level.FINEST)) {
              _logger.finest("String_Node_Str" + poolInfo + "String_Node_Str"+ xaresWrapper);
            }
            xaresList.add(xaresWrapper);
          }
 else {
            if (_logger.isLoggable(Level.FINEST)) {
              _logger.finest("String_Node_Str" + poolInfo + "String_Node_Str"+ xares);
            }
            xaresList.add(xares);
          }
        }
      }
 catch (      ResourceException ex) {
        _logger.log(Level.WARNING,"String_Node_Str",poolInfo);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,"String_Node_Str",ex);
        }
      }
    }
 catch (    Exception ex) {
      _logger.log(Level.WARNING,"String_Node_Str",poolInfo);
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str",ex);
      }
    }
  }
}