nus-yam/ex-repair huggingface dataset:
Program: 30073
Project: 30073
Buggy source:
/** 
 * Reconfigures the access log of this VirtualServer with the updated attributes of the access-log element from domain.xml.
 */
void reconfigureAccessLog(HttpService httpService,WebContainerFeatureFactory webcontainerFeatureFactory){
  try {
    boolean restart=false;
    if (accessLogValve.isStarted()) {
      accessLogValve.stop();
      restart=true;
    }
    accessLogValve.updateAccessLogAttributes(httpService,webcontainerFeatureFactory);
    if (restart) {
      accessLogValve.start();
    }
  }
 catch (  LifecycleException le) {
    _logger.log(Level.SEVERE,"String_Node_Str",le);
  }
}

Fixed version (ground truth):
/** 
 * Reconfigures the access log of this VirtualServer with the updated attributes of the access-log element from domain.xml.
 */
void reconfigureAccessLog(HttpService httpService,WebContainerFeatureFactory webcontainerFeatureFactory){
  try {
    boolean restart=false;
    if (accessLogValve.isStarted()) {
      accessLogValve.stop();
      restart=true;
    }
    accessLogValve.updateAccessLogAttributes(httpService,webcontainerFeatureFactory);
    if (restart) {
      accessLogValve.start();
      addHttpProbes(false);
    }
  }
 catch (  LifecycleException le) {
    _logger.log(Level.SEVERE,"String_Node_Str",le);
  }
}
Program: 30074
Project: 30074
Buggy source:
/** 
 * Create a virtual server/host.
 */
public VirtualServer createHost(String vsID,com.sun.enterprise.config.serverbeans.VirtualServer vsBean,String docroot,MimeMap mimeMap){
  VirtualServer vs=(VirtualServer)_embedded.createHost(vsID,vsBean,docroot,vsBean.getLogFile(),mimeMap);
  vs.configureState();
  vs.configureRemoteAddressFilterValve();
  vs.configureRemoteHostFilterValve();
  vs.configureSingleSignOn(globalSSOEnabled,webContainerFeatureFactory,isSsoFailoverEnabled());
  vs.configureRedirect();
  vs.configureErrorPage();
  vs.configureErrorReportValve();
  vs.setServerContext(getServerContext());
  return vs;
}

Fixed version (ground truth):
/** 
 * Create a virtual server/host.
 */
public VirtualServer createHost(String vsID,com.sun.enterprise.config.serverbeans.VirtualServer vsBean,String docroot,MimeMap mimeMap){
  VirtualServer vs=(VirtualServer)_embedded.createHost(vsID,vsBean,docroot,vsBean.getLogFile(),mimeMap);
  vs.configureState();
  vs.configureRemoteAddressFilterValve();
  vs.configureRemoteHostFilterValve();
  vs.configureSingleSignOn(globalSSOEnabled,webContainerFeatureFactory,isSsoFailoverEnabled());
  vs.configureRedirect();
  vs.configureErrorPage();
  vs.configureErrorReportValve();
  vs.setServerContext(getServerContext());
  vs.setServerConfig(serverConfig);
  vs.setGrizzlyService(grizzlyService);
  vs.setWebContainer(this);
  return vs;
}
Program: 30076
Project: 30076
Buggy source:
/** 
 * cache the default client info which can will set back during close()<br> as this connection may be re-used by connection pool of application server<br>
 */
protected void init(){
  try {
    defaultClientInfo=getClientInfo();
  }
 catch (  SQLException e) {
    _logger.log(Level.INFO,"String_Node_Str",e.getMessage());
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.log(Level.FINEST,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * cache the default client info which can will set back during close()<br> as this connection may be re-used by connection pool of application server<br>
 */
protected void init(){
  try {
    if (isSupportClientInfo()) {
      defaultClientInfo=getClientInfo();
    }
  }
 catch (  Throwable e) {
    _logger.log(Level.INFO,"String_Node_Str",e.getMessage());
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.log(Level.FINEST,"String_Node_Str",e);
    }
  }
}
Program: 30077
Project: 30077
Buggy source:
/** 
 * Closes the logical connection.<br> Cleans up client specific details<br>
 * @throws SQLException In case of a database error.
 */
public void close() throws SQLException {
  if (isClosed) {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",this);
    }
    return;
  }
  if (!jdbc30Connection) {
    try {
      checkValidity();
      if (defaultClientInfo == null) {
        setClientInfo(new Properties());
      }
 else {
        setClientInfo(defaultClientInfo);
      }
    }
 catch (    SQLClientInfoException e) {
      _logger.log(Level.INFO,"String_Node_Str",e.getMessage());
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.log(Level.FINEST,"String_Node_Str",e);
      }
    }
  }
  super.close();
}

Fixed version (ground truth):
/** 
 * Closes the logical connection.<br> Cleans up client specific details<br>
 * @throws SQLException In case of a database error.
 */
public void close() throws SQLException {
  if (isClosed) {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str",this);
    }
    return;
  }
  if (!jdbc30Connection) {
    try {
      checkValidity();
      if (isSupportClientInfo()) {
        if (defaultClientInfo == null) {
          setClientInfo(new Properties());
        }
 else {
          setClientInfo(defaultClientInfo);
        }
      }
    }
 catch (    Throwable e) {
      _logger.log(Level.INFO,"String_Node_Str",e.getMessage());
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.log(Level.FINEST,"String_Node_Str",e);
      }
    }
  }
  super.close();
}
Program: 30078
Project: 30078
Buggy source:
@Override public Iterable<Metadata<Extension>> getExtensions(){
  return context.getTransientAppMetaData(WeldDeployer.WELD_BOOTSTRAP,WeldBootstrap.class).loadExtensions(Thread.currentThread().getContextClassLoader());
}

Fixed version (ground truth):
@Override public Iterable<Metadata<Extension>> getExtensions(){
  List<BeanDeploymentArchive> bdas=getBeanDeploymentArchives();
  ArrayList<Metadata<Extension>> extnList=new ArrayList<Metadata<Extension>>();
  for (  BeanDeploymentArchive bda : bdas) {
    Iterable<Metadata<Extension>> bdaExtns=context.getTransientAppMetaData(WeldDeployer.WELD_BOOTSTRAP,WeldBootstrap.class).loadExtensions(((BeanDeploymentArchiveImpl)bda).getModuleClassLoaderForBDA());
    for (    Metadata<Extension> bdaExtn : bdaExtns) {
      extnList.add(bdaExtn);
    }
  }
  return extnList;
}
Program: 30079
Project: 30079
Buggy source:
private void firePITEvent(WeldBootstrap bootstrap,BeanDeploymentArchive bda,Class<?> bdaClazz){
  AnnotatedType at=bootstrap.getManager(bda).createAnnotatedType(bdaClazz);
  InjectionTarget<?> it=bootstrap.getManager(bda).fireProcessInjectionTarget(at);
  ((BeanDeploymentArchiveImpl)bda).putInjectionTarget(at,it);
}

