nus-yam/ex-repair huggingface dataset:
Program: 29039
Project: 29039
Buggy source:
private static File getServiceTagRegistry(File serviceTagRegistry){
  if (!serviceTagRegistry.exists()) {
    File serviceTagLink=new File(getRegistrationHome(),SERVICE_TAG_REGISTRY_LINK_NAME);
    if (serviceTagLink.exists()) {
      BufferedReader in=null;
      try {
        in=new BufferedReader(new FileReader(serviceTagLink));
        String indirectedServiceTagRegistryName=in.readLine();
        File indirectedServiceTagRegisitryFile=new File(indirectedServiceTagRegistryName);
        if (indirectedServiceTagRegisitryFile.exists()) {
          serviceTagRegistry=indirectedServiceTagRegisitryFile;
        }
      }
 catch (      IOException e) {
      }
 finally {
        if (in != null)         try {
          in.close();
        }
 catch (        IOException ex) {
        }
      }
    }
 else {
    }
  }
  return serviceTagRegistry;
}

Fixed version (ground truth):
private static File getServiceTagRegistry(File serviceTagRegistry){
  if (!serviceTagRegistry.exists()) {
    File serviceTagLink=new File(getRegistrationHome(),SERVICE_TAG_REGISTRY_LINK_NAME);
    if (serviceTagLink.exists()) {
      BufferedReader in=null;
      try {
        in=new BufferedReader(new FileReader(serviceTagLink));
        String indirectedServiceTagRegistryName=in.readLine();
        if (indirectedServiceTagRegistryName != null) {
          File indirectedServiceTagRegisitryFile=new File(indirectedServiceTagRegistryName);
          if (indirectedServiceTagRegisitryFile.exists()) {
            serviceTagRegistry=indirectedServiceTagRegisitryFile;
          }
        }
      }
 catch (      IOException e) {
      }
 finally {
        if (in != null)         try {
          in.close();
        }
 catch (        IOException ex) {
        }
      }
    }
 else {
    }
  }
  return serviceTagRegistry;
}
Program: 29040
Project: 29040
Buggy source:
/** 
 * This methos invokes the Derby's NetworkServerControl to start/stop/ping the database.
 */
private void invokeNetworkServerControl(){
  try {
    Class networkServer=Class.forName("String_Node_Str");
    Method networkServerMethod=networkServer.getDeclaredMethod("String_Node_Str",new Class[]{String[].class});
    Object[] paramObj=null;
    if (derbyUser == null && derbyPassword == null) {
      paramObj=new Object[]{new String[]{derbyCommand,"String_Node_Str",derbyHost,"String_Node_Str",derbyPort}};
    }
 else {
      paramObj=new Object[]{new String[]{derbyCommand,"String_Node_Str",derbyHost,"String_Node_Str",derbyPort,"String_Node_Str",derbyUser,"String_Node_Str",derbyPassword}};
    }
    networkServerMethod.invoke(networkServer,paramObj);
  }
 catch (  Throwable t) {
    t.printStackTrace();
    System.exit(2);
  }
}

Fixed version (ground truth):
/** 
 * This methos invokes the Derby's NetworkServerControl to start/stop/ping the database.
 */
private void invokeNetworkServerControl(){
  try {
    Class networkServer=Class.forName("String_Node_Str");
    Method networkServerMethod=networkServer.getDeclaredMethod("String_Node_Str",new Class[]{String[].class});
    Object[] paramObj=null;
    if (derbyUser == null && derbyPassword == null) {
      paramObj=new Object[]{new String[]{derbyCommand,"String_Node_Str",derbyHost,"String_Node_Str",derbyPort}};
    }
 else {
      paramObj=new Object[]{new String[]{derbyCommand,"String_Node_Str",derbyHost,"String_Node_Str",derbyPort,"String_Node_Str",derbyUser,"String_Node_Str",derbyPassword}};
    }
    networkServerMethod.invoke(networkServer,paramObj);
  }
 catch (  Throwable t) {
    t.printStackTrace();
    Runtime.getRuntime().exit(2);
  }
}
Program: 29041
Project: 29041
Buggy source:
public static void addIndex(Config c,ServiceLocator habitat,String name){
  ActiveDescriptor<?> bob=ServiceLocatorUtilities.addOneDescriptor(habitat,BuilderHelper.createConstantDescriptor(c,name,Config.class));
  ConfigBeanProxy dirref[]={c.getAdminService(),c.getAvailabilityService(),c.getDiagnosticService(),c.getHttpService(),c.getJavaConfig(),c.getLogService(),c.getNetworkConfig(),c.getSecurityService(),c.getThreadPools(),c.getMonitoringService()};
  for (  ConfigBeanProxy cbp : dirref) {
    if (cbp != null) {
      ServiceLocatorUtilities.addOneDescriptor(habitat,BuilderHelper.createConstantDescriptor(cbp,name,ConfigSupport.getImpl(cbp).getProxyType()));
    }
  }
  for (  Container extension : c.getContainers()) {
    ServiceLocatorUtilities.addOneDescriptor(habitat,BuilderHelper.createConstantDescriptor(extension,name,ConfigSupport.getImpl(extension).getProxyType()));
  }
}

