Program: 90662
Project: 90662
Buggy source:
/** 
 * Create a Flume Avro Appender.
 * @param agents An array of Agents.
 * @param properties Properties to pass to the embedded agent.
 * @param embedded true if the embedded agent manager should be used. otherwise the Avro manager will be used.<b>Note: </b><i>The embedded attribute is deprecated in favor of specifying the type attribute.</i>
 * @param type Avro (default), Embedded, or Persistent.
 * @param dataDir The directory where the Flume FileChannel should write its data.
 * @param connectionTimeout The amount of time in milliseconds to wait before a connection times out. Minimum is1000.
 * @param requestTimeout The amount of time in milliseconds to wait before a request times out. Minimum is 1000.
 * @param agentRetries The number of times to retry an agent before failing to the next agent.
 * @param maxDelay The maximum number of seconds to wait for a complete batch.
 * @param name The name of the Appender.
 * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwisethey are propagated to the caller.
 * @param excludes A comma separated list of MDC elements to exclude.
 * @param includes A comma separated list of MDC elements to include.
 * @param required A comma separated list of MDC elements that are required.
 * @param mdcPrefix The prefix to add to MDC key names.
 * @param eventPrefix The prefix to add to event key names.
 * @param compressBody If true the event body will be compressed.
 * @param batchSize Number of events to include in a batch. Defaults to 1.
 * @param lockTimeoutRetries Times to retry a lock timeout when writing to Berkeley DB.
 * @param factory The factory to use to create Flume events.
 * @param layout The layout to format the event.
 * @param filter A Filter to filter events.
 * @return A Flume Avro Appender.
 */
@PluginFactory public static FlumeAppender createAppender(@PluginElement("String_Node_Str") Agent[] agents,@PluginElement("String_Node_Str") final Property[] properties,@PluginAttribute("String_Node_Str") final String embedded,@PluginAttribute("String_Node_Str") final String type,@PluginAttribute("String_Node_Str") final String dataDir,@PluginAttribute("String_Node_Str") final String connectionTimeout,@PluginAttribute("String_Node_Str") final String requestTimeout,@PluginAttribute("String_Node_Str") final String agentRetries,@PluginAttribute("String_Node_Str") final String maxDelay,@PluginAttribute("String_Node_Str") final String name,@PluginAttribute("String_Node_Str") final String ignore,@PluginAttribute("String_Node_Str") final String excludes,@PluginAttribute("String_Node_Str") final String includes,@PluginAttribute("String_Node_Str") final String required,@PluginAttribute("String_Node_Str") final String mdcPrefix,@PluginAttribute("String_Node_Str") final String eventPrefix,@PluginAttribute("String_Node_Str") final String compressBody,@PluginAttribute("String_Node_Str") final String batchSize,@PluginAttribute("String_Node_Str") final String lockTimeoutRetries,@PluginElement("String_Node_Str") final FlumeEventFactory factory,@PluginElement("String_Node_Str") Layout<? extends Serializable> layout,@PluginElement("String_Node_Str") final Filter filter){
  final boolean embed=embedded != null ? Boolean.parseBoolean(embedded) : (agents == null || agents.length == 0) && properties != null && properties.length > 0;
  final boolean ignoreExceptions=Booleans.parseBoolean(ignore,true);
  final boolean compress=Booleans.parseBoolean(compressBody,true);
  ManagerType managerType;
  if (type != null) {
    if (embed && embedded != null) {
      try {
        managerType=ManagerType.getType(type);
        LOGGER.warn("String_Node_Str" + type);
      }
 catch (      final Exception ex) {
        LOGGER.warn("String_Node_Str" + type + "String_Node_Str");
        managerType=ManagerType.EMBEDDED;
      }
    }
 else {
      try {
        managerType=ManagerType.getType(type);
      }
 catch (      final Exception ex) {
        LOGGER.warn("String_Node_Str" + type + "String_Node_Str");
        managerType=ManagerType.EMBEDDED;
      }
    }
  }
 else   if (embed) {
    managerType=ManagerType.EMBEDDED;
  }
 else {
    managerType=ManagerType.AVRO;
  }
  final int batchCount=Integers.parseInt(batchSize,1);
  final int connectTimeout=Integers.parseInt(connectionTimeout,0);
  final int reqTimeout=Integers.parseInt(requestTimeout,0);
  final int retries=Integers.parseInt(agentRetries,0);
  final int lockTimeoutRetryCount=Integers.parseInt(lockTimeoutRetries,DEFAULT_LOCK_TIMEOUT_RETRY_COUNT);
  final int delay=Integers.parseInt(maxDelay,DEFAULT_MAX_DELAY);
  if (layout == null) {
    layout=Rfc5424Layout.createLayout(null,null,null,"String_Node_Str",null,mdcPrefix,eventPrefix,null,null,null,null,excludes,includes,required,null,null,null,null);
  }
  if (name == null) {
    LOGGER.error("String_Node_Str");
    return null;
  }
  AbstractFlumeManager manager;
switch (managerType) {
case EMBEDDED:
    manager=FlumeEmbeddedManager.getManager(name,agents,properties,batchCount,dataDir);
  break;
case AVRO:
if (agents == null || agents.length == 0) {
  LOGGER.debug("String_Node_Str");
  agents=new Agent[]{Agent.createAgent(null,null)};
}
manager=FlumeAvroManager.getManager(name,agents,batchCount,retries,connectTimeout,reqTimeout);
break;
case PERSISTENT:
if (agents == null || agents.length == 0) {
LOGGER.debug("String_Node_Str");
agents=new Agent[]{Agent.createAgent(null,null)};
}
manager=FlumePersistentManager.getManager(name,agents,properties,batchCount,retries,connectTimeout,reqTimeout,delay,lockTimeoutRetryCount,dataDir);
break;
default :
LOGGER.debug("String_Node_Str");
if (agents == null || agents.length == 0) {
LOGGER.debug("String_Node_Str");
agents=new Agent[]{Agent.createAgent(null,null)};
}
manager=FlumeAvroManager.getManager(name,agents,batchCount,retries,connectTimeout,reqTimeout);
}
if (manager == null) {
return null;
}
return new FlumeAppender(name,filter,layout,ignoreExceptions,includes,excludes,required,mdcPrefix,eventPrefix,compress,factory,manager);
}

