nus-yam/ex-repair huggingface dataset:
Program: 28886
Project: 28886
Buggy source:
/** 
 * This will return a list of jobs which have crossed the JOBS_RETENTION_PERIOD and need to be purged
 * @return  list of jobs to be purged
 */
public ArrayList<Job> getExpiredJobs(){
  ArrayList expiredJobs=new ArrayList();
  Iterator<Job> jobs=getJobs();
  while (jobs.hasNext()) {
    Job job=jobs.next();
    long executedTime=job.getCommandExecutionDate();
    long currentTime=System.currentTimeMillis();
    long jobsRetentionPeriod=86400000;
    boolean enableJobManager=Boolean.parseBoolean(System.getProperty("String_Node_Str"));
    if (enableJobManager) {
      managedJobConfig=domain.getExtensionByType(ManagedJobConfig.class);
      jobsRetentionPeriod=convert(managedJobConfig.getJobRetentionPeriod());
    }
    if (currentTime - executedTime > jobsRetentionPeriod && job.getState().equals(AdminCommandState.State.COMPLETED)) {
      expiredJobs.add(job);
    }
  }
  return expiredJobs;
}

Fixed version (ground truth):
/** 
 * This will return a list of jobs which have crossed the JOBS_RETENTION_PERIOD and need to be purged
 * @return  list of jobs to be purged
 */
public ArrayList<JobInfo> getExpiredJobs(){
  ArrayList<JobInfo> expiredJobs=new ArrayList<JobInfo>();
  JobInfos jobInfos=getCompletedJobs();
  for (  JobInfo job : jobInfos.getJobInfoList()) {
    long executedTime=job.commandExecutionDate;
    long currentTime=System.currentTimeMillis();
    long jobsRetentionPeriod=86400000;
    managedJobConfig=domain.getExtensionByType(ManagedJobConfig.class);
    jobsRetentionPeriod=convert(managedJobConfig.getJobRetentionPeriod());
    if (currentTime - executedTime > jobsRetentionPeriod && job.exitCode.equals(AdminCommandState.State.COMPLETED.name())) {
      expiredJobs.add(job);
    }
  }
  return expiredJobs;
}
Program: 28887
Project: 28887
Buggy source:
/** 
 * This will remove the job from the registry
 * @param id  The job id of the job to be removed
 */
@Override public synchronized void purgeJob(String id){
  Job obj=jobRegistry.remove(id);
  logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",obj));
}

Fixed version (ground truth):
/** 
 * This will remove the job from the registry
 * @param id  The job id of the job to be removed
 */
@Override public synchronized void purgeJob(String id){
  Job obj=jobRegistry.remove(id);
  purgeCompletedJobForId(id);
  logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",obj));
}
Program: 28888
Project: 28888
Buggy source:
public Map<ObjectName,List<String>> getComplianceFailures(){
  final Map<ObjectName,AMXValidator.ProblemList> failures=mCompliance.getComplianceFailures();
  final Map<ObjectName,List<String>> result=MapUtil.newMap();
  for (  final Map.Entry<ObjectName,AMXValidator.ProblemList> me : failures.entrySet()) {
    result.put(me.getKey(),me.getValue().getProblems());
  }
  return result;
}

Fixed version (ground truth):
public Map<ObjectName,List<String>> getComplianceFailures(){
  final Map<ObjectName,List<String>> result=MapUtil.newMap();
  if (mCompliance == null) {
    return result;
  }
  final Map<ObjectName,AMXValidator.ProblemList> failures=mCompliance.getComplianceFailures();
  for (  final Map.Entry<ObjectName,AMXValidator.ProblemList> me : failures.entrySet()) {
    result.put(me.getKey(),me.getValue().getProblems());
  }
  return result;
}
Program: 28889
Project: 28889
Buggy source:
@Override public <T extends Container>T parseContainerConfig(ServiceLocator habitat,final URL configuration,Class<T> configType) throws IOException {
  org.jvnet.hk2.config.ConfigParser configParser=new org.jvnet.hk2.config.ConfigParser(habitat);
  final DomDocument doc=new DomDocument<GlassFishConfigBean>(habitat){
    @Override public Dom make(    final ServiceLocator habitat,    XMLStreamReader xmlStreamReader,    GlassFishConfigBean dom,    ConfigModel configModel){
      return new GlassFishConfigBean(habitat,this,dom,configModel,xmlStreamReader);
    }
  }
;
  final T container=doc.getRoot().createProxy(configType);
  try {
    ConfigSupport.apply(new SingleConfigCode<Config>(){
      @Override public Object run(      Config config) throws PropertyVetoException, TransactionFailure {
        config.getContainers().add(container);
        return null;
      }
    }
,config);
  }
 catch (  TransactionFailure e) {
    logger.log(Level.SEVERE,KernelLoggerInfo.exceptionAddContainer,e);
  }
  return container;
}

Fixed version (ground truth):
@Override public <T extends Container>T parseContainerConfig(ServiceLocator habitat,final URL configuration,Class<T> configType) throws IOException {
  final DomDocument doc=new DomDocument<GlassFishConfigBean>(habitat){
    @Override public Dom make(    final ServiceLocator habitat,    XMLStreamReader xmlStreamReader,    GlassFishConfigBean dom,    ConfigModel configModel){
      return new GlassFishConfigBean(habitat,this,dom,configModel,xmlStreamReader);
    }
  }
;
  final T container=doc.getRoot().createProxy(configType);
  try {
    ConfigSupport.apply(new SingleConfigCode<Config>(){
      @Override public Object run(      Config config) throws PropertyVetoException, TransactionFailure {
        config.getContainers().add(container);
        return null;
      }
    }
,config);
  }
 catch (  TransactionFailure e) {
    logger.log(Level.SEVERE,KernelLoggerInfo.exceptionAddContainer,e);
  }
  return container;
}
Program: 28890
Project: 28890
Buggy source:
protected CommonResourceDescriptor(ResourceDescriptor other){
  super(other);
}

Fixed version (ground truth):
protected CommonResourceDescriptor(Descriptor other){
  super(other);
}
Program: 28891
Project: 28891
Buggy source:
/** 
 * Returns descriptor based on the Resource Type.
 * @param javaEEResourceType
 * @return
 */
public Set<ResourceDescriptor> getResourceDescriptors(JavaEEResourceType javaEEResourceType){
  Set<ResourceDescriptor> resourceDescriptorSet=resourceDescriptors.get(javaEEResourceType);
  if (resourceDescriptorSet == null) {
    return new HashSet<ResourceDescriptor>();
  }
  return resourceDescriptors.get(javaEEResourceType);
}

