nus-yam/ex-repair huggingface dataset:
Program: 30377
Project: 30377
Buggy source:
/** 
 */
@Override protected int executeCommand() throws CommandException, CommandValidationException {
  File domainXMLFile=getDomainXml();
  logger.log(Level.FINER,"String_Node_Str",domainXMLFile);
  try {
    ArrayList<URL> urls=new ArrayList<URL>();
    File idir=new File(System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
    File mdir=new File(idir,"String_Node_Str");
    for (    File f : mdir.listFiles()) {
      if (f.toString().endsWith("String_Node_Str")) {
        urls.add(f.toURI().toURL());
      }
    }
    URL[] urlsA=urls.toArray(new URL[0]);
    ClassLoader cl=new URLClassLoader(urlsA,Globals.class.getClassLoader());
    ModulesRegistry registry=new StaticModulesRegistry(cl);
    Habitat habitat=registry.createHabitat("String_Node_Str");
    ConfigParser parser=new ConfigParser(habitat);
    URL domainURL=domainXMLFile.toURI().toURL();
    DomDocument doc=parser.parse(domainURL);
    Dom domDomain=doc.getRoot();
    Domain domain=domDomain.createProxy(Domain.class);
    DomainXmlVerifier validator=new DomainXmlVerifier(domain);
    if (validator.invokeConfigValidator())     return 1;
  }
 catch (  Exception e) {
    throw new CommandException(e);
  }
  return 0;
}

Fixed version (ground truth):
/** 
 */
@Override protected int executeCommand() throws CommandException, CommandValidationException {
  File domainXMLFile=getDomainXml();
  logger.log(Level.FINER,"String_Node_Str",domainXMLFile);
  try {
    ArrayList<URL> urls=new ArrayList<URL>();
    File idir=new File(System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
    File mdir=new File(idir,"String_Node_Str");
    for (    File f : mdir.listFiles()) {
      if (f.toString().endsWith("String_Node_Str")) {
        urls.add(f.toURI().toURL());
      }
    }
    final URL[] urlsA=urls.toArray(new URL[urls.size()]);
    ClassLoader cl=(ClassLoader)AccessController.doPrivileged(new PrivilegedAction(){
      @Override public Object run(){
        return new URLClassLoader(urlsA,Globals.class.getClassLoader());
      }
    }
);
    ModulesRegistry registry=new StaticModulesRegistry(cl);
    Habitat habitat=registry.createHabitat("String_Node_Str");
    ConfigParser parser=new ConfigParser(habitat);
    URL domainURL=domainXMLFile.toURI().toURL();
    DomDocument doc=parser.parse(domainURL);
    Dom domDomain=doc.getRoot();
    Domain domain=domDomain.createProxy(Domain.class);
    DomainXmlVerifier validator=new DomainXmlVerifier(domain);
    if (validator.invokeConfigValidator())     return 1;
  }
 catch (  Exception e) {
    throw new CommandException(e);
  }
  return 0;
}
Program: 30378
Project: 30378
Buggy source:
private List<String> handleAttrs(final Map<String,String> old,final Map<String,String> cur){
  if (old.size() != cur.size()) {
    throw new IllegalArgumentException();
  }
  final List<String> reasons=new ArrayList<String>();
  for (  final String key : old.keySet()) {
    final String oldValue=old.get(key);
    final String curValue=cur.get(key);
    final boolean changed=(oldValue == null && curValue != null) || (oldValue != null && curValue == null) || (oldValue != null && !oldValue.equals(curValue));
    if (changed) {
      reasons.add("String_Node_Str" + key + "String_Node_Str"+ oldValue+ "String_Node_Str"+ curValue+ "String_Node_Str");
    }
  }
  return reasons;
}

Fixed version (ground truth):
private List<String> handleAttrs(final Map<String,String> old,final Map<String,String> cur){
  if (old.size() != cur.size()) {
    throw new IllegalArgumentException();
  }
  final List<String> reasons=new ArrayList<String>();
  for (  final Map.Entry<String,String> olde : old.entrySet()) {
    final String key=olde.getKey();
    final String oldValue=olde.getValue();
    final String curValue=cur.get(key);
    final boolean changed=(oldValue == null && curValue != null) || (oldValue != null && curValue == null) || (oldValue != null && !oldValue.equals(curValue));
    if (changed) {
      reasons.add("String_Node_Str" + key + "String_Node_Str"+ oldValue+ "String_Node_Str"+ curValue+ "String_Node_Str");
    }
  }
  return reasons;
}
Program: 30380
Project: 30380
Buggy source:
private void init(ServletRequest servletRequest,ServletResponse servletResponse,boolean isStartAsyncWithZeroArg){
  this.servletRequest=servletRequest;
  this.servletResponse=servletResponse;
  this.isOriginalRequestAndResponse=((servletRequest instanceof RequestFacade || servletRequest instanceof ApplicationHttpRequest) && (servletResponse instanceof ResponseFacade || servletResponse instanceof ApplicationHttpResponse));
  zeroArgDispatchTarget=getZeroArgDispatchTarget(this.origRequest,servletRequest,isStartAsyncWithZeroArg);
}

Fixed version (ground truth):
private void init(ServletRequest servletRequest,ServletResponse servletResponse,boolean isStartAsyncWithZeroArg){
  this.servletRequest=servletRequest;
  this.servletResponse=servletResponse;
  this.isOriginalRequestAndResponse=((servletRequest instanceof RequestFacade || servletRequest instanceof ApplicationHttpRequest) && (servletResponse instanceof ResponseFacade || servletResponse instanceof ApplicationHttpResponse));
  this.isStartAsyncWithZeroArg=isStartAsyncWithZeroArg;
}
Program: 30383
Project: 30383
Buggy source:
/** 
 * Create and return a response wrapper that has been inserted in the appropriate spot in the response chain.
 */
private ServletResponse wrapResponse(State state){
  ServletResponse previous=null;
  ServletResponse current=state.outerResponse;
  while (current != null) {
    if (!(current instanceof ServletResponseWrapper))     break;
    if (current instanceof ApplicationHttpResponse)     break;
    if (current instanceof ApplicationResponse)     break;
    if (current instanceof org.apache.catalina.Response)     break;
    previous=current;
    current=((ServletResponseWrapper)current).getResponse();
  }
  ServletResponse wrapper=null;
  if ((current instanceof ApplicationHttpResponse) || (current instanceof HttpResponse) || (current instanceof HttpServletResponse))   wrapper=new ApplicationHttpResponse((HttpServletResponse)current,DispatcherType.INCLUDE.equals(state.dispatcherType));
 else   wrapper=new ApplicationResponse(current,DispatcherType.INCLUDE.equals(state.dispatcherType));
  if (previous == null)   state.outerResponse=wrapper;
 else   ((ServletResponseWrapper)previous).setResponse(wrapper);
  state.wrapResponse=wrapper;
  return (wrapper);
}

Fixed version (ground truth):
/** 
 * Create and return a response wrapper that has been inserted in the appropriate spot in the response chain.
 */
private ServletResponse wrapResponse(State state){
  ServletResponse previous=null;
  ServletResponse current=state.outerResponse;
  while (current != null) {
    if (!(current instanceof ServletResponseWrapper))     break;
    if (current instanceof ApplicationHttpResponse)     break;
    if (current instanceof ApplicationResponse)     break;
    if (current instanceof org.apache.catalina.Response)     break;
    previous=current;
    current=((ServletResponseWrapper)current).getResponse();
  }
  ServletResponse wrapper=null;
  if ((current instanceof ApplicationHttpResponse) || (current instanceof HttpResponse) || (current instanceof HttpServletResponse))   wrapper=new ApplicationHttpResponse((HttpServletResponse)current,DispatcherType.INCLUDE == state.dispatcherType);
 else   wrapper=new ApplicationResponse(current,DispatcherType.INCLUDE == state.dispatcherType);
  if (previous == null)   state.outerResponse=wrapper;
 else   ((ServletResponseWrapper)previous).setResponse(wrapper);
  state.wrapResponse=wrapper;
  return (wrapper);
}
Program: 30384
Project: 30384
Buggy source:
/** 
 * Get the list of commands from the remote server.
 * @return the commands as a String array, sorted
 */
public static String[] getRemoteCommands(Habitat habitat,ProgramOptions po,Environment env) throws CommandException, CommandValidationException {
  Set<String> localnames=new HashSet<String>();
  String cname=CLICommand.class.getName();
  for (  Inhabitant<?> command : habitat.getInhabitantsByContract(cname)) {
    for (    String name : Inhabitants.getNamesFor(command,cname))     localnames.add(name);
  }
  RemoteCommand cmd=new RemoteCommand("String_Node_Str",po,env);
  String cmds=cmd.executeAndReturnOutput("String_Node_Str");
  List<String> rcmds=new ArrayList<String>();
  BufferedReader r=new BufferedReader(new StringReader(cmds));
  String line;
  try {
    while ((line=r.readLine()) != null) {
      if (line.startsWith("String_Node_Str")) {
        int i=line.indexOf(':');
        if (i < 0)         continue;
        String s=line.substring(i + 1).trim();
        if (!localnames.contains(s))         rcmds.add(s);
      }
    }
  }
 catch (  IOException ioex) {
  }
  Collections.sort(rcmds);
  String[] remoteCommands=rcmds.toArray(new String[rcmds.size()]);
  Arrays.sort(remoteCommands);
  return remoteCommands;
}

Fixed version (ground truth):
/** 
 * Get the list of commands from the remote server.
 * @return the commands as a String array, sorted
 */
public static String[] getRemoteCommands(Habitat habitat,ProgramOptions po,Environment env) throws CommandException, CommandValidationException {
  Set<String> localnames=new HashSet<String>();
  String cname=CLICommand.class.getName();
  for (  Inhabitant<?> command : habitat.getInhabitantsByContract(cname)) {
    for (    String name : Inhabitants.getNamesFor(command,cname))     localnames.add(name);
  }
  RemoteCommand cmd=new RemoteCommand("String_Node_Str",po,env);
  String cmds=cmd.executeAndReturnOutput("String_Node_Str");
  List<String> rcmds=new ArrayList<String>();
  BufferedReader r=new BufferedReader(new StringReader(cmds));
  String line;
  try {
    while ((line=r.readLine()) != null) {
      if (!localnames.contains(line)) {
        rcmds.add(line);
      }
    }
  }
 catch (  IOException ioex) {
  }
  Collections.sort(rcmds);
  String[] remoteCommands=rcmds.toArray(new String[rcmds.size()]);
  Arrays.sort(remoteCommands);
  return remoteCommands;
}
Program: 30385
Project: 30385
Buggy source:
/** 
 * Executes the command with the command parameters passed as Properties where the keys are the paramter names and the values the parameter values
 * @param context information
 */
public void execute(AdminCommandContext context){
  context.getActionReport().setActionExitCode(ActionReport.ExitCode.SUCCESS);
  ActionReport report=context.getActionReport();
  report.setMessage("String_Node_Str");
  report.getTopMessagePart().setChildrenType("String_Node_Str");
  for (  String name : sortedAdminCommands()) {
    ActionReport.MessagePart part=report.getTopMessagePart().addChild();
    part.setMessage(name);
  }
}

Fixed version (ground truth):
/** 
 * Executes the command with the command parameters passed as Properties where the keys are the paramter names and the values the parameter values
 * @param context information
 */
public void execute(AdminCommandContext context){
  context.getActionReport().setActionExitCode(ActionReport.ExitCode.SUCCESS);
  ActionReport report=context.getActionReport();
  report.getTopMessagePart().setChildrenType("String_Node_Str");
  for (  String name : sortedAdminCommands()) {
    ActionReport.MessagePart part=report.getTopMessagePart().addChild();
    part.setMessage(name);
  }
}
Program: 30387
Project: 30387
Buggy source:
public void writeReport(String prefix,MessagePart part,Manifest m,Attributes attr){
  StringBuilder sb=new StringBuilder();
  getCombinedMessages(this,sb);
  attr.putValue("String_Node_Str",sb.toString());
  if (part.getProps().size() > 0) {
    String keys=null;
    for (    Map.Entry entry : part.getProps().entrySet()) {
      String key=fixKey(entry.getKey().toString());
      keys=(keys == null ? key : keys + "String_Node_Str" + key);
      attr.putValue(key + "String_Node_Str",entry.getKey().toString());
      attr.putValue(key + "String_Node_Str",entry.getValue().toString());
    }
    attr.putValue("String_Node_Str",keys);
  }
  if (part.getChildren().size() > 0) {
    attr.putValue("String_Node_Str",part.getChildrenType());
    String keys=null;
    for (    MessagePart child : part.getChildren()) {
      String cm=child.getMessage().replaceAll("String_Node_Str","String_Node_Str");
      String newPrefix=(prefix == null ? cm : prefix + "String_Node_Str" + cm);
      keys=(keys == null ? newPrefix : keys + "String_Node_Str" + newPrefix);
      Attributes childAttr=new Attributes();
      m.getEntries().put(newPrefix,childAttr);
      writeReport(newPrefix,child,m,childAttr);
    }
    attr.putValue("String_Node_Str",keys);
  }
}

Fixed version (ground truth):
public void writeReport(String prefix,MessagePart part,Manifest m,Attributes attr){
  StringBuilder sb=new StringBuilder();
  getCombinedMessages(this,sb);
  attr.putValue("String_Node_Str",sb.toString());
  if (part.getProps().size() > 0) {
    String keys=null;
    for (    Map.Entry entry : part.getProps().entrySet()) {
      String key=fixKey(entry.getKey().toString());
      keys=(keys == null ? key : keys + "String_Node_Str" + key);
      attr.putValue(key + "String_Node_Str",entry.getKey().toString());
      attr.putValue(key + "String_Node_Str",entry.getValue().toString());
    }
    attr.putValue("String_Node_Str",keys);
  }
  if (part.getChildren().size() > 0) {
    attr.putValue("String_Node_Str",part.getChildrenType());
    String keys=null;
    for (    MessagePart child : part.getChildren()) {
      String cm=child.getMessage();
      if (cm != null)       cm=cm.replaceAll("String_Node_Str","String_Node_Str");
      String newPrefix=(prefix == null ? cm : prefix + "String_Node_Str" + cm);
      keys=(keys == null ? newPrefix : keys + "String_Node_Str" + newPrefix);
      Attributes childAttr=new Attributes();
      m.getEntries().put(newPrefix,childAttr);
      writeReport(newPrefix,child,m,childAttr);
    }
    attr.putValue("String_Node_Str",keys);
  }
}
Program: 30388
Project: 30388
Buggy source:
private boolean doIsEncodeable(Request hreq,Session session,String location){
  URL url=null;
  try {
    url=new URL(location);
  }
 catch (  MalformedURLException e) {
    return false;
  }
  if (!hreq.getScheme().equalsIgnoreCase(url.getProtocol()))   return false;
  if (!hreq.getServerName().equalsIgnoreCase(url.getHost()))   return false;
  int serverPort=hreq.getServerPort();
  if (serverPort == -1) {
    if ("String_Node_Str".equals(hreq.getScheme()))     serverPort=443;
 else     serverPort=80;
  }
  int urlPort=url.getPort();
  if (urlPort == -1) {
    if ("String_Node_Str".equals(url.getProtocol()))     urlPort=443;
 else     urlPort=80;
  }
  if (serverPort != urlPort)   return false;
  Context ctx=getContext();
  if (ctx != null) {
    String contextPath=ctx.getPath();
    if (contextPath != null) {
      String file=url.getFile();
      if (file == null || !file.startsWith(contextPath)) {
        return false;
      }
      String sessionParamName=ctx.getSessionParameterName();
      if (file.contains("String_Node_Str" + sessionParamName + "String_Node_Str"+ session.getIdInternal())) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean doIsEncodeable(Request hreq,Session session,String location){
  URL url=null;
  try {
    url=new URL(location);
  }
 catch (  MalformedURLException e) {
    return false;
  }
  if (!hreq.getServerName().equalsIgnoreCase(url.getHost()))   return false;
  int serverPort=hreq.getServerPort();
  if (serverPort == -1) {
    if ("String_Node_Str".equals(hreq.getScheme()))     serverPort=443;
 else     serverPort=80;
  }
  int urlPort=url.getPort();
  boolean httpsLocation="String_Node_Str".equals(url.getProtocol());
  if (urlPort == -1) {
    if (httpsLocation)     urlPort=443;
 else     urlPort=80;
  }
  if (!((hreq.getScheme().equalsIgnoreCase(url.getProtocol()) && serverPort == urlPort) || httpsLocation)) {
    return false;
  }
  Context ctx=getContext();
  if (ctx != null) {
    String contextPath=ctx.getPath();
    if (contextPath != null) {
      String file=url.getFile();
      if (file == null || !file.startsWith(contextPath)) {
        return false;
      }
      String sessionParamName=ctx.getSessionParameterName();
      if (file.contains("String_Node_Str" + sessionParamName + "String_Node_Str"+ session.getIdInternal())) {
        return false;
      }
    }
  }
  return true;
}
Program: 30389
Project: 30389
Buggy source:
/** 
 * Method to be used to create resource, instead of calling ResourceAllocator.createConfigBean(). This method handles the connection creation retrial in case of failure
 * @param resourceAllocator ResourceAllocator
 * @return ResourceHandle newly created resource
 * @throws PoolingException when unable create a resource
 */
protected ResourceHandle createSingleResource(ResourceAllocator resourceAllocator) throws PoolingException {
  ResourceHandle resourceHandle;
  int count=0;
  long startTime=0;
  while (true) {
    try {
      count++;
      startTime=System.currentTimeMillis();
      resourceHandle=resourceAllocator.createResource();
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str" + resourceHandle.getResourceSpec().getResourceId() + "String_Node_Str"+ (System.currentTimeMillis() - startTime));
      }
      if (validation || validateAtmostEveryIdleSecs)       resourceHandle.setLastValidated(System.currentTimeMillis());
      break;
    }
 catch (    Exception ex) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + count + "String_Node_Str"+ "String_Node_Str",ex);
      }
      if (!connectionCreationRetry_ || count >= connectionCreationRetryAttempts_)       throw new PoolingException(ex);
      try {
        Thread.sleep(conCreationRetryInterval_);
      }
 catch (      InterruptedException ie) {
      }
    }
  }
  return resourceHandle;
}

Fixed version (ground truth):
/** 
 * Method to be used to create resource, instead of calling ResourceAllocator.createConfigBean(). This method handles the connection creation retrial in case of failure
 * @param resourceAllocator ResourceAllocator
 * @return ResourceHandle newly created resource
 * @throws PoolingException when unable create a resource
 */
protected ResourceHandle createSingleResource(ResourceAllocator resourceAllocator) throws PoolingException {
  ResourceHandle resourceHandle;
  int count=0;
  long startTime=0;
  while (true) {
    try {
      count++;
      startTime=System.currentTimeMillis();
      resourceHandle=resourceAllocator.createResource();
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str" + resourceHandle.getResourceSpec().getResourceId() + "String_Node_Str"+ (System.currentTimeMillis() - startTime));
      }
      if (validation || validateAtmostEveryIdleSecs)       resourceHandle.setLastValidated(System.currentTimeMillis());
      break;
    }
 catch (    Exception ex) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + count + "String_Node_Str"+ "String_Node_Str",ex);
      }
      if (!connectionCreationRetry_ || count > connectionCreationRetryAttempts_)       throw new PoolingException(ex);
      try {
        Thread.sleep(conCreationRetryInterval_);
      }
 catch (      InterruptedException ie) {
      }
    }
  }
  return resourceHandle;
}
Program: 30390
Project: 30390
Buggy source:
static File obtainFileStatusDir(File f,File statDir,File autoDeployDir){
  File dir=f.getParentFile();
  while (!dir.getAbsolutePath().equals(autoDeployDir.getAbsolutePath())) {
    statDir=new File(statDir,dir.getName());
    dir=dir.getParentFile();
  }
  if (autoDeployDir.exists()) {
    if (!statDir.mkdirs()) {
      sLogger.log(Level.WARNING,"String_Node_Str",autoDeployDir.getAbsolutePath());
    }
  }
  return statDir;
}

