Program: 176074
Project: 176074
Buggy source:
/** 
 * Creates new instance of client factory for given persistence unit.
 * @param persistenceUnit
 * @param puProperties
 * @param clientFactory
 * @return new instance of clientFactory
 */
private static ClientFactory instantiateClientFactory(String persistenceUnit,Map<String,Object> puProperties){
  ClientFactory clientFactory=null;
  logger.info("String_Node_Str" + persistenceUnit);
  PersistenceUnitMetadata persistenceUnitMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String kunderaClientFactory=puProperties != null ? (String)puProperties.get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
  if (kunderaClientFactory == null) {
    kunderaClientFactory=persistenceUnitMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_CLIENT_FACTORY);
  }
  if (kunderaClientFactory == null) {
    throw new ClientResolverException("String_Node_Str");
  }
  try {
    clientFactory=(ClientFactory)Class.forName(kunderaClientFactory).newInstance();
    Method m=GenericClientFactory.class.getDeclaredMethod("String_Node_Str",String.class);
    if (!m.isAccessible()) {
      m.setAccessible(true);
    }
    m.invoke(clientFactory,persistenceUnit);
    m=GenericClientFactory.class.getDeclaredMethod("String_Node_Str",Map.class);
    if (!m.isAccessible()) {
      m.setAccessible(true);
    }
    m.invoke(clientFactory,puProperties);
  }
 catch (  InstantiationException e) {
    onError(e);
  }
catch (  IllegalAccessException e) {
    onError(e);
  }
catch (  ClassNotFoundException e) {
    onError(e);
  }
catch (  SecurityException e) {
    onError(e);
  }
catch (  NoSuchMethodException e) {
    onError(e);
  }
catch (  IllegalArgumentException e) {
    onError(e);
  }
catch (  InvocationTargetException e) {
    onError(e);
  }
  if (clientFactory == null) {
    logger.error("String_Node_Str");
    throw new ClientResolverException("String_Node_Str");
  }
  logger.info("String_Node_Str");
  return clientFactory;
}

Fixed version (ground truth):
/** 
 * Creates new instance of client factory for given persistence unit.
 * @param persistenceUnit
 * @param puProperties
 * @param clientFactory
 * @return new instance of clientFactory
 */
private static ClientFactory instantiateClientFactory(String persistenceUnit,Map<String,Object> puProperties,final KunderaMetadata kunderaMetadata){
  ClientFactory clientFactory=null;
  logger.info("String_Node_Str" + persistenceUnit);
  PersistenceUnitMetadata persistenceUnitMetadata=kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
  String kunderaClientFactory=puProperties != null ? (String)puProperties.get(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
  if (kunderaClientFactory == null) {
    kunderaClientFactory=persistenceUnitMetadata.getProperties().getProperty(PersistenceProperties.KUNDERA_CLIENT_FACTORY);
  }
  if (kunderaClientFactory == null) {
    throw new ClientResolverException("String_Node_Str");
  }
  try {
    clientFactory=(ClientFactory)Class.forName(kunderaClientFactory).newInstance();
    Method m=GenericClientFactory.class.getDeclaredMethod("String_Node_Str",String.class);
    if (!m.isAccessible()) {
      m.setAccessible(true);
    }
    m.invoke(clientFactory,persistenceUnit);
    m=GenericClientFactory.class.getDeclaredMethod("String_Node_Str",Map.class);
    if (!m.isAccessible()) {
      m.setAccessible(true);
    }
    m.invoke(clientFactory,puProperties);
    m=GenericClientFactory.class.getDeclaredMethod("String_Node_Str",KunderaMetadata.class);
    if (!m.isAccessible()) {
      m.setAccessible(true);
    }
    m.invoke(clientFactory,kunderaMetadata);
  }
 catch (  InstantiationException e) {
    onError(e);
  }
catch (  IllegalAccessException e) {
    onError(e);
  }
catch (  ClassNotFoundException e) {
    onError(e);
  }
catch (  SecurityException e) {
    onError(e);
  }
catch (  NoSuchMethodException e) {
    onError(e);
  }
catch (  IllegalArgumentException e) {
    onError(e);
  }
catch (  InvocationTargetException e) {
    onError(e);
  }
  if (clientFactory == null) {
    logger.error("String_Node_Str");
    throw new ClientResolverException("String_Node_Str");
  }
  logger.info("String_Node_Str");
  return clientFactory;
}