Fixed version (ground truth):
/** 
 * Returns descriptor based on the Resource Type.
 * @param javaEEResourceType
 * @return
 */
public Set<ResourceDescriptor> getResourceDescriptors(JavaEEResourceType javaEEResourceType){
  Set<ResourceDescriptor> resourceDescriptorSet=resourceDescriptors.get(javaEEResourceType);
  if (resourceDescriptorSet == null) {
    resourceDescriptors.put(javaEEResourceType,new HashSet<ResourceDescriptor>());
  }
  return resourceDescriptors.get(javaEEResourceType);
}
Program: 28892
Project: 28892
Buggy source:
@Override public void dispatch(ServletContext context,String path){
  if (path == null || context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ApplicationDispatcher dispatcher=(ApplicationDispatcher)context.getRequestDispatcher(path);
  isDispatchInScope.set(true);
  if (dispatcher != null) {
    if (isDispatchInProgress.compareAndSet(false,true)) {
      pool.execute(new Handler(this,dispatcher,origRequest));
    }
 else {
      throw new IllegalStateException(STRING_MANAGER.getString("String_Node_Str"));
    }
  }
 else {
    String msg=MessageFormat.format(rb.getString(UNABLE_ACQUIRE_REQUEST_DISPATCHER_IN_SERVLET_CONTEXT),new Object[]{path,context.getContextPath()});
    log.log(Level.WARNING,msg);
  }
}

Fixed version (ground truth):
@Override public void dispatch(ServletContext context,String path){
  if (path == null || context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ApplicationDispatcher dispatcher=(ApplicationDispatcher)context.getRequestDispatcher(path);
  isDispatchInScope.set(true);
  if (dispatcher != null) {
    if (isDispatchInProgress.compareAndSet(false,true)) {
      pool.execute(new Handler(this,dispatcher));
    }
 else {
      throw new IllegalStateException(STRING_MANAGER.getString("String_Node_Str"));
    }
  }
 else {
    String msg=MessageFormat.format(rb.getString(UNABLE_ACQUIRE_REQUEST_DISPATCHER_IN_SERVLET_CONTEXT),new Object[]{path,context.getContextPath()});
    log.log(Level.WARNING,msg);
  }
}
Program: 28893
Project: 28893
Buggy source:
@Override public void run(){
  asyncContext.isStartAsyncInScope.set(Boolean.TRUE);
  origRequest.setAttribute(Globals.DISPATCHER_TYPE_ATTR,DispatcherType.ASYNC);
  origRequest.setAsyncStarted(false);
  int startAsyncCurrent=asyncContext.startAsyncCounter.get();
  try {
    dispatcher.dispatch(asyncContext.getRequest(),asyncContext.getResponse(),DispatcherType.ASYNC);
    if (asyncContext.startAsyncCounter.compareAndSet(startAsyncCurrent,startAsyncCurrent)) {
      asyncContext.complete();
    }
 else {
      origRequest.setAsyncTimeout(asyncContext.getTimeout());
    }
  }
 catch (  Throwable t) {
    asyncContext.notifyAsyncListeners(AsyncEventType.ERROR,t);
    asyncContext.getOriginalRequest().errorDispatchAndComplete(t);
  }
 finally {
    asyncContext.isStartAsyncInScope.set(Boolean.FALSE);
  }
}

Fixed version (ground truth):
@Override public void run(){
  asyncContext.isStartAsyncInScope.set(Boolean.TRUE);
  Request origRequest=asyncContext.getOriginalRequest();
  origRequest.setAttribute(Globals.DISPATCHER_TYPE_ATTR,DispatcherType.ASYNC);
  origRequest.setAsyncStarted(false);
  int startAsyncCurrent=asyncContext.startAsyncCounter.get();
  try {
    dispatcher.dispatch(asyncContext.getRequest(),asyncContext.getResponse(),DispatcherType.ASYNC);
    if (asyncContext.startAsyncCounter.compareAndSet(startAsyncCurrent,startAsyncCurrent)) {
      asyncContext.complete();
    }
 else {
      origRequest.setAsyncTimeout(asyncContext.getTimeout());
    }
  }
 catch (  Throwable t) {
    asyncContext.notifyAsyncListeners(AsyncEventType.ERROR,t);
    origRequest.errorDispatchAndComplete(t);
  }
 finally {
    asyncContext.isStartAsyncInScope.set(Boolean.FALSE);
  }
}
Program: 28894
Project: 28894
Buggy source:
Handler(AsyncContextImpl asyncContext,ApplicationDispatcher dispatcher,Request origRequest){
  this.asyncContext=asyncContext;
  this.dispatcher=dispatcher;
  this.origRequest=origRequest;
}

Fixed version (ground truth):
Handler(AsyncContextImpl asyncContext,ApplicationDispatcher dispatcher){
  this.asyncContext=asyncContext;
  this.dispatcher=dispatcher;
}
Program: 28895
Project: 28895
Buggy source:
void errorDispatchAndComplete(Throwable t){
  if (asyncContext != null && !asyncContext.isDispatchInScope() && !isAsyncComplete && isAsyncStarted()) {
    ((HttpServletResponse)response).setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    response.setError();
    if (t != null) {
      setAttribute(RequestDispatcher.ERROR_EXCEPTION,t);
    }
    try {
      if (hostValve != null) {
        hostValve.postInvoke(this,response);
      }
    }
 catch (    Exception e) {
      log.log(Level.SEVERE,UNABLE_PERFORM_ERROR_DISPATCH,e);
    }
 finally {
      if (!isAsyncComplete && isAsyncStarted()) {
        asyncComplete();
      }
    }
  }
}

Fixed version (ground truth):
void errorDispatchAndComplete(Throwable t){
  if (asyncContext != null && !asyncContext.isDispatchInScope() && !isAsyncComplete) {
    ((HttpServletResponse)response).setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    response.setError();
    if (t != null) {
      setAttribute(RequestDispatcher.ERROR_EXCEPTION,t);
    }
    try {
      if (hostValve != null) {
        hostValve.postInvoke(this,response);
      }
    }
 catch (    Exception e) {
      log.log(Level.SEVERE,UNABLE_PERFORM_ERROR_DISPATCH,e);
    }
 finally {
      if (!isAsyncComplete) {
        asyncComplete();
      }
    }
  }
}
Program: 28896
Project: 28896
Buggy source:
@Override public synchronized void persist(JobInfo jobInfo){
  File file=new File(serverEnvironment.getConfigDirPath(),JOBS_FILE);
  try {
    jaxbMarshaller=jaxbContext.createMarshaller();
    jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
    jobInfos.getJobInfoList().add(jobInfo);
    jaxbMarshaller.marshal(jobInfos,file);
    jobManager.purgeJob(jobInfo.jobId);
  }
 catch (  JAXBException e) {
    throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",jobInfo.jobId,e.getLocalizedMessage()));
  }
}

Fixed version (ground truth):
@Override public synchronized void persist(Object obj){
  JobInfo jobInfo=(JobInfo)obj;
  File file=new File(serverEnvironment.getConfigDirPath(),JOBS_FILE);
  jobInfos=jobManager.getCompletedJobs();
  if (jobInfos == null)   jobInfos=new JobInfos();
  try {
    JAXBContext jaxbContext=JAXBContext.newInstance(JobInfos.class);
    jaxbMarshaller=jaxbContext.createMarshaller();
    jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
    jobInfos.getJobInfoList().add(jobInfo);
    jaxbMarshaller.marshal(jobInfos,file);
    jobManager.purgeJob(jobInfo.jobId);
  }
 catch (  JAXBException e) {
    throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",jobInfo.jobId,e.getLocalizedMessage()));
  }
}
Program: 28897
Project: 28897
Buggy source:
public JobInfo getCompletedJobForId(String id);

Fixed version (ground truth):
public Object getCompletedJobForId(String id);
Program: 28898
Project: 28898
Buggy source:
public void persist(JobInfo jobInfo);

Fixed version (ground truth):
public void persist(Object jobInfo);
Program: 28899
Project: 28899
Buggy source:
/** 
 * This will load the jobs which have already completed and persisted in the jobs.xml
 * @return JobsInfos which contains information about completed jobs
 */
public synchronized JobInfos getCompletedJobs(){
  try {
    File file=new File(serverEnvironment.getConfigDirPath(),JOBS_FILE);
    Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
    if (file != null && file.exists()) {
      JobInfos jobInfos=(JobInfos)unmarshaller.unmarshal(file);
      return jobInfos;
    }
  }
 catch (  JAXBException e) {
    throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",e.getLocalizedMessage()));
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This will load the jobs which have already completed and persisted in the jobs.xml
 * @return JobsInfos which contains information about completed jobs
 */
public synchronized JobInfos getCompletedJobs(){
  try {
    File file=new File(serverEnvironment.getConfigDirPath(),JOBS_FILE);
    if (jaxbContext == null)     jaxbContext=JAXBContext.newInstance(JobInfos.class);
    Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
    if (file != null && file.exists()) {
      JobInfos jobInfos=(JobInfos)unmarshaller.unmarshal(file);
      return jobInfos;
    }
  }
 catch (  JAXBException e) {
    throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",e.getLocalizedMessage()));
  }
  return null;
}
Program: 28901
Project: 28901
Buggy source:
/** 
 * Called to forward to the login page. may redirect current request to HTTPS
 * @param request HttpRequest we are processing
 * @param response HttpResponse we are creating
 * @param config    Login configuration describing how authenticationshould be performed
 */
protected void forwardToLoginPage(HttpRequest request,HttpResponse response,LoginConfig config){
  ServletContext sc=context.getServletContext();
  try {
    String loginPage=config.getLoginPage();
    if (!request.getRequest().isSecure()) {
      Realm realm=context.getRealm();
      if (realm != null) {
        SecurityConstraint[] secConstraints=realm.findSecurityConstraints(loginPage,"String_Node_Str",context);
        if (secConstraints != null && !realm.hasUserDataPermission(request,response,secConstraints,loginPage,"String_Node_Str")) {
          return;
        }
      }
    }
    RequestDispatcher disp=sc.getRequestDispatcher(loginPage);
    disp.forward(request.getRequest(),response.getResponse());
    response.finishResponse();
  }
 catch (  Throwable t) {
    log.log(Level.WARNING,UNEXPECTED_ERROR_FORWARDING_TO_LOGIN_PAGE,t);
  }
}

Fixed version (ground truth):
/** 
 * Called to forward to the login page. may redirect current request to HTTPS
 * @param request HttpRequest we are processing
 * @param response HttpResponse we are creating
 * @param config    Login configuration describing how authenticationshould be performed
 */
protected void forwardToLoginPage(HttpRequest request,HttpResponse response,LoginConfig config){
  if (isChangeSessionIdOnAuthentication()) {
    request.changeSessionId();
  }
  ServletContext sc=context.getServletContext();
  try {
    String loginPage=config.getLoginPage();
    if (!request.getRequest().isSecure()) {
      Realm realm=context.getRealm();
      if (realm != null) {
        SecurityConstraint[] secConstraints=realm.findSecurityConstraints(loginPage,"String_Node_Str",context);
        if (secConstraints != null && !realm.hasUserDataPermission(request,response,secConstraints,loginPage,"String_Node_Str")) {
          return;
        }
      }
    }
    RequestDispatcher disp=sc.getRequestDispatcher(loginPage);
    disp.forward(request.getRequest(),response.getResponse());
    response.finishResponse();
  }
 catch (  Throwable t) {
    log.log(Level.WARNING,UNEXPECTED_ERROR_FORWARDING_TO_LOGIN_PAGE,t);
  }
}
Program: 28903
Project: 28903
Buggy source:
private String getPhysicalDestinationFromConfiguration(String logicalDest,String appName,String moduleName) throws ConnectorRuntimeException {
  Property ep=null;
  try {
    AdminObjectResource res=null;
    res=(AdminObjectResource)ResourcesUtil.createInstance().getResource(logicalDest,appName,moduleName,AdminObjectResource.class);
    if (res == null) {
      String msg=sm.getString("String_Node_Str",logicalDest);
      throw new ConnectorRuntimeException(msg);
    }
    ep=res.getProperty(PHYSICAL_DESTINATION);
  }
 catch (  Exception ce) {
    String msg=sm.getString("String_Node_Str",logicalDest);
    ConnectorRuntimeException cre=new ConnectorRuntimeException(msg);
    cre.initCause(ce);
    throw cre;
  }
  if (ep == null) {
    String msg=sm.getString("String_Node_Str",ep);
    throw new ConnectorRuntimeException(msg);
  }
  return ep.getValue();
}

Fixed version (ground truth):
private String getPhysicalDestinationFromConfiguration(String logicalDest,String appName,String moduleName) throws ConnectorRuntimeException {
  Property ep=null;
  try {
    AdminObjectResource res=null;
    res=(AdminObjectResource)ResourcesUtil.createInstance().getResource(logicalDest,appName,moduleName,AdminObjectResource.class);
    if (res == null) {
      String msg=sm.getString("String_Node_Str",logicalDest);
      throw new ConnectorRuntimeException(msg);
    }
    ep=res.getProperty(PHYSICAL_DESTINATION);
  }
 catch (  Exception ce) {
    String msg=sm.getString("String_Node_Str",logicalDest);
    ConnectorRuntimeException cre=new ConnectorRuntimeException(msg);
    cre.initCause(ce);
    throw cre;
  }
  if (ep == null) {
    String msg=sm.getString("String_Node_Str",null);
    throw new ConnectorRuntimeException(msg);
  }
  return ep.getValue();
}
Program: 28904
Project: 28904
Buggy source:
protected JmsHost getJmsHost(){
  String defaultJmsHost=getJmsService().getDefaultJmsHost();
  JmsHost jmsHost=null;
  if (defaultJmsHost == null || defaultJmsHost.equals("String_Node_Str")) {
    jmsHost=(JmsHost)Globals.get(JmsHost.class);
  }
 else {
    List jmsHostsList=getJmsService().getJmsHost();
    for (int i=0; i < jmsHostsList.size(); i++) {
      JmsHost tmpJmsHost=(JmsHost)jmsHostsList.get(i);
      if (tmpJmsHost != null && tmpJmsHost.getName().equals(defaultJmsHost))       jmsHost=tmpJmsHost;
    }
    if (jmsHost == null) {
      if (jmsHostsList != null && jmsHostsList.size() > 0) {
        jmsHost=(JmsHost)jmsHostsList.get(0);
      }
 else       jmsHost=(JmsHost)Globals.get(JmsHost.class);
    }
  }
  return jmsHost;
}

Fixed version (ground truth):
protected JmsHost getJmsHost(){
  String defaultJmsHost=getJmsService().getDefaultJmsHost();
  if (defaultJmsHost == null || defaultJmsHost.equals("String_Node_Str")) {
    return (JmsHost)Globals.get(JmsHost.class);
  }
  List jmsHostsList=getJmsService().getJmsHost();
  if (jmsHostsList == null || jmsHostsList.size() == 0) {
    return (JmsHost)Globals.get(JmsHost.class);
  }
  JmsHost jmsHost=null;
  for (int i=0; i < jmsHostsList.size(); i++) {
    JmsHost tmpJmsHost=(JmsHost)jmsHostsList.get(i);
    if (tmpJmsHost != null && tmpJmsHost.getName().equals(defaultJmsHost)) {
      jmsHost=tmpJmsHost;
      break;
    }
  }
  if (jmsHost == null) {
    jmsHost=(JmsHost)jmsHostsList.get(0);
  }
  return jmsHost;
}
Program: 28905
Project: 28905
Buggy source:
@POST public Response create(HashMap<String,String> data){
  deleteExistingProperties();
  return saveProperties(data);
}

Fixed version (ground truth):
@POST public Response create(HashMap<String,String> data){
  Response resp=deleteRemovedProperties(data);
  return (resp == null) ? saveProperties(data) : resp;
}
Program: 28908
Project: 28908
Buggy source:
public Node writeDescriptor(Node parent,RootDeploymentDescriptor descriptor){
  Node bundleNode;
  if (getDocType() == null) {
    bundleNode=appendChildNS(parent,getXMLRootTag().getQName(),WLDescriptorConstants.WL_WEBSERVICES_XML_NS);
    addBundleNodeAttributes((Element)bundleNode,descriptor);
  }
 else {
    bundleNode=appendChild(parent,getXMLRootTag().getQName());
  }
  writeDisplayableComponentInfo(bundleNode,descriptor);
  WLWebServiceNode wsNode=new WLWebServiceNode();
  for (  WebService next : ((WebServicesDescriptor)descriptor).getWebServices()) {
    wsNode.writeDescriptor(bundleNode,WebServicesTagNames.WEB_SERVICE,next);
  }
  return bundleNode;
}

Fixed version (ground truth):
public Node writeDescriptor(Node parent,RootDeploymentDescriptor descriptor){
  Node bundleNode;
  if (getDocType() == null) {
    bundleNode=appendChildNS(parent,getXMLRootTag().getQName(),WLDescriptorConstants.WL_WEBSERVICES_XML_NS);
    addBundleNodeAttributes((Element)bundleNode,descriptor);
  }
 else {
    bundleNode=appendChild(parent,getXMLRootTag().getQName());
  }
  writeDisplayableComponentInfo(bundleNode,descriptor);
  if (descriptor instanceof WebServicesDescriptor) {
    WLWebServiceNode wsNode=new WLWebServiceNode();
    for (    WebService next : ((WebServicesDescriptor)descriptor).getWebServices()) {
      wsNode.writeDescriptor(bundleNode,WebServicesTagNames.WEB_SERVICE,next);
    }
  }
  return bundleNode;
}
Program: 28909
Project: 28909
Buggy source:
public String serializeConfigBean(ConfigBeanProxy configBean){
  if (configBean == null)   return null;
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  XMLOutputFactory xmlFactory=XMLOutputFactory.newInstance();
  XMLStreamWriter writer=null;
  IndentingXMLStreamWriter indentingXMLStreamWriter=null;
  String s=null;
  try {
    writer=xmlFactory.createXMLStreamWriter(new BufferedOutputStream(bos));
    indentingXMLStreamWriter=new IndentingXMLStreamWriter(writer);
    Dom configBeanDom=Dom.unwrap(configBean);
    configBeanDom.writeToXml();
    configBeanDom.writeTo(configBeanDom.model.getTagName(),indentingXMLStreamWriter);
    indentingXMLStreamWriter.flush();
    s=bos.toString();
  }
 catch (  XMLStreamException e) {
    return s;
  }
 finally {
    try {
      if (bos != null)       bos.close();
      if (writer != null)       writer.close();
      if (indentingXMLStreamWriter != null)       indentingXMLStreamWriter.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
catch (    XMLStreamException e) {
      e.printStackTrace();
    }
  }
  return s;
}

Fixed version (ground truth):
public String serializeConfigBean(ConfigBeanProxy configBean){
  if (configBean == null)   return null;
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  XMLOutputFactory xmlFactory=XMLOutputFactory.newInstance();
  XMLStreamWriter writer=null;
  IndentingXMLStreamWriter indentingXMLStreamWriter=null;
  String s=null;
  try {
    writer=xmlFactory.createXMLStreamWriter(new BufferedOutputStream(bos));
    indentingXMLStreamWriter=new IndentingXMLStreamWriter(writer);
    Dom configBeanDom=Dom.unwrap(configBean);
    configBeanDom.writeToXml();
    configBeanDom.writeTo(configBeanDom.model.getTagName(),indentingXMLStreamWriter);
    indentingXMLStreamWriter.flush();
    s=bos.toString();
  }
 catch (  XMLStreamException e) {
    LOG.log(Level.FINE,"String_Node_Str" + configBean.toString(),e);
    return null;
  }
 finally {
    try {
      if (bos != null)       bos.close();
      if (writer != null)       writer.close();
      if (indentingXMLStreamWriter != null)       indentingXMLStreamWriter.close();
    }
 catch (    IOException e) {
      LOG.log(Level.FINE,"String_Node_Str" + configBean.toString(),e);
    }
catch (    XMLStreamException e) {
      LOG.log(Level.FINE,"String_Node_Str" + configBean.toString(),e);
    }
  }
  return s;
}
Program: 28910
Project: 28910
Buggy source:
@Override public void complete(ActionReport report,Payload.Outbound outbound){
  if (commandProgress != null && report != null && report.getActionExitCode() == ExitCode.SUCCESS) {
    commandProgress.complete();
  }
  this.payload=outbound;
  complete(report);
  if (isManagedJob) {
    JobPersistence jobPersistenceService=Globals.getDefaultHabitat().getService(JobPersistenceService.class);
    List<String> userList=SubjectUtil.getUsernamesFromSubject(subject);
    jobPersistenceService.persist(new JobInfo(id,commandName,executionDate,state.name(),(userList.size() == 0 ? "String_Node_Str" : userList.get(0)),report.getMessage()));
  }
}

Fixed version (ground truth):
@Override public void complete(ActionReport report,Payload.Outbound outbound){
  if (commandProgress != null && report != null && report.getActionExitCode() == ExitCode.SUCCESS) {
    commandProgress.complete();
  }
  this.payload=outbound;
  complete(report);
  if (isManagedJob) {
    JobPersistence jobPersistenceService=Globals.getDefaultHabitat().getService(JobPersistenceService.class);
    List<String> userList=SubjectUtil.getUsernamesFromSubject(subject);
    jobPersistenceService.persist(new JobInfo(id,commandName,executionDate,state.name(),"String_Node_Str",report.getMessage()));
  }
}
Program: 28913
Project: 28913
Buggy source:
protected String processReport(ActionReporter ar){
  StringBuilder result=new StringBuilder();
  String des=ar.getActionDescription();
  if (des == null) {
    des="String_Node_Str";
  }
  final String message=(ar instanceof RestActionReporter) ? ((RestActionReporter)ar).getCombinedMessage() : ar.getMessage();
  if (message != null) {
    result.append("String_Node_Str").append(des).append("String_Node_Str").append("String_Node_Str" + message + "String_Node_Str").append("String_Node_Str");
  }
  if (ar.getActionExitCode() != ExitCode.SUCCESS) {
    result.append("String_Node_Str" + ar.getActionExitCode().toString() + "String_Node_Str");
  }
  Properties properties=ar.getTopMessagePart().getProps();
  if (!properties.isEmpty()) {
    result.append(processProperties(properties));
  }
  Properties extraProperties=ar.getExtraProperties();
  if ((extraProperties != null) && (!extraProperties.isEmpty())) {
    if ((extraProperties.size() == 1) && (extraProperties.get("String_Node_Str") != null)) {
    }
 else {
      result.append(getExtraProperties(extraProperties));
    }
  }
  List<ActionReport.MessagePart> children=ar.getTopMessagePart().getChildren();
  if (children.size() > 0) {
    result.append(processChildren(children));
  }
  List<ActionReporter> subReports=ar.getSubActionsReport();
  if (subReports.size() > 0) {
    result.append(processSubReports(subReports));
  }
  return result.toString();
}

Fixed version (ground truth):
protected String processReport(ActionReporter ar){
  StringBuilder result=new StringBuilder();
  String des=ar.getActionDescription();
  if (des == null) {
    des="String_Node_Str";
  }
  final String message=ResourceUtil.encodeString((ar instanceof RestActionReporter) ? ((RestActionReporter)ar).getCombinedMessage() : ar.getMessage());
  if (message != null) {
    result.append("String_Node_Str").append(des).append("String_Node_Str").append("String_Node_Str").append(message).append("String_Node_Str").append("String_Node_Str");
  }
  if (ar.getActionExitCode() != ExitCode.SUCCESS) {
    result.append("String_Node_Str").append(ar.getActionExitCode().toString()).append("String_Node_Str");
  }
  Properties properties=ar.getTopMessagePart().getProps();
  if (!properties.isEmpty()) {
    result.append(processProperties(properties));
  }
  Properties extraProperties=ar.getExtraProperties();
  if ((extraProperties != null) && (!extraProperties.isEmpty())) {
    if ((extraProperties.size() == 1) && (extraProperties.get("String_Node_Str") != null)) {
    }
 else {
      result.append(getExtraProperties(extraProperties));
    }
  }
  List<ActionReport.MessagePart> children=ar.getTopMessagePart().getChildren();
  if (children.size() > 0) {
    result.append(processChildren(children));
  }
  List<ActionReporter> subReports=ar.getSubActionsReport();
  if (subReports.size() > 0) {
    result.append(processSubReports(subReports));
  }
  return result.toString();
}
Program: 28915
Project: 28915
Buggy source:
public static void addCommandLog(RestActionReporter ar,String commandName,ParameterMap parameters){
  List<String> logs=(List<String>)ar.getExtraProperties().get("String_Node_Str");
  if (logs == null) {
    logs=new ArrayList<String>();
    ar.getExtraProperties().put("String_Node_Str",logs);
  }
  logs.add(commandName + getParameterList(parameters));
}

Fixed version (ground truth):
public static void addCommandLog(RestActionReporter ar,String commandName,ParameterMap parameters){
  List<String> logs=(List<String>)ar.getExtraProperties().get("String_Node_Str");
  if (logs == null) {
    logs=new ArrayList<String>();
    ar.getExtraProperties().put("String_Node_Str",logs);
  }
  final String parameterList=encodeString(getParameterList(parameters));
  logs.add(commandName + parameterList);
}
Program: 28916
Project: 28916
Buggy source:
private JmsHost getResolvedJmsHost(Server as) throws Exception {
  logFine("String_Node_Str" + as);
  JmsHost jmsHost=getResolvedLocalJmsHostInServer(as);
  JmsHost copy=createJmsHostCopy(jmsHost,as);
  String hostName=getNodeHostName(as);
  String port=JmsRaUtil.getJMSPropertyValue(as);
  if (copy != null) {
    copy.setHost(hostName);
    copy.setPort(port);
  }
  return copy;
}

Fixed version (ground truth):
private JmsHost getResolvedJmsHost(Server as) throws Exception {
  if (as == null) {
    return null;
  }
  logFine("String_Node_Str" + as);
  JmsHost jmsHost=getResolvedLocalJmsHostInServer(as);
  JmsHost copy=createJmsHostCopy(jmsHost,as);
  String hostName=getNodeHostName(as);
  String port=JmsRaUtil.getJMSPropertyValue(as);
  if (copy != null) {
    copy.setHost(hostName);
    copy.setPort(port);
  }
  return copy;
}
Program: 28917
Project: 28917
Buggy source:
private JmsService getJmsServiceForMasterBroker(String clusterName){
  Domain domain=Globals.get(Domain.class);
  Clusters clusters=domain.getClusters();
  List clusterList=clusters.getCluster();
  Cluster cluster=domain.getClusterNamed(clusterName);
  final Server[] buddies=this.getServersInCluster(cluster);
  final Config cfg=getConfigForServer(buddies[0]);
  return cfg.getExtensionByType(JmsService.class);
}

Fixed version (ground truth):
private JmsService getJmsServiceForMasterBroker(String clusterName){
  Domain domain=Globals.get(Domain.class);
  Cluster cluster=domain.getClusterNamed(clusterName);
  final Server[] buddies=getServersInCluster(cluster);
  final Config cfg=getConfigForServer(buddies[0]);
  return cfg.getExtensionByType(JmsService.class);
}
Program: 28918
Project: 28918
Buggy source:
public static MQUrl createUrl(JmsHost host,JmsService js,String overridedHostName){
  try {
    String name=host.getName();
    String hostName=host.getHost();
    ServerContext serverContext=Globals.get(ServerContext.class);
    Server server=serverContext.getConfigBean();
    if (overridedHostName != null && !overridedHostName.trim().equals("String_Node_Str")) {
      hostName=overridedHostName;
    }
    String port=host.getPort();
    MQUrl url=new MQUrl(name);
    url.setHost(hostName);
    url.setPort(port);
    if (js != null) {
      String scheme=js.getMqScheme();
      if (scheme != null && !scheme.trim().equals("String_Node_Str")) {
        url.setScheme(scheme);
      }
      String service=js.getMqService();
      if (service != null && !service.trim().equals("String_Node_Str")) {
        url.setService(service);
      }
    }
    return url;
  }
 catch (  Exception ce) {
    ce.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public static MQUrl createUrl(JmsHost host,JmsService js,String overridedHostName){
  try {
    String name=host.getName();
    String hostName=host.getHost();
    if (overridedHostName != null && !overridedHostName.trim().equals("String_Node_Str")) {
      hostName=overridedHostName;
    }
    String port=host.getPort();
    MQUrl url=new MQUrl(name);
    url.setHost(hostName);
    url.setPort(port);
    if (js != null) {
      String scheme=js.getMqScheme();
      if (scheme != null && !scheme.trim().equals("String_Node_Str")) {
        url.setScheme(scheme);
      }
      String service=js.getMqService();
      if (service != null && !service.trim().equals("String_Node_Str")) {
        url.setService(service);
      }
    }
    return url;
  }
 catch (  Exception ce) {
    ce.printStackTrace();
  }
  return null;
}
Program: 28919
Project: 28919
Buggy source:
private Field findField(final AdminCommand command,final String fieldName) throws NoSuchFieldException {
  Field result=null;
  for (Class c=command.getClass(); c != null && result == null; c=c.getSuperclass()) {
    try {
      result=c.getDeclaredField(fieldName);
      return result;
    }
 catch (    NoSuchFieldException ex) {
      continue;
    }
  }
  return result;
}

Fixed version (ground truth):
private Field findField(final AdminCommand command,final String fieldName) throws NoSuchFieldException {
  Field result=null;
  for (Class c=command.getClass(); c != null; c=c.getSuperclass()) {
    try {
      result=c.getDeclaredField(fieldName);
      return result;
    }
 catch (    NoSuchFieldException ex) {
      continue;
    }
  }
  return result;
}
Program: 28920
Project: 28920
Buggy source:
private Field findField(final AdminCommand command,final String fieldName) throws NoSuchFieldException {
  Field result=null;
  for (Class c=command.getClass(); c != null && result == null; c=c.getSuperclass()) {
    result=c.getDeclaredField(fieldName);
  }
  return result;
}

Fixed version (ground truth):
private Field findField(final AdminCommand command,final String fieldName) throws NoSuchFieldException {
  Field result=null;
  for (Class c=command.getClass(); c != null && result == null; c=c.getSuperclass()) {
    try {
      result=c.getDeclaredField(fieldName);
      return result;
    }
 catch (    NoSuchFieldException ex) {
      continue;
    }
  }
  return result;
}
Program: 28921
Project: 28921
Buggy source:
/** 
 * publishes the loadbalancer.xml to the physical loadbalancer.
 * @throws java.io.IOException 
 * @throws com.sun.enterprise.config.ConfigException 
 * @throws org.netbeans.modules.schema2beans.Schema2BeansException 
 */
public void publish(ConnectionManager _connectionManager,Domain domain,String lbConfigName) throws IOException, Exception {
  LoadbalancerReader lbr=LbConfigHelper.getLbReader(domain,appRegistry,lbConfigName);
  HttpURLConnection conn=_connectionManager.getConnection(LB_UPDATE_CONTEXT_ROOT);
  OutputStream out=null;
  try {
    conn.setDoOutput(true);
    conn.setRequestMethod(POST);
    conn.connect();
    out=conn.getOutputStream();
    LbConfigHelper.exportXml(lbr,out);
    out.flush();
    lbr.getLbConfig().setLastApplied();
  }
 catch (  UnknownHostException uhe) {
    throw new IOException(LbLogUtil.getStringManager().getString("String_Node_Str",uhe.getMessage()),uhe);
  }
catch (  Exception e) {
    throw new IOException(e.getMessage(),e);
  }
 finally {
    if (out != null && conn != null) {
      int code=conn.getResponseCode();
      String response=conn.getResponseMessage();
      out.close();
      conn.disconnect();
      out=null;
      if (code != HttpURLConnection.HTTP_OK) {
        String url=conn.getURL().toString();
        conn=null;
        throw new IOException(LbLogUtil.getStringManager().getString("String_Node_Str",new Integer(code),response,url));
      }
      conn=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * publishes the loadbalancer.xml to the physical loadbalancer.
 * @throws java.io.IOException 
 * @throws com.sun.enterprise.config.ConfigException 
 * @throws org.netbeans.modules.schema2beans.Schema2BeansException 
 */
public void publish(ConnectionManager _connectionManager,Domain domain,String lbConfigName) throws IOException, Exception {
  LoadbalancerReader lbr=LbConfigHelper.getLbReader(domain,appRegistry,lbConfigName);
  HttpURLConnection conn=_connectionManager.getConnection(LB_UPDATE_CONTEXT_ROOT);
  OutputStream out=null;
  try {
    conn.setDoOutput(true);
    conn.setRequestMethod(POST);
    conn.connect();
    out=conn.getOutputStream();
    LbConfigHelper.exportXml(lbr,out);
    out.flush();
    lbr.getLbConfig().setLastApplied();
  }
 catch (  UnknownHostException uhe) {
    throw new IOException(LbLogUtil.getStringManager().getString("String_Node_Str",uhe.getMessage()),uhe);
  }
catch (  Exception e) {
    throw new IOException(e.getMessage(),e);
  }
 finally {
    if (out != null && conn != null) {
      int code=conn.getResponseCode();
      String response=conn.getResponseMessage();
      out.close();
      conn.disconnect();
      out=null;
      if (code != HttpURLConnection.HTTP_OK) {
        String url=conn.getURL().toString();
        conn=null;
        throw new IOException(LbLogUtil.getStringManager().getString("String_Node_Str",Integer.valueOf(code),response,url));
      }
      conn=null;
    }
  }
}
Program: 28922
Project: 28922
Buggy source:
/** 
 * Construct an instance of this <code>RuleSet</code> with the specified matching pattern prefix.
 * @param prefix Prefix for matching pattern rules (including thetrailing slash character)
 */
public EngineRuleSet(String prefix){
  super();
  this.namespaceURI=null;
  this.prefix=prefix;
}

Fixed version (ground truth):
/** 
 * Construct an instance of this <code>RuleSet</code> with the specified matching pattern prefix.
 * @param prefix Prefix for matching pattern rules (including thetrailing slash character)
 */
public EngineRuleSet(String prefix){
  super();
  this.prefix=prefix;
}
Program: 28923
Project: 28923
Buggy source:
/** 
 * Returns true if String b contains String a. Returns true if both strings are null. Returns false if only one of the strings is null.
 * @param a The possibly null string that must be containedin b
 * @param b The possibly null string that must contain a
 * @return true if b contains a
 */
public static boolean matchString(String a,String b){
  if (a == b)   return true;
  if (a == null)   return false;
  if (b == null)   return false;
  return b.indexOf(a) != -1;
}

Fixed version (ground truth):
/** 
 * Returns true if String b contains String a. Returns true if both strings are null. Returns false if only one of the strings is null.
 * @param a The possibly null string that must be containedin b
 * @param b The possibly null string that must contain a
 * @return true if b contains a
 */
public static boolean matchString(String a,String b){
  if ((a == null) && (b == null))   return true;
  if (a == null)   return false;
  if (b == null)   return false;
  return b.indexOf(a) != -1;
}
Program: 28925
Project: 28925
Buggy source:
private void updateMasterBroker(String serverName,String oldMasterBroker,String newMasterBroker) throws Exception {
  MQJMXConnectorInfo mqInfo=getMQJMXConnectorInfo(serverName,config,serverContext,domain,connectorRuntime);
  try {
    MBeanServerConnection mbsc=mqInfo.getMQMBeanServerConnection();
    ObjectName on=new ObjectName(CLUSTER_CONFIG_MBEAN_NAME);
    Object[] params=null;
    String[] signature=new String[]{"String_Node_Str","String_Node_Str"};
    params=new Object[]{oldMasterBroker,newMasterBroker};
    mbsc.invoke(on,"String_Node_Str",params,signature);
  }
 catch (  Exception e) {
    logAndHandleException(e,"String_Node_Str");
  }
 finally {
    try {
      if (mqInfo != null) {
        mqInfo.closeMQMBeanServerConnection();
      }
    }
 catch (    Exception e) {
      handleException(e);
    }
  }
}

Fixed version (ground truth):
private CompositeData updateMasterBroker(String serverName,String oldMasterBroker,String newMasterBroker) throws Exception {
  MQJMXConnectorInfo mqInfo=getMQJMXConnectorInfo(serverName,config,serverContext,domain,connectorRuntime);
  CompositeData result=null;
  try {
    MBeanServerConnection mbsc=mqInfo.getMQMBeanServerConnection();
    ObjectName on=new ObjectName(CLUSTER_CONFIG_MBEAN_NAME);
    Object[] params=null;
    String[] signature=new String[]{"String_Node_Str","String_Node_Str"};
    params=new Object[]{oldMasterBroker,newMasterBroker};
    result=(CompositeData)mbsc.invoke(on,"String_Node_Str",params,signature);
  }
 catch (  Exception e) {
    logAndHandleException(e,"String_Node_Str");
  }
 finally {
    try {
      if (mqInfo != null) {
        mqInfo.closeMQMBeanServerConnection();
      }
    }
 catch (    Exception e) {
      handleException(e);
    }
  }
  return result;
}
Program: 28928
Project: 28928
Buggy source:
/** 
 * Creates a String representation of address list from array list. In short, it is a comma separated list. Actual syntax of an MQ url is inside MQUrl class.
 * @return AddressList String
 * @see MQUrl
 */
public String toString(){
  String s="String_Node_Str";
  Iterator it=urlList.iterator();
  if (it.hasNext()) {
    s=it.next().toString();
  }
  while (it.hasNext()) {
    s=s + "String_Node_Str" + it.next().toString();
  }
  logFine("String_Node_Str" + s);
  return s;
}

Fixed version (ground truth):
/** 
 * Creates a String representation of address list from array list. In short, it is a comma separated list. Actual syntax of an MQ url is inside MQUrl class.
 * @return AddressList String
 * @see MQUrl
 */
public String toString(){
  StringBuilder builder=new StringBuilder();
  Iterator it=urlList.iterator();
  if (it.hasNext()) {
    builder.append(it.next().toString());
  }
  while (it.hasNext()) {
    builder.append("String_Node_Str").append(it.next().toString());
  }
  String s=builder.toString();
  logFine("String_Node_Str" + s);
  return s;
}
Program: 28929
Project: 28929
Buggy source:
/** 
 * @returns an @see java.io.OutputStream for a new entry in thiscurrent abstract archive.
 * @param name the entry name
 */
@Override public OutputStream putNextEntry(String name) throws java.io.IOException {
  name=name.replace('/',File.separatorChar);
  File newFile=new File(archive,name);
  if (newFile.exists()) {
    if (!deleteEntry(name,false)) {
      deplLogger.log(Level.FINE,"String_Node_Str",new Object[]{name,uri.toASCIIString()});
    }
  }
  if (name.lastIndexOf(File.separatorChar) != -1) {
    String dirs=name.substring(0,name.lastIndexOf(File.separatorChar));
    File dirsFile=new File(archive,dirs);
    if (!dirsFile.exists() && !dirsFile.mkdirs()) {
      throw new IOException("String_Node_Str" + dirsFile.getAbsolutePath());
    }
  }
  staleFileManager().recordValidEntry(newFile);
  os=new BufferedOutputStream(new FileOutputStream(newFile));
  return os;
}

Fixed version (ground truth):
/** 
 * @returns an @see java.io.OutputStream for a new entry in thiscurrent abstract archive.
 * @param name the entry name
 */
@Override public OutputStream putNextEntry(String name) throws java.io.IOException {
  name=name.replace('/',File.separatorChar);
  File newFile=new File(archive,name);
  if (newFile.exists()) {
    if (!deleteEntry(name,false) && uri != null) {
      deplLogger.log(Level.FINE,"String_Node_Str",new Object[]{name,uri.toASCIIString()});
    }
  }
  if (name.lastIndexOf(File.separatorChar) != -1) {
    String dirs=name.substring(0,name.lastIndexOf(File.separatorChar));
    File dirsFile=new File(archive,dirs);
    if (!dirsFile.exists() && !dirsFile.mkdirs()) {
      throw new IOException("String_Node_Str" + dirsFile.getAbsolutePath());
    }
  }
  staleFileManager().recordValidEntry(newFile);
  os=new BufferedOutputStream(new FileOutputStream(newFile));
  return os;
}
Program: 28930
Project: 28930
Buggy source:
/** 
 * Adds the files in the specified directory to the collection of files already assembled.  Excludes the contents of embedded archives in the current archive which appear in the file tree anchored at the given directory.
 * @param directory the directory to scan for files
 * @param files collection of files already assembled to which this directory's files are to be added
 * @param embeddedArchives collection of embedded archives in the current archive
 * @param logger logger to which to report inability to get the list of files from the directory
 */
void getListOfFiles(File directory,List<String> files,List embeddedArchives,final Logger logger){
  if (directory == null || !directory.isDirectory())   return;
  final File[] fileList=directory.listFiles();
  if (fileList == null) {
    deplLogger.log(Level.WARNING,FILE_LIST_FAILURE,directory.getAbsolutePath());
    return;
  }
  for (  File aList : fileList) {
    String fileName=aList.getAbsolutePath().substring(archive.getAbsolutePath().length() + 1);
    fileName=fileName.replace(File.separatorChar,'/');
    if (!aList.isDirectory()) {
      if (!fileName.equals(JarFile.MANIFEST_NAME) && isEntryValid(fileName,logger)) {
        files.add(fileName);
      }
    }
 else     if (isEntryValid(fileName,logger)) {
      files.add(fileName);
      if (embeddedArchives != null) {
        if (!embeddedArchives.contains(fileName)) {
          getListOfFiles(aList,files,null,logger);
        }
      }
 else {
        getListOfFiles(aList,files,null,logger);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds the files in the specified directory to the collection of files already assembled.  Excludes the contents of embedded archives in the current archive which appear in the file tree anchored at the given directory.
 * @param directory the directory to scan for files
 * @param files collection of files already assembled to which this directory's files are to be added
 * @param embeddedArchives collection of embedded archives in the current archive
 * @param logger logger to which to report inability to get the list of files from the directory
 */
void getListOfFiles(File directory,List<String> files,List embeddedArchives,final Logger logger){
  if (archive == null || directory == null || !directory.isDirectory())   return;
  final File[] fileList=directory.listFiles();
  if (fileList == null) {
    deplLogger.log(Level.WARNING,FILE_LIST_FAILURE,directory.getAbsolutePath());
    return;
  }
  for (  File aList : fileList) {
    String fileName=aList.getAbsolutePath().substring(archive.getAbsolutePath().length() + 1);
    fileName=fileName.replace(File.separatorChar,'/');
    if (!aList.isDirectory()) {
      if (!fileName.equals(JarFile.MANIFEST_NAME) && isEntryValid(fileName,logger)) {
        files.add(fileName);
      }
    }
 else     if (isEntryValid(fileName,logger)) {
      files.add(fileName);
      if (embeddedArchives != null) {
        if (!embeddedArchives.contains(fileName)) {
          getListOfFiles(aList,files,null,logger);
        }
      }
 else {
        getListOfFiles(aList,files,null,logger);
      }
    }
  }
}
Program: 28931
Project: 28931
Buggy source:
/** 
 * Returns the enumeration of first level directories in this archive
 * @return enumeration of directories under the root of this archive
 */
@Override public Collection<String> getDirectories() throws IOException {
  List<String> results=new ArrayList<String>();
  for (  File f : archive.listFiles()) {
    if (f.isDirectory() && isEntryValid(f)) {
      results.add(f.getName());
    }
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Returns the enumeration of first level directories in this archive
 * @return enumeration of directories under the root of this archive
 */
@Override public Collection<String> getDirectories() throws IOException {
  List<String> results=new ArrayList<String>();
  if (archive != null) {
    for (    File f : archive.listFiles()) {
      if (f.isDirectory() && isEntryValid(f)) {
        results.add(f.getName());
      }
    }
  }
  return results;
}