Fixed version (ground truth):
public static void addIndex(Config c,ServiceLocator habitat,String name){
  ServiceLocatorUtilities.addOneDescriptor(habitat,BuilderHelper.createConstantDescriptor(c,name,Config.class));
  ConfigBeanProxy dirref[]={c.getAdminService(),c.getAvailabilityService(),c.getDiagnosticService(),c.getHttpService(),c.getJavaConfig(),c.getLogService(),c.getNetworkConfig(),c.getSecurityService(),c.getThreadPools(),c.getMonitoringService()};
  for (  ConfigBeanProxy cbp : dirref) {
    if (cbp != null) {
      ServiceLocatorUtilities.addOneDescriptor(habitat,BuilderHelper.createConstantDescriptor(cbp,name,ConfigSupport.getImpl(cbp).getProxyType()));
    }
  }
  for (  Container extension : c.getContainers()) {
    ServiceLocatorUtilities.addOneDescriptor(habitat,BuilderHelper.createConstantDescriptor(extension,name,ConfigSupport.getImpl(extension).getProxyType()));
  }
}
Program: 29042
Project: 29042
Buggy source:
public boolean checkInterfaces(Class[] ifs,Type actualGenericParameter){
  for (  Class clz : ifs) {
    if (clz.getSimpleName().equals("String_Node_Str") || clz.getSimpleName().equals("String_Node_Str") || clz.getSimpleName().equals("String_Node_Str")) {
      continue;
    }
    if (clz.isAssignableFrom((Class)actualGenericParameter)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean checkInterfaces(Class[] ifs,Type actualGenericParameter){
  for (  Class clz : ifs) {
    if (clz.getSimpleName().equals("String_Node_Str") || clz.getSimpleName().equals("String_Node_Str") || clz.getSimpleName().equals("String_Node_Str")) {
      continue;
    }
    if (actualGenericParameter instanceof Class && clz.isAssignableFrom((Class)actualGenericParameter)) {
      return true;
    }
  }
  return false;
}
Program: 29044
Project: 29044
Buggy source:
public Class getClassFor(String serviceName){
  serviceName=getServiceTypeNameIfNamedComponent(serviceName);
  ConfigInjector injector=serviceLocator.getService(ConfigInjector.class,serviceName.toLowerCase());
  return getClassFromInjector(injector);
}

Fixed version (ground truth):
public Class getClassFor(String serviceName){
  serviceName=getServiceTypeNameIfNamedComponent(serviceName);
  ConfigInjector injector=serviceLocator.getService(ConfigInjector.class,serviceName.toLowerCase(Locale.getDefault()));
  return getClassFromInjector(injector);
}
Program: 29045
Project: 29045
Buggy source:
private static boolean equalsStr(String s,String t){
  if (s == t)   return true;
  if ((s != null) && (t != null)) {
    return s.equals(t);
  }
  return false;
}

Fixed version (ground truth):
private static boolean equalsStr(String s,String t){
  if (s == null && t == null)   return true;
  if ((s != null) && (t != null)) {
    return s.equals(t);
  }
  return false;
}
Program: 29046
Project: 29046
Buggy source:
private static boolean equalsStrIgnoreCase(String s,String t){
  if (s == t)   return true;
  if ((s != null) && (t != null)) {
    return s.equalsIgnoreCase(t);
  }
  return false;
}

Fixed version (ground truth):
private static boolean equalsStrIgnoreCase(String s,String t){
  if (s == null && t == null)   return true;
  if ((s != null) && (t != null)) {
    return s.equalsIgnoreCase(t);
  }
  return false;
}
Program: 29048
Project: 29048
Buggy source:
private void handleEntry(String entry,boolean isBeanArchive) throws ClassNotFoundException {
  if (legalClassName(entry)) {
    String className=filenameToClassname(entry);
    try {
      if (isBeanArchive) {
        beanClasses.add(getClassLoader().loadClass(className));
      }
      moduleClasses.add(getClassLoader().loadClass(className));
    }
 catch (    Throwable t) {
      logger.log(Level.WARNING,"String_Node_Str" + className + "String_Node_Str"+ t.toString());
    }
  }
 else   if (entry.endsWith("String_Node_Str")) {
    URL beansXmlUrl=Thread.currentThread().getContextClassLoader().getResource(entry);
    if (beansXmlUrl != null) {
      beansXmlUrLs.add(beansXmlUrl);
    }
  }
}

Fixed version (ground truth):
private void handleEntry(String entry,boolean isBeanArchive) throws ClassNotFoundException {
  if (legalClassName(entry)) {
    String className=filenameToClassname(entry);
    try {
      if (isBeanArchive) {
        beanClasses.add(getClassLoader().loadClass(className));
      }
      moduleClasses.add(getClassLoader().loadClass(className));
    }
 catch (    Throwable t) {
      logger.log(Level.WARNING,"String_Node_Str" + className + "String_Node_Str"+ t.toString());
    }
  }
 else   if (entry.endsWith("String_Node_Str")) {
    URL beansXmlUrl=Thread.currentThread().getContextClassLoader().getResource(entry);
    if (beansXmlUrl != null && !beansXmlUrLs.contains(beansXmlUrl)) {
      beansXmlUrLs.add(beansXmlUrl);
    }
  }
}
Program: 29049
Project: 29049
Buggy source:
public BeanDeploymentArchiveImpl(String id,List<Class<?>> wClasses,Set<URI> wUris,Collection<com.sun.enterprise.deployment.EjbDescriptor> ejbs,DeploymentContext ctx){
  this.id=id;
  this.moduleClasses=wClasses;
  this.beanClasses=new ArrayList<Class<?>>(wClasses);
  this.wUris=wUris;
  this.ejbDescImpls=new HashSet<EjbDescriptor<?>>();
  this.beanDeploymentArchives=new ArrayList<BeanDeploymentArchive>();
  this.context=ctx;
  populateEJBsForThisBDA(ejbs);
  this.moduleClassLoaderForBDA=Thread.currentThread().getContextClassLoader();
}

Fixed version (ground truth):
public BeanDeploymentArchiveImpl(String id,List<Class<?>> wClasses,List<URL> beansXmlUrls,Collection<com.sun.enterprise.deployment.EjbDescriptor> ejbs,DeploymentContext ctx){
  this.id=id;
  this.moduleClasses=wClasses;
  this.beanClasses=new ArrayList<Class<?>>(wClasses);
  this.beansXmlUrLs=beansXmlUrls;
  this.ejbDescImpls=new HashSet<EjbDescriptor<?>>();
  this.beanDeploymentArchives=new ArrayList<BeanDeploymentArchive>();
  this.context=ctx;
  populateEJBsForThisBDA(ejbs);
  this.moduleClassLoaderForBDA=Thread.currentThread().getContextClassLoader();
}
Program: 29050
Project: 29050
Buggy source:
public BeansXml getBeansXml(){
  WeldBootstrap wb=context.getTransientAppMetaData(WeldDeployer.WELD_BOOTSTRAP,WeldBootstrap.class);
  List<URL> sl=new ArrayList<URL>();
  for (  URI u : wUris) {
    try {
      sl.add(u.toURL());
    }
 catch (    MalformedURLException mfue) {
      logger.log(Level.WARNING,"String_Node_Str" + u,mfue);
    }
  }
  return wb.parse(sl);
}

Fixed version (ground truth):
public BeansXml getBeansXml(){
  WeldBootstrap wb=context.getTransientAppMetaData(WeldDeployer.WELD_BOOTSTRAP,WeldBootstrap.class);
  return wb.parse(beansXmlUrLs);
}
Program: 29052
Project: 29052
Buggy source:
private void handleEntry(String entry,boolean isBeanArchive) throws ClassNotFoundException {
  if (legalClassName(entry)) {
    String className=filenameToClassname(entry);
    try {
      if (isBeanArchive) {
        beanClasses.add(getClassLoader().loadClass(className));
      }
      moduleClasses.add(getClassLoader().loadClass(className));
    }
 catch (    Throwable t) {
      logger.log(Level.WARNING,"String_Node_Str" + className + "String_Node_Str"+ t.toString());
    }
  }
 else   if (entry.endsWith("String_Node_Str")) {
    try {
      URL beansXmlUrl=Thread.currentThread().getContextClassLoader().getResource(entry);
      if (beansXmlUrl != null) {
        wUris.add(beansXmlUrl.toURI());
      }
    }
 catch (    URISyntaxException use) {
      logger.log(Level.WARNING,"String_Node_Str" + entry,use);
    }
  }
}

Fixed version (ground truth):
private void handleEntry(String entry,boolean isBeanArchive) throws ClassNotFoundException {
  if (legalClassName(entry)) {
    String className=filenameToClassname(entry);
    try {
      if (isBeanArchive) {
        beanClasses.add(getClassLoader().loadClass(className));
      }
      moduleClasses.add(getClassLoader().loadClass(className));
    }
 catch (    Throwable t) {
      logger.log(Level.WARNING,"String_Node_Str" + className + "String_Node_Str"+ t.toString());
    }
  }
 else   if (entry.endsWith("String_Node_Str")) {
    URL beansXmlUrl=Thread.currentThread().getContextClassLoader().getResource(entry);
    if (beansXmlUrl != null) {
      beansXmlUrLs.add(beansXmlUrl);
    }
  }
}
Program: 29054
Project: 29054
Buggy source:
private void bindIntermediateContexts(Map namespace,String name) throws NamingException {
  String partialName;
  if (name.startsWith("String_Node_Str")) {
    partialName="String_Node_Str";
  }
 else   if (name.startsWith("String_Node_Str")) {
    partialName="String_Node_Str";
  }
 else   if (name.startsWith("String_Node_Str")) {
    partialName="String_Node_Str";
  }
 else {
    throw new NamingException("String_Node_Str" + name);
  }
  name=name.substring((partialName + "String_Node_Str").length());
  StringTokenizer toks=new StringTokenizer(name,"String_Node_Str",false);
  while (toks.hasMoreTokens()) {
    String tok=toks.nextToken();
    partialName=partialName + "String_Node_Str" + tok;
    if (namespace.get(partialName) == null) {
      namespace.put(partialName,new JavaURLContext(partialName,null));
    }
  }
}

Fixed version (ground truth):
private void bindIntermediateContexts(Map namespace,String name) throws NamingException {
  String partialName;
  if (name.startsWith("String_Node_Str")) {
    partialName="String_Node_Str";
  }
 else   if (name.startsWith("String_Node_Str")) {
    partialName="String_Node_Str";
  }
 else   if (name.startsWith("String_Node_Str")) {
    partialName="String_Node_Str";
  }
 else {
    throw new NamingException("String_Node_Str" + name);
  }
  name=name.substring((partialName + "String_Node_Str").length());
  StringTokenizer toks=new StringTokenizer(name,"String_Node_Str",false);
  StringBuilder sb=new StringBuilder();
  sb.append(partialName);
  while (toks.hasMoreTokens()) {
    String tok=toks.nextToken();
    sb.append("String_Node_Str").append(tok);
    partialName=sb.toString();
    if (namespace.get(partialName) == null) {
      namespace.put(partialName,new JavaURLContext(partialName,null));
    }
  }
}
Program: 29059
Project: 29059
Buggy source:
public static void main(String[] args){
  long startTime=System.currentTimeMillis();
  AsadminMain asadminMain=new AsadminMain();
  int code=asadminMain.doMain(args);
  System.exit(code);
}

Fixed version (ground truth):
public static void main(String[] args){
  AsadminMain asadminMain=new AsadminMain();
  int code=asadminMain.doMain(args);
  System.exit(code);
}
Program: 29061
Project: 29061
Buggy source:
/** 
 * Copies the contents of the given error page to the response, and updates the status message with the reason string of the error page.
 * @param response The response object
 * @param errorPage The error page whose contents are to be copied
 * @param statusCode The status code
 */
private void handleHostErrorPage(Response response,ErrorPage errorPage,int statusCode) throws Exception {
  ServletOutputStream ostream=null;
  PrintWriter writer=null;
  FileReader reader=null;
  BufferedInputStream istream=null;
  IOException ioe=null;
  String message=errorPage.getReason();
  if (message != null) {
    ((HttpResponse)response).reset(statusCode,message);
  }
  try {
    ostream=response.getResponse().getOutputStream();
  }
 catch (  IllegalStateException e) {
    writer=response.getResponse().getWriter();
  }
  if (writer != null) {
    reader=new FileReader(errorPage.getLocation());
    ioe=ResponseUtil.copy(reader,writer);
    try {
      reader.close();
    }
 catch (    Throwable t) {
      ;
    }
  }
 else {
    istream=new BufferedInputStream(new FileInputStream(errorPage.getLocation()));
    ioe=ResponseUtil.copy(istream,ostream);
    try {
      istream.close();
    }
 catch (    Throwable t) {
      ;
    }
  }
  if (ioe != null) {
    throw ioe;
  }
}

Fixed version (ground truth):
/** 
 * Copies the contents of the given error page to the response, and updates the status message with the reason string of the error page.
 * @param response The response object
 * @param errorPage The error page whose contents are to be copied
 * @param statusCode The status code
 */
private void handleHostErrorPage(Response response,ErrorPage errorPage,int statusCode) throws Exception {
  ServletOutputStream ostream=null;
  PrintWriter writer=null;
  FileReader reader=null;
  BufferedInputStream istream=null;
  IOException ioe=null;
  if (!response.getResponse().isCommitted()) {
    response.resetBuffer(true);
  }
  String message=errorPage.getReason();
  if (message != null) {
    ((HttpResponse)response).reset(statusCode,message);
  }
  try {
    ostream=response.getResponse().getOutputStream();
  }
 catch (  IllegalStateException e) {
    writer=response.getResponse().getWriter();
  }
  if (writer != null) {
    reader=new FileReader(errorPage.getLocation());
    ioe=ResponseUtil.copy(reader,writer);
    try {
      reader.close();
    }
 catch (    Throwable t) {
      ;
    }
  }
 else {
    istream=new BufferedInputStream(new FileInputStream(errorPage.getLocation()));
    ioe=ResponseUtil.copy(istream,ostream);
    try {
      istream.close();
    }
 catch (    Throwable t) {
      ;
    }
  }
  if (ioe != null) {
    throw ioe;
  }
}
Program: 29064
Project: 29064
Buggy source:
protected void createBeanPool(){
  ObjectFactory sessionCtxFactory=new SessionContextFactory();
  iased=ejbDescriptor.getIASEjbExtraDescriptors();
  if (iased != null) {
    beanPoolDes=iased.getBeanPool();
  }
  poolProp=new PoolProperties();
  String val=ejbDescriptor.getEjbBundleDescriptor().getEnterpriseBeansProperty(SINGLETON_BEAN_POOL_PROP);
  pool=new NonBlockingPool(getContainerId(),ejbDescriptor.getName(),sessionCtxFactory,poolProp.steadyPoolSize,poolProp.poolResizeQuantity,poolProp.maxPoolSize,poolProp.poolIdleTimeoutInSeconds,loader,Boolean.parseBoolean(val));
}

Fixed version (ground truth):
protected void createBeanPool(){
  ObjectFactory sessionCtxFactory=new SessionContextFactory();
  iased=ejbDescriptor.getIASEjbExtraDescriptors();
  if (iased != null) {
    beanPoolDes=iased.getBeanPool();
  }
  poolProp=new PoolProperties(ejbContainer,beanPoolDes);
  String val=ejbDescriptor.getEjbBundleDescriptor().getEnterpriseBeansProperty(SINGLETON_BEAN_POOL_PROP);
  pool=new NonBlockingPool(getContainerId(),ejbDescriptor.getName(),sessionCtxFactory,poolProp.steadyPoolSize,poolProp.poolResizeQuantity,poolProp.maxPoolSize,poolProp.poolIdleTimeoutInSeconds,loader,Boolean.parseBoolean(val));
}
Program: 29065
Project: 29065
Buggy source:
public PoolProperties(){
  maxPoolSize=Integer.parseInt(ejbContainer.getMaxPoolSize());
  poolIdleTimeoutInSeconds=Integer.parseInt(ejbContainer.getPoolIdleTimeoutInSeconds());
  poolResizeQuantity=Integer.parseInt(ejbContainer.getPoolResizeQuantity());
  steadyPoolSize=Integer.parseInt(ejbContainer.getSteadyPoolSize());
  if (beanPoolDes != null) {
    int temp=0;
    if ((temp=beanPoolDes.getMaxPoolSize()) != -1) {
      maxPoolSize=temp;
    }
    if ((temp=beanPoolDes.getPoolIdleTimeoutInSeconds()) != -1) {
      poolIdleTimeoutInSeconds=temp;
    }
    if ((temp=beanPoolDes.getPoolResizeQuantity()) != -1) {
      poolResizeQuantity=temp;
    }
    if ((temp=beanPoolDes.getSteadyPoolSize()) != -1) {
      steadyPoolSize=temp;
    }
  }
}

Fixed version (ground truth):
public PoolProperties(EjbContainer ejbContainer,BeanPoolDescriptor beanPoolDes){
  maxPoolSize=Integer.parseInt(ejbContainer.getMaxPoolSize());
  poolIdleTimeoutInSeconds=Integer.parseInt(ejbContainer.getPoolIdleTimeoutInSeconds());
  poolResizeQuantity=Integer.parseInt(ejbContainer.getPoolResizeQuantity());
  steadyPoolSize=Integer.parseInt(ejbContainer.getSteadyPoolSize());
  if (beanPoolDes != null) {
    int temp=0;
    if ((temp=beanPoolDes.getMaxPoolSize()) != -1) {
      maxPoolSize=temp;
    }
    if ((temp=beanPoolDes.getPoolIdleTimeoutInSeconds()) != -1) {
      poolIdleTimeoutInSeconds=temp;
    }
    if ((temp=beanPoolDes.getPoolResizeQuantity()) != -1) {
      poolResizeQuantity=temp;
    }
    if ((temp=beanPoolDes.getSteadyPoolSize()) != -1) {
      steadyPoolSize=temp;
    }
  }
}
Program: 29066
Project: 29066
Buggy source:
/** 
 * Called from EjbCMPEntityDescriptor when some classes in this object are updated.
 */
public boolean classesChanged(){
  persistentClass=null;
  stateClass=null;
  Class persClass=getPersistentClass();
  Vector fieldDescriptors=parentDesc.getFieldDescriptors();
  if (this.cmpFields != null) {
    for (Iterator iter=cmpFields.iterator(); iter.hasNext(); ) {
      FieldDescriptor next=(FieldDescriptor)iter.next();
      if (!fieldDescriptors.contains(next)) {
        iter.remove();
      }
    }
  }
  if (this.pkeyFields != null) {
    for (Iterator iter=pkeyFields.iterator(); iter.hasNext(); ) {
      FieldDescriptor next=(FieldDescriptor)iter.next();
      if (!fieldDescriptors.contains(next)) {
        iter.remove();
      }
    }
  }
  FieldDescriptor primKeyFieldDesc=parentDesc.getPrimaryKeyFieldDesc();
  if ((primKeyFieldDesc != null) && !fieldDescriptors.contains(primKeyFieldDesc)) {
    parentDesc.setPrimaryKeyFieldDesc(null);
  }
  Hashtable queriesClone=(Hashtable)queries.clone();
  queries=new Hashtable();
  initializeAllQueriedMethods();
  Iterator it=queriesClone.keySet().iterator();
  while (it.hasNext()) {
    Method oldMethod=(Method)it.next();
    Method newMethod=findEquivalentMethod(allQueriedMethods,oldMethod);
    if (newMethod != null) {
      QueryDescriptor oldQuery=(QueryDescriptor)queriesClone.get(oldMethod);
      QueryDescriptor newQuery=new QueryDescriptor(oldQuery,newMethod);
      queries.put(newMethod,newQuery);
    }
  }
  invalidate();
  return false;
}

Fixed version (ground truth):
/** 
 * Called from EjbCMPEntityDescriptor when some classes in this object are updated.
 */
public boolean classesChanged(){
  persistentClass=null;
  stateClass=null;
  Class persClass=getPersistentClass();
  Vector fieldDescriptors=parentDesc.getFieldDescriptors();
  if (this.cmpFields != null) {
    for (Iterator iter=cmpFields.iterator(); iter.hasNext(); ) {
      FieldDescriptor next=(FieldDescriptor)iter.next();
      if (!fieldDescriptors.contains(next)) {
        iter.remove();
      }
    }
  }
  if (this.pkeyFields != null) {
    for (Iterator iter=pkeyFields.iterator(); iter.hasNext(); ) {
      FieldDescriptor next=(FieldDescriptor)iter.next();
      if (!fieldDescriptors.contains(next)) {
        iter.remove();
      }
    }
  }
  FieldDescriptor primKeyFieldDesc=parentDesc.getPrimaryKeyFieldDesc();
  if ((primKeyFieldDesc != null) && !fieldDescriptors.contains(primKeyFieldDesc)) {
    parentDesc.setPrimaryKeyFieldDesc(null);
  }
  Hashtable queriesClone=(Hashtable)queries.clone();
  queries=new Hashtable();
  initializeAllQueriedMethods();
  for (  Object o : queriesClone.entrySet()) {
    Map.Entry entry=(Map.Entry)o;
    Method oldMethod=(Method)entry.getKey();
    Method newMethod=findEquivalentMethod(allQueriedMethods,oldMethod);
    if (newMethod != null) {
      QueryDescriptor oldQuery=(QueryDescriptor)entry.getValue();
      QueryDescriptor newQuery=new QueryDescriptor(oldQuery,newMethod);
      queries.put(newMethod,newQuery);
    }
  }
  invalidate();
  return false;
}
Program: 29067
Project: 29067
Buggy source:
public void setParentDescriptor(Descriptor parentDesc){
  this.parentDesc=(EjbCMPEntityDescriptor)parentDesc;
}

Fixed version (ground truth):
public void setParentDescriptor(EjbCMPEntityDescriptor parentDesc){
  this.parentDesc=parentDesc;
}
Program: 29068
Project: 29068
Buggy source:
/** 
 * Checks whether two methods that might have been loaded by different class loaders are equal.  
 * @param compareDeclaringClass if true, declaring class willbe considered as part of equality test.  
 */
private boolean methodsEqual(MethodDescriptor m1,Method m2,boolean compareDeclaringClass){
  Method m=m1.getMethod(parentDesc);
  return methodsEqual(m,m2,compareDeclaringClass);
}

Fixed version (ground truth):
/** 
 * Checks whether two methods that might have been loaded by different class loaders are equal.  
 * @param compareDeclaringClass if true, declaring class willbe considered as part of equality test.  
 */
private boolean methodsEqual(Method m1,Method m2,boolean compareDeclaringClass){
  boolean equal=false;
  do {
    String m1Name=m1.getName();
    String m2Name=m2.getName();
    if (!m1Name.equals(m2Name)) {
      break;
    }
    String m1DeclaringClass=m1.getDeclaringClass().getName();
    String m2DeclaringClass=m2.getDeclaringClass().getName();
    if (compareDeclaringClass) {
      if (!m1DeclaringClass.equals(m2DeclaringClass)) {
        break;
      }
    }
    Class[] m1ParamTypes=m1.getParameterTypes();
    Class[] m2ParamTypes=m2.getParameterTypes();
    if (m1ParamTypes.length != m2ParamTypes.length) {
      break;
    }
    equal=true;
    for (int pIndex=0; pIndex < m1ParamTypes.length; pIndex++) {
      String m1ParamClass=m1ParamTypes[pIndex].getName();
      String m2ParamClass=m2ParamTypes[pIndex].getName();
      if (!m1ParamClass.equals(m2ParamClass)) {
        equal=false;
        break;
      }
    }
  }
 while (false);
  return equal;
}
Program: 29069
Project: 29069
Buggy source:
/** 
 * write the descriptor class to a DOM tree and return it
 * @param parent node in the DOM tree 
 * @param nodeName name for the root element of this xml fragment
 * @param ejb the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent,String nodeName,EjbDescriptor ejb){
  Map methodToTransactions=ejb.getMethodContainerTransactions();
  MethodNode mn=new MethodNode();
  for (Iterator e=methodToTransactions.keySet().iterator(); e.hasNext(); ) {
    MethodDescriptor md=(MethodDescriptor)e.next();
    Node ctNode=super.writeDescriptor(parent,nodeName,ejb);
    ContainerTransaction ct=(ContainerTransaction)methodToTransactions.get(md);
    appendTextChild(ctNode,EjbTagNames.DESCRIPTION,ct.getDescription());
    mn.writeDescriptor(ctNode,EjbTagNames.METHOD,md,ejb.getName());
    appendTextChild(ctNode,EjbTagNames.TRANSACTION_ATTRIBUTE,ct.getTransactionAttribute());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * write the descriptor class to a DOM tree and return it
 * @param parent node in the DOM tree 
 * @param nodeName name for the root element of this xml fragment
 * @param ejb the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent,String nodeName,EjbDescriptor ejb){
  Map methodToTransactions=ejb.getMethodContainerTransactions();
  MethodNode mn=new MethodNode();
  for (  Object o : methodToTransactions.entrySet()) {
    Map.Entry entry=(Map.Entry)o;
    MethodDescriptor md=(MethodDescriptor)entry.getKey();
    Node ctNode=super.writeDescriptor(parent,nodeName,ejb);
    ContainerTransaction ct=(ContainerTransaction)entry.getValue();
    appendTextChild(ctNode,EjbTagNames.DESCRIPTION,ct.getDescription());
    mn.writeDescriptor(ctNode,EjbTagNames.METHOD,md,ejb.getName());
    appendTextChild(ctNode,EjbTagNames.TRANSACTION_ATTRIBUTE,ct.getTransactionAttribute());
  }
  return null;
}
Program: 29071
Project: 29071
Buggy source:
private void addMethodPermissions(EjbDescriptor ejb,Map mpToMethods,Vector excludedMethods,MethodPermissionNode mpNode,Node assemblyNode){
  if (mpToMethods == null || mpToMethods.size() == 0) {
    return;
  }
  for (Iterator mpIterator=mpToMethods.keySet().iterator(); mpIterator.hasNext(); ) {
    MethodPermission mp=(MethodPermission)mpIterator.next();
    if (mp.isExcluded()) {
      Set methods=(Set)mpToMethods.get(mp);
      excludedMethods.addAll(methods);
    }
 else {
      MethodPermissionDescriptor mpd=new MethodPermissionDescriptor();
      mpd.addMethodPermission(mp);
      mpd.addMethods((Set)mpToMethods.get(mp));
      mpNode.writeDescriptor(assemblyNode,EjbTagNames.METHOD_PERMISSION,mpd,ejb);
    }
  }
}

Fixed version (ground truth):
private void addMethodPermissions(EjbDescriptor ejb,Map mpToMethods,Vector excludedMethods,MethodPermissionNode mpNode,Node assemblyNode){
  if (mpToMethods == null || mpToMethods.size() == 0) {
    return;
  }
  for (  Object o : mpToMethods.entrySet()) {
    Map.Entry entry=(Map.Entry)o;
    MethodPermission mp=(MethodPermission)entry.getKey();
    if (mp.isExcluded()) {
      Set methods=(Set)entry.getValue();
      excludedMethods.addAll(methods);
    }
 else {
      MethodPermissionDescriptor mpd=new MethodPermissionDescriptor();
      mpd.addMethodPermission(mp);
      mpd.addMethods((Set)mpToMethods.get(mp));
      mpNode.writeDescriptor(assemblyNode,EjbTagNames.METHOD_PERMISSION,mpd,ejb);
    }
  }
}
Program: 29073
Project: 29073
Buggy source:
public void execute(AdminCommandContext context){
  final ActionReport report=context.getActionReport();
  logger.entering(getClass().getName(),"String_Node_Str",new Object[]{destName,destType});
  try {
    validateJMSDestName(destName);
    validateJMSDestType(destType);
  }
 catch (  IllegalArgumentException e) {
    report.setMessage(e.getMessage());
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  try {
    Object ret=deleteJMSDestination(destName,destType,target);
    return;
  }
 catch (  Exception e) {
    logger.throwing(getClass().getName(),"String_Node_Str",e);
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
  }
}

Fixed version (ground truth):
public void execute(AdminCommandContext context){
  final ActionReport report=context.getActionReport();
  logger.entering(getClass().getName(),"String_Node_Str",new Object[]{destName,destType});
  try {
    validateJMSDestName(destName);
    validateJMSDestType(destType);
  }
 catch (  IllegalArgumentException e) {
    report.setMessage(e.getMessage());
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  try {
    deleteJMSDestination(destName,destType,target);
    return;
  }
 catch (  Exception e) {
    logger.throwing(getClass().getName(),"String_Node_Str",e);
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
  }
}
Program: 29074
Project: 29074
Buggy source:
public void purgeJMSDestination(String destName,String destType,String tgtName) throws Exception {
  logger.log(Level.FINE,"String_Node_Str");
  MQJMXConnectorInfo[] mqInfos=getMQJMXConnectorInfos(target,config,serverContext,domain,connectorRuntime);
  if (mqInfos != null && mqInfos.length > 0) {
    for (    MQJMXConnectorInfo mqInfo : mqInfos) {
      try {
        MBeanServerConnection mbsc=mqInfo.getMQMBeanServerConnection();
        if (destType.equalsIgnoreCase("String_Node_Str")) {
          destType=DESTINATION_TYPE_TOPIC;
        }
 else         if (destType.equalsIgnoreCase("String_Node_Str")) {
          destType=DESTINATION_TYPE_QUEUE;
        }
        ObjectName on=createDestinationConfig(destType,destName);
        String[] signature=null;
        Object[] params=null;
        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):
public void purgeJMSDestination(String destName,String destType,String tgtName) throws Exception {
  logger.log(Level.FINE,"String_Node_Str");
  MQJMXConnectorInfo[] mqInfos=getMQJMXConnectorInfos(target,config,serverContext,domain,connectorRuntime);
  if (mqInfos != null && mqInfos.length > 0) {
    for (    MQJMXConnectorInfo mqInfo : mqInfos) {
      try {
        MBeanServerConnection mbsc=mqInfo.getMQMBeanServerConnection();
        if (destType.equalsIgnoreCase("String_Node_Str")) {
          destType=DESTINATION_TYPE_TOPIC;
        }
 else         if (destType.equalsIgnoreCase("String_Node_Str")) {
          destType=DESTINATION_TYPE_QUEUE;
        }
        ObjectName on=createDestinationConfig(destType,destName);
        mbsc.invoke(on,"String_Node_Str",null,null);
      }
 catch (      Exception e) {
        logAndHandleException(e,"String_Node_Str");
      }
 finally {
        try {
          if (mqInfo != null) {
            mqInfo.closeMQMBeanServerConnection();
          }
        }
 catch (        Exception e) {
          handleException(e);
        }
      }
    }
  }
}
Program: 29077
Project: 29077
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) {
      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<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;
}
Program: 29078
Project: 29078
Buggy source:
public CacheProperties(EntityContainer entityContainer){
  numberOfVictimsToSelect=Integer.parseInt(entityContainer.ejbContainer.getCacheResizeQuantity());
  maxCacheSize=Integer.parseInt(entityContainer.ejbContainer.getMaxCacheSize());
  cacheIdleTimeoutInSeconds=Integer.parseInt(entityContainer.ejbContainer.getCacheIdleTimeoutInSeconds());
  victimSelectionPolicy=entityContainer.ejbContainer.getVictimSelectionPolicy();
  removalTimeoutInSeconds=Integer.parseInt(entityContainer.ejbContainer.getRemovalTimeoutInSeconds());
  if (entityContainer.beanCacheDes != null) {
    int temp=0;
    if ((temp=entityContainer.beanCacheDes.getResizeQuantity()) != -1) {
      numberOfVictimsToSelect=temp;
    }
    if ((temp=entityContainer.beanCacheDes.getMaxCacheSize()) != -1) {
      maxCacheSize=temp;
    }
    if ((temp=entityContainer.beanCacheDes.getCacheIdleTimeoutInSeconds()) != -1) {
      cacheIdleTimeoutInSeconds=temp;
    }
    if ((entityContainer.beanCacheDes.getVictimSelectionPolicy()) != null) {
      victimSelectionPolicy=entityContainer.beanCacheDes.getVictimSelectionPolicy();
    }
    if ((temp=entityContainer.beanCacheDes.getRemovalTimeoutInSeconds()) != -1) {
      removalTimeoutInSeconds=temp;
    }
  }
}

Fixed version (ground truth):
public CacheProperties(EntityContainer entityContainer){
  numberOfVictimsToSelect=Integer.parseInt(entityContainer.ejbContainer.getCacheResizeQuantity());
  maxCacheSize=Integer.parseInt(entityContainer.ejbContainer.getMaxCacheSize());
  cacheIdleTimeoutInSeconds=Integer.parseInt(entityContainer.ejbContainer.getCacheIdleTimeoutInSeconds());
  if (entityContainer.beanCacheDes != null) {
    int temp=0;
    if ((temp=entityContainer.beanCacheDes.getResizeQuantity()) != -1) {
      numberOfVictimsToSelect=temp;
    }
    if ((temp=entityContainer.beanCacheDes.getMaxCacheSize()) != -1) {
      maxCacheSize=temp;
    }
    if ((temp=entityContainer.beanCacheDes.getCacheIdleTimeoutInSeconds()) != -1) {
      cacheIdleTimeoutInSeconds=temp;
    }
  }
}
Program: 29080
Project: 29080
Buggy source:
/** 
 * @return a method object representing the target of a web service invocation
 */
public Method getInvMethod(Tie webServiceTie,MessageContext context) throws Exception {
  SOAPMessageContext soapMsgContext=(SOAPMessageContext)context;
  SOAPMessage message=soapMsgContext.getMessage();
  StreamingHandler streamingHandler=(StreamingHandler)webServiceTie;
  int opcode=streamingHandler.getOpcodeForRequestMessage(message);
  return streamingHandler.getMethodForOpcode(opcode);
}

Fixed version (ground truth):
/** 
 * @return a method object representing the target of a web service invocation
 */
public Method getInvMethod(Tie webServiceTie,MessageContext context) throws Exception {
  SOAPMessageContext soapMsgContext=(SOAPMessageContext)context;
  SOAPMessage message=soapMsgContext.getMessage();
  if (!(webServiceTie instanceof StreamingHandler)) {
    throw new IllegalArgumentException(webServiceTie + "String_Node_Str");
  }
  StreamingHandler streamingHandler=(StreamingHandler)webServiceTie;
  int opcode=streamingHandler.getOpcodeForRequestMessage(message);
  return streamingHandler.getMethodForOpcode(opcode);
}
Program: 29082
Project: 29082
Buggy source:
@Override public <A>A get(String key,Class<A> clazz){
  if (key == null || key.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (clazz == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  DataProvider provider=adminCahceUtils.getProvider(clazz);
  if (provider == null) {
    return null;
  }
  InputStream is=null;
  try {
    is=getInputStream(key);
    return (A)provider.toInstance(is,clazz);
  }
 catch (  FileNotFoundException ex) {
    return null;
  }
catch (  IOException ex) {
    if (logger.isLoggable(Level.WARNING)) {
      logger.log(Level.WARNING,AdminLoggerInfo.mCannotReadCache,new Object[]{key});
    }
    return null;
  }
 finally {
    try {
      is.close();
    }
 catch (    Exception ex) {
    }
  }
}

Fixed version (ground truth):
@Override public <A>A get(String key,Class<A> clazz){
  if (key == null || key.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (clazz == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  DataProvider provider=adminCahceUtils.getProvider(clazz);
  if (provider == null) {
    return null;
  }
  InputStream is=null;
  try {
    is=getInputStream(key);
    return (A)provider.toInstance(is,clazz);
  }
 catch (  FileNotFoundException ex) {
    return null;
  }
catch (  IOException ex) {
    if (logger.isLoggable(Level.WARNING)) {
      logger.log(Level.WARNING,AdminLoggerInfo.mCannotReadCache,new Object[]{key});
    }
    return null;
  }
 finally {
    if (is != null) {
      try {
        is.close();
      }
 catch (      Exception ex) {
      }
    }
  }
}
Program: 29083
Project: 29083
Buggy source:
public static Habitat getHabitat(){
  ServletContext servletCtx=(ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();
  Habitat habitat=(Habitat)servletCtx.getAttribute(org.glassfish.admingui.common.plugin.ConsoleClassLoader.HABITAT_ATTRIBUTE);
  return habitat;
}

Fixed version (ground truth):
public static ServiceLocator getHabitat(){
  ServletContext servletCtx=(ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();
  ServiceLocator habitat=(ServiceLocator)servletCtx.getAttribute(org.glassfish.admingui.common.plugin.ConsoleClassLoader.HABITAT_ATTRIBUTE);
  return habitat;
}
Program: 29084
Project: 29084
Buggy source:
public GlassFishDocument(final Habitat habitat,final ExecutorService executor){
  super(habitat);
  ServiceLocatorUtilities.addOneConstant(habitat,executor,"String_Node_Str",ExecutorService.class);
  ServiceLocatorUtilities.addOneConstant(habitat,this,null,DomDocument.class);
  final DomDocument doc=this;
  habitat.<Transactions>getService(Transactions.class).addTransactionsListener(new TransactionListener(){
    public void transactionCommited(    List<PropertyChangeEvent> changes){
      for (      ConfigurationPersistence pers : habitat.<ConfigurationPersistence>getAllServices(ConfigurationPersistence.class)) {
        try {
          if (doc.getRoot().getProxyType().equals(Domain.class)) {
            Dom domainRoot=doc.getRoot();
            domainRoot.attribute("String_Node_Str",Version.getBuildVersion());
          }
          pers.save(doc);
        }
 catch (        IOException e) {
          logger.log(Level.SEVERE,"String_Node_Str",new String[]{e.getMessage()});
          logger.log(Level.FINE,e.getMessage(),e);
        }
catch (        XMLStreamException e) {
          logger.log(Level.SEVERE,"String_Node_Str",new String[]{e.getMessage()});
          logger.log(Level.SEVERE,e.getMessage(),e);
        }
      }
    }
    public void unprocessedTransactedEvents(    List<UnprocessedChangeEvents> changes){
    }
  }
);
}

Fixed version (ground truth):
public GlassFishDocument(final ServiceLocator habitat,final ExecutorService executor){
  super(habitat);
  ServiceLocatorUtilities.addOneConstant(habitat,executor,"String_Node_Str",ExecutorService.class);
  ServiceLocatorUtilities.addOneConstant(habitat,this,null,DomDocument.class);
  final DomDocument doc=this;
  habitat.<Transactions>getService(Transactions.class).addTransactionsListener(new TransactionListener(){
    public void transactionCommited(    List<PropertyChangeEvent> changes){
      for (      ConfigurationPersistence pers : habitat.<ConfigurationPersistence>getAllServices(ConfigurationPersistence.class)) {
        try {
          if (doc.getRoot().getProxyType().equals(Domain.class)) {
            Dom domainRoot=doc.getRoot();
            domainRoot.attribute("String_Node_Str",Version.getBuildVersion());
          }
          pers.save(doc);
        }
 catch (        IOException e) {
          logger.log(Level.SEVERE,"String_Node_Str",new String[]{e.getMessage()});
          logger.log(Level.FINE,e.getMessage(),e);
        }
catch (        XMLStreamException e) {
          logger.log(Level.SEVERE,"String_Node_Str",new String[]{e.getMessage()});
          logger.log(Level.SEVERE,e.getMessage(),e);
        }
      }
    }
    public void unprocessedTransactedEvents(    List<UnprocessedChangeEvents> changes){
    }
  }
);
}
Program: 29085
Project: 29085
Buggy source:
@Override public GlassFishConfigBean make(final ServiceLocator habitat,XMLStreamReader xmlStreamReader,GlassFishConfigBean dom,ConfigModel configModel){
  return new GlassFishConfigBean((Habitat)habitat,this,dom,configModel,xmlStreamReader);
}

Fixed version (ground truth):
@Override public GlassFishConfigBean make(final ServiceLocator habitat,XMLStreamReader xmlStreamReader,GlassFishConfigBean dom,ConfigModel configModel){
  return new GlassFishConfigBean(habitat,this,dom,configModel,xmlStreamReader);
}
Program: 29087
Project: 29087
Buggy source:
public CacheProperties(){
  numberOfVictimsToSelect=Integer.parseInt(ejbContainer.getCacheResizeQuantity());
  maxCacheSize=Integer.parseInt(ejbContainer.getMaxCacheSize());
  cacheIdleTimeoutInSeconds=Integer.parseInt(ejbContainer.getCacheIdleTimeoutInSeconds());
  victimSelectionPolicy=ejbContainer.getVictimSelectionPolicy();
  removalTimeoutInSeconds=Integer.parseInt(ejbContainer.getRemovalTimeoutInSeconds());
  if (beanCacheDes != null) {
    int temp=0;
    if ((temp=beanCacheDes.getResizeQuantity()) != -1) {
      numberOfVictimsToSelect=temp;
    }
    if ((temp=beanCacheDes.getMaxCacheSize()) != -1) {
      maxCacheSize=temp;
    }
    if ((temp=beanCacheDes.getCacheIdleTimeoutInSeconds()) != -1) {
      cacheIdleTimeoutInSeconds=temp;
    }
    if ((beanCacheDes.getVictimSelectionPolicy()) != null) {
      victimSelectionPolicy=beanCacheDes.getVictimSelectionPolicy();
    }
    if ((temp=beanCacheDes.getRemovalTimeoutInSeconds()) != -1) {
      removalTimeoutInSeconds=temp;
    }
  }
}

Fixed version (ground truth):
public CacheProperties(EntityContainer entityContainer){
  numberOfVictimsToSelect=Integer.parseInt(entityContainer.ejbContainer.getCacheResizeQuantity());
  maxCacheSize=Integer.parseInt(entityContainer.ejbContainer.getMaxCacheSize());
  cacheIdleTimeoutInSeconds=Integer.parseInt(entityContainer.ejbContainer.getCacheIdleTimeoutInSeconds());
  victimSelectionPolicy=entityContainer.ejbContainer.getVictimSelectionPolicy();
  removalTimeoutInSeconds=Integer.parseInt(entityContainer.ejbContainer.getRemovalTimeoutInSeconds());
  if (entityContainer.beanCacheDes != null) {
    int temp=0;
    if ((temp=entityContainer.beanCacheDes.getResizeQuantity()) != -1) {
      numberOfVictimsToSelect=temp;
    }
    if ((temp=entityContainer.beanCacheDes.getMaxCacheSize()) != -1) {
      maxCacheSize=temp;
    }
    if ((temp=entityContainer.beanCacheDes.getCacheIdleTimeoutInSeconds()) != -1) {
      cacheIdleTimeoutInSeconds=temp;
    }
    if ((entityContainer.beanCacheDes.getVictimSelectionPolicy()) != null) {
      victimSelectionPolicy=entityContainer.beanCacheDes.getVictimSelectionPolicy();
    }
    if ((temp=entityContainer.beanCacheDes.getRemovalTimeoutInSeconds()) != -1) {
      removalTimeoutInSeconds=temp;
    }
  }
}
Program: 29088
Project: 29088
Buggy source:
private void createCaches() throws Exception {
  cacheProp=new CacheProperties();
  int cacheSize=cacheProp.maxCacheSize;
  int numberOfVictimsToSelect=cacheProp.numberOfVictimsToSelect;
  float loadFactor=DEFAULT_LOAD_FACTOR;
  idleTimeout=cacheProp.cacheIdleTimeoutInSeconds * 1000L;
  createReadyStore(cacheSize,numberOfVictimsToSelect,loadFactor,idleTimeout);
  createEJBObjectStores(cacheSize,numberOfVictimsToSelect,idleTimeout);
}

Fixed version (ground truth):
private void createCaches() throws Exception {
  cacheProp=new CacheProperties(this);
  int cacheSize=cacheProp.maxCacheSize;
  int numberOfVictimsToSelect=cacheProp.numberOfVictimsToSelect;
  float loadFactor=DEFAULT_LOAD_FACTOR;
  idleTimeout=cacheProp.cacheIdleTimeoutInSeconds * 1000L;
  createReadyStore(cacheSize,numberOfVictimsToSelect,loadFactor,idleTimeout);
  createEJBObjectStores(cacheSize,numberOfVictimsToSelect,idleTimeout);
}
Program: 29089
Project: 29089
Buggy source:
/** 
 * Called from the ContainerFactory during initialization.
 */
protected void initializeHome() throws Exception {
  ObjectFactory entityCtxFactory=new EntityContextFactory(this);
  int steadyPoolSize=0;
  int resizeQuantity=10;
  int idleTimeoutInSeconds=Integer.MAX_VALUE - 1;
  poolProp=new PoolProperties();
  super.initializeHome();
  entityCtxPool=new NonBlockingPool(getContainerId(),ejbDescriptor.getName(),entityCtxFactory,poolProp.steadyPoolSize,poolProp.poolResizeQuantity,poolProp.maxPoolSize,poolProp.poolIdleTimeoutInSeconds,loader);
  registerMonitorableComponents();
}

Fixed version (ground truth):
/** 
 * Called from the ContainerFactory during initialization.
 */
protected void initializeHome() throws Exception {
  ObjectFactory entityCtxFactory=new EntityContextFactory(this);
  int steadyPoolSize=0;
  int resizeQuantity=10;
  int idleTimeoutInSeconds=Integer.MAX_VALUE - 1;
  poolProp=new PoolProperties(this);
  super.initializeHome();
  entityCtxPool=new NonBlockingPool(getContainerId(),ejbDescriptor.getName(),entityCtxFactory,poolProp.steadyPoolSize,poolProp.poolResizeQuantity,poolProp.maxPoolSize,poolProp.poolIdleTimeoutInSeconds,loader);
  registerMonitorableComponents();
}