Fixed version (ground truth):
private void firePITEvent(WeldBootstrap bootstrap,BeanDeploymentArchive bda,Class<?> bdaClazz){
  if (bdaClazz.isInterface()) {
    return;
  }
  AnnotatedType at=bootstrap.getManager(bda).createAnnotatedType(bdaClazz);
  InjectionTarget<?> it=bootstrap.getManager(bda).fireProcessInjectionTarget(at);
  ((BeanDeploymentArchiveImpl)bda).putInjectionTarget(at,it);
}
Program: 30081
Project: 30081
Buggy source:
/** 
 * Remove trailing slash from a path string
 * @param s
 * @return
 */
String removeTrailingSlash(String s){
  if (s.endsWith("String_Node_Str")) {
    s=s.substring(0,s.length() - 1);
  }
  return s;
}

Fixed version (ground truth):
/** 
 * Remove trailing slash from a path string
 * @param s
 * @return
 */
String removeTrailingSlash(String s){
  if (!StringUtils.ok(s))   return s;
  if (s.endsWith("String_Node_Str")) {
    s=s.substring(0,s.length() - 1);
  }
  return s;
}
Program: 30084
Project: 30084
Buggy source:
/** 
 * Gets the value of the gmsMulticastPort property. This is the communication port GMS uses to listen for group  events. This should be a valid port number.
 * @return possible object is{@link String }
 */
@Attribute @Min(value=2048) @Max(value=32000) String getGmsMulticastPort();

Fixed version (ground truth):
/** 
 * Gets the value of the gmsMulticastPort property. This is the communication port GMS uses to listen for group  events. This should be a valid port number.
 * @return possible object is{@link String }
 */
@Attribute @Min(value=2048) @Max(value=49151) String getGmsMulticastPort();
Program: 30085
Project: 30085
Buggy source:
/** 
 * Execute the remote command using the parameters we've collected.
 */
@Override protected int executeCommand() throws CommandException {
  RemoteAdminCommand rac=new RemoteAdminCommand(name,programOpts.getHost(),programOpts.getPort(),programOpts.isSecure(),programOpts.getUser(),programOpts.getPassword(),logger);
  rac.executeCommand(params);
  return SUCCESS;
}

Fixed version (ground truth):
/** 
 * Execute the remote command using the parameters we've collected.
 */
@Override protected int executeCommand() throws CommandException {
  if (ok(domainDirParam) || ok(userArgDomainName)) {
    String domainDir=(ok(domainDirParam)) ? domainDirParam : getDomainsDir().getPath();
    String domainName=(ok(userArgDomainName)) ? userArgDomainName : getDomainName();
    return changeAdminPasswordLocally(domainDir,domainName);
  }
 else {
    try {
      RemoteAdminCommand rac=new RemoteAdminCommand(name,programOpts.getHost(),programOpts.getPort(),programOpts.isSecure(),programOpts.getUser(),programOpts.getPassword(),logger);
      rac.executeCommand(params);
      return SUCCESS;
    }
 catch (    CommandException ce) {
      if (ce.getCause() instanceof ConnectException) {
        if (!isLocalHost(programOpts.getHost())) {
          throw ce;
        }
        return changeAdminPasswordLocally(getDomainsDir().getPath(),getDomainName());
      }
 else {
        throw ce;
      }
    }
  }
}
Program: 30086
Project: 30086
Buggy source:
/** 
 * Require the user to actually type the passwords unless they are in the file specified by the --passwordfile option.
 */
@Override protected void validate() throws CommandException, CommandValidationException {
  if (programOpts.getUser() == null) {
    Console cons=System.console();
    if (cons != null && programOpts.isInteractive()) {
      cons.printf("String_Node_Str",strings.get("String_Node_Str",SystemPropertyConstants.DEFAULT_ADMIN_USER));
      String val=cons.readLine();
      if (ok(val))       programOpts.setUser(val);
 else       programOpts.setUser(SystemPropertyConstants.DEFAULT_ADMIN_USER);
    }
 else {
      throw new CommandValidationException(strings.get("String_Node_Str"));
    }
  }
  try {
    String password=getPasswords();
    programOpts.setPassword(password,ProgramOptions.PasswordLocation.USER);
  }
 catch (  CommandValidationException cve) {
    throw new CommandException(cve);
  }
  params=new ParameterMap();
  params.set("String_Node_Str",programOpts.getUser());
  params.set(oldpwName,passwords.get(oldpwName));
  params.set(newpwName,passwords.get(newpwName));
}

Fixed version (ground truth):
/** 
 * Require the user to actually type the passwords unless they are in the file specified by the --passwordfile option.
 */
@Override protected void validate() throws CommandException, CommandValidationException {
  setDomainName(userArgDomainName);
  super.validate();
  if (programOpts.getUser() == null) {
    Console cons=System.console();
    if (cons != null && programOpts.isInteractive()) {
      cons.printf("String_Node_Str",strings.get("String_Node_Str",SystemPropertyConstants.DEFAULT_ADMIN_USER));
      String val=cons.readLine();
      if (ok(val))       programOpts.setUser(val);
 else       programOpts.setUser(SystemPropertyConstants.DEFAULT_ADMIN_USER);
    }
 else {
      throw new CommandValidationException(strings.get("String_Node_Str"));
    }
  }
  try {
    String password=getPasswords();
    programOpts.setPassword(password,ProgramOptions.PasswordLocation.USER);
  }
 catch (  CommandValidationException cve) {
    throw new CommandException(cve);
  }
  params=new ParameterMap();
  params.set("String_Node_Str",programOpts.getUser());
  params.set(oldpwName,passwords.get(oldpwName));
  params.set(newpwName,passwords.get(newpwName));
}
Program: 30087
Project: 30087
Buggy source:
public String hostname() throws UnknownHostException {
  InetAddress.getByName(mHostName);
  if (mHostName.equals("String_Node_Str") || mHostName.equals("String_Node_Str")) {
    return Util.localhost();
  }
 else   if (mHostName.contains("String_Node_Str") && !mHostName.startsWith("String_Node_Str")) {
    return "String_Node_Str" + mHostName + "String_Node_Str";
  }
  return mHostName;
}

