nus-yam/ex-repair huggingface dataset:
Program: 30191
Project: 30191
Buggy source:
/** 
 * Rebind an object in the namespace. Rebinds the reference to the actual object in either the cosnaming or serial context.
 * @throws NamingException if there is a naming exception.
 */
public void rebind(Name name,Object obj) throws NamingException {
  throw new NamingException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Rebind an object in the namespace. Rebinds the reference to the actual object in either the cosnaming or serial context.
 * @throws NamingException if there is a naming exception.
 */
@Override public void rebind(Name name,Object obj) throws NamingException {
  throw new NamingException("String_Node_Str");
}
Program: 30192
Project: 30192
Buggy source:
/** 
 * Unbind an object from the namespace.
 * @throws NamingException if there is a naming exception.
 */
public void unbind(Name name) throws NamingException {
  throw new NamingException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Unbind an object from the namespace.
 * @throws NamingException if there is a naming exception.
 */
@Override public void unbind(Name name) throws NamingException {
  throw new NamingException("String_Node_Str");
}
Program: 30193
Project: 30193
Buggy source:
/** 
 * The rename operation is not supported by this context. It throws an OperationNotSupportedException.
 */
public void rename(Name oldname,Name newname) throws NamingException {
  throw new NamingException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * The rename operation is not supported by this context. It throws an OperationNotSupportedException.
 */
@Override public void rename(Name oldname,Name newname) throws NamingException {
  throw new NamingException("String_Node_Str");
}
Program: 30194
Project: 30194
Buggy source:
public Context createSubcontext(Name name) throws NamingException {
  throw new NamingException("String_Node_Str");
}

Fixed version (ground truth):
@Override public Context createSubcontext(Name name) throws NamingException {
  throw new NamingException("String_Node_Str");
}
Program: 30195
Project: 30195
Buggy source:
/** 
 * Remove a property from the environment.
 */
public Object removeFromEnvironment(String propName) throws NamingException {
  if (myEnv == null) {
    return null;
  }
  return myEnv.remove(propName);
}

Fixed version (ground truth):
/** 
 * Remove a property from the environment.
 */
@Override public Object removeFromEnvironment(String propName) throws NamingException {
  if (myEnv == null) {
    return null;
  }
  return myEnv.remove(propName);
}
Program: 30196
Project: 30196
Buggy source:
/** 
 * Return the name of this context within the namespace.  The name can be passed as an argument to (new InitialContext()).lookup() to reproduce this context.
 */
public String getNameInNamespace() throws NamingException {
  return myName;
}

Fixed version (ground truth):
/** 
 * Return the name of this context within the namespace.  The name can be passed as an argument to (new InitialContext()).lookup() to reproduce this context.
 */
@Override public String getNameInNamespace() throws NamingException {
  return myName;
}
Program: 30197
Project: 30197
Buggy source:
/** 
 * The destroySubcontext operation is not supported by this context. It throws an OperationNotSupportedException.
 */
public void destroySubcontext(Name name) throws NamingException {
  throw new NamingException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * The destroySubcontext operation is not supported by this context. It throws an OperationNotSupportedException.
 */
@Override public void destroySubcontext(Name name) throws NamingException {
  throw new NamingException("String_Node_Str");
}
Program: 30198
Project: 30198
Buggy source:
/** 
 * Add a property to the environment.
 */
public Object addToEnvironment(String propName,Object propVal) throws NamingException {
  if (myEnv == null) {
    myEnv=new Hashtable(5,0.75f);
  }
  return myEnv.put(propName,propVal);
}

Fixed version (ground truth):
/** 
 * Add a property to the environment.
 */
@Override public Object addToEnvironment(String propName,Object propVal) throws NamingException {
  if (myEnv == null) {
    myEnv=new Hashtable(5,0.75f);
  }
  return myEnv.put(propName,propVal);
}
Program: 30199
Project: 30199
Buggy source:
/** 
 * New JNDI 1.2 operation.
 */
public void close() throws NamingException {
  myEnv=null;
}

Fixed version (ground truth):
/** 
 * New JNDI 1.2 operation.
 */
@Override public void close() throws NamingException {
  myEnv=null;
}
Program: 30200
Project: 30200
Buggy source:
public byte[] run(){
  Iterator iter=credset.iterator();
  PasswordCredential pc=(PasswordCredential)iter.next();
  return pc.getTargetName();
}

Fixed version (ground truth):
public byte[] run(){
  Iterator<PasswordCredential> iter=credset.iterator();
  PasswordCredential pc=iter.next();
  return pc.getTargetName();
}
Program: 30201
Project: 30201
Buggy source:
private byte[] getTargetName(Subject subj){
  byte[] tgt_name={};
  final Subject sub=subj;
  final Set credset=AccessController.doPrivileged(new PrivilegedAction<Set>(){
    public Set run(){
      return sub.getPrivateCredentials(PasswordCredential.class);
    }
  }
);
  if (credset.size() == 1) {
    tgt_name=AccessController.doPrivileged(new PrivilegedAction<byte[]>(){
      public byte[] run(){
        Iterator iter=credset.iterator();
        PasswordCredential pc=(PasswordCredential)iter.next();
        return pc.getTargetName();
      }
    }
);
  }
  return tgt_name;
}

Fixed version (ground truth):
private byte[] getTargetName(Subject subj){
  byte[] tgt_name={};
  final Subject sub=subj;
  final Set<PasswordCredential> credset=AccessController.doPrivileged(new PrivilegedAction<Set>(){
    public Set run(){
      return sub.getPrivateCredentials(PasswordCredential.class);
    }
  }
);
  if (credset.size() == 1) {
    tgt_name=AccessController.doPrivileged(new PrivilegedAction<byte[]>(){
      public byte[] run(){
        Iterator<PasswordCredential> iter=credset.iterator();
        PasswordCredential pc=iter.next();
        return pc.getTargetName();
      }
    }
);
  }
  return tgt_name;
}
Program: 30204
Project: 30204
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + command + "String_Node_Str"+ httpMethod+ "String_Node_Str"+ resourcePath+ "String_Node_Str"+ displayName+ "String_Node_Str"+ String.valueOf(commandParams)+ "String_Node_Str"+ customClassName+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + command + "String_Node_Str"+ httpMethod+ "String_Node_Str"+ resourcePath+ "String_Node_Str"+ displayName+ "String_Node_Str"+ Arrays.asList(commandParams).toString()+ "String_Node_Str"+ customClassName+ '}';
}
Program: 30205
Project: 30205
Buggy source:
/** 
 * Return the relative path associated with this servlet.
 * @param request The servlet request we are processing
 */
protected String getRelativePath(HttpServletRequest request){
  if (request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null) {
    String result=(String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
    if (result == null)     result=(String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
    if ((result == null) || (result.equals("String_Node_Str")))     result="String_Node_Str";
    return (result);
  }
  String result=request.getPathInfo();
  if (result == null) {
    result=request.getServletPath();
  }
  if ((result == null) || (result.equals("String_Node_Str"))) {
    result="String_Node_Str";
  }
  return (result);
}

Fixed version (ground truth):
/** 
 * Return the relative path associated with this servlet.
 * @param request The servlet request we are processing
 */
protected String getRelativePath(HttpServletRequest request){
  if (request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null) {
    String result=(String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
    if (result == null)     result=(String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
    if ((result == null) || (result.equals("String_Node_Str")))     result="String_Node_Str";
    return (result);
  }
  String result=request.getPathInfo();
  if (result == null) {
    result=request.getServletPath();
  }
 else {
    result=request.getServletPath() + result;
  }
  if ((result == null) || (result.equals("String_Node_Str"))) {
    result="String_Node_Str";
  }
  return (result);
}
Program: 30206
Project: 30206
Buggy source:
private void validateKeepStateOption(DeploymentContext context,DeployCommandParameters params,Application app){
  if ((params.keepstate != null && params.keepstate) || app.getKeepState()) {
    if (!DeploymentUtils.isDASTarget(params.target)) {
      params.keepstate=false;
      String warningMsg=localStrings.getLocalString("String_Node_Str","String_Node_Str");
      ActionReport subReport=context.getActionReport().addSubActionsReport();
      subReport.setActionExitCode(ActionReport.ExitCode.WARNING);
      subReport.setMessage(warningMsg);
      context.getLogger().log(Level.WARNING,warningMsg);
    }
  }
}

Fixed version (ground truth):
private void validateKeepStateOption(DeploymentContext context,DeployCommandParameters params,Application app){
  if ((params.keepstate != null && params.keepstate) || app.getKeepState()) {
    if (!isDASTarget(context,params)) {
      params.keepstate=false;
      String warningMsg=localStrings.getLocalString("String_Node_Str","String_Node_Str");
      ActionReport subReport=context.getActionReport().addSubActionsReport();
      subReport.setActionExitCode(ActionReport.ExitCode.WARNING);
      subReport.setMessage(warningMsg);
      context.getLogger().log(Level.WARNING,warningMsg);
    }
  }
}
Program: 30207
Project: 30207
Buggy source:
/** 
 * Return true if the two object references refer to the same remote object.
 */
@Override public boolean isIdentical(Remote obj1,Remote obj2){
  org.omg.CORBA.Object corbaObj1=(org.omg.CORBA.Object)obj1;
  org.omg.CORBA.Object corbaObj2=(org.omg.CORBA.Object)obj2;
  return corbaObj1._is_equivalent(corbaObj2);
}

Fixed version (ground truth):
/** 
 * Return true if the two object references refer to the same remote object.
 */
@Override public boolean isIdentical(Remote obj1,Remote obj2){
  if (obj1 instanceof org.omg.CORBA.Object && obj2 instanceof org.omg.CORBA.Object) {
    org.omg.CORBA.Object corbaObj1=(org.omg.CORBA.Object)obj1;
    org.omg.CORBA.Object corbaObj2=(org.omg.CORBA.Object)obj2;
    return corbaObj1._is_equivalent(corbaObj2);
  }
 else {
    return false;
  }
}
Program: 30208
Project: 30208
Buggy source:
private boolean setSyncBundleExportFile(){
  if (isRetrieve) {
    try {
      syncBundleExport=File.createTempFile("String_Node_Str","String_Node_Str");
      syncBundleExport.deleteOnExit();
    }
 catch (    Exception ex) {
      syncBundleExport=null;
      setError(Strings.get("String_Node_Str",ex.getLocalizedMessage()));
      return false;
    }
  }
 else {
    File f=null;
    if (file_name != null && !file_name.isEmpty()) {
      f=new File(file_name);
      if (f.isDirectory()) {
        f=new File(f,getDefaultBundleName());
      }
    }
 else {
      f=getDefaultBundle();
    }
    if (f.getParentFile() != null && !f.getParentFile().exists()) {
      f.getParentFile().mkdirs();
    }
    syncBundleExport=SmartFile.sanitize(f);
  }
  return true;
}

Fixed version (ground truth):
private boolean setSyncBundleExportFile(){
  if (isRetrieve) {
    try {
      syncBundleExport=File.createTempFile("String_Node_Str","String_Node_Str");
      syncBundleExport.deleteOnExit();
    }
 catch (    Exception ex) {
      syncBundleExport=null;
      setError(Strings.get("String_Node_Str",ex.getLocalizedMessage()));
      return false;
    }
  }
 else {
    File f=null;
    if (file_name != null && !file_name.isEmpty()) {
      f=new File(file_name);
      if (f.isDirectory()) {
        f=new File(f,getDefaultBundleName());
      }
    }
 else {
      f=getDefaultBundle();
    }
    if (f.getParentFile() != null && !f.getParentFile().exists()) {
      if (!f.getParentFile().mkdirs()) {
        setError(Strings.get("String_Node_Str",f.getParentFile().getPath()));
        return false;
      }
    }
    syncBundleExport=SmartFile.sanitize(f);
  }
  return true;
}
Program: 30210
Project: 30210
Buggy source:
public BitSet getRolesOfPrincipals(String pcid,String[] roles,Principal[] principals) throws SecurityException, UnsupportedOperationException {
  BitSet roleSet=new BitSet(roles.length);
  if (principals.length == 0 || roles == null || roles.length == 0) {
    return null;
  }
  SecurityRoleMapper srm=getInternalMapper(pcid);
  for (int i=0; i < roles.length; i++) {
    roleSet.set(i,arePrincipalsInRole(srm,principals,roles[i]));
  }
  return roleSet;
}

Fixed version (ground truth):
public BitSet getRolesOfPrincipals(String pcid,String[] roles,Principal[] principals) throws SecurityException, UnsupportedOperationException {
  if (principals.length == 0 || roles == null || roles.length == 0) {
    return null;
  }
  BitSet roleSet=new BitSet(roles.length);
  SecurityRoleMapper srm=getInternalMapper(pcid);
  for (int i=0; i < roles.length; i++) {
    roleSet.set(i,arePrincipalsInRole(srm,principals,roles[i]));
  }
  return roleSet;
}
Program: 30211
Project: 30211
Buggy source:
/** 
 * Causes all policy statements to be deleted from this PolicyConfiguration and sets its internal state such that calling any method, other than delete, getContextID, or inService on the PolicyConfiguration will be rejected and cause an UnsupportedOperationException to be thrown. <P> This operation has no affect on any linked PolicyConfigurations other than removing any links involving the deleted PolicyConfiguration.
 * @throws java.lang.SecurityException if called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
 * @throws javax.security.jacc.PolicyContextException if the implementation throws a checked exception that has not been accounted for by the delete method signature. The exception thrown by the implementation class will be encapsulated (during construction) in the thrown PolicyContextException.
 */
public void delete() throws javax.security.jacc.PolicyContextException {
  checkSetPolicyPermission();
  SharedState.removeLinks(id);
  pcwLock.lock();
  try {
    removePolicy();
  }
  finally {
    pcwLock.unlock();
    setState(DELETED_STATE);
  }
}

Fixed version (ground truth):
/** 
 * Causes all policy statements to be deleted from this PolicyConfiguration and sets its internal state such that calling any method, other than delete, getContextID, or inService on the PolicyConfiguration will be rejected and cause an UnsupportedOperationException to be thrown. <P> This operation has no affect on any linked PolicyConfigurations other than removing any links involving the deleted PolicyConfiguration.
 * @throws java.lang.SecurityException if called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
 * @throws javax.security.jacc.PolicyContextException if the implementation throws a checked exception that has not been accounted for by the delete method signature. The exception thrown by the implementation class will be encapsulated (during construction) in the thrown PolicyContextException.
 */
public void delete() throws javax.security.jacc.PolicyContextException {
  checkSetPolicyPermission();
  SharedState.removeLinks(id);
  pcwLock.lock();
  try {
    removePolicy();
  }
  finally {
    try {
      setState(DELETED_STATE);
    }
  finally {
      pcwLock.unlock();
    }
  }
}
Program: 30212
Project: 30212
Buggy source:
private Role getRole(String roleName){
  int index=-1;
  Role rvalue=new Role(roleName);
  if (roleTable == null) {
    roleTable=new ArrayList<Role>();
  }
 else {
    index=roleTable.indexOf(rvalue);
  }
  if (index < 0) {
    roleTable.add(rvalue);
    roleTable.indexOf(rvalue);
  }
 else {
    rvalue=roleTable.get(index);
  }
  return rvalue;
}

Fixed version (ground truth):
private Role getRole(String roleName){
  int index=-1;
  Role rvalue=new Role(roleName);
  if (roleTable == null) {
    roleTable=new ArrayList<Role>();
  }
 else {
    index=roleTable.indexOf(rvalue);
  }
  if (index < 0) {
    roleTable.add(rvalue);
  }
 else {
    rvalue=roleTable.get(index);
  }
  return rvalue;
}
Program: 30213
Project: 30213
Buggy source:
/** 
 * Makes sure something is running at the DASHost and DASPort. We intentionally do not do an operation that requires authentication since we may be called in a context where authentication is not provided (like over SSH). This method assumes that _create_instance_filesystem is being called by the DAS via SSH -- so the DAS should be running.
 * @throws CommandException
 */
private void checkDASCoordinates() throws CommandException {
  try {
    InetAddress addr=InetAddress.getByName(DASHost);
  }
 catch (  UnknownHostException e) {
    String thisHost=NetUtils.getHostName();
    String msg=Strings.get("String_Node_Str",DASHost,thisHost);
    throw new CommandException(msg,e);
  }
  if (!NetUtils.isRunning(DASHost,DASPort)) {
    String thisHost=NetUtils.getHostName();
    String msg=Strings.get("String_Node_Str",DASHost,Integer.toString(DASPort),thisHost);
    throw new CommandException(msg);
  }
}

Fixed version (ground truth):
/** 
 * Makes sure something is running at the DASHost and DASPort. We intentionally do not do an operation that requires authentication since we may be called in a context where authentication is not provided (like over SSH). This method assumes that _create_instance_filesystem is being called by the DAS via SSH -- so the DAS should be running.
 * @throws CommandException
 */
private void checkDASCoordinates() throws CommandException {
  try {
    InetAddress.getByName(DASHost);
  }
 catch (  UnknownHostException e) {
    String thisHost=NetUtils.getHostName();
    String msg=Strings.get("String_Node_Str",DASHost,thisHost);
    throw new CommandException(msg,e);
  }
  if (!NetUtils.isRunning(DASHost,DASPort)) {
    String thisHost=NetUtils.getHostName();
    String msg=Strings.get("String_Node_Str",DASHost,Integer.toString(DASPort),thisHost);
    throw new CommandException(msg);
  }
}
Program: 30214
Project: 30214
Buggy source:
private void writeDasProperties() throws IOException {
  dasPropsFile.createNewFile();
  dasProperties=new Properties();
  dasProperties.setProperty(K_DAS_HOST,DASHost);
  dasProperties.setProperty(K_DAS_PORT,String.valueOf(DASPort));
  dasProperties.setProperty(K_DAS_IS_SECURE,String.valueOf(dasIsSecure));
  dasProperties.setProperty(K_DAS_PROTOCOL,DASProtocol);
  FileOutputStream fos=new FileOutputStream(dasPropsFile);
  dasProperties.store(fos,Strings.get("String_Node_Str"));
  fos.close();
}

Fixed version (ground truth):
private void writeDasProperties() throws IOException {
  if (dasPropsFile.createNewFile()) {
    dasProperties=new Properties();
    dasProperties.setProperty(K_DAS_HOST,DASHost);
    dasProperties.setProperty(K_DAS_PORT,String.valueOf(DASPort));
    dasProperties.setProperty(K_DAS_IS_SECURE,String.valueOf(dasIsSecure));
    dasProperties.setProperty(K_DAS_PROTOCOL,DASProtocol);
    FileOutputStream fos=null;
    try {
      fos=new FileOutputStream(dasPropsFile);
      dasProperties.store(fos,Strings.get("String_Node_Str"));
    }
  finally {
      if (fos != null) {
        fos.close();
      }
    }
  }
}
Program: 30215
Project: 30215
Buggy source:
private void writeDasProperties() throws IOException {
  dasPropsFile.createNewFile();
  dasProperties=new Properties();
  dasProperties.setProperty(K_DAS_HOST,DASHost);
  dasProperties.setProperty(K_DAS_PORT,String.valueOf(DASPort));
  dasProperties.setProperty(K_DAS_IS_SECURE,String.valueOf(dasIsSecure));
  dasProperties.setProperty(K_DAS_PROTOCOL,DASProtocol);
  FileOutputStream fos=new FileOutputStream(dasPropsFile);
  dasProperties.store(fos,Strings.get("String_Node_Str"));
  fos.close();
}

Fixed version (ground truth):
private void writeDasProperties() throws IOException {
  if (dasPropsFile.createNewFile()) {
    dasProperties=new Properties();
    dasProperties.setProperty(K_DAS_HOST,DASHost);
    dasProperties.setProperty(K_DAS_PORT,String.valueOf(DASPort));
    dasProperties.setProperty(K_DAS_IS_SECURE,String.valueOf(dasIsSecure));
    dasProperties.setProperty(K_DAS_PROTOCOL,DASProtocol);
    FileOutputStream fos=null;
    try {
      fos=new FileOutputStream(dasPropsFile);
      dasProperties.store(fos,Strings.get("String_Node_Str"));
    }
  finally {
      if (fos != null) {
        fos.close();
      }
    }
  }
}
Program: 30216
Project: 30216
Buggy source:
private void restoreInstanceDir(){
  File backup=getBackupDir();
  if (backup != null && backup.isDirectory()) {
    getServerDirs().getServerDir().delete();
    backup.renameTo(getServerDirs().getServerDir());
  }
}

Fixed version (ground truth):
private void restoreInstanceDir(){
  File backup=getBackupDir();
  if (backup != null && backup.isDirectory()) {
    getServerDirs().getServerDir().delete();
    if (!backup.renameTo(getServerDirs().getServerDir())) {
      logger.warning(Strings.get("String_Node_Str",backup.getAbsolutePath(),getServerDirs().getServerDir().getAbsolutePath()));
    }
  }
}
Program: 30217
Project: 30217
Buggy source:
private int createDirectories() throws CommandException {
  if (!agentConfigDir.isDirectory()) {
    agentConfigDir.mkdirs();
  }
  writeProperties();
  FileInputStream in=null;
  Payload.Inbound payload=null;
  try {
    in=new FileInputStream(syncBundle);
    payload=PayloadImpl.Inbound.newInstance("String_Node_Str",in);
  }
 catch (  IOException ex) {
    try {
      if (in != null)       in.close();
    }
 catch (    IOException ioe) {
      logger.warning(Strings.get("String_Node_Str",syncBundle,ioe.getLocalizedMessage()));
    }
    throw new CommandException(Strings.get("String_Node_Str",syncBundle,ex.getLocalizedMessage()),ex);
  }
  backupInstanceDir();
  File targetDir=this.getServerDirs().getServerDir();
  targetDir.mkdirs();
  Perm perm=new Perm(targetDir,null,logger);
  try {
    perm.processParts(payload);
  }
 catch (  Exception ex) {
    restoreInstanceDir();
    String msg=Strings.get("String_Node_Str",syncBundle,targetDir.getAbsolutePath());
    if (ex.getLocalizedMessage() != null)     msg=msg + "String_Node_Str" + ex.getLocalizedMessage();
    throw new CommandException(msg,ex);
  }
 finally {
    try {
      if (in != null)       in.close();
    }
 catch (    IOException ex) {
      logger.warning(Strings.get("String_Node_Str",syncBundle,ex.getLocalizedMessage()));
    }
  }
  deleteBackupDir();
  return SUCCESS;
}

Fixed version (ground truth):
private int createDirectories() throws CommandException {
  if (!agentConfigDir.isDirectory()) {
    if (!agentConfigDir.mkdirs()) {
      throw new CommandException(Strings.get("String_Node_Str",agentConfigDir.getPath()));
    }
  }
  writeProperties();
  FileInputStream in=null;
  Payload.Inbound payload=null;
  try {
    in=new FileInputStream(syncBundle);
    payload=PayloadImpl.Inbound.newInstance("String_Node_Str",in);
  }
 catch (  IOException ex) {
    try {
      if (in != null)       in.close();
    }
 catch (    IOException ioe) {
      logger.warning(Strings.get("String_Node_Str",syncBundle,ioe.getLocalizedMessage()));
    }
    throw new CommandException(Strings.get("String_Node_Str",syncBundle,ex.getLocalizedMessage()),ex);
  }
  backupInstanceDir();
  File targetDir=this.getServerDirs().getServerDir();
  if (!targetDir.mkdirs()) {
    restoreInstanceDir();
    throw new CommandException(Strings.get("String_Node_Str",targetDir.getPath()));
  }
  Perm perm=new Perm(targetDir,null,logger);
  try {
    perm.processParts(payload);
  }
 catch (  Exception ex) {
    restoreInstanceDir();
    String msg=Strings.get("String_Node_Str",syncBundle,targetDir.getAbsolutePath());
    if (ex.getLocalizedMessage() != null)     msg=msg + "String_Node_Str" + ex.getLocalizedMessage();
    throw new CommandException(msg,ex);
  }
 finally {
    try {
      if (in != null)       in.close();
    }
 catch (    IOException ex) {
      logger.warning(Strings.get("String_Node_Str",syncBundle,ex.getLocalizedMessage()));
    }
  }
  deleteBackupDir();
  return SUCCESS;
}
Program: 30218
Project: 30218
Buggy source:
@Override public String generateMethodBody(CommandModel cm,String httpMethod,String resourcePath,boolean includeOptional,boolean needsMultiPart){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  Map<String,String> paramNames=new HashMap<String,String>();
  Collection<ParamModel> params=cm.getParameters();
  if ((params != null) && (!params.isEmpty())) {
    for (    ParamModel model : params) {
      Param param=model.getParam();
      boolean include=true;
      if (param.optional() && !includeOptional) {
        continue;
      }
      String key=(!param.alias().isEmpty()) ? param.alias() : model.getName();
      String paramName=Util.eleminateHypen(model.getName());
      sb.append("String_Node_Str").append(key).append("String_Node_Str").append(paramName).append("String_Node_Str");
    }
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(httpMethod.toUpperCase(Locale.US)).append("String_Node_Str").append(resourcePath).append("String_Node_Str").append("String_Node_Str").append(needsMultiPart).append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
@Override public String generateMethodBody(CommandModel cm,String httpMethod,String resourcePath,boolean includeOptional,boolean needsMultiPart){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  Collection<ParamModel> params=cm.getParameters();
  if ((params != null) && (!params.isEmpty())) {
    for (    ParamModel model : params) {
      Param param=model.getParam();
      boolean include=true;
      if (param.optional() && !includeOptional) {
        continue;
      }
      String key=(!param.alias().isEmpty()) ? param.alias() : model.getName();
      String paramName=Util.eleminateHypen(model.getName());
      sb.append("String_Node_Str").append(key).append("String_Node_Str").append(paramName).append("String_Node_Str");
    }
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(httpMethod.toUpperCase(Locale.US)).append("String_Node_Str").append(resourcePath).append("String_Node_Str").append("String_Node_Str").append(needsMultiPart).append("String_Node_Str");
  return sb.toString();
}
Program: 30219
Project: 30219
Buggy source:
public static void main(String[] args){
  try {
    File f=new File("String_Node_Str");
    BackupFilenameManager mgr=new BackupFilenameManager(f,"String_Node_Str");
    File fnew=mgr.next();
    System.out.println("String_Node_Str" + fnew);
    File fold=mgr.latest();
    System.out.println("String_Node_Str" + fold);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    File f=new File(args[0]);
    BackupFilenameManager mgr=new BackupFilenameManager(f,"String_Node_Str");
    File fnew=mgr.next();
    System.out.println("String_Node_Str" + fnew);
    File fold=mgr.latest();
    System.out.println("String_Node_Str" + fold);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 30220
Project: 30220
Buggy source:
/** 
 * @param file Either a zip file that contains backup.properties -- or backup.properties itself.
 * @param terse if true, give a short summary
 * @return a String summary of the backup
 */
private void setPropsFromFile(File file){
  props=null;
  ZipInputStream zis=null;
  if (file.getName().toLowerCase().endsWith("String_Node_Str")) {
    readPropertiesFile(file);
    return;
  }
  try {
    zis=new ZipInputStream(new FileInputStream(file));
    ZipEntry ze;
    while ((ze=zis.getNextEntry()) != null) {
      if (ze.getName().equals(Constants.PROPS_FILENAME)) {
        props=new Properties();
        props.load(zis);
        break;
      }
    }
  }
 catch (  Exception e) {
    props=null;
  }
 finally {
    if (zis != null) {
      try {
        zis.close();
      }
 catch (      Exception e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param file Either a zip file that contains backup.properties -- or backup.properties itself.
 * @param terse if true, give a short summary
 * @return a String summary of the backup
 */
private void setPropsFromFile(File file){
  props=null;
  ZipInputStream zis=null;
  if (file.getName().toLowerCase(Locale.ENGLISH).endsWith("String_Node_Str")) {
    readPropertiesFile(file);
    return;
  }
  try {
    zis=new ZipInputStream(new FileInputStream(file));
    ZipEntry ze;
    while ((ze=zis.getNextEntry()) != null) {
      if (ze.getName().equals(Constants.PROPS_FILENAME)) {
        props=new Properties();
        props.load(zis);
        break;
      }
    }
  }
 catch (  Exception e) {
    props=null;
  }
 finally {
    if (zis != null) {
      try {
        zis.close();
      }
 catch (      Exception e) {
      }
    }
  }
}
Program: 30221
Project: 30221
Buggy source:
private void setProps(){
  props.setProperty(Constants.PROPS_USER_NAME,System.getProperty(Constants.PROPS_USER_NAME));
  props.setProperty(Constants.PROPS_TIMESTAMP_MSEC,"String_Node_Str" + request.timestamp);
  props.setProperty(Constants.PROPS_DOMAINS_DIR,FileUtils.safeGetCanonicalPath(request.domainsDir));
  props.setProperty(Constants.PROPS_DOMAIN_DIR,FileUtils.safeGetCanonicalPath(request.domainDir));
  props.setProperty(Constants.PROPS_BACKUP_FILE,FileUtils.safeGetCanonicalPath(request.backupFile));
  props.setProperty(Constants.PROPS_DOMAIN_NAME,request.domainName);
  props.setProperty(Constants.PROPS_DESCRIPTION,request.description);
  props.setProperty(Constants.PROPS_TIMESTAMP_HUMAN,new Date(request.timestamp).toString());
  props.setProperty(Constants.PROPS_VERSION,Version.getFullVersion());
  String type=request.configOnly ? Constants.CONFIG_ONLY : Constants.FULL;
  props.setProperty(Constants.PROPS_TYPE,type);
  String bc=(request.backupConfig == null) ? Constants.NO_CONFIG : request.backupConfig;
  props.setProperty(Constants.BACKUP_CONFIG,bc);
}

Fixed version (ground truth):
private void setProps(BackupRequest request){
  props.setProperty(Constants.PROPS_USER_NAME,System.getProperty(Constants.PROPS_USER_NAME));
  props.setProperty(Constants.PROPS_TIMESTAMP_MSEC,"String_Node_Str" + request.timestamp);
  props.setProperty(Constants.PROPS_DOMAINS_DIR,FileUtils.safeGetCanonicalPath(request.domainsDir));
  props.setProperty(Constants.PROPS_DOMAIN_DIR,FileUtils.safeGetCanonicalPath(request.domainDir));
  props.setProperty(Constants.PROPS_BACKUP_FILE,FileUtils.safeGetCanonicalPath(request.backupFile));
  props.setProperty(Constants.PROPS_DOMAIN_NAME,request.domainName);
  props.setProperty(Constants.PROPS_DESCRIPTION,request.description);
  props.setProperty(Constants.PROPS_TIMESTAMP_HUMAN,new Date(request.timestamp).toString());
  props.setProperty(Constants.PROPS_VERSION,Version.getFullVersion());
  String type=request.configOnly ? Constants.CONFIG_ONLY : Constants.FULL;
  props.setProperty(Constants.PROPS_TYPE,type);
  String bc=(request.backupConfig == null) ? Constants.NO_CONFIG : request.backupConfig;
  props.setProperty(Constants.BACKUP_CONFIG,bc);
}
Program: 30222
Project: 30222
Buggy source:
void delete(){
  if (!statusFile.delete()) {
    statusFile.deleteOnExit();
  }
}

Fixed version (ground truth):
void delete(){
  if (statusFile != null && !statusFile.delete()) {
    statusFile.deleteOnExit();
  }
}
Program: 30223
Project: 30223
Buggy source:
String write(BackupRequest req){
  props=new Properties();
  request=req;
  File backupFileDir=null;
  if (request.configOnly) {
    backupFileDir=new File(request.domainDir,Constants.CONFIG_DIR);
  }
 else {
    backupFileDir=request.domainDir;
  }
  statusFile=new File(backupFileDir,Constants.PROPS_FILENAME);
  FileOutputStream out=null;
  try {
    setProps();
    out=new FileOutputStream(statusFile);
    props.store(out,Constants.PROPS_HEADER);
    return propsToString(false);
  }
 catch (  Exception e) {
    return StringHelper.get("String_Node_Str",statusFile);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException ex) {
      }
    }
  }
}

Fixed version (ground truth):
String write(BackupRequest request){
  props=new Properties();
  File backupFileDir=null;
  if (request.configOnly) {
    backupFileDir=new File(request.domainDir,Constants.CONFIG_DIR);
  }
 else {
    backupFileDir=request.domainDir;
  }
  statusFile=new File(backupFileDir,Constants.PROPS_FILENAME);
  FileOutputStream out=null;
  try {
    setProps(request);
    out=new FileOutputStream(statusFile);
    props.store(out,Constants.PROPS_HEADER);
    return propsToString(false);
  }
 catch (  Exception e) {
    return StringHelper.get("String_Node_Str",statusFile);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException ex) {
      }
    }
  }
}
Program: 30224
Project: 30224
Buggy source:
public boolean accept(File dir,String name){
  return name.toLowerCase().endsWith("String_Node_Str");
}

Fixed version (ground truth):
public boolean accept(File dir,String name){
  return name.toLowerCase(Locale.ENGLISH).endsWith("String_Node_Str");
}
Program: 30225
Project: 30225
Buggy source:
@Override public void gatherMetric(){
  TreeNode activeSessionsNode=rootNode.getNode(WEB_SESSION_ACTIVESESSIONSCURRENT);
  if (activeSessionsNode != null) {
    Object value=activeSessionsNode.getValue();
    if (value != null) {
      if (value instanceof RangeStatistic) {
        RangeStatistic statisticObject=(RangeStatistic)value;
        table.add(System.currentTimeMillis(),new ActiveSessionsStat(statisticObject.getHighWaterMark(),statisticObject.getLastSampleTime(),statisticObject.getDescription(),statisticObject.getUnit(),statisticObject.getName(),statisticObject.getStartTime(),statisticObject.getCurrent(),statisticObject.getLowWaterMark()));
        Iterator<TabularMetricEntry<ActiveSessionsStat>> iter=table.iterator(10,TimeUnit.SECONDS);
        while (iter.hasNext()) {
          TabularMetricEntry<ActiveSessionsStat> tme=iter.next();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void gatherMetric(){
  if (rootNode != null) {
    TreeNode activeSessionsNode=rootNode.getNode(WEB_SESSION_ACTIVESESSIONSCURRENT);
    if (activeSessionsNode != null) {
      Object value=activeSessionsNode.getValue();
      if (value != null) {
        if (value instanceof RangeStatistic) {
          RangeStatistic statisticObject=(RangeStatistic)value;
          table.add(System.currentTimeMillis(),new ActiveSessionsStat(statisticObject.getHighWaterMark(),statisticObject.getLastSampleTime(),statisticObject.getDescription(),statisticObject.getUnit(),statisticObject.getName(),statisticObject.getStartTime(),statisticObject.getCurrent(),statisticObject.getLowWaterMark()));
        }
      }
    }
  }
}
Program: 30226
Project: 30226
Buggy source:
@Override public void gatherMetric(){
  TreeNode activeSessionsNode=rootNode.getNode(WEB_REQUEST_PROCESSINGTIME);
  if (activeSessionsNode != null) {
    Object value=activeSessionsNode.getValue();
    if (value != null) {
      if (value instanceof CountStatistic) {
        CountStatistic statisticObject=(CountStatistic)value;
        table.add(System.currentTimeMillis(),new ProcessingTimeStat(statisticObject.getLastSampleTime(),statisticObject.getDescription(),statisticObject.getUnit(),statisticObject.getName(),statisticObject.getStartTime(),statisticObject.getCount()));
        Iterator<TabularMetricEntry<ProcessingTimeStat>> iter=table.iterator(10,TimeUnit.SECONDS);
        while (iter.hasNext()) {
          TabularMetricEntry<ProcessingTimeStat> tme=iter.next();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void gatherMetric(){
  if (rootNode != null) {
    TreeNode activeSessionsNode=rootNode.getNode(WEB_REQUEST_PROCESSINGTIME);
    if (activeSessionsNode != null) {
      Object value=activeSessionsNode.getValue();
      if (value != null) {
        if (value instanceof CountStatistic) {
          CountStatistic statisticObject=(CountStatistic)value;
          table.add(System.currentTimeMillis(),new ProcessingTimeStat(statisticObject.getLastSampleTime(),statisticObject.getDescription(),statisticObject.getUnit(),statisticObject.getName(),statisticObject.getStartTime(),statisticObject.getCount()));
        }
      }
    }
  }
}
Program: 30227
Project: 30227
Buggy source:
public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  MonitorContract mContract=null;
  for (  MonitorContract m : habitat.getAllByContract(MonitorContract.class)) {
    if ((m.getName()).equals(type)) {
      mContract=m;
      break;
    }
  }
  if (mContract != null) {
    mContract.process(report,filter);
    return;
  }
  if (habitat.getAllByContract(MonitorContract.class).size() != 0) {
    String validTypes="String_Node_Str";
    Iterator<MonitorContract> contractsIterator=habitat.getAllByContract(MonitorContract.class).iterator();
    while (contractsIterator.hasNext()) {
      validTypes+=contractsIterator.next().getName();
      if (contractsIterator.hasNext()) {
        validTypes+="String_Node_Str";
      }
    }
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str",type,validTypes));
  }
 else {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",type));
  }
  report.setActionExitCode(ActionReport.ExitCode.FAILURE);
}

Fixed version (ground truth):
public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  MonitorContract mContract=null;
  for (  MonitorContract m : habitat.getAllByContract(MonitorContract.class)) {
    if ((m.getName()).equals(type)) {
      mContract=m;
      break;
    }
  }
  if (mContract != null) {
    mContract.process(report,filter);
    return;
  }
  if (habitat.getAllByContract(MonitorContract.class).size() != 0) {
    StringBuffer buf=new StringBuffer();
    Iterator<MonitorContract> contractsIterator=habitat.getAllByContract(MonitorContract.class).iterator();
    while (contractsIterator.hasNext()) {
      buf.append(contractsIterator.next().getName());
      if (contractsIterator.hasNext()) {
        buf.append("String_Node_Str");
      }
    }
    String validTypes=buf.toString();
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str",type,validTypes));
  }
 else {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",type));
  }
  report.setActionExitCode(ActionReport.ExitCode.FAILURE);
}
Program: 30228
Project: 30228
Buggy source:
Enumeration privateGetAttributeList(){
synchronized (attributes) {
    return (new Enumerator(new ArrayList(attributes.keySet())));
  }
}

Fixed version (ground truth):
Enumeration privateGetAttributeList(){
  return (new Enumerator(new ArrayList(attributes.keySet())));
}
Program: 30229
Project: 30229
Buggy source:
/** 
 * set the SessionAttributeState for attributeName based on persistent value
 * @param attributeName
 * @param persistent
 */
void setAttributeStatePersistent(String attributeName,boolean persistent){
synchronized (attributes) {
    SessionAttributeState attrState=(SessionAttributeState)_attributeStates.get(attributeName);
    if (attrState == null) {
      attrState=new SessionAttributeState();
      attrState.setPersistent(persistent);
      _attributeStates.put(attributeName,attrState);
    }
 else {
      attrState.setPersistent(persistent);
    }
  }
}

Fixed version (ground truth):
/** 
 * set the SessionAttributeState for attributeName based on persistent value
 * @param attributeName
 * @param persistent
 */
void setAttributeStatePersistent(String attributeName,boolean persistent){
  SessionAttributeState attrState=(SessionAttributeState)_attributeStates.get(attributeName);
  if (attrState == null) {
    attrState=new SessionAttributeState();
    attrState.setPersistent(persistent);
    _attributeStates.put(attributeName,attrState);
  }
 else {
    attrState.setPersistent(persistent);
  }
}
Program: 30230
Project: 30230
Buggy source:
/** 
 * this method called when session is loaded from persistent store or after session state was stored note: pre-condition is that the removed attributes have been removed from _attributeStates; this is taken care of by removeAttribute method
 */
void resetAttributeState(){
  clearAttributeStates();
synchronized (attributes) {
    Enumeration attrNames=getAttributeNames();
    while (attrNames.hasMoreElements()) {
      String nextAttrName=(String)attrNames.nextElement();
      SessionAttributeState nextAttrState=SessionAttributeState.createPersistentAttribute();
      _attributeStates.put(nextAttrName,nextAttrState);
    }
    setDirty(false);
  }
}

Fixed version (ground truth):
/** 
 * this method called when session is loaded from persistent store or after session state was stored note: pre-condition is that the removed attributes have been removed from _attributeStates; this is taken care of by removeAttribute method
 */
void resetAttributeState(){
  clearAttributeStates();
  Enumeration attrNames=getAttributeNames();
  while (attrNames.hasMoreElements()) {
    String nextAttrName=(String)attrNames.nextElement();
    SessionAttributeState nextAttrState=SessionAttributeState.createPersistentAttribute();
    _attributeStates.put(nextAttrName,nextAttrState);
  }
  setDirty(false);
}
Program: 30231
Project: 30231
Buggy source:
/** 
 * set the attribute name to the value value and update the attribute state accordingly
 * @param name
 * @param value
 */
public void setAttribute(String name,Object value){
synchronized (attributes) {
    super.setAttribute(name,value);
    SessionAttributeState attributeState=getAttributeState(name);
    if (_logger.isLoggable(Level.FINE)) {
      _logger.fine("String_Node_Str" + name + "String_Node_Str"+ attributeState);
    }
    if (value == null) {
      if (attributeState != null) {
        if (attributeState.isPersistent()) {
          attributeState.setDeleted(true);
        }
 else {
          removeAttributeState(name);
        }
      }
    }
 else {
      if (attributeState == null) {
        SessionAttributeState newAttrState=new SessionAttributeState();
        _attributeStates.put(name,newAttrState);
      }
 else {
        if (attributeState.isDeleted()) {
          attributeState.setDeleted(false);
        }
 else {
          if (attributeState.isPersistent()) {
            attributeState.setDirty(true);
          }
        }
      }
    }
    setDirty(true);
  }
}

Fixed version (ground truth):
/** 
 * set the attribute name to the value value and update the attribute state accordingly
 * @param name
 * @param value
 */
public void setAttribute(String name,Object value){
  super.setAttribute(name,value);
  SessionAttributeState attributeState=getAttributeState(name);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + name + "String_Node_Str"+ attributeState);
  }
  if (value == null) {
    if (attributeState != null) {
      if (attributeState.isPersistent()) {
        attributeState.setDeleted(true);
      }
 else {
        removeAttributeState(name);
      }
    }
  }
 else {
    if (attributeState == null) {
      SessionAttributeState newAttrState=new SessionAttributeState();
      _attributeStates.put(name,newAttrState);
    }
 else {
      if (attributeState.isDeleted()) {
        attributeState.setDeleted(false);
      }
 else {
        if (attributeState.isPersistent()) {
          attributeState.setDirty(true);
        }
      }
    }
  }
  setDirty(true);
}
Program: 30232
Project: 30232
Buggy source:
/** 
 * set the SessionAttributeState for attributeName based on dirty value
 * @param attributeName
 * @param dirty
 */
void setAttributeStateDirty(String attributeName,boolean dirty){
synchronized (attributes) {
    SessionAttributeState attrState=(SessionAttributeState)_attributeStates.get(attributeName);
    if (attrState == null) {
      attrState=new SessionAttributeState();
      attrState.setDirty(dirty);
      _attributeStates.put(attributeName,attrState);
    }
 else {
      attrState.setDirty(dirty);
    }
  }
}

Fixed version (ground truth):
/** 
 * set the SessionAttributeState for attributeName based on dirty value
 * @param attributeName
 * @param dirty
 */
void setAttributeStateDirty(String attributeName,boolean dirty){
  SessionAttributeState attrState=(SessionAttributeState)_attributeStates.get(attributeName);
  if (attrState == null) {
    attrState=new SessionAttributeState();
    attrState.setDirty(dirty);
    _attributeStates.put(attributeName,attrState);
  }
 else {
    attrState.setDirty(dirty);
  }
}
Program: 30233
Project: 30233
Buggy source:
/** 
 * remove the attribute name and update the attribute state accordingly
 * @param name
 */
public void removeAttribute(String name){
synchronized (attributes) {
    super.removeAttribute(name);
    SessionAttributeState attributeState=getAttributeState(name);
    if (attributeState != null) {
      if (attributeState.isPersistent()) {
        attributeState.setDeleted(true);
      }
 else {
        removeAttributeState(name);
      }
    }
    setDirty(true);
  }
}

Fixed version (ground truth):
/** 
 * remove the attribute name and update the attribute state accordingly
 * @param name
 */
public void removeAttribute(String name){
  super.removeAttribute(name);
  SessionAttributeState attributeState=getAttributeState(name);
  if (attributeState != null) {
    if (attributeState.isPersistent()) {
      attributeState.setDeleted(true);
    }
 else {
      removeAttributeState(name);
    }
  }
  setDirty(true);
}
Program: 30234
Project: 30234
Buggy source:
public void removeSessionFromManagerCache(Session session){
  if (logger.isLoggable(Level.FINE)) {
    logger.fine("String_Node_Str" + this.getClass().getName() + "String_Node_Str"+ session);
  }
  if (session == null) {
    return;
  }
  Session removed=null;
synchronized (sessions) {
    removed=sessions.remove(session.getIdInternal());
  }
  if (removed != null && logger.isLoggable(Level.FINE)) {
    logger.fine("String_Node_Str" + session.getId());
  }
}

Fixed version (ground truth):
public void removeSessionFromManagerCache(Session session){
  if (logger.isLoggable(Level.FINE)) {
    logger.fine("String_Node_Str" + this.getClass().getName() + "String_Node_Str"+ session);
  }
  if (session == null) {
    return;
  }
  Session removed=null;
  removed=sessions.remove(session.getIdInternal());
  if (removed != null && logger.isLoggable(Level.FINE)) {
    logger.fine("String_Node_Str" + session.getId());
  }
}