Fixed version (ground truth):
/** 
 * Create a Flume Avro Appender.
 * @param agents An array of Agents.
 * @param properties Properties to pass to the embedded agent.
 * @param embedded true if the embedded agent manager should be used. otherwise the Avro manager will be used.<b>Note: </b><i>The embedded attribute is deprecated in favor of specifying the type attribute.</i>
 * @param type Avro (default), Embedded, or Persistent.
 * @param dataDir The directory where the Flume FileChannel should write its data.
 * @param connectionTimeout The amount of time in milliseconds to wait before a connection times out. Minimum is1000.
 * @param requestTimeout The amount of time in milliseconds to wait before a request times out. Minimum is 1000.
 * @param agentRetries The number of times to retry an agent before failing to the next agent.
 * @param maxDelay The maximum number of seconds to wait for a complete batch.
 * @param name The name of the Appender.
 * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwisethey are propagated to the caller.
 * @param excludes A comma separated list of MDC elements to exclude.
 * @param includes A comma separated list of MDC elements to include.
 * @param required A comma separated list of MDC elements that are required.
 * @param mdcPrefix The prefix to add to MDC key names.
 * @param eventPrefix The prefix to add to event key names.
 * @param compressBody If true the event body will be compressed.
 * @param batchSize Number of events to include in a batch. Defaults to 1.
 * @param lockTimeoutRetries Times to retry a lock timeout when writing to Berkeley DB.
 * @param factory The factory to use to create Flume events.
 * @param layout The layout to format the event.
 * @param filter A Filter to filter events.
 * @return A Flume Avro Appender.
 */