Fixed version (ground truth):
static File obtainFileStatusDir(File f,File statDir,File autoDeployDir){
  File dir=f.getParentFile();
  while (!dir.getAbsolutePath().equals(autoDeployDir.getAbsolutePath())) {
    statDir=new File(statDir,dir.getName());
    dir=dir.getParentFile();
  }
  if (autoDeployDir.exists()) {
    if (!statDir.exists() && !statDir.mkdirs()) {
      sLogger.log(Level.WARNING,"String_Node_Str",autoDeployDir.getAbsolutePath());
    }
  }
  return statDir;
}
Program: 30392
Project: 30392
Buggy source:
/** 
 * Retrieve the localization resource bundle for this logger for the current default locale.  Note that if the result is null, then the Logger will use a resource bundle inherited from its parent.
 * @return localization bundle (may be null)
 */
public ResourceBundle getResourceBundle(){
  try {
    return ResourceBundle.getBundle(getLoggerResourceBundleName(name),Locale.getDefault(),cloader);
  }
 catch (  MissingResourceException e) {
    String root=clazz.getPackage().getName();
    try {
      return ResourceBundle.getBundle(root + "String_Node_Str" + RESOURCE_BUNDLE,Locale.getDefault(),cloader);
    }
 catch (    MissingResourceException me) {
      String p=root;
      while (p != null) {
        try {
          int i=p.lastIndexOf("String_Node_Str");
          if (i != -1) {
            p=p.substring(0,i);
            return ResourceBundle.getBundle(p + "String_Node_Str" + RESOURCE_BUNDLE,Locale.getDefault(),cloader);
          }
 else {
            p=null;
          }
        }
 catch (        MissingResourceException mre) {
        }
      }
    }
    try {
      return ResourceBundle.getBundle(getLoggerResourceBundleName(name),Locale.getDefault(),LogDomains.class.getClassLoader());
    }
 catch (    MissingResourceException me) {
    }
    Logger l=LogManager.getLogManager().getLogger(name);
    l.log(Level.FINE,"String_Node_Str" + "String_Node_Str" + clazz.getName());
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Retrieve the localization resource bundle for this logger for the current default locale.  Note that if the result is null, then the Logger will use a resource bundle inherited from its parent.
 * @return localization bundle (may be null)
 */
public ResourceBundle getResourceBundle(){
  try {
    return ResourceBundle.getBundle(getLoggerResourceBundleName(name),Locale.getDefault(),cloader);
  }
 catch (  MissingResourceException e) {
    String root=clazz.getPackage().getName();
    try {
      return ResourceBundle.getBundle(root + "String_Node_Str" + RESOURCE_BUNDLE,Locale.getDefault(),cloader);
    }
 catch (    MissingResourceException me) {
      String p=root;
      while (p != null) {
        try {
          int i=p.lastIndexOf("String_Node_Str");
          if (i != -1) {
            p=p.substring(0,i);
            return ResourceBundle.getBundle(p + "String_Node_Str" + RESOURCE_BUNDLE,Locale.getDefault(),cloader);
          }
 else {
            p=null;
          }
        }
 catch (        MissingResourceException mre) {
        }
      }
    }
    try {
      return ResourceBundle.getBundle(getLoggerResourceBundleName(name),Locale.getDefault(),LogDomains.class.getClassLoader());
    }
 catch (    MissingResourceException me) {
    }
    if (!vectorClazz.contains(clazz.getName())) {
      Logger l=LogManager.getLogManager().getLogger(name);
      l.log(Level.FINE,"String_Node_Str" + "String_Node_Str" + clazz.getName());
      vectorClazz.add(clazz.getName());
    }
    return null;
  }
}
Program: 30393
Project: 30393
Buggy source:
/** 
 * Obtain connection validation class names.
 * @see #VALIDATION_CLASS_NAMES_KEY
 * @see #REASON_FAILED_KEY
 */
@ManagedOperation(impact=MBeanOperationInfo.INFO) @Description("String_Node_Str") public Map<String,Object> getValidationClassNames(final String dbVendor);

Fixed version (ground truth):
/** 
 * Obtain connection validation class names.
 * @see #VALIDATION_CLASS_NAMES_KEY
 * @see #REASON_FAILED_KEY
 */
@ManagedOperation(impact=MBeanOperationInfo.INFO) @Description("String_Node_Str") public Map<String,Object> getValidationClassNames(final String className);
Program: 30395
Project: 30395
Buggy source:
/** 
 * Get Validation class names list for the database vendor that the jdbc  connection pool refers to. This is used for custom connection validation.
 * @param dbVendor database vendor
 * @return all validation class names.
 */
public Set<String> getValidationClassNames(String dbVendor);

Fixed version (ground truth):
/** 
 * Get Validation class names list for the datasource/driver class name that the jdbc connection pool refers to. This is used for custom connection validation.
 * @param className class name
 * @return all validation class names.
 */
public Set<String> getValidationClassNames(String className);
Program: 30396
Project: 30396
Buggy source:
/** 
 * Get Validation class names list for the database vendor that the jdbc  connection pool refers to. This is used for custom connection validation.
 * @param dbVendor
 * @return all validation class names.
 */
public Set<String> getValidationClassNames(String dbVendor){
  return jdbcAdminService.getValidationClassNames(dbVendor);
}

Fixed version (ground truth):
/** 
 * Get Validation class names list for the datasource/driver class name that the jdbc connection pool refers to. This is used for custom connection validation.
 * @param className class name
 * @return all validation class names.
 */
public Set<String> getValidationClassNames(String className){
  return jdbcAdminService.getValidationClassNames(className);
}
Program: 30397
Project: 30397
Buggy source:
/** 
 * Get Validation class names list for the database vendor that the jdbc  connection pool refers to. This is used for custom connection validation.
 * @param dbVendor
 * @return all validation class names.
 */
public Set<String> getValidationClassNames(String dbVendor){
  SortedSet classNames=new TreeSet();
  if (dbVendor.equalsIgnoreCase("String_Node_Str")) {
    classNames.add("String_Node_Str");
  }
 else   if (dbVendor.equalsIgnoreCase("String_Node_Str")) {
    classNames.add("String_Node_Str");
  }
 else   if (dbVendor.equalsIgnoreCase("String_Node_Str")) {
    classNames.add("String_Node_Str");
  }
 else   if (dbVendor.equalsIgnoreCase("String_Node_Str")) {
    classNames.add("String_Node_Str");
  }
  return classNames;
}

Fixed version (ground truth):
/** 
 * Get Validation class names list for the classname that the jdbc  connection pool refers to. This is used for custom connection validation.
 * @param className
 * @return all validation class names.
 */
public Set<String> getValidationClassNames(String className){
  SortedSet classNames=new TreeSet();
  if (className == null) {
    _logger.log(Level.WARNING,"String_Node_Str");
    return classNames;
  }
  File validationClassMappingFile;
  String dbVendor=getDatabaseVendorName(className);
  if (dbVendor != null) {
    validationClassMappingFile=new File(DBVENDOR_MAPPINGS_ROOT + CONVAL_PROPERTIES);
    Properties validationClassMappings=DriverLoader.loadFile(validationClassMappingFile);
    String validationClassName=validationClassMappings.getProperty(dbVendor);
    if (validationClassName != null) {
      classNames.add(validationClassName);
    }
    if (detectJDBC40(className)) {
      classNames.add(JDBC40_CONNECTION_VALIDATION);
    }
  }
  return classNames;
}
Program: 30398
Project: 30398
Buggy source:
/** 
 * Perform the filtering that has been configured for this Valve, matching against the specified request property.
 * @param property The request property on which to filter
 * @param request The servlet request to be processed
 * @param response The servlet response to be processed
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
protected int process(String property,Request request,Response response) throws IOException, ServletException {
  for (int i=0; i < denies.length; i++) {
    if (denies[i].matcher(property).matches()) {
      ServletResponse sres=response.getResponse();
      HttpServletResponse hres=(HttpServletResponse)sres;
      hres.sendError(HttpServletResponse.SC_FORBIDDEN);
      return END_PIPELINE;
    }
  }
  for (int i=0; i < allows.length; i++) {
    if (allows[i].matcher(property).matches()) {
      return INVOKE_NEXT;
    }
  }
  if ((denies.length > 0) && (allows.length == 0)) {
    return INVOKE_NEXT;
  }
  ServletResponse sres=response.getResponse();
  HttpServletResponse hres=(HttpServletResponse)sres;
  hres.sendError(HttpServletResponse.SC_FORBIDDEN);
  return END_PIPELINE;
}

Fixed version (ground truth):
/** 
 * Perform the filtering that has been configured for this Valve, matching against the specified request property.
 * @param property The request property on which to filter
 * @param request The servlet request to be processed
 * @param response The servlet response to be processed
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
protected int process(String property,Request request,Response response) throws IOException, ServletException {
  for (int i=0; i < denies.length; i++) {
    if (denies[i].matcher(property).matches()) {
      handleError(request,response,HttpServletResponse.SC_FORBIDDEN);
      return END_PIPELINE;
    }
  }
  for (int i=0; i < allows.length; i++) {
    if (allows[i].matcher(property).matches()) {
      return INVOKE_NEXT;
    }
  }
  if ((denies.length > 0) && (allows.length == 0)) {
    return INVOKE_NEXT;
  }
  handleError(request,response,HttpServletResponse.SC_FORBIDDEN);
  return END_PIPELINE;
}
Program: 30399
Project: 30399
Buggy source:
protected void service(HttpServletRequest hreq,HttpServletResponse hresp) throws ServletException, IOException {
  boolean dispatch=true;
  String requestUriRaw=hreq.getRequestURI();
  String requestUri=(requestUriRaw.charAt(0) == '/') ? requestUriRaw.substring(1) : requestUriRaw;
  String query=hreq.getQueryString();
  if ("String_Node_Str".equalsIgnoreCase(query)) {
    Endpoint endpoint=WebServiceEngineImpl.getInstance().getEndpoint(hreq.getRequestURI());
    if ((endpoint.getDescriptor().isSecure()) || (endpoint.getDescriptor().getMessageSecurityBinding() != null)) {
      String message=endpoint.getDescriptor().getWebService().getName() + "String_Node_Str";
      (new WsUtil()).writeInvalidMethodType(hresp,message);
      return;
    }
    if (endpoint != null && Boolean.parseBoolean(endpoint.getDescriptor().getDebugging())) {
      dispatch=false;
      WebServiceTesterServlet.invoke(hreq,hresp,endpoint.getDescriptor());
    }
  }
  if (dispatch) {
    WebServiceEjbEndpointRegistry wsejbEndpointRegistry=(WebServiceEjbEndpointRegistry)org.glassfish.internal.api.Globals.getDefaultHabitat().getComponent(WSEjbEndpointRegistry.class);
    EjbRuntimeEndpointInfo ejbEndpoint=wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri,hreq.getMethod(),query);
    if (ejbEndpoint != null) {
      dispatchToEjbEndpoint(hreq,hresp,ejbEndpoint);
    }
  }
}

Fixed version (ground truth):
protected void service(HttpServletRequest hreq,HttpServletResponse hresp) throws ServletException, IOException {
  boolean dispatch=true;
  String requestUriRaw=hreq.getRequestURI();
  String requestUri=(requestUriRaw.charAt(0) == '/') ? requestUriRaw.substring(1) : requestUriRaw;
  String query=hreq.getQueryString();
  if ("String_Node_Str".equalsIgnoreCase(query)) {
    Endpoint endpoint=WebServiceEngineImpl.getInstance().getEndpoint(hreq.getRequestURI());
    if ((endpoint.getDescriptor().isSecure()) || (endpoint.getDescriptor().getMessageSecurityBinding() != null)) {
      String message=endpoint.getDescriptor().getWebService().getName() + "String_Node_Str";
      (new WsUtil()).writeInvalidMethodType(hresp,message);
      return;
    }
    if (Boolean.parseBoolean(endpoint.getDescriptor().getDebugging())) {
      dispatch=false;
      WebServiceTesterServlet.invoke(hreq,hresp,endpoint.getDescriptor());
    }
  }
  if (dispatch) {
    WebServiceEjbEndpointRegistry wsejbEndpointRegistry=(WebServiceEjbEndpointRegistry)org.glassfish.internal.api.Globals.getDefaultHabitat().getComponent(WSEjbEndpointRegistry.class);
    EjbRuntimeEndpointInfo ejbEndpoint=wsejbEndpointRegistry.getEjbWebServiceEndpoint(requestUri,hreq.getMethod(),query);
    if (ejbEndpoint != null) {
      dispatchToEjbEndpoint(hreq,hresp,ejbEndpoint);
    }
  }
}
Program: 30400
Project: 30400
Buggy source:
ContextAdapter(String contextRoot){
  this.contextRoot=contextRoot;
  fixedUrlPatternEndpoints=new HashMap();
  pathUrlPatternEndpoints=new ArrayList();
}

Fixed version (ground truth):
ContextAdapter(){
  fixedUrlPatternEndpoints=new HashMap();
  pathUrlPatternEndpoints=new ArrayList();
}
Program: 30402
Project: 30402
Buggy source:
private void checkUnsupportedMethods(int methodType) throws UnsupportedOperationException {
  Set illegalMethods=fullWsdl ? fullWsdlIllegalMethods : noWsdlIllegalMethods;
  if (illegalMethods.contains(new Integer(methodType))) {
    throw new UnsupportedOperationException();
  }
  return;
}

Fixed version (ground truth):
private void checkUnsupportedMethods(int methodType) throws UnsupportedOperationException {
  Set illegalMethods=fullWsdl ? fullWsdlIllegalMethods : noWsdlIllegalMethods;
  if (illegalMethods.contains(Integer.valueOf(methodType))) {
    throw new UnsupportedOperationException();
  }
  return;
}
Program: 30404
Project: 30404
Buggy source:
public void log(LogRecord record){
  record.getSourceMethodName();
  if (record.getResourceBundle() == null) {
    ResourceBundle rb=getResourceBundle();
    if (rb != null) {
      record.setResourceBundle(rb);
    }
  }
  super.log(record);
}

Fixed version (ground truth):
public void log(LogRecord record){
  record.getSourceMethodName();
  if (record.getResourceBundle() == null) {
    ResourceBundle rb=getResourceBundle();
    if (rb != null) {
      record.setResourceBundle(rb);
    }
  }
  if (record.getMessage() == null) {
    record.setMessage("String_Node_Str");
  }
  super.log(record);
}
Program: 30407
Project: 30407
Buggy source:
private boolean deleteFile(File path){
  if (path != null && path.exists()) {
    if (path.isDirectory()) {
      File[] files=path.listFiles();
      for (      File file : files) {
        if (file.isDirectory()) {
          deleteFile(file);
          if (file.delete())           continue;
        }
 else {
          if (file.delete())           continue;
        }
      }
    }
    path.delete();
  }
  return true;
}

Fixed version (ground truth):
private boolean deleteFile(File path){
  if (path != null && path.exists()) {
    if (path.isDirectory()) {
      File[] files=path.listFiles();
      for (      File file : files) {
        if (file.isDirectory()) {
          deleteFile(file);
          if (file.delete())           continue;
        }
 else {
          if (file.delete())           continue;
        }
      }
    }
    if (!path.delete()) {
      return false;
    }
  }
  return true;
}
Program: 30409
Project: 30409
Buggy source:
private void ensureNonDASConfigsHaveAdminNetworkListener() throws TransactionFailure {
  final Transaction t=new Transaction();
  for (  Config c : configs.getConfig()) {
    final NetworkConfig nc=c.getNetworkConfig();
    final NetworkListener nl=nc.getNetworkListener(SecureAdminCommand.ADMIN_LISTENER_NAME);
    if (nl != null) {
      continue;
    }
    ConfigSupport.apply(new SingleConfigCode<Config>(){
      @Override public Object run(      Config config_w) throws PropertyVetoException, TransactionFailure {
        final NetworkListener nl_w=createAdminNetworkListener(t,nc);
        final VirtualServer vs_w=createAdminVirtualServer(t,config_w);
        return config_w;
      }
    }
,c);
  }
  try {
    t.commit();
  }
 catch (  RetryableException ex) {
    throw new TransactionFailure("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void ensureNonDASConfigsHaveAdminNetworkListener() throws TransactionFailure {
  final Transaction t=new Transaction();
  for (  Config c : configs.getConfig()) {
    final NetworkConfig nc=c.getNetworkConfig();
    final NetworkListener nl=nc.getNetworkListener(SecureAdminCommand.ADMIN_LISTENER_NAME);
    if (nl != null) {
      continue;
    }
    ConfigSupport.apply(new SingleConfigCode<Config>(){
      @Override public Object run(      Config config_w) throws PropertyVetoException, TransactionFailure {
        createAdminNetworkListener(t,nc);
        createAdminVirtualServer(t,config_w);
        return config_w;
      }
    }
,c);
  }
  try {
    t.commit();
  }
 catch (  RetryableException ex) {
    throw new TransactionFailure("String_Node_Str",ex);
  }
}
Program: 30410
Project: 30410
Buggy source:
@Override public Object run(Config config_w) throws PropertyVetoException, TransactionFailure {
  final NetworkListener nl_w=createAdminNetworkListener(t,nc);
  final VirtualServer vs_w=createAdminVirtualServer(t,config_w);
  return config_w;
}

Fixed version (ground truth):
@Override public Object run(Config config_w) throws PropertyVetoException, TransactionFailure {
  createAdminNetworkListener(t,nc);
  createAdminVirtualServer(t,config_w);
  return config_w;
}
Program: 30412
Project: 30412
Buggy source:
@Override public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final StringNonce other=(StringNonce)obj;
  if (!this.nonce.equals(other.getNonce()) && (this.nonce == null || !this.nonce.equals(other.getNonce()))) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final StringNonce other=(StringNonce)obj;
  if (this.nonce == null || !this.nonce.equals(other.getNonce())) {
    return false;
  }
  return true;
}
Program: 30413
Project: 30413
Buggy source:
public static void createRealms(String defaultRealm,List<AuthRealm> realms,String configName){
  assert(realms != null);
  String goodRealm=null;
  for (  AuthRealm aRealm : realms) {
    String realmName=aRealm.getName();
    String realmClass=aRealm.getClassname();
    assert(realmName != null);
    assert(realmClass != null);
    try {
      List<Property> realmProps=aRealm.getProperty();
      Properties props=new Properties();
      for (      Property realmProp : realmProps) {
        props.setProperty(realmProp.getName(),realmProp.getValue());
      }
      Realm.instantiate(realmName,realmClass,props,configName);
      if (logger.isLoggable(Level.FINE)) {
        logger.fine("String_Node_Str" + realmName);
      }
      if (goodRealm == null) {
        goodRealm=realmName;
      }
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",realmName);
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
  }
  if (goodRealm == null) {
    logger.severe("String_Node_Str");
  }
 else {
    try {
      Realm def=Realm.getInstance(defaultRealm);
    }
 catch (    Exception e) {
      defaultRealm=goodRealm;
    }
    Realm.setDefaultRealm(defaultRealm);
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("String_Node_Str" + defaultRealm);
    }
  }
}

Fixed version (ground truth):
public static void createRealms(String defaultRealm,List<AuthRealm> realms,String configName){
  assert(realms != null);
  String goodRealm=null;
  for (  AuthRealm aRealm : realms) {
    String realmName=aRealm.getName();
    String realmClass=aRealm.getClassname();
    assert(realmName != null);
    assert(realmClass != null);
    try {
      List<Property> realmProps=aRealm.getProperty();
      Properties props=new Properties();
      for (      Property realmProp : realmProps) {
        props.setProperty(realmProp.getName(),realmProp.getValue());
      }
      Realm.instantiate(realmName,realmClass,props,configName);
      if (logger.isLoggable(Level.FINE)) {
        logger.fine("String_Node_Str" + realmName);
      }
      if (goodRealm == null) {
        goodRealm=realmName;
      }
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",realmName);
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
  }
  if (goodRealm == null) {
    logger.severe("String_Node_Str");
  }
 else {
    try {
      Realm.getInstance(defaultRealm);
    }
 catch (    Exception e) {
      defaultRealm=goodRealm;
    }
    Realm.setDefaultRealm(defaultRealm);
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("String_Node_Str" + defaultRealm);
    }
  }
}
Program: 30414
Project: 30414
Buggy source:
@Override public Enumeration getGroupNames(String username) throws NoSuchUserException {
  try {
    Set<String> groupsSet=Collections.EMPTY_SET;
    groupsSet=new PAM(PAM_SERVICE).getGroupsOfUser(username);
    return Collections.enumeration(groupsSet);
  }
 catch (  PAMException ex) {
    Logger.getLogger(PamRealm.class.getName()).log(Level.SEVERE,"String_Node_Str",ex);
    return null;
  }
}

Fixed version (ground truth):
@Override public Enumeration getGroupNames(String username) throws NoSuchUserException {
  try {
    Set<String> groupsSet=new PAM(PAM_SERVICE).getGroupsOfUser(username);
    return Collections.enumeration(groupsSet);
  }
 catch (  PAMException ex) {
    Logger.getLogger(PamRealm.class.getName()).log(Level.SEVERE,"String_Node_Str",ex);
    return null;
  }
}
Program: 30416
Project: 30416
Buggy source:
public static File writeConfigFileToTempDir(String fileName) throws IOException {
  File filePath=new File(fileName);
  if (filePath.exists()) {
    return filePath;
  }
  File localFile=null;
  if (filePath.getParentFile() != null && filePath.getParentFile().exists()) {
    localFile=filePath;
    localFile.createNewFile();
  }
 else {
    String userHome=System.getProperty("String_Node_Str");
    String embeddedServerName=getCurrentEmbeddedServerName();
    File tempDir=new File(userHome + File.separator + "String_Node_Str"+ embeddedServerName+ File.separator+ "String_Node_Str");
    boolean mkDirSuccess=true;
    if (!tempDir.exists()) {
      mkDirSuccess=tempDir.mkdirs();
    }
    localFile=new File(tempDir.getAbsolutePath() + File.separator + fileName);
    if (mkDirSuccess && !localFile.exists()) {
      localFile.createNewFile();
    }
  }
  FileOutputStream oStream=null;
  InputStream iStream=null;
  try {
    oStream=new FileOutputStream(localFile);
    iStream=Util.class.getResourceAsStream("String_Node_Str" + fileName);
    while (iStream != null && iStream.available() > 0) {
      oStream.write(iStream.read());
    }
  }
  finally {
    oStream.close();
    if (iStream != null) {
      iStream.close();
    }
  }
  return localFile;
}

Fixed version (ground truth):
public static File writeConfigFileToTempDir(String fileName) throws IOException {
  File filePath=new File(fileName);
  if (filePath.exists()) {
    return filePath;
  }
  File localFile=null;
  if (filePath.getParentFile() != null && filePath.getParentFile().exists()) {
    localFile=filePath;
    if (!localFile.createNewFile()) {
      throw new IOException();
    }
  }
 else {
    String userHome=System.getProperty("String_Node_Str");
    String embeddedServerName=getCurrentEmbeddedServerName();
    File tempDir=new File(userHome + File.separator + "String_Node_Str"+ embeddedServerName+ File.separator+ "String_Node_Str");
    boolean mkDirSuccess=true;
    if (!tempDir.exists()) {
      mkDirSuccess=tempDir.mkdirs();
    }
    localFile=new File(tempDir.getAbsolutePath() + File.separator + fileName);
    if (mkDirSuccess && !localFile.exists()) {
      localFile.createNewFile();
    }
  }
  FileOutputStream oStream=null;
  InputStream iStream=null;
  try {
    oStream=new FileOutputStream(localFile);
    iStream=Util.class.getResourceAsStream("String_Node_Str" + fileName);
    while (iStream != null && iStream.available() > 0) {
      oStream.write(iStream.read());
    }
  }
  finally {
    oStream.close();
    if (iStream != null) {
      iStream.close();
    }
  }
  return localFile;
}
Program: 30419
Project: 30419
Buggy source:
/** 
 * Used to add a single excluded policy statement to this PolicyConfiguration. <P>
 * @param permission the permission to be addedto the excluded policy statements. 
 * @throws java.lang.SecurityException if called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
 * @throws java.lang.UnsupportedOperationException if the state of the policy context whose interface is this PolicyConfiguration Object is "deleted" or "inService" when this method is called.
 * @throws javax.security.jacc.PolicyContextException if the implementation throws a checked exception that has not been accounted for by the addToExcludedPolicy method signature. The exception thrown by the implementation class will be encapsulated (during construction) in the thrown PolicyContextException.
 */
public void addToExcludedPolicy(Permission permission) throws PolicyContextException {
  assertStateIsOpen();
  if (permission != null) {
    checkSetPolicyPermission();
    this.getExcludedPermissions().add(permission);
    writeOnCommit=true;
  }
}

Fixed version (ground truth):
/** 
 * Used to add a single excluded policy statement to this PolicyConfiguration. <P>
 * @param permission the permission to be addedto the excluded policy statements. 
 * @throws java.lang.SecurityException if called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.                  fa
 * @throws java.lang.UnsupportedOperationException if the state of the policy context whose interface is this PolicyConfiguration Object is "deleted" or "inService" when this method is called.
 * @throws javax.security.jacc.PolicyContextException if the implementation throws a checked exception that has not been accounted for by the addToExcludedPolicy method signature. The exception thrown by the implementation class will be encapsulated (during construction) in the thrown PolicyContextException.
 */
public void addToExcludedPolicy(Permission permission) throws PolicyContextException {
  assertStateIsOpen();
  if (permission != null) {
    checkSetPolicyPermission();
    this.getExcludedPermissions().add(permission);
    writeOnCommit=true;
  }
}