Fixed version (ground truth):
public String hostname() throws UnknownHostException {
  if (mHostName.equals("String_Node_Str") || mHostName.equals("String_Node_Str")) {
    return Util.localhost();
  }
 else   if (mHostName.contains("String_Node_Str") && !mHostName.startsWith("String_Node_Str")) {
    return "String_Node_Str" + mHostName + "String_Node_Str";
  }
  return mHostName;
}
Program: 30089
Project: 30089
Buggy source:
public Object run(ServiceProvisioningEngines serviceProvisioningEngines) throws PropertyVetoException, TransactionFailure {
  ServiceProvisioningEngine serviceProvisioningEngine=serviceProvisioningEngines.createChild(ServiceProvisioningEngine.class);
  serviceProvisioningEngine.setClassName(className);
  serviceProvisioningEngine.setType(type.toUpperCase());
  serviceProvisioningEngine.setDefault(defaultService);
  if (properties != null) {
    for (    Map.Entry e : properties.entrySet()) {
      Property prop=serviceProvisioningEngine.createChild(Property.class);
      prop.setName((String)e.getKey());
      prop.setValue((String)e.getValue());
      serviceProvisioningEngine.getProperty().add(prop);
    }
  }
  serviceProvisioningEngines.getServiceProvisioningEngines().add(serviceProvisioningEngine);
  if (defaultService) {
    if (force) {
      for (      final ServiceProvisioningEngine spe : serviceProvisioningEngines.getServiceProvisioningEngines()) {
        if (spe.getDefault() && type.equalsIgnoreCase(spe.getType())) {
          Transaction t=Transaction.getTransaction(serviceProvisioningEngines);
          ServiceProvisioningEngine spe_w=t.enroll(spe);
          spe_w.setDefault(false);
          break;
        }
      }
    }
  }
  return serviceProvisioningEngines;
}

Fixed version (ground truth):
public Object run(ServiceProvisioningEngines serviceProvisioningEngines) throws PropertyVetoException, TransactionFailure {
  Locale locale=Locale.getDefault();
  ServiceProvisioningEngine serviceProvisioningEngine=serviceProvisioningEngines.createChild(ServiceProvisioningEngine.class);
  serviceProvisioningEngine.setClassName(className);
  serviceProvisioningEngine.setType(type.toUpperCase(locale));
  serviceProvisioningEngine.setDefault(defaultService);
  if (properties != null) {
    for (    Map.Entry e : properties.entrySet()) {
      Property prop=serviceProvisioningEngine.createChild(Property.class);
      prop.setName((String)e.getKey());
      prop.setValue((String)e.getValue());
      serviceProvisioningEngine.getProperty().add(prop);
    }
  }
  serviceProvisioningEngines.getServiceProvisioningEngines().add(serviceProvisioningEngine);
  if (defaultService) {
    if (force) {
      for (      final ServiceProvisioningEngine spe : serviceProvisioningEngines.getServiceProvisioningEngines()) {
        if (spe.getDefault() && type.equalsIgnoreCase(spe.getType())) {
          Transaction t=Transaction.getTransaction(serviceProvisioningEngines);
          ServiceProvisioningEngine spe_w=t.enroll(spe);
          spe_w.setDefault(false);
          break;
        }
      }
    }
  }
  return serviceProvisioningEngines;
}
Program: 30091
Project: 30091
Buggy source:
private ResourceStatus isValid(Resources resources){
  ResourceStatus status=new ResourceStatus(ResourceStatus.SUCCESS,"String_Node_Str");
  if (jdbcconnectionpoolid == null) {
    String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str");
    return new ResourceStatus(ResourceStatus.FAILURE,msg);
  }
  for (  ResourcePool pool : resources.getResources(ResourcePool.class)) {
    if (pool.getName().equals(jdbcconnectionpoolid)) {
      String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str",jdbcconnectionpoolid);
      return new ResourceStatus(ResourceStatus.FAILURE,msg,true);
    }
  }
  if (this.validationmethod.equals("String_Node_Str") && this.isconnectvalidatereq.equals(Boolean.TRUE.toString()) && this.validationtable == null) {
    String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str");
    return new ResourceStatus(ResourceStatus.FAILURE,msg,true);
  }
  return status;
}

Fixed version (ground truth):
private ResourceStatus isValid(Resources resources){
  ResourceStatus status=new ResourceStatus(ResourceStatus.SUCCESS,"String_Node_Str");
  if (jdbcconnectionpoolid == null) {
    String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str");
    return new ResourceStatus(ResourceStatus.FAILURE,msg);
  }
  for (  ResourcePool pool : resources.getResources(ResourcePool.class)) {
    if (pool.getName().equals(jdbcconnectionpoolid)) {
      String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str",jdbcconnectionpoolid);
      return new ResourceStatus(ResourceStatus.FAILURE,msg,true);
    }
  }
  if ("String_Node_Str".equals(this.validationmethod) && Boolean.TRUE.toString().equals(this.isconnectvalidatereq) && this.validationtable == null) {
    String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str");
    return new ResourceStatus(ResourceStatus.FAILURE,msg,true);
  }
  return status;
}
Program: 30092
Project: 30092
Buggy source:
/** 
 * Get equivalent name for the database vendor name. This is useful for introspection as the vendor name for oracle and sun oracle type of jdbc drivers are the same. 
 * @param dbVendor
 * @return
 */
