nus-yam/ex-repair huggingface dataset:
Program: 28793
Project: 28793
Buggy source:
/** 
 * This method looks for the completed jobs and purges a job which is marked with the jobId
 * @param jobId the job to purge
 * @return  the new list of completed jobs
 */
@Override public synchronized JobInfos purgeCompletedJobForId(String jobId){
  CopyOnWriteArrayList<JobInfo> jobList=new CopyOnWriteArrayList<JobInfo>();
  if (getCompletedJobs() != null)   jobList.addAll(getCompletedJobs().getJobInfoList());
  for (  JobInfo jobInfo : jobList) {
    if (jobInfo.jobId.equals(jobId)) {
      jobList.remove(jobInfo);
    }
  }
  JobInfos jobInfos=new JobInfos();
  try {
    if (jaxbContext == null)     jaxbContext=JAXBContext.newInstance(JobInfos.class);
    jobInfos.setJobInfoList(jobList);
    Marshaller jaxbMarshaller=jaxbContext.createMarshaller();
    jaxbMarshaller.marshal(jobInfos,jobsFile);
  }
 catch (  JAXBException e) {
    throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",jobId,e.getLocalizedMessage()),e);
  }
  return jobInfos;
}

Fixed version (ground truth):
/** 
 * This method looks for the completed jobs and purges a job which is marked with the jobId
 * @param jobId the job to purge
 * @return  the new list of completed jobs
 */
@Override public JobInfos purgeCompletedJobForId(String jobId){
synchronized (jobsFile) {
    CopyOnWriteArrayList<JobInfo> jobList=new CopyOnWriteArrayList<JobInfo>();
    if (getCompletedJobs() != null)     jobList.addAll(getCompletedJobs().getJobInfoList());
    for (    JobInfo jobInfo : jobList) {
      if (jobInfo.jobId.equals(jobId)) {
        jobList.remove(jobInfo);
      }
    }
    JobInfos jobInfos=new JobInfos();
    try {
      if (jaxbContext == null)       jaxbContext=JAXBContext.newInstance(JobInfos.class);
      jobInfos.setJobInfoList(jobList);
      Marshaller jaxbMarshaller=jaxbContext.createMarshaller();
      jaxbMarshaller.marshal(jobInfos,jobsFile);
    }
 catch (    JAXBException e) {
      throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",jobId,e.getLocalizedMessage()),e);
    }
    return jobInfos;
  }
}
Program: 28794
Project: 28794
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<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;
}

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 synchronized 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: 28795
Project: 28795
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
 */