@PluginFactory public static FlumeAppender createAppender(@PluginElement("String_Node_Str") Agent[] agents,@PluginElement("String_Node_Str") final Property[] properties,@PluginAttribute("String_Node_Str") final String embedded,@PluginAttribute("String_Node_Str") final String type,@PluginAttribute("String_Node_Str") final String dataDir,@PluginAttribute("String_Node_Str") final String connectionTimeout,@PluginAttribute("String_Node_Str") final String requestTimeout,@PluginAttribute("String_Node_Str") final String agentRetries,@PluginAttribute("String_Node_Str") final String maxDelay,@PluginAttribute("String_Node_Str") final String name,@PluginAttribute("String_Node_Str") final String ignore,@PluginAttribute("String_Node_Str") final String excludes,@PluginAttribute("String_Node_Str") final String includes,@PluginAttribute("String_Node_Str") final String required,@PluginAttribute("String_Node_Str") final String mdcPrefix,@PluginAttribute("String_Node_Str") final String eventPrefix,@PluginAttribute("String_Node_Str") final String compressBody,@PluginAttribute("String_Node_Str") final String batchSize,@PluginAttribute("String_Node_Str") final String lockTimeoutRetries,@PluginElement("String_Node_Str") final FlumeEventFactory factory,@PluginElement("String_Node_Str") Layout<? extends Serializable> layout,@PluginElement("String_Node_Str") final Filter filter){
  final boolean embed=embedded != null ? Boolean.parseBoolean(embedded) : (agents == null || agents.length == 0) && properties != null && properties.length > 0;
  final boolean ignoreExceptions=Booleans.parseBoolean(ignore,true);
  final boolean compress=Booleans.parseBoolean(compressBody,true);
  ManagerType managerType;
  if (type != null) {
    if (embed && embedded != null) {
      try {
        managerType=ManagerType.getType(type);
        LOGGER.warn("String_Node_Str" + type);
      }
 catch (      final Exception ex) {
        LOGGER.warn("String_Node_Str" + type + "String_Node_Str");
        managerType=ManagerType.EMBEDDED;
      }
    }
 else {
      try {
        managerType=ManagerType.getType(type);
      }
 catch (      final Exception ex) {
        LOGGER.warn("String_Node_Str" + type + "String_Node_Str");
        managerType=ManagerType.EMBEDDED;
      }
    }
  }
 else   if (embed) {
    managerType=ManagerType.EMBEDDED;
  }
 else {
    managerType=ManagerType.AVRO;
  }
  final int batchCount=Integers.parseInt(batchSize,1);
  final int connectTimeout=Integers.parseInt(connectionTimeout,0);
  final int reqTimeout=Integers.parseInt(requestTimeout,0);
  final int retries=Integers.parseInt(agentRetries,0);
  final int lockTimeoutRetryCount=Integers.parseInt(lockTimeoutRetries,DEFAULT_LOCK_TIMEOUT_RETRY_COUNT);
  final int delay=Integers.parseInt(maxDelay,DEFAULT_MAX_DELAY);
  if (layout == null) {
    final int enterpriseNumber=Integer.parseInt(Rfc5424Layout.DEFAULT_ENTERPRISE_NUMBER);
    layout=Rfc5424Layout.createLayout(null,null,enterpriseNumber,true,Rfc5424Layout.DEFAULT_MDCID,mdcPrefix,eventPrefix,false,null,null,null,excludes,includes,required,null,false,null,null);
  }
  if (name == null) {
    LOGGER.error("String_Node_Str");
    return null;
  }
  AbstractFlumeManager manager;
switch (managerType) {
case EMBEDDED:
    manager=FlumeEmbeddedManager.getManager(name,agents,properties,batchCount,dataDir);
  break;
case AVRO:
if (agents == null || agents.length == 0) {
  LOGGER.debug("String_Node_Str");
  agents=new Agent[]{Agent.createAgent(null,null)};
}
manager=FlumeAvroManager.getManager(name,agents,batchCount,retries,connectTimeout,reqTimeout);
break;
case PERSISTENT:
if (agents == null || agents.length == 0) {
LOGGER.debug("String_Node_Str");
agents=new Agent[]{Agent.createAgent(null,null)};
}
manager=FlumePersistentManager.getManager(name,agents,properties,batchCount,retries,connectTimeout,reqTimeout,delay,lockTimeoutRetryCount,dataDir);
break;
default :
LOGGER.debug("String_Node_Str");
if (agents == null || agents.length == 0) {
LOGGER.debug("String_Node_Str");
agents=new Agent[]{Agent.createAgent(null,null)};
}
manager=FlumeAvroManager.getManager(name,agents,batchCount,retries,connectTimeout,reqTimeout);
}
if (manager == null) {
return null;
}
return new FlumeAppender(name,filter,layout,ignoreExceptions,includes,excludes,required,mdcPrefix,eventPrefix,compress,factory,manager);
}