private String getEquivalentName(String dbVendor){
  if (dbVendor.toUpperCase(Locale.getDefault()).startsWith(DATABASE_VENDOR_JAVADB) || dbVendor.equalsIgnoreCase(DATABASE_VENDOR_EMBEDDED_DERBY)) {
    return DATABASE_VENDOR_DERBY;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_MSSQLSERVER) || dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_SQLSERVER)) {
    return DATABASE_VENDOR_SQLSERVER;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_DB2)) {
    return DATABASE_VENDOR_DB2;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_ORACLE)) {
    return DATABASE_VENDOR_ORACLE;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_SYBASE)) {
    return DATABASE_VENDOR_SYBASE;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get equivalent name for the database vendor name. This is useful for introspection as the vendor name for oracle and sun oracle type of jdbc drivers are the same. 
 * @param dbVendor
 * @return
 */
private String getEquivalentName(String dbVendor){
  if (dbVendor.toUpperCase(Locale.getDefault()).startsWith(DATABASE_VENDOR_JAVADB) || dbVendor.equalsIgnoreCase(DATABASE_VENDOR_EMBEDDED_DERBY) || dbVendor.equalsIgnoreCase(DATABASE_VENDOR_EMBEDDED_DERBY_30)|| dbVendor.equalsIgnoreCase(DATABASE_VENDOR_DERBY_30)|| dbVendor.equalsIgnoreCase(DATABASE_VENDOR_JAVADB_30)) {
    return DATABASE_VENDOR_DERBY;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_MSSQLSERVER) || dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_SQLSERVER)) {
    return DATABASE_VENDOR_SQLSERVER;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_DB2)) {
    return DATABASE_VENDOR_DB2;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_ORACLE)) {
    return DATABASE_VENDOR_ORACLE;
  }
 else   if (dbVendor.equalsIgnoreCase(DATABASE_VENDOR_SUN_SYBASE)) {
    return DATABASE_VENDOR_SYBASE;
  }
  return null;
}
Program: 30094
Project: 30094
Buggy source:
public WebServiceContext getWebServiceContext(){
  return wsCtxt;
}

Fixed version (ground truth):
public synchronized WebServiceContext getWebServiceContext(){
  return wsCtxt;
}
Program: 30095
Project: 30095
Buggy source:
/** 
 * Extract the root cause from a servlet exception.
 * @param e The servlet exception
 */
public static Throwable getRootCause(ServletException e){
  Throwable rootCause=e;
  Throwable rootCauseCheck;
  do {
    try {
      rootCauseCheck=(Throwable)IntrospectionUtils.getProperty(rootCause,"String_Node_Str");
      if (rootCauseCheck != null)       rootCause=rootCauseCheck;
    }
 catch (    ClassCastException ex) {
      rootCauseCheck=null;
    }
  }
 while (rootCauseCheck != null);
  return rootCause;
}

Fixed version (ground truth):
/** 
 * Extract the root cause from a servlet exception.
 * @param e The servlet exception
 */
public static Throwable getRootCause(ServletException e){
  Throwable rootCause=e;
  Throwable rootCauseCheck;
  int loops=0;
  do {
    loops++;
    rootCauseCheck=rootCause.getCause();
    if (rootCauseCheck != null)     rootCause=rootCauseCheck;
  }
 while (rootCauseCheck != null && (loops < 20));
  return rootCause;
}
Program: 30100
Project: 30100
Buggy source:
private void handleError(Request request,Response response,int statusCode) throws IOException {
  ServletRequest sreq=request.getRequest();
  ServletResponse sres=response.getResponse();
  HttpServletResponse hres=(HttpServletResponse)sres;
  ErrorPage errorPage=((StandardHost)getContainer()).findErrorPage(statusCode);
  if (errorPage != null) {
    try {
      request.lockSession();
      hres.setStatus(statusCode);
      ServletContext servletContext=request.getContext().getServletContext();
      ApplicationDispatcher dispatcher=(ApplicationDispatcher)servletContext.getRequestDispatcher(errorPage.getLocation());
      if (hres.isCommitted()) {
        dispatcher.include(sreq,sres);
      }
 else {
        response.resetBuffer(true);
        dispatcher.dispatch(sreq,sres,DispatcherType.ERROR);
        response.setSuspended(false);
      }
      sres.flushBuffer();
    }
 catch (    Throwable t) {
      if (log.isLoggable(Level.INFO)) {
        String message=sm.getString("String_Node_Str",errorPage.getLocation());
        log.log(Level.INFO,message,t);
      }
    }
 finally {
      request.unlockSession();
    }
  }
 else {
    hres.sendError(statusCode);
  }
}

Fixed version (ground truth):
private void handleError(Request request,Response response,int statusCode) throws IOException {
  ServletRequest sreq=request.getRequest();
  ServletResponse sres=response.getResponse();
  HttpServletResponse hres=(HttpServletResponse)sres;
  ErrorPage errorPage=((StandardHost)getContainer()).findErrorPage(statusCode);
  if (errorPage != null) {
    try {
      hres.setStatus(statusCode);
      ServletContext servletContext=request.getContext().getServletContext();
      ApplicationDispatcher dispatcher=(ApplicationDispatcher)servletContext.getRequestDispatcher(errorPage.getLocation());
      if (hres.isCommitted()) {
        dispatcher.include(sreq,sres);
      }
 else {
        response.resetBuffer(true);
        dispatcher.dispatch(sreq,sres,DispatcherType.ERROR);
        response.setSuspended(false);
      }
      sres.flushBuffer();
    }
 catch (    Throwable t) {
      if (log.isLoggable(Level.INFO)) {
        String message=sm.getString("String_Node_Str",errorPage.getLocation());
        log.log(Level.INFO,message,t);
      }
    }
  }
 else {
    hres.sendError(statusCode);
  }
}
Program: 30101
Project: 30101
Buggy source:
private void getHealthWithGMS(){
  StringBuilder result=new StringBuilder();
  HealthHistory history=gmsAdapter.getHealthHistory();
  if (history == null) {
    setFail(Strings.get("String_Node_Str"));
    return;
  }
  if (history.getInstances().isEmpty()) {
    report.setMessage(Strings.get("String_Node_Str",clusterName));
    return;
  }
  ActionReport.MessagePart top=report.getTopMessagePart();
  SortedSet<String> names=new TreeSet<String>(history.getInstances());
  for (  String name : names) {
    HealthHistory.InstanceHealth ih=history.getHealthByInstance(name);
    if (HealthHistory.NOTIME == ih.time) {
      result.append(Strings.get("String_Node_Str",name,ih.state));
      top.addProperty(name,ih.state.toString());
    }
 else {
      String status=Strings.get("String_Node_Str",name,ih.state,new Date(ih.time).toString());
      result.append(status);
      top.addProperty(name,status.substring(name.length(),status.length() - 1).trim());
    }
    result.append("String_Node_Str");
  }
  String rawResult=result.toString();
  report.setMessage(rawResult.substring(0,rawResult.lastIndexOf("String_Node_Str")));
}