@Override public synchronized JobInfos getCompletedJobs(){
  try {
    if (jaxbContext == null)     jaxbContext=JAXBContext.newInstance(JobInfos.class);
    Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
    if (jobsFile != null && jobsFile.exists()) {
      JobInfos jobInfos=(JobInfos)unmarshaller.unmarshal(jobsFile);
      return jobInfos;
    }
  }
 catch (  JAXBException e) {
    throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",e.getLocalizedMessage()),e);
  }
  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
 */
@Override public JobInfos getCompletedJobs(){
synchronized (jobsFile) {
    try {
      if (jaxbContext == null)       jaxbContext=JAXBContext.newInstance(JobInfos.class);
      Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
      if (jobsFile != null && jobsFile.exists()) {
        JobInfos jobInfos=(JobInfos)unmarshaller.unmarshal(jobsFile);
        return jobInfos;
      }
    }
 catch (    JAXBException e) {
      throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",e.getLocalizedMessage()),e);
    }
    return null;
  }
}
Program: 28796
Project: 28796
Buggy source:
public ObjectName getJmxName(){
  return oname;
}

Fixed version (ground truth):
public ObjectName getJmxName(){
synchronized (this) {
    return oname;
  }
}
Program: 28799
Project: 28799
Buggy source:
public void stopServer(){
  if (server == null) {
    Digester digester=createStopDigester();
    digester.setClassLoader(Thread.currentThread().getContextClassLoader());
    File file=configFile();
    FileInputStream fis=null;
    try {
      InputSource is=new InputSource("String_Node_Str" + file.getAbsolutePath());
      fis=new FileInputStream(file);
      is.setByteStream(fis);
      digester.push(this);
      digester.parse(is);
    }
 catch (    Exception e) {
      log.log(Level.SEVERE,CATALINA_STOP_EXCEPTION,e);
      System.exit(1);
    }
 finally {
      try {
        if (fis != null) {
          fis.close();
        }
      }
 catch (      IOException ioe) {
      }
    }
  }
  Socket socket=null;
  OutputStream stream=null;
  try {
    socket=new Socket("String_Node_Str",server.getPort());
    stream=socket.getOutputStream();
    String shutdown=server.getShutdown();
    for (int i=0; i < shutdown.length(); i++)     stream.write(shutdown.charAt(i));
    stream.flush();
  }
 catch (  IOException e) {
    log.log(Level.SEVERE,CATALINA_STOP_EXCEPTION,e);
    System.exit(1);
  }
 finally {
    if (stream != null) {
      try {
        stream.close();
      }
 catch (      IOException e) {
      }
    }
    if (socket != null) {
      try {
        socket.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void stopServer(){
  if (server == null) {
    Digester digester=createStopDigester();
    digester.setClassLoader(Thread.currentThread().getContextClassLoader());
    File file=configFile();
    FileInputStream fis=null;
    try {
      InputSource is=new InputSource("String_Node_Str" + file.getAbsolutePath());
      fis=new FileInputStream(file);
      is.setByteStream(fis);
      digester.push(this);
      digester.parse(is);
    }
 catch (    Exception e) {
      log.log(Level.SEVERE,CATALINA_STOP_EXCEPTION,e);
      try {
        if (fis != null) {
          fis.close();
        }
      }
 catch (      IOException ioe) {
      }
      System.exit(1);
    }
 finally {
      try {
        if (fis != null) {
          fis.close();
        }
      }
 catch (      IOException ioe) {
      }
    }
  }
  Socket socket=null;
  OutputStream stream=null;
  try {
    socket=new Socket("String_Node_Str",server.getPort());
    stream=socket.getOutputStream();
    String shutdown=server.getShutdown();
    for (int i=0; i < shutdown.length(); i++)     stream.write(shutdown.charAt(i));
    stream.flush();
  }
 catch (  IOException e) {
    log.log(Level.SEVERE,CATALINA_STOP_EXCEPTION,e);
    System.exit(1);
  }
 finally {
    if (stream != null) {
      try {
        stream.close();
      }
 catch (      IOException e) {
      }
    }
    if (socket != null) {
      try {
        socket.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 28802
Project: 28802
Buggy source:
@Test public void testBraces() throws Exception {
  final File tmpDir=File.createTempFile("String_Node_Str","String_Node_Str");
  tmpDir.delete();
  tmpDir.mkdir();
  final PayloadFilesManager instance=new PayloadFilesManager.Perm(tmpDir,null,Logger.getAnonymousLogger());
  final String originalPath="String_Node_Str";
  final Part testPart=PayloadImpl.Part.newInstance("String_Node_Str",originalPath,null,"String_Node_Str");
  final URI result=instance.getOutputFileURI(testPart,testPart.getName());
  assertFalse(result.toASCIIString().contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testBraces() throws Exception {
  final File tmpDir=File.createTempFile("String_Node_Str","String_Node_Str");
  tmpDir.delete();
  tmpDir.mkdir();
  try {
    final PayloadFilesManager instance=new PayloadFilesManager.Perm(tmpDir,null,Logger.getAnonymousLogger());
    final String originalPath="String_Node_Str";
    final Part testPart=PayloadImpl.Part.newInstance("String_Node_Str",originalPath,null,"String_Node_Str");
    final URI result=instance.getOutputFileURI(testPart,testPart.getName());
    assertFalse(result.toASCIIString().contains("String_Node_Str"));
  }
  finally {
    PayloadFilesManagerTest.cleanup(tmpDir);
  }
}
Program: 28803
Project: 28803
Buggy source:
/** 
 * Test of getOutputFileURI method, of class PayloadFilesManager.
 */
@Test public void testGetOutputFileURI() throws Exception {
  PayloadFilesManager instance=new PayloadFilesManager.Temp(Logger.getAnonymousLogger());
  String originalPath="String_Node_Str";
  Part testPart=PayloadImpl.Part.newInstance("String_Node_Str",originalPath,null,"String_Node_Str");
  URI result=instance.getOutputFileURI(testPart,testPart.getName());
  assertTrue(result.toASCIIString().endsWith("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Test of getOutputFileURI method, of class PayloadFilesManager.
 */
@Test public void testGetOutputFileURI() throws Exception {
  PayloadFilesManager.Temp instance=new PayloadFilesManager.Temp(Logger.getAnonymousLogger());
  try {
    String originalPath="String_Node_Str";
    Part testPart=PayloadImpl.Part.newInstance("String_Node_Str",originalPath,null,"String_Node_Str");
    URI result=instance.getOutputFileURI(testPart,testPart.getName());
    assertTrue(result.toASCIIString().endsWith("String_Node_Str"));
  }
  finally {
    instance.cleanup();
  }
}
Program: 28808
Project: 28808
Buggy source:
@Before public void setUp(){
  try {
    tempMgr=new PayloadFilesManager.Temp(defaultLogger);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
@Before public void setUp(){
}
Program: 28810
Project: 28810
Buggy source:
@Override protected void cleanup(){
  tempInstance.cleanup();
}

Fixed version (ground truth):
@Override protected void cleanup(){
  doCleanup();
  for (  PayloadFilesManager.Temp tempInstance : tempInstances) {
    tempInstance.cleanup();
  }
}
Program: 28812
Project: 28812
Buggy source:
public AdminAccessController.Access authenticate(Request req) throws Exception {
  try {
    final Subject s=authenticator.loginAsAdmin(req);
    return (env.isDas() ? AdminAccessController.Access.FULL : AdminAccessController.Access.READONLY);
  }
 catch (  RemoteAdminAccessException ex) {
    return AdminAccessController.Access.FORBIDDEN;
  }
catch (  LoginException ex) {
    return AdminAccessController.Access.NONE;
  }
}

Fixed version (ground truth):
public AdminAccessController.Access authenticate(Request req) throws Exception {
  try {
    authenticator.loginAsAdmin(req);
    return (env.isDas() ? AdminAccessController.Access.FULL : AdminAccessController.Access.READONLY);
  }
 catch (  RemoteAdminAccessException ex) {
    return AdminAccessController.Access.FORBIDDEN;
  }
catch (  LoginException ex) {
    return AdminAccessController.Access.NONE;
  }
}
Program: 28814
Project: 28814
Buggy source:
private boolean afterMessageDeliveryInternal(ResourceHandle resourceHandle){
  boolean success=false;
  EjbInvocation invocation=null;
  invocation=(EjbInvocation)invocationManager.getCurrentInvocation();
  if (invocation == null) {
    _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{appEJBName_,"String_Node_Str"});
  }
 else {
    try {
      if (invocation.containerStartsTx) {
        unregisterMessageBeanResource(resourceHandle);
      }
      invocationManager.postInvoke(invocation);
      postInvokeTx(invocation);
      success=true;
      ejbProbeNotifier.messageDeliveredEvent(getContainerId(),containerInfo.appName,containerInfo.modName,containerInfo.ejbName);
    }
 catch (    Throwable ce) {
      _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{appEJBName_,ce.toString()});
      _logger.log(Level.SEVERE,ce.getClass().getName(),ce);
    }
 finally {
      releaseContext(invocation);
    }
    Utility.setContextClassLoader(invocation.getOriginalContextClassLoader());
    if (invocation.exception != null) {
      if (isSystemUncheckedException(invocation.exception)) {
        success=false;
      }
      Level exLogLevel=isSystemUncheckedException(invocation.exception) ? Level.WARNING : Level.FINE;
      _logger.log(exLogLevel,"String_Node_Str",new Object[]{appEJBName_,invocation.exception.toString()});
      _logger.log(exLogLevel,invocation.exception.getClass().getName(),invocation.exception);
    }
  }
  return success;
}

Fixed version (ground truth):
private boolean afterMessageDeliveryInternal(ResourceHandle resourceHandle){
  boolean success=false;
  EjbInvocation invocation=null;
  invocation=(EjbInvocation)invocationManager.getCurrentInvocation();
  if (invocation == null) {
    _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{appEJBName_,"String_Node_Str"});
  }
 else {
    try {
      if (invocation.isContainerStartsTx()) {
        unregisterMessageBeanResource(resourceHandle);
      }
      invocationManager.postInvoke(invocation);
      postInvokeTx(invocation);
      success=true;
      ejbProbeNotifier.messageDeliveredEvent(getContainerId(),containerInfo.appName,containerInfo.modName,containerInfo.ejbName);
    }
 catch (    Throwable ce) {
      _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{appEJBName_,ce.toString()});
      _logger.log(Level.SEVERE,ce.getClass().getName(),ce);
    }
 finally {
      releaseContext(invocation);
    }
    Utility.setContextClassLoader(invocation.getOriginalContextClassLoader());
    if (invocation.exception != null) {
      if (isSystemUncheckedException(invocation.exception)) {
        success=false;
      }
      Level exLogLevel=isSystemUncheckedException(invocation.exception) ? Level.WARNING : Level.FINE;
      _logger.log(exLogLevel,"String_Node_Str",new Object[]{appEJBName_,invocation.exception.toString()});
      _logger.log(exLogLevel,invocation.exception.getClass().getName(),invocation.exception);
    }
  }
  return success;
}
Program: 28815
Project: 28815
Buggy source:
/** 
 * The JMXAUthenticator's authenticate method.
 */
@Override public Subject authenticate(Object credentials){
  String user="String_Node_Str", password="String_Node_Str";
  String host=null;
  if (credentials instanceof String[]) {
    String[] up=(String[])credentials;
    if (up.length == 1) {
      user=up[0];
    }
 else     if (up.length >= 2) {
      user=up[0];
      password=up[1];
      if (password == null)       password="String_Node_Str";
    }
    if (up.length > 2) {
      host=up[2];
    }
 else {
      try {
        host=RemoteServer.getClientHost();
      }
 catch (      ServerNotActiveException ex) {
        throw new RuntimeException(ex);
      }
    }
  }
  String realm=as.getSystemJmxConnector().getAuthRealmName();
  if (realm == null)   realm=as.getAuthRealmName();
  try {
    final Subject s=loginAsAdmin(user,password,realm,host);
    return null;
  }
 catch (  LoginException e) {
    if (ADMSEC_LOGGER.isLoggable(Level.FINE)) {
      ADMSEC_LOGGER.log(Level.FINE,"String_Node_Str",new Object[]{user,host,realm});
    }
    throw new SecurityException(e);
  }
}

Fixed version (ground truth):
/** 
 * The JMXAUthenticator's authenticate method.
 */
@Override public Subject authenticate(Object credentials){
  String user="String_Node_Str", password="String_Node_Str";
  String host=null;
  if (credentials instanceof String[]) {
    String[] up=(String[])credentials;
    if (up.length == 1) {
      user=up[0];
    }
 else     if (up.length >= 2) {
      user=up[0];
      password=up[1];
      if (password == null)       password="String_Node_Str";
    }
    if (up.length > 2) {
      host=up[2];
    }
 else {
      try {
        host=RemoteServer.getClientHost();
      }
 catch (      ServerNotActiveException ex) {
        throw new RuntimeException(ex);
      }
    }
  }
  String realm=as.getSystemJmxConnector().getAuthRealmName();
  if (realm == null)   realm=as.getAuthRealmName();
  try {
    loginAsAdmin(user,password,realm,host);
    return null;
  }
 catch (  LoginException e) {
    if (ADMSEC_LOGGER.isLoggable(Level.FINE)) {
      ADMSEC_LOGGER.log(Level.FINE,"String_Node_Str",new Object[]{user,host,realm});
    }
    throw new SecurityException(e);
  }
}
Program: 28818
Project: 28818
Buggy source:
@Override public void initialize(Subject subject,CallbackHandler callbackHandler,Map<String,?> sharedState,Map<String,?> options){
  if (callbackHandler instanceof AdminCallbackHandler) {
    ServiceLocator sl=((AdminCallbackHandler)callbackHandler).getServiceLocator();
    findServices(sl);
  }
  this.subject=subject;
  this.callbackHandler=callbackHandler;
  authRealm=(String)options.get("String_Node_Str");
}

Fixed version (ground truth):
@Override public void initialize(Subject subject,CallbackHandler callbackHandler,Map<String,?> sharedState,Map<String,?> options){
  if (callbackHandler instanceof AdminCallbackHandler) {
    ServiceLocator sl=((AdminCallbackHandler)callbackHandler).getServiceLocator();
    findServices(sl);
  }
  this.subject=subject;
  this.callbackHandler=callbackHandler;
}
Program: 28820
Project: 28820
Buggy source:
@Override public Collection<? extends AccessRequired.AccessCheck> getAccessChecks(){
  String className=configModularityUtils.convertConfigElementNameToClassName(serviceName);
  Class configBeanType=configModularityUtils.getClassFor(serviceName);
  if (configBeanType == null) {
    return Collections.emptyList();
  }
  if (configModularityUtils.hasCustomConfig(configBeanType)) {
    List<ConfigBeanDefaultValue> defaults=configModularityUtils.getDefaultConfigurations(configBeanType,configModularityUtils.getRuntimeTypePrefix(serverenv.getStartupContext()));
    return getAccessChecksForDefaultValue(defaults,target,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  if (ConfigExtension.class.isAssignableFrom(configBeanType)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  if (configBeanType.isAssignableFrom(DomainExtension.class)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override public Collection<? extends AccessRequired.AccessCheck> getAccessChecks(){
  Class configBeanType=configModularityUtils.getClassFor(serviceName);
  if (configBeanType == null) {
    return Collections.emptyList();
  }
  if (configModularityUtils.hasCustomConfig(configBeanType)) {
    List<ConfigBeanDefaultValue> defaults=configModularityUtils.getDefaultConfigurations(configBeanType,configModularityUtils.getRuntimeTypePrefix(serverenv.getStartupContext()));
    return getAccessChecksForDefaultValue(defaults,target,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  if (ConfigExtension.class.isAssignableFrom(configBeanType)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  if (configBeanType.isAssignableFrom(DomainExtension.class)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  return Collections.emptyList();
}
Program: 28821
Project: 28821
Buggy source:
@Override public Collection<? extends AccessRequired.AccessCheck> getAccessChecks(){
  String className=configModularityUtils.convertConfigElementNameToClassName(serviceName);
  Class configBeanType=configModularityUtils.getClassFor(serviceName);
  if (configBeanType == null) {
    return Collections.emptyList();
  }
  if (configModularityUtils.hasCustomConfig(configBeanType)) {
    List<ConfigBeanDefaultValue> defaults=configModularityUtils.getDefaultConfigurations(configBeanType,configModularityUtils.getRuntimeTypePrefix(serverenv.getStartupContext()));
    return getAccessChecksForDefaultValue(defaults,target,Arrays.asList("String_Node_Str","String_Node_Str"));
  }
  if (ConfigExtension.class.isAssignableFrom(configBeanType)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str"));
  }
  if (configBeanType.isAssignableFrom(DomainExtension.class)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str"));
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override public Collection<? extends AccessRequired.AccessCheck> getAccessChecks(){
  Class configBeanType=configModularityUtils.getClassFor(serviceName);
  if (configBeanType == null) {
    return Collections.emptyList();
  }
  if (configModularityUtils.hasCustomConfig(configBeanType)) {
    List<ConfigBeanDefaultValue> defaults=configModularityUtils.getDefaultConfigurations(configBeanType,configModularityUtils.getRuntimeTypePrefix(serverenv.getStartupContext()));
    return getAccessChecksForDefaultValue(defaults,target,Arrays.asList("String_Node_Str","String_Node_Str"));
  }
  if (ConfigExtension.class.isAssignableFrom(configBeanType)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str"));
  }
  if (configBeanType.isAssignableFrom(DomainExtension.class)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str","String_Node_Str"));
  }
  return Collections.emptyList();
}
Program: 28822
Project: 28822
Buggy source:
@Override public Collection<? extends AccessRequired.AccessCheck> getAccessChecks(){
  String className=configModularityUtils.convertConfigElementNameToClassName(serviceName);
  Class configBeanType=configModularityUtils.getClassFor(serviceName);
  if (configBeanType == null) {
    return Collections.emptyList();
  }
  if (configModularityUtils.hasCustomConfig(configBeanType)) {
    List<ConfigBeanDefaultValue> defaults=configModularityUtils.getDefaultConfigurations(configBeanType,configModularityUtils.getRuntimeTypePrefix(serverenv.getStartupContext()));
    return getAccessChecksForDefaultValue(defaults,target,Arrays.asList("String_Node_Str"));
  }
  if (ConfigExtension.class.isAssignableFrom(configBeanType)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str"));
  }
  if (configBeanType.isAssignableFrom(DomainExtension.class)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str"));
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override public Collection<? extends AccessRequired.AccessCheck> getAccessChecks(){
  Class configBeanType=configModularityUtils.getClassFor(serviceName);
  if (configBeanType == null) {
    return Collections.emptyList();
  }
  if (configModularityUtils.hasCustomConfig(configBeanType)) {
    List<ConfigBeanDefaultValue> defaults=configModularityUtils.getDefaultConfigurations(configBeanType,configModularityUtils.getRuntimeTypePrefix(serverenv.getStartupContext()));
    return getAccessChecksForDefaultValue(defaults,target,Arrays.asList("String_Node_Str"));
  }
  if (ConfigExtension.class.isAssignableFrom(configBeanType)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str"));
  }
  if (configBeanType.isAssignableFrom(DomainExtension.class)) {
    return getAccessChecksForConfigBean(config.getExtensionByType(configBeanType),target,Arrays.asList("String_Node_Str"));
  }
  return Collections.emptyList();
}
Program: 28823
Project: 28823
Buggy source:
public List<ConfigBeanDefaultValue> getDefaultConfigurations(Class configBeanClass,String runtimeType){
  CustomConfiguration c=(CustomConfiguration)configBeanClass.getAnnotation(CustomConfiguration.class);
  List<ConfigBeanDefaultValue> defaults=Collections.emptyList();
  if (c.usesOnTheFlyConfigGeneration()) {
    Method m=getGetDefaultValuesMethod(configBeanClass);
    if (m != null) {
      try {
        defaults=(List<ConfigBeanDefaultValue>)m.invoke(null,runtimeType);
      }
 catch (      Exception e) {
        LOG.log(Level.INFO,"String_Node_Str" + configBeanClass.getName(),e);
      }
    }
  }
 else {
    LocalStringManager localStrings=new LocalStringManagerImpl(configBeanClass);
    ModuleXMLConfigurationFileParser parser=new ModuleXMLConfigurationFileParser(localStrings);
    try {
      defaults=parser.parseServiceConfiguration(getConfigurationFileUrl(configBeanClass,c.baseConfigurationFileName(),runtimeType).openStream());
    }
 catch (    XMLStreamException e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
    }
catch (    IOException e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
    }
  }
  return defaults;
}

Fixed version (ground truth):
private List<ConfigBeanDefaultValue> getDefaultConfigurations(Class configBeanClass,String runtimeType){
  CustomConfiguration c=(CustomConfiguration)configBeanClass.getAnnotation(CustomConfiguration.class);
  List<ConfigBeanDefaultValue> defaults=Collections.emptyList();
  if (c.usesOnTheFlyConfigGeneration()) {
    Method m=getGetDefaultValuesMethod(configBeanClass);
    if (m != null) {
      try {
        defaults=(List<ConfigBeanDefaultValue>)m.invoke(null,runtimeType);
      }
 catch (      Exception e) {
        LOG.log(Level.INFO,"String_Node_Str" + configBeanClass.getName(),e);
      }
    }
  }
 else {
    LocalStringManager localStrings=new LocalStringManagerImpl(configBeanClass);
    ModuleXMLConfigurationFileParser parser=new ModuleXMLConfigurationFileParser(localStrings);
    try {
      defaults=parser.parseServiceConfiguration(getConfigurationFileUrl(configBeanClass,c.baseConfigurationFileName(),runtimeType).openStream());
    }
 catch (    XMLStreamException e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
    }
catch (    IOException e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
    }
  }
  return defaults;
}
Program: 28824
Project: 28824
Buggy source:
public <U extends ConfigBeanProxy>URL getConfigurationFileUrl(Class<U> configBeanClass,String baseFileName,String runtimeType){
  String fileName=runtimeType + "String_Node_Str" + baseFileName;
  URL fileUrl=configBeanClass.getClassLoader().getResource("String_Node_Str" + fileName);
  if (fileUrl == null) {
    fileUrl=configBeanClass.getClassLoader().getResource("String_Node_Str" + baseFileName);
  }
  return fileUrl;
}

Fixed version (ground truth):
private <U extends ConfigBeanProxy>URL getConfigurationFileUrl(Class<U> configBeanClass,String baseFileName,String runtimeType){
  String fileName=runtimeType + "String_Node_Str" + baseFileName;
  URL fileUrl=configBeanClass.getClassLoader().getResource("String_Node_Str" + fileName);
  if (fileUrl == null) {
    fileUrl=configBeanClass.getClassLoader().getResource("String_Node_Str" + baseFileName);
  }
  return fileUrl;
}
Program: 28825
Project: 28825
Buggy source:
public List<ConfigCustomizationToken> getPresentConfigCustomizationTokens(String runtimeType) throws NoSuchFieldException, IllegalAccessException {
  List<ConfigCustomizationToken> ctk=new ArrayList<ConfigCustomizationToken>();
  ClassLoader cl=this.getClass().getClassLoader();
  Field classes=cl.getClass().getDeclaredField("String_Node_Str");
  classes.setAccessible(true);
  Vector<Class> clzs=(Vector<Class>)classes.get(cl);
  for (Iterator<Class> iter=clzs.iterator(); iter.hasNext(); ) {
    Class clz=iter.next();
    if (clz != null) {
      if (clz.isAnnotationPresent(HasCustomizationTokens.class)) {
        ctk.addAll(getTokens(clz,runtimeType));
      }
    }
  }
  return ctk;
}

Fixed version (ground truth):
public List<ConfigCustomizationToken> getPresentConfigCustomizationTokens(String runtimeType) throws NoSuchFieldException, IllegalAccessException {
  List<ConfigCustomizationToken> ctk=new ArrayList<ConfigCustomizationToken>();
  ClassLoader cl=this.getClass().getClassLoader();
  classesField.setAccessible(true);
  final Vector<Class> clzs=(Vector<Class>)classesField.get(cl);
  Class[] clzss=new Class[clzs.size()];
synchronized (clzs) {
    clzs.toArray(clzss);
  }
  for (  Class clz : clzss) {
    if (clz != null) {
      if (clz.isAnnotationPresent(HasCustomizationTokens.class)) {
        ctk.addAll(getTokens(clz,runtimeType));
      }
    }
  }
  return ctk;
}
Program: 28826
Project: 28826
Buggy source:
public Class getDuckClass(Class configBeanType){
  Class duck;
  final Class[] clz=configBeanType.getDeclaredClasses();
  for (  Class aClz : clz) {
    duck=aClz;
    if (duck.getSimpleName().equals("String_Node_Str")) {
      return duck;
    }
  }
  return null;
}

Fixed version (ground truth):
private Class getDuckClass(Class configBeanType){
  Class duck;
  final Class[] clz=configBeanType.getDeclaredClasses();
  for (  Class aClz : clz) {
    duck=aClz;
    if (duck.getSimpleName().equals("String_Node_Str")) {
      return duck;
    }
  }
  return null;
}
Program: 28827
Project: 28827
Buggy source:
public Method getGetDefaultValuesMethod(Class configBeanType){
  Class duck=getDuckClass(configBeanType);
  if (duck == null) {
    return null;
  }
  Method m;
  try {
    m=duck.getMethod("String_Node_Str",String.class);
  }
 catch (  Exception ex) {
    return null;
  }
  return m;
}

Fixed version (ground truth):
private Method getGetDefaultValuesMethod(Class configBeanType){
  Class duck=getDuckClass(configBeanType);
  if (duck == null) {
    return null;
  }
  Method m;
  try {
    m=duck.getMethod("String_Node_Str",String.class);
  }
 catch (  Exception ex) {
    return null;
  }
  return m;
}
Program: 28829
Project: 28829
Buggy source:
/** 
 * Copies the entire tree to a new location.
 * @param din  File pointing at root of tree to copy
 * @param dout File pointing at root of new tree
 * @throws IOException if an error while copying the content
 */
public static void copyTree(File din,File dout) throws IOException {
  if (!safeIsDirectory(din))   throw new IllegalArgumentException("String_Node_Str");
  dout.mkdirs();
  if (!safeIsDirectory(dout))   throw new IllegalArgumentException("String_Node_Str");
  FileListerRelative flr=new FileListerRelative(din);
  String[] files=flr.getFiles();
  for (int i=0; i < files.length; i++) {
    File fin=new File(din,files[i]);
    File fout=new File(dout,files[i]);
    copy(fin,fout);
  }
}

Fixed version (ground truth):
/** 
 * Copies the entire tree to a new location.
 * @param din  File pointing at root of tree to copy
 * @param dout File pointing at root of new tree
 * @throws IOException if an error while copying the content
 */
public static void copyTree(File din,File dout) throws IOException {
  if (!safeIsDirectory(din))   throw new IllegalArgumentException("String_Node_Str");
  if (!mkdirsMaybe(dout))   throw new IllegalArgumentException("String_Node_Str");
  FileListerRelative flr=new FileListerRelative(din);
  String[] files=flr.getFiles();
  for (int i=0; i < files.length; i++) {
    File fin=new File(din,files[i]);
    File fout=new File(dout,files[i]);
    copy(fin,fout);
  }
}
Program: 28830
Project: 28830
Buggy source:
/** 
 * If the path dir/file does not exist, look for it in the classpath. If found in classpath, create dir/file.
 * @param file - path to look for
 * @param dir - directory where the path file should exist
 * @return the File representing dir/file. If that does not exist, return null.
 * @throws IOException
 */
public static File getManagedFile(String file,File dir) throws IOException {
  File f=new File(dir,file);
  if (f.exists())   return f;
  InputStream is=null, bis=null;
  OutputStream os=null;
  try {
    is=Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
    if (is == null)     return null;
    bis=new BufferedInputStream(is);
    f.getParentFile().mkdirs();
    os=new BufferedOutputStream(FileUtils.openFileOutputStream(f));
    byte buf[]=new byte[10240];
    int len=0;
    while ((len=bis.read(buf)) > 0) {
      os.write(buf,0,len);
    }
    return f;
  }
  finally {
    if (os != null)     try {
      os.close();
    }
 catch (    IOException ex) {
    }
    if (bis != null)     try {
      bis.close();
    }
 catch (    IOException ex) {
    }
    if (is != null)     try {
      is.close();
    }
 catch (    IOException ex) {
    }
  }
}

Fixed version (ground truth):
/** 
 * If the path dir/file does not exist, look for it in the classpath. If found in classpath, create dir/file.
 * @param file - path to look for
 * @param dir - directory where the path file should exist
 * @return the File representing dir/file. If that does not exist, return null.
 * @throws IOException
 */
public static File getManagedFile(String file,File dir) throws IOException {
  File f=new File(dir,file);
  if (f.exists())   return f;
  InputStream is=null, bis=null;
  OutputStream os=null;
  try {
    is=Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
    if (is == null)     return null;
    bis=new BufferedInputStream(is);
    if (!mkdirsMaybe(f.getParentFile()))     throw new RuntimeException("String_Node_Str" + f);
    os=new BufferedOutputStream(FileUtils.openFileOutputStream(f));
    byte buf[]=new byte[10240];
    int len=0;
    while ((len=bis.read(buf)) > 0) {
      os.write(buf,0,len);
    }
    return f;
  }
  finally {
    if (os != null)     try {
      os.close();
    }
 catch (    IOException ex) {
    }
    if (bis != null)     try {
      bis.close();
    }
 catch (    IOException ex) {
    }
    if (is != null)     try {
      is.close();
    }
 catch (    IOException ex) {
    }
  }
}
Program: 28831
Project: 28831
Buggy source:
public void run(){
  ClassLoader previousClassLoader=null;
  try {
    previousClassLoader=Utility.setContextClassLoader(clsLoader);
    mdbClient.close();
    _logger.log(Level.FINE,"String_Node_Str");
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{appName,e.toString()});
    _logger.log(Level.SEVERE,e.getClass().getName(),e);
  }
 finally {
synchronized (this) {
      this.done=true;
      this.notify();
    }
    try {
      mdbPool.close();
    }
 catch (    Exception ex) {
      _logger.log(Level.FINE,"String_Node_Str",ex);
    }
    if (previousClassLoader != null) {
      Utility.setContextClassLoader(previousClassLoader);
    }
  }
}

Fixed version (ground truth):
public void run(){
  ClassLoader previousClassLoader=null;
  try {
    previousClassLoader=Utility.setContextClassLoader(clsLoader);
    mdbClient.close();
    _logger.log(Level.FINE,"String_Node_Str");
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",new Object[]{appName,e.toString()});
    _logger.log(Level.SEVERE,e.getClass().getName(),e);
  }
 finally {
synchronized (this) {
      this.done=true;
      this.notifyAll();
    }
    try {
      mdbPool.close();
    }
 catch (    Exception ex) {
      _logger.log(Level.FINE,"String_Node_Str",ex);
    }
    if (previousClassLoader != null) {
      Utility.setContextClassLoader(previousClassLoader);
    }
  }
}
Program: 28832
Project: 28832
Buggy source:
public void remove(Object ejbRef){
  EJBLocalObjectImpl localObjectImpl=getEJBLocalObject(ejbRef);
  if (localObjectImpl == null) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  Container container=localObjectImpl.getContainer();
  EjbDescriptor ejbDesc=container.getEjbDescriptor();
  boolean isStatefulBean=false;
  if (ejbDesc.getType().equals(EjbSessionDescriptor.TYPE)) {
    EjbSessionDescriptor sessionDesc=(EjbSessionDescriptor)ejbDesc;
    isStatefulBean=sessionDesc.isStateful();
  }
  if (!isStatefulBean) {
    return;
  }
  try {
    localObjectImpl.remove();
  }
 catch (  EJBException e) {
    _logger.log(Level.FINE,"String_Node_Str",e);
  }
catch (  javax.ejb.RemoveException re) {
    throw new NoSuchEJBException(re.getMessage(),re);
  }
}

Fixed version (ground truth):
public void remove(Object ejbRef){
  EJBLocalObjectImpl localObjectImpl=getEJBLocalObject(ejbRef);
  if (localObjectImpl == null) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  Container container=localObjectImpl.getContainer();
  EjbDescriptor ejbDesc=container.getEjbDescriptor();
  boolean isStatefulBean=false;
  if (ejbDesc.getType().equals(EjbSessionDescriptor.TYPE)) {
    EjbSessionDescriptor sessionDesc=(EjbSessionDescriptor)ejbDesc;
    isStatefulBean=sessionDesc.isStateful();
  }
  if (!isStatefulBean) {
    return;
  }
  try {
    localObjectImpl.remove();
  }
 catch (  EJBException e) {
    LogFacade.getLogger().log(Level.FINE,"String_Node_Str",e);
  }
catch (  javax.ejb.RemoveException re) {
    throw new NoSuchEJBException(re.getMessage(),re);
  }
}
Program: 28834
Project: 28834
Buggy source:
/** 
 * {@inheritDoc}
 * @Override
 */
public String getInstanceName(){
  if (processType == null) {
    ProcessEnvironment pe=Globals.get(ProcessEnvironment.class);
    processType=pe.getProcessType();
    if (processType.isServer()) {
      ServerEnvironmentImpl env=Globals.get(ServerEnvironmentImpl.class);
      String instance=env.getInstanceName();
      Domain domain=Globals.get(Domain.class);
      Server server=domain.getServerNamed(instance);
      Cluster cluster=server.getCluster();
      if (cluster != null) {
        String cName=cluster.getName();
        instanceName=instance;
      }
    }
  }
  return instanceName;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @Override
 */
public String getInstanceName(){
  if (processType == null) {
    ProcessEnvironment pe=Globals.get(ProcessEnvironment.class);
    processType=pe.getProcessType();
    if (processType.isServer()) {
      ServerEnvironmentImpl env=Globals.get(ServerEnvironmentImpl.class);
      String instance=env.getInstanceName();
      Domain domain=Globals.get(Domain.class);
      Server server=domain.getServerNamed(instance);
      Cluster cluster=server.getCluster();
      if (cluster != null) {
        instanceName=instance;
      }
    }
  }
  return instanceName;
}
Program: 28835
Project: 28835
Buggy source:
public static boolean compareStrings(String str1,String str2){
  return str1 == str2 || (str1 != null && str1.equals(str2));
}

Fixed version (ground truth):
public static boolean compareStrings(String str1,String str2){
  if (str1 == null) {
    return str2 == null;
  }
 else {
    return str1.equals(str2);
  }
}
Program: 28836
Project: 28836
Buggy source:
public static boolean compareStringsIgnoreCase(String str1,String str2){
  return str1 == str2 || (str1 != null && str1.equalsIgnoreCase(str2));
}

Fixed version (ground truth):
public static boolean compareStringsIgnoreCase(String str1,String str2){
  if (str1 == null) {
    return str2 == null;
  }
 else {
    return str1.equalsIgnoreCase(str2);
  }
}
Program: 28838
Project: 28838
Buggy source:
@Override public AzResult getAuthorizationDecision(AzSubject subject,AzResource resource,AzAction action,AzEnvironment environment,List<AzAttributeResolver> attributeResolvers){
  final String isDASSetting=environment.getAttributeValue(AuthorizationAttributeNames.ISDAS_ATTRIBUTE);
  final boolean isDAS=Boolean.parseBoolean(isDASSetting);
  final String adminIndicator=subject.getAttributeValue(AuthorizationAttributeNames.ADMIN_INDICATOR_ATTRIBUTE);
  final boolean isLocalPassword=(subject.getAttributeValue(AuthorizationAttributeNames.ADMIN_LOCAL_PASSWORD_ATTRIBUTE)) != null;
  final Decision d=(isDAS || isLocalPassword || (adminIndicator != null)|| (action.getAttributeValue("String_Node_Str").equals("String_Node_Str"))) ? Decision.PERMIT : Decision.DENY;
  AzResult rtn=new AzResultImpl(d,Status.OK,new AzObligationsImpl());
  return rtn;
}

Fixed version (ground truth):
@Override public AzResult getAuthorizationDecision(AzSubject subject,AzResource resource,AzAction action,AzEnvironment environment,List<AzAttributeResolver> attributeResolvers){
  final String isDASSetting=environment.getAttributeValue(AuthorizationAttributeNames.ISDAS_ATTRIBUTE);
  final boolean isDAS=Boolean.parseBoolean(isDASSetting);
  final String adminIndicator=subject.getAttributeValue(AuthorizationAttributeNames.ADMIN_INDICATOR_ATTRIBUTE);
  final boolean isLocalPassword=(subject.getAttributeValue(AuthorizationAttributeNames.ADMIN_LOCAL_PASSWORD_ATTRIBUTE)) != null;
  final Decision d=(isDAS || isLocalPassword || (adminIndicator != null)|| action.getAction().equals("String_Node_Str")) ? Decision.PERMIT : Decision.DENY;
  AzResult rtn=new AzResultImpl(d,Status.OK,new AzObligationsImpl());
  return rtn;
}
Program: 28839
Project: 28839
Buggy source:
/** 
 * Determines whether the given Subject has been granted the specified Permission by delegating to the configured java.security.Policy object.  This method is a high-level convenience method that tests for a Subject-based permission grant without reference to the AccessControlContext of the caller. In addition, this method isolates the query from the underlying Policy configuration model.  It could, for example, multiplex queries across multiple instances of Policy configured in an implementation-specific way such that different threads, or different applications, query different Policy objects.  The initial implementation simply delegates to the configured Policy as defined by Java SE.
 * @param subject The Subject for which permission is being tested.
 * @param permission The Permission being queried.
 * @return True or false, depending on whether the specified Permissionis granted to the Subject by the configured Policy.
 * @throws IllegalArgumentException Given null or illegal subject or permission
 * @throws IllegalStateException Service was not initialized.
 */
public boolean isPermissionGranted(Subject subject,Permission permission);

Fixed version (ground truth):
/** 
 * Determines whether the given Subject has been granted the specified Permission by delegating to the configured java.security.Policy object.  This method is a high-level convenience method that tests for a Subject-based permission grant without reference to the AccessControlContext of the caller. In addition, this method isolates the query from the underlying Policy configuration model.  It could, for example, multiplex queries across multiple instances of Policy configured in an implementation-specific way such that different threads, or different applications, query different Policy objects.  The initial implementation simply delegates to the configured Policy as defined by Java SE.
 * @param subject The Subject for which permission is being tested.
 * @param permission The Permission being queried.
 * @return True or false, depending on whether the specified Permissionis granted to the Subject by the configured Policy.
 * @throws IllegalArgumentException Given null or illegal subject or permission
 */
public boolean isPermissionGranted(Subject subject,Permission permission);
Program: 28841
Project: 28841
Buggy source:
@Test public void testIsPermissionGranted() throws Exception {
  assertSame("String_Node_Str",NOT_INITIALIZED,impl.getInitializationState());
  try {
    impl.isPermissionGranted(new Subject(),new AllPermission());
    fail("String_Node_Str");
  }
 catch (  RuntimeException e) {
  }
  assertSame("String_Node_Str",NOT_INITIALIZED,impl.getInitializationState());
  assertNotNull("String_Node_Str",impl.getReasonInitializationFailed());
}

Fixed version (ground truth):
@Test public void testIsPermissionGranted() throws Exception {
  assertSame("String_Node_Str",NOT_INITIALIZED,impl.getInitializationState());
  impl.isPermissionGranted(new Subject(),new AllPermission());
}
Program: 28843
Project: 28843
Buggy source:
/** 
 * Stop an existing web application, attached to the specified context path.  Only stops a web application if it is running.
 * @param contextPath The context path of the application to be stopped
 * @exception IllegalArgumentException if the specified context pathis malformed (it must be "" or start with a slash)
 * @exception IllegalArgumentException if the specified context path doesnot identify a currently installed web application
 * @exception IOException if an input/output error occurs while stoppingthe web application
 */
public void stop(String contextPath) throws IOException {
  if (contextPath == null)   throw new IllegalArgumentException(rb.getString(CONTEXT_PATH_REQUIRED_EXCEPTION));
  if (!contextPath.equals("String_Node_Str") && !contextPath.startsWith("String_Node_Str")) {
    String msg=MessageFormat.format(rb.getString(INVALID_CONTEXT_PATH_EXCEPTION),contextPath);
    throw new IllegalArgumentException(msg);
  }
  Context context=findDeployedApp(contextPath);
  if (context == null) {
    String msg=MessageFormat.format(rb.getString(CONTEXT_PATH_NOT_IN_USE),contextPath);
    throw new IllegalArgumentException(msg);
  }
  if (log.isLoggable(Level.INFO)) {
    String msg=MessageFormat.format(rb.getString(STOPPING_WEB_APP_INFO),contextPath);
    log.log(Level.INFO,STOPPING_WEB_APP_INFO,contextPath);
  }
  try {
    ((Lifecycle)context).stop();
  }
 catch (  LifecycleException e) {
    String msg=MessageFormat.format(rb.getString(STOPPING_WEB_APP_FAILED_EXCEPTION),contextPath);
    log.log(Level.SEVERE,msg,e);
    throw new IllegalStateException(msg,e);
  }
}

Fixed version (ground truth):
/** 
 * Stop an existing web application, attached to the specified context path.  Only stops a web application if it is running.
 * @param contextPath The context path of the application to be stopped
 * @exception IllegalArgumentException if the specified context pathis malformed (it must be "" or start with a slash)
 * @exception IllegalArgumentException if the specified context path doesnot identify a currently installed web application
 * @exception IOException if an input/output error occurs while stoppingthe web application
 */
public void stop(String contextPath) throws IOException {
  if (contextPath == null)   throw new IllegalArgumentException(rb.getString(CONTEXT_PATH_REQUIRED_EXCEPTION));
  if (!contextPath.equals("String_Node_Str") && !contextPath.startsWith("String_Node_Str")) {
    String msg=MessageFormat.format(rb.getString(INVALID_CONTEXT_PATH_EXCEPTION),contextPath);
    throw new IllegalArgumentException(msg);
  }
  Context context=findDeployedApp(contextPath);
  if (context == null) {
    String msg=MessageFormat.format(rb.getString(CONTEXT_PATH_NOT_IN_USE),contextPath);
    throw new IllegalArgumentException(msg);
  }
  if (log.isLoggable(Level.INFO)) {
    log.log(Level.INFO,STOPPING_WEB_APP_INFO,contextPath);
  }
  try {
    ((Lifecycle)context).stop();
  }
 catch (  LifecycleException e) {
    String msg=MessageFormat.format(rb.getString(STOPPING_WEB_APP_FAILED_EXCEPTION),contextPath);
    log.log(Level.SEVERE,msg,e);
    throw new IllegalStateException(msg,e);
  }
}
Program: 28844
Project: 28844
Buggy source:
private static void insist(boolean b,String mesg) throws ZipFileException {
  if (!b) {
    throw new ZipFileException(mesg);
  }
 else {
    return;
  }
}

Fixed version (ground truth):
private static void insist(boolean b,String mesg) throws ZipFileException {
  if (!b) {
    throw new ZipFileException(mesg);
  }
}