Fixed version (ground truth):
private void getHealthWithGMS(){
  StringBuilder result=new StringBuilder();
  HealthHistory history=gmsAdapter.getHealthHistory();
  if (history == null) {
    setFail(Strings.get("String_Node_Str"));
    return;
  }
  if (history.getInstances().isEmpty()) {
    report.setMessage(Strings.get("String_Node_Str",clusterName));
    return;
  }
  SortedSet<String> names=new TreeSet<String>(history.getInstances());
  List<Properties> statesAndTimes=new ArrayList<Properties>(names.size());
  for (  String name : names) {
    Properties instanceStateAndTime=new Properties();
    HealthHistory.InstanceHealth ih=history.getHealthByInstance(name);
    instanceStateAndTime.put("String_Node_Str",name);
    instanceStateAndTime.put("String_Node_Str",ih.state.name());
    if (HealthHistory.NOTIME == ih.time) {
      result.append(Strings.get("String_Node_Str",name,ih.state));
      instanceStateAndTime.put("String_Node_Str","String_Node_Str");
    }
 else {
      result.append(Strings.get("String_Node_Str",name,ih.state,new Date(ih.time).toString()));
      instanceStateAndTime.put("String_Node_Str",String.valueOf(ih.time));
    }
    result.append("String_Node_Str");
    statesAndTimes.add(instanceStateAndTime);
  }
  Properties instanceStateTimes=new Properties();
  instanceStateTimes.put("String_Node_Str",statesAndTimes);
  report.setExtraProperties(instanceStateTimes);
  String rawResult=result.toString();
  report.setMessage(rawResult.substring(0,rawResult.lastIndexOf("String_Node_Str")));
}
Program: 30105
Project: 30105
Buggy source:
public boolean start(ApplicationContext startupContext) throws Exception {
  cl=startupContext.getClassLoader();
  try {
    app=deploymentCtx.getModuleMetaData(Application.class);
    Iterator<EjbEndpoint> iter=ejbendpoints.iterator();
    EjbEndpoint ejbendpoint=null;
    while (iter.hasNext()) {
      ejbendpoint=iter.next();
      String contextRoot=ejbendpoint.contextRoot;
      dispatcher.registerEndpoint(contextRoot,httpHandler,this);
      logger.info(format(rb.getString("String_Node_Str"),app.getAppName(),new WsUtil().getWebServerInfoForDAS().getWebServerRootURL(ejbendpoint.isSecure).toString() + contextRoot));
    }
  }
 catch (  EndpointRegistrationException e) {
    logger.log(Level.SEVERE,format(rb.getString("String_Node_Str"),e.toString()));
  }
  return true;
}

Fixed version (ground truth):
public boolean start(ApplicationContext startupContext) throws Exception {
  cl=startupContext.getClassLoader();
  try {
    app=deploymentCtx.getModuleMetaData(Application.class);
    Iterator<EjbEndpoint> iter=ejbendpoints.iterator();
    EjbEndpoint ejbendpoint=null;
    while (iter.hasNext()) {
      ejbendpoint=iter.next();
      String contextRoot=ejbendpoint.contextRoot;
      WebServerInfo wsi=new WsUtil().getWebServerInfoForDAS();
      URL rootURL=wsi.getWebServerRootURL(ejbendpoint.isSecure);
      dispatcher.registerEndpoint(contextRoot,httpHandler,this);
      if (wsi.getHttpVS() != null && wsi.getHttpVS().getPort() != 0)       logger.info(format(rb.getString("String_Node_Str"),app.getAppName(),rootURL + contextRoot));
    }
  }
 catch (  EndpointRegistrationException e) {
    logger.log(Level.SEVERE,format(rb.getString("String_Node_Str"),e.toString()));
  }
  return true;
}
Program: 30109
Project: 30109
Buggy source:
private String checkForAddrAny(Properties props,String orbInitialHost){
  if ((orbInitialHost.equals("String_Node_Str")) || (orbInitialHost.equals("String_Node_Str")) || (orbInitialHost.equals("String_Node_Str"))) {
    try {
      String localAddress=java.net.InetAddress.getLocalHost().getHostAddress();
      return localAddress;
    }
 catch (    java.net.UnknownHostException uhe) {
      logger.log(Level.WARNING,"String_Node_Str");
      return DEFAULT_ORB_INIT_HOST;
    }
  }
 else {
    return orbInitialHost;
  }
}

Fixed version (ground truth):
private String checkForAddrAny(Properties props,String orbInitialHost){
  if ((orbInitialHost.equals("String_Node_Str")) || (orbInitialHost.equals("String_Node_Str")) || (orbInitialHost.equals("String_Node_Str"))) {
    try {
      String localAddress=java.net.InetAddress.getLocalHost().getHostAddress();
      return localAddress;
    }
 catch (    java.net.UnknownHostException uhe) {
      logger.log(Level.WARNING,"String_Node_Str");
      return DEFAULT_ORB_INIT_HOST;
    }
  }
 else {
    props.setProperty(ORBConstants.SERVER_HOST_PROPERTY,orbInitialHost);
    return orbInitialHost;
  }
}
Program: 30111
Project: 30111
Buggy source:
public void unload(ExtendedDeploymentContext context){
  Logger logger=context.getLogger();
  if (!isLoaded) {
    logger.fine("String_Node_Str");
    return;
  }
  ClassLoader currentClassLoader=Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(appClassLoader);
    context.setClassLoader(appClassLoader);
    super.unload(context);
    for (    ModuleInfo module : reversedModules) {
      module.unload(getSubContext(module,context));
    }
    isLoaded=false;
    if (events != null) {
      events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_UNLOADED,this),false);
    }
    try {
      PreDestroy.class.cast(appClassLoader).preDestroy();
    }
 catch (    Exception e) {
    }
    appClassLoader=null;
    for (    ModuleInfo module : getModuleInfos()) {
      if (module.getClassLoaders() != null) {
        for (        ClassLoader cloader : module.getClassLoaders()) {
          try {
            PreDestroy.class.cast(cloader).preDestroy();
          }
 catch (          Exception e) {
          }
        }
        module.cleanClassLoaders();
      }
    }
  }
  finally {
    Thread.currentThread().setContextClassLoader(currentClassLoader);
    context.setClassLoader(null);
  }
}

Fixed version (ground truth):
public void unload(ExtendedDeploymentContext context){
  Logger logger=context.getLogger();
  if (!isLoaded) {
    logger.fine("String_Node_Str");
    return;
  }
  ClassLoader currentClassLoader=Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(appClassLoader);
    context.setClassLoader(appClassLoader);
    super.unload(context);
    for (    ModuleInfo module : reversedModules) {
      module.unload(getSubContext(module,context));
    }
    isLoaded=false;
    if (events != null) {
      events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_UNLOADED,this),false);
    }
  }
  finally {
    Thread.currentThread().setContextClassLoader(currentClassLoader);
    context.setClassLoader(null);
  }
}
Program: 30112
Project: 30112
Buggy source:
public void clean(ExtendedDeploymentContext context) throws Exception {
  if (appClassLoader != null) {
    try {
      PreDestroy.class.cast(appClassLoader).preDestroy();
    }
 catch (    Exception e) {
    }
    appClassLoader=null;
  }
  super.clean(context);
  for (  ModuleInfo info : reversedModules) {
    info.clean(getSubContext(info,context));
    info=null;
  }
  if (events != null) {
    events.send(new EventListener.Event<DeploymentContext>(Deployment.APPLICATION_CLEANED,context),false);
  }
}

Fixed version (ground truth):
public void clean(ExtendedDeploymentContext context) throws Exception {
  super.clean(context);
  for (  ModuleInfo info : reversedModules) {
    info.clean(getSubContext(info,context));
    info=null;
  }
  if (appClassLoader != null) {
    try {
      PreDestroy.class.cast(appClassLoader).preDestroy();
    }
 catch (    Exception e) {
    }
    appClassLoader=null;
  }
  for (  ModuleInfo module : getModuleInfos()) {
    if (module.getClassLoaders() != null) {
      for (      ClassLoader cloader : module.getClassLoaders()) {
        try {
          PreDestroy.class.cast(cloader).preDestroy();
        }
 catch (        Exception e) {
        }
      }
      module.cleanClassLoaders();
    }
  }
  if (events != null) {
    events.send(new EventListener.Event<DeploymentContext>(Deployment.APPLICATION_CLEANED,context),false);
  }
}
Program: 30116
Project: 30116
Buggy source:
public Object lookup(String name) throws NamingException, RemoteException {
  Object obj=super.lookup(name);
  ClassLoader originalClassLoader=null;
  try {
    if (obj instanceof Reference) {
      Reference ref=(Reference)obj;
      if (ref.getFactoryClassName().equals(GlassfishNamingManagerImpl.IIOPOBJECT_FACTORY)) {
        originalClassLoader=Utility.setContextClassLoader(getClass().getClassLoader());
        Hashtable env=new Hashtable();
        env.put("String_Node_Str",orb);
        obj=javax.naming.spi.NamingManager.getObjectInstance(obj,new CompositeName(name),null,env);
      }
    }
 else     if (obj instanceof NamingObjectProxy) {
      NamingObjectProxy namingProxy=(NamingObjectProxy)obj;
      obj=((NamingObjectProxy)obj).create(new InitialContext());
      if (namingProxy instanceof NamingObjectProxy.InitializationNamingObjectProxy) {
        return super.lookup(name);
      }
    }
  }
 catch (  Exception e) {
    RemoteException re=new RemoteException("String_Node_Str",e);
    throw re;
  }
 finally {
    if (originalClassLoader != null) {
      Utility.setContextClassLoader(originalClassLoader);
    }
  }
  return obj;
}

Fixed version (ground truth):
@Override public Object lookup(String name) throws NamingException, RemoteException {
  Object obj=super.lookup(name);
  ClassLoader originalClassLoader=null;
  try {
    if (obj instanceof Reference) {
      Reference ref=(Reference)obj;
      if (ref.getFactoryClassName().equals(GlassfishNamingManagerImpl.IIOPOBJECT_FACTORY)) {
        originalClassLoader=Utility.setContextClassLoader(getClass().getClassLoader());
        Hashtable env=new Hashtable();
        env.put("String_Node_Str",orb);
        obj=javax.naming.spi.NamingManager.getObjectInstance(obj,new CompositeName(name),null,env);
      }
    }
 else     if (obj instanceof NamingObjectProxy) {
      NamingObjectProxy namingProxy=(NamingObjectProxy)obj;
      obj=((NamingObjectProxy)obj).create(new InitialContext());
      if (namingProxy instanceof NamingObjectProxy.InitializationNamingObjectProxy) {
        return super.lookup(name);
      }
    }
  }
 catch (  Exception e) {
    RemoteException re=new RemoteException("String_Node_Str",e);
    throw re;
  }
 finally {
    if (originalClassLoader != null) {
      Utility.setContextClassLoader(originalClassLoader);
    }
  }
  return obj;
}
Program: 30117
Project: 30117
Buggy source:
public static MbeanService getInstance(){
  if (habitat == null)   return null;
  return habitat.getComponent(MbeanService.class);
}

Fixed version (ground truth):
public static MbeanService getInstance(){
  if (habitat == null)   return null;
  if (_mbeanService != null)   return _mbeanService;
  return habitat.getComponent(MbeanService.class);
}
Program: 30118
Project: 30118
Buggy source:
public void init(ServletConfig servletConfig) throws ServletException {
  try {
    super.init(servletConfig);
    wsEngine_=WebServiceEngineImpl.getInstance();
    doInit(servletConfig);
  }
 catch (  Throwable e) {
    throw new ServletException(e);
  }
}

Fixed version (ground truth):
public void init(ServletConfig servletConfig) throws ServletException {
  String servletName="String_Node_Str";
  try {
    super.init(servletConfig);
    wsEngine_=WebServiceEngineImpl.getInstance();
    WebServiceContractImpl wscImpl=WebServiceContractImpl.getInstance();
    ComponentEnvManager compEnvManager=wscImpl.getComponentEnvManager();
    JndiNameEnvironment jndiNameEnv=compEnvManager.getCurrentJndiNameEnvironment();
    WebBundleDescriptor webBundle=null;
    if (jndiNameEnv != null && jndiNameEnv instanceof WebBundleDescriptor) {
      webBundle=((WebBundleDescriptor)jndiNameEnv);
    }
 else {
      throw new WebServiceException("String_Node_Str" + jndiNameEnv);
    }
    servletName=servletConfig.getServletName();
    contextRoot=webBundle.getContextRoot();
    WebComponentDescriptor webComponent=webBundle.getWebComponentByCanonicalName(servletName);
    if (webComponent != null) {
      WebServicesDescriptor webServices=webBundle.getWebServices();
      Collection<WebServiceEndpoint> endpoints=webServices.getEndpointsImplementedBy(webComponent);
      endpoint=endpoints.iterator().next();
    }
 else {
      throw new ServletException(servletName + "String_Node_Str");
    }
    if (!(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding()))) {
      wsEngine_.createHandler(endpoint);
    }
    if (endpoint.getWsdlExposed() != null) {
      wsdlExposed=Boolean.parseBoolean(endpoint.getWsdlExposed());
    }
    String uri=endpoint.getEndpointAddressUri();
    urlPattern=uri.startsWith("String_Node_Str") ? uri : "String_Node_Str" + uri;
  }
 catch (  Throwable t) {
    logger.log(Level.WARNING,"String_Node_Str" + servletName + "String_Node_Str",t);
    ServletException se=new ServletException();
    se.initCause(t);
    throw se;
  }
}
Program: 30120
Project: 30120
Buggy source:
public void registerEndpoint(WebServiceEndpoint webserviceEndpoint,EjbEndpointFacade ejbContainer,Object servant,Class tieClass){
  String ctxtRoot=null;
  String uri=null;
  EjbRuntimeEndpointInfo endpoint=createEjbEndpointInfo(webserviceEndpoint,ejbContainer,servant,tieClass);
synchronized (webServiceEjbEndpoints) {
    String uriRaw=endpoint.getEndpointAddressUri();
    if (uriRaw != null) {
      uri=(uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
      if (webServiceEjbEndpoints.containsKey(uri)) {
        logger.log(Level.SEVERE,format(rb.getString("String_Node_Str"),uri));
      }
      webServiceEjbEndpoints.put(uri,endpoint);
      regenerateEjbContextRoots();
      ctxtRoot=getContextRootForUri(uri);
      if (adapterListMap.get(uri) == null) {
        ServletAdapterList list=new ServletAdapterList();
        adapterListMap.put(uri,list);
      }
    }
 else     throw new WebServiceException(rb.getString("String_Node_Str"));
  }
  WebServiceEngineImpl engine=WebServiceEngineImpl.getInstance();
  if (endpoint.getEndpoint().getWebService().getMappingFileUri() != null) {
    engine.createHandler((com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate)null,endpoint.getEndpoint());
  }
 else {
    engine.createHandler(endpoint.getEndpoint());
    try {
      endpoint.initRuntimeInfo((ServletAdapterList)adapterListMap.get(uri));
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public void registerEndpoint(WebServiceEndpoint webserviceEndpoint,EjbEndpointFacade ejbContainer,Object servant,Class tieClass){
  String uri=null;
  EjbRuntimeEndpointInfo endpoint=createEjbEndpointInfo(webserviceEndpoint,ejbContainer,servant,tieClass);
synchronized (webServiceEjbEndpoints) {
    String uriRaw=endpoint.getEndpointAddressUri();
    if (uriRaw != null) {
      uri=(uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
      if (webServiceEjbEndpoints.containsKey(uri)) {
        logger.log(Level.SEVERE,format(rb.getString("String_Node_Str"),uri));
      }
      webServiceEjbEndpoints.put(uri,endpoint);
      regenerateEjbContextRoots();
      if (adapterListMap.get(uri) == null) {
        ServletAdapterList list=new ServletAdapterList();
        adapterListMap.put(uri,list);
      }
    }
 else     throw new WebServiceException(rb.getString("String_Node_Str"));
  }
  WebServiceEngineImpl engine=WebServiceEngineImpl.getInstance();
  if (endpoint.getEndpoint().getWebService().getMappingFileUri() != null) {
    engine.createHandler((com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate)null,endpoint.getEndpoint());
  }
 else {
    engine.createHandler(endpoint.getEndpoint());
    try {
      endpoint.initRuntimeInfo((ServletAdapterList)adapterListMap.get(uri));
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
  }
}
Program: 30123
Project: 30123
Buggy source:
public void downloadFile(URL httpUrl,File toFile) throws Exception {
  InputStream is=null;
  FileOutputStream os=null;
  try {
    if (!toFile.createNewFile()) {
      throw new Exception(localStrings.getLocalString("String_Node_Str","String_Node_Str",toFile.getAbsolutePath()));
    }
    is=httpUrl.openStream();
    os=new FileOutputStream(toFile,true);
    int readCount;
    byte[] buffer=new byte[10240];
    while (true) {
      readCount=is.read(buffer,0,10240);
      if (readCount != -1) {
        os.write(buffer,0,readCount);
      }
 else {
        break;
      }
    }
  }
  finally {
    if (is != null) {
      is.close();
    }
    if (os != null) {
      os.flush();
      os.close();
    }
  }
}

Fixed version (ground truth):
public void downloadFile(URL httpUrl,File toFile) throws Exception {
  InputStream is=null;
  FileOutputStream os=null;
  try {
    if (!toFile.createNewFile()) {
      throw new Exception(localStrings.getLocalString("String_Node_Str","String_Node_Str",toFile.getAbsolutePath()));
    }
    is=httpUrl.openStream();
    os=new FileOutputStream(toFile,true);
    int readCount;
    byte[] buffer=new byte[10240];
    while (true) {
      readCount=is.read(buffer,0,10240);
      if (readCount != -1) {
        os.write(buffer,0,readCount);
      }
 else {
        break;
      }
    }
    os.flush();
  }
  finally {
    try {
      if (is != null) {
        is.close();
      }
    }
  finally {
      if (os != null) {
        os.close();
      }
    }
  }
}
Program: 30124
Project: 30124
Buggy source:
private void ctor(InputStream inStream,File anExplodeDir) throws ZipFileException {
  insist(anExplodeDir != null);
  explodeDir=anExplodeDir;
  try {
    zipStream=new ZipInputStream(inStream);
    checkExplodeDir();
  }
 catch (  Throwable t) {
    if (zipStream != null) {
      try {
        zipStream.close();
      }
 catch (      Throwable thr) {
      }
    }
    throw new ZipFileException(t.toString());
  }
}

Fixed version (ground truth):
/** 
 * /******************************** Private  /
 */
private void ctor(InputStream inStream,File anExplodeDir) throws ZipFileException {
  insist(anExplodeDir != null);
  explodeDir=anExplodeDir;
  try {
    zipStream=new ZipInputStream(inStream);
    checkExplodeDir();
  }
 catch (  Throwable t) {
    if (zipStream != null) {
      try {
        zipStream.close();
      }
 catch (      Throwable thr) {
      }
    }
    throw new ZipFileException(t.toString());
  }
}
Program: 30125
Project: 30125
Buggy source:
public static MbeanService getInstance(){
  if (habitat == null)   return null;
  return habitat.getComponent(MbeanService.class);
}

Fixed version (ground truth):
public static MbeanService getInstance(){
  if (habitat == null)   return null;
  if (mbeanService != null)   return mbeanService;
  return habitat.getComponent(MbeanService.class);
}
Program: 30126
Project: 30126
Buggy source:
void logCommandLine(){
  StringBuilder sb=new StringBuilder();
  for (  String s : commandLine) {
    sb.append(NEWLINE);
    sb.append(s);
  }
  if (!isFakeLaunch()) {
    GFLauncherLogger.info("String_Node_Str",sb.toString());
  }
}

Fixed version (ground truth):
void logCommandLine(){
  StringBuilder sb=new StringBuilder();
  for (  String s : commandLine) {
    sb.append(NEWLINE);
    sb.append(s);
  }
  if (!isFakeLaunch()) {
    GFLauncherLogger.fine("String_Node_Str",sb.toString());
  }
}
Program: 30127
Project: 30127
Buggy source:
public synchronized void add(T key){
  cache.put(key,null);
}

Fixed version (ground truth):
public void add(T key){
synchronized (cache) {
    cache.put(key,null);
  }
}
Program: 30128
Project: 30128
Buggy source:
/** 
 * Return the specified URL with the nonce added to the query string. 
 * @param url URL to be modified
 */
private String addNonce(String url){
  if ((url == null) || (nonce == null))   return (url);
  String path=url;
  String query="String_Node_Str";
  String anchor="String_Node_Str";
  int pound=path.indexOf('#');
  if (pound >= 0) {
    anchor=path.substring(pound);
    path=path.substring(0,pound);
  }
  int question=path.indexOf('?');
  if (question >= 0) {
    query=path.substring(question);
    path=path.substring(0,question);
  }
  StringBuilder sb=new StringBuilder(path);
  if (query.length() > 0) {
    sb.append(query);
    sb.append('&');
  }
 else {
    sb.append('?');
  }
  sb.append(Constants.CSRF_NONCE_REQUEST_PARAM);
  sb.append('=');
  sb.append(nonce);
  sb.append(anchor);
  return (sb.toString());
}

Fixed version (ground truth):
/** 
 * Return the specified URL with the nonce added to the query string.
 * @param url URL to be modified
 */
private String addNonce(String url){
  if ((url == null) || (nonce == null)) {
    return (url);
  }
  String path=url;
  String query="String_Node_Str";
  String anchor="String_Node_Str";
  int pound=path.indexOf('#');
  if (pound >= 0) {
    anchor=path.substring(pound);
    path=path.substring(0,pound);
  }
  int question=path.indexOf('?');
  if (question >= 0) {
    query=path.substring(question);
    path=path.substring(0,question);
  }
  StringBuilder sb=new StringBuilder(path);
  if (query.length() > 0) {
    sb.append(query);
    sb.append('&');
  }
 else {
    sb.append('?');
  }
  sb.append(Constants.CSRF_NONCE_REQUEST_PARAM);
  sb.append('=');
  sb.append(nonce);
  sb.append(anchor);
  return (sb.toString());
}
Program: 30129
Project: 30129
Buggy source:
@Override protected boolean removeEldestEntry(Map.Entry<K,V> eldest){
  if (size() > cacheSize) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean removeEldestEntry(Map.Entry<T,T> eldest){
  if (size() > cacheSize) {
    return true;
  }
  return false;
}
Program: 30130
Project: 30130
Buggy source:
public synchronized boolean contains(T key){
  return cache.containsKey(key);
}

Fixed version (ground truth):
public boolean contains(T key){
synchronized (cache) {
    return cache.containsKey(key);
  }
}
Program: 30131
Project: 30131
Buggy source:
public LruCache(final int cacheSize){
  cache=new FixedSizedLinkedHashMap<T,T>(cacheSize);
}

Fixed version (ground truth):
public LruCache(final int cacheSize){
  cache=new LinkedHashMap<T,T>(){
    private static final long serialVersionUID=1L;
    @Override protected boolean removeEldestEntry(    Map.Entry<T,T> eldest){
      if (size() > cacheSize) {
        return true;
      }
      return false;
    }
  }
;
}
Program: 30132
Project: 30132
Buggy source:
/** 
 * Generate a once time token (nonce) for authenticating subsequent requests. This will also add the token to the session. The nonce generation is a simplified version of ManagerBase.generateSessionId().
 */
protected String generateNonce(){
  byte random[]=new byte[16];
  StringBuilder buffer=new StringBuilder();
  randomSource.nextBytes(random);
  for (int j=0; j < random.length; j++) {
    byte b1=(byte)((random[j] & 0xf0) >> 4);
    byte b2=(byte)(random[j] & 0x0f);
    if (b1 < 10)     buffer.append((char)('0' + b1));
 else     buffer.append((char)('A' + (b1 - 10)));
    if (b2 < 10)     buffer.append((char)('0' + b2));
 else     buffer.append((char)('A' + (b2 - 10)));
  }
  return buffer.toString();
}

Fixed version (ground truth):
/** 
 * Generate a once time token (nonce) for authenticating subsequent requests. This will also add the token to the session. The nonce generation is a simplified version of ManagerBase.generateSessionId().
 */
protected String generateNonce(){
  byte random[]=new byte[16];
  StringBuilder buffer=new StringBuilder();
  randomSource.nextBytes(random);
  for (int j=0; j < random.length; j++) {
    byte b1=(byte)((random[j] & 0xf0) >> 4);
    byte b2=(byte)(random[j] & 0x0f);
    if (b1 < 10) {
      buffer.append((char)('0' + b1));
    }
 else {
      buffer.append((char)('A' + (b1 - 10)));
    }
    if (b2 < 10) {
      buffer.append((char)('0' + b2));
    }
 else {
      buffer.append((char)('A' + (b2 - 10)));
    }
  }
  return buffer.toString();
}