nus-yam/ex-repair huggingface dataset:
Program: 4190
Project: 4190
Buggy source:
/** 
 * Call this method with the verified simppSettings which are used to replace other settings if they exist in the system.
 */
public synchronized void updateSimppSettings(String simppSettings){
  byte[] settings=null;
  try {
    settings=simppSettings.getBytes("String_Node_Str");
  }
 catch (  UnsupportedEncodingException uex) {
    ErrorService.error(uex);
    return;
  }
  ByteArrayInputStream bais=new ByteArrayInputStream(settings);
  _simppProps.clear();
  try {
    _simppProps.load(bais);
  }
 catch (  IOException iox) {
    LOG.error("String_Node_Str",iox);
    return;
  }
  activateSimppSettings();
}

Fixed version (ground truth):
/** 
 * Call this method with the verified simppSettings which are used to replace other settings if they exist in the system.
 */
public void updateSimppSettings(String simppSettings){
  if (_remoteController == null)   throw new IllegalStateException("String_Node_Str");
synchronized (_remoteController) {
    byte[] settings=null;
    try {
      settings=simppSettings.getBytes("String_Node_Str");
    }
 catch (    UnsupportedEncodingException uex) {
      ErrorService.error(uex);
      return;
    }
    ByteArrayInputStream bais=new ByteArrayInputStream(settings);
    _simppProps.clear();
    try {
      _simppProps.load(bais);
    }
 catch (    IOException iox) {
      LOG.error("String_Node_Str",iox);
      return;
    }
    activateSimppSettings();
  }
}
Program: 4191
Project: 4191
Buggy source:
/** 
 * Call this method if you want to activate the settings to the ones in this.simppProps
 */
public void activateSimppSettings(){
  LOG.debug("String_Node_Str");
synchronized (this) {
    if (_remoteController == null)     throw new IllegalStateException("String_Node_Str");
synchronized (_simppProps) {
      for (      Map.Entry<Object,Object> entry : _simppProps.entrySet()) {
        String key=(String)entry.getKey();
        String value=(String)entry.getValue();
        if (!_remoteController.updateSetting(key,value))         _remainderSimppSettings.put(key,value);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Call this method if you want to activate the settings to the ones in this.simppProps
 */
public void activateSimppSettings(){
  LOG.debug("String_Node_Str");
  if (_remoteController == null)   throw new IllegalStateException("String_Node_Str");
synchronized (_remoteController) {
    for (    Map.Entry<Object,Object> entry : _simppProps.entrySet()) {
      String key=(String)entry.getKey();
      String value=(String)entry.getValue();
      if (!_remoteController.updateSetting(key,value))       _remainderSimppSettings.put(key,value);
    }
  }
}
Program: 4192
Project: 4192
Buggy source:
/** 
 * @return the simpp value for a simppkey from the map that remembers simppsettings which have not been loaded yet. Removes the entry from the mapping since it is no longer needed, now that the setting has been created.
 */
public synchronized String getUnloadedValueFor(String simppKey){
  return _remainderSimppSettings.remove(simppKey);
}

Fixed version (ground truth):
/** 
 * @return the simpp value for a simppkey from the map that remembers simppsettings which have not been loaded yet. Removes the entry from the mapping since it is no longer needed, now that the setting has been created.
 */
public String getUnloadedValueFor(String simppKey){
synchronized (_remoteController) {
    return _remainderSimppSettings.remove(simppKey);
  }
}
Program: 4193
Project: 4193
Buggy source:
public synchronized void setRemoteSettingController(RemoteSettingController controller){
  _remoteController=controller;
}

Fixed version (ground truth):
public void setRemoteSettingController(RemoteSettingController controller){
  _remoteController=controller;
}
Program: 4194
Project: 4194
Buggy source:
/** 
 * Sets a new RemoteSettingManager to control remote settings. 
 */
public synchronized void setRemoteSettingManager(RemoteSettingManager manager){
  this.remoteManager=manager;
  manager.setRemoteSettingController(new RemoteSettingController(){
    public boolean updateSetting(    String remoteKey,    String value){
synchronized (SettingsFactory.this) {
        Setting setting=remoteKeyToSetting.get(remoteKey);
        if (setting != null) {
          setting.setValue(value);
          return true;
        }
 else {
          return false;
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Sets a new RemoteSettingManager to control remote settings. 
 */
public synchronized void setRemoteSettingManager(RemoteSettingManager manager){
  this.remoteManager=manager;
  manager.setRemoteSettingController(this);
}
Program: 4195
Project: 4195
Buggy source:
/** 
 * Reloads the settings with the predefined settings file from disk.
 */
public synchronized void reload(){
  if (!SETTINGS_FILE.isFile()) {
    setExpireValue();
    return;
  }
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(SETTINGS_FILE);
    try {
      PROPS.load(fis);
    }
 catch (    IllegalArgumentException ignored) {
    }
catch (    StringIndexOutOfBoundsException sioobe) {
    }
catch (    IOException iox) {
      String msg=iox.getMessage();
      if (msg != null) {
        msg=msg.toLowerCase();
        if (msg.indexOf("String_Node_Str") == -1)         throw iox;
      }
      SETTINGS_FILE.delete();
      MessageService.showError(I18n.marktr("String_Node_Str"));
    }
  }
 catch (  IOException e) {
    ErrorService.error(e);
  }
 finally {
    if (fis != null) {
      try {
        fis.close();
      }
 catch (      IOException e) {
      }
    }
  }
  for (  Setting set : settings)   set.reload();
  setExpireValue();
}

Fixed version (ground truth):
/** 
 * Reloads the settings with the predefined settings file from disk.
 */
public synchronized void reload(){
  if (!SETTINGS_FILE.isFile()) {
    setExpireValue();
    return;
  }
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(SETTINGS_FILE);
    try {
      PROPS.load(fis);
    }
 catch (    IllegalArgumentException ignored) {
    }
catch (    StringIndexOutOfBoundsException sioobe) {
    }
catch (    IOException iox) {
      String msg=iox.getMessage();
      if (msg != null) {
        msg=msg.toLowerCase();
        if (msg.indexOf("String_Node_Str") == -1)         throw iox;
      }
      SETTINGS_FILE.delete();
      MessageService.showError("String_Node_Str");
    }
  }
 catch (  IOException e) {
    ErrorService.error(e);
  }
 finally {
    if (fis != null) {
      try {
        fis.close();
      }
 catch (      IOException e) {
      }
    }
  }
  for (  Setting set : settings)   set.reload();
  setExpireValue();
}
Program: 4196
Project: 4196
Buggy source:
public boolean updateSetting(String remoteKey,String value){
synchronized (SettingsFactory.this) {
    Setting setting=remoteKeyToSetting.get(remoteKey);
    if (setting != null) {
      setting.setValue(value);
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
public synchronized boolean updateSetting(String remoteKey,String value){
  Setting setting=remoteKeyToSetting.get(remoteKey);
  if (setting != null) {
    setting.setValue(value);
    return true;
  }
 else {
    return false;
  }
}
Program: 4197
Project: 4197
Buggy source:
public long extendSequenceNumber(long sequenceNumber){
  long extendedSeqNo;
  if (sequenceNumber >= HIGH_BASE_SWITCH_POINT && sequenceNumber < LOW_BASE_SWITCH_POINT && highSwitchPending) {
    highBase=lowBase;
    highSwitchPending=false;
    lowSwitchPending=true;
  }
  if (sequenceNumber > LOW_BASE_SWITCH_POINT && lowSwitchPending) {
    lowBase+=BASE_INCREMENT;
    highSwitchPending=true;
    lowSwitchPending=false;
  }
  if (sequenceNumber < HIGH_BASE_SWITCH_POINT) {
    extendedSeqNo=sequenceNumber + lowBase;
  }
 else {
    extendedSeqNo=sequenceNumber + highBase;
  }
  return extendedSeqNo;
}

Fixed version (ground truth):
public long extendSequenceNumber(long sequenceNumber){
  long extendedSeqNo;
  if (sequenceNumber >= HIGH_BASE_SWITCH_POINT && sequenceNumber < BASE_MIDPOINT && highSwitchPending) {
    highBase=lowBase;
    highSwitchPending=false;
    lowSwitchPending=true;
  }
  if (sequenceNumber > LOW_BASE_SWITCH_POINT && lowSwitchPending) {
    lowBase+=BASE_INCREMENT;
    highSwitchPending=true;
    lowSwitchPending=false;
  }
  if (sequenceNumber < HIGH_BASE_SWITCH_POINT) {
    extendedSeqNo=sequenceNumber + lowBase;
  }
 else {
    extendedSeqNo=sequenceNumber + highBase;
  }
  return extendedSeqNo;
}
Program: 4198
Project: 4198
Buggy source:
public void testOutOfOrderNumber(){
  SequenceNumberExtender extender=new SequenceNumberExtender();
  assertEquals(0x3FFF,extender.extendSequenceNumber(0x3FFF));
  assertEquals(0x7FFF + 1,extender.extendSequenceNumber(0x7FFF + 1));
  assertEquals(0x7FFF - 3,extender.extendSequenceNumber(0x7FFF - 3));
}

Fixed version (ground truth):
public void testOutOfOrderNumber(){
  SequenceNumberExtender extender=new SequenceNumberExtender();
  for (long i=0; i < 0x3FFF; i++)   assertEquals(i,extender.extendSequenceNumber(i));
  assertEquals(0x3FFF,extender.extendSequenceNumber(0x3FFF));
  for (long i=0x3FFF + 1; i < 0x7FFF - 4; i++)   assertEquals(i,extender.extendSequenceNumber(i));
  assertEquals(0x7FFF + 1,extender.extendSequenceNumber(0x7FFF + 1));
  assertEquals(0x7FFF - 3,extender.extendSequenceNumber(0x7FFF - 3));
}
Program: 4199
Project: 4199
Buggy source:
public void testUDPHostCacheEndpoints() throws Exception {
  ExtendedEndpoint e=ExtendedEndpoint.read("String_Node_Str");
  assertTrue(e.isUDPHostCache());
  assertEquals(1,e.getUDPHostCacheFailures());
  e.recordUDPHostCacheFailure();
  assertEquals(2,e.getUDPHostCacheFailures());
  e.recordUDPHostCacheSuccess();
  assertEquals(0,e.getUDPHostCacheFailures());
  StringWriter writer=new StringWriter();
  e.write(writer);
  assertEquals("String_Node_Str",writer.toString());
  e.recordUDPHostCacheFailure();
  e.recordUDPHostCacheFailure();
  e.recordUDPHostCacheFailure();
  writer=new StringWriter();
  e.write(writer);
  assertEquals("String_Node_Str",writer.toString());
  e.setUDPHostCache(false);
  assertFalse(e.isUDPHostCache());
  try {
    e.recordUDPHostCacheFailure();
    fail("String_Node_Str");
  }
 catch (  AssertFailure expected) {
  }
  try {
    e.recordUDPHostCacheSuccess();
    fail("String_Node_Str");
  }
 catch (  AssertFailure expected) {
  }
  writer=new StringWriter();
  e.write(writer);
  assertEquals("String_Node_Str",writer.toString());
  e=ExtendedEndpoint.read("String_Node_Str");
  assertTrue(e.isUDPHostCache());
  assertEquals(0,e.getUDPHostCacheFailures());
}

Fixed version (ground truth):
public void testUDPHostCacheEndpoints() throws Exception {
  ExtendedEndpoint e=ExtendedEndpoint.read("String_Node_Str");
  assertTrue(e.isUDPHostCache());
  assertEquals(1,e.getUDPHostCacheFailures());
  e.recordUDPHostCacheFailure();
  assertEquals(2,e.getUDPHostCacheFailures());
  e.recordUDPHostCacheSuccess();
  assertEquals(0,e.getUDPHostCacheFailures());
  StringWriter writer=new StringWriter();
  e.write(writer);
  assertEquals("String_Node_Str",writer.toString());
  e.recordUDPHostCacheFailure();
  e.recordUDPHostCacheFailure();
  e.recordUDPHostCacheFailure();
  writer=new StringWriter();
  e.write(writer);
  assertEquals("String_Node_Str",writer.toString());
  e.setUDPHostCache(false);
  assertFalse(e.isUDPHostCache());
  try {
    e.recordUDPHostCacheFailure();
    fail("String_Node_Str");
  }
 catch (  AssertionError expected) {
  }
  try {
    e.recordUDPHostCacheSuccess();
    fail("String_Node_Str");
  }
 catch (  AssertionError expected) {
  }
  writer=new StringWriter();
  e.write(writer);
  assertEquals("String_Node_Str",writer.toString());
  e=ExtendedEndpoint.read("String_Node_Str");
  assertTrue(e.isUDPHostCache());
  assertEquals(0,e.getUDPHostCacheFailures());
}
Program: 4201
Project: 4201
Buggy source:
/** 
 * Validates a potential settings directory. This returns the validated directory, or throws an IOException if it can't be validated.
 */
public static File validateSettingsDirectory(File dir) throws IOException {
  dir=dir.getAbsoluteFile();
  if (!dir.isDirectory()) {
    dir.delete();
    if (!dir.mkdirs())     throw new IOException("String_Node_Str" + dir);
  }
  if (!dir.canWrite())   throw new IOException("String_Node_Str");
  if (!dir.canRead())   throw new IOException("String_Node_Str");
  return dir;
}

Fixed version (ground truth):
/** 
 * Validates a potential settings directory. This returns the validated directory, or throws an IOException if it can't be validated.
 */
public static File validateSettingsDirectory(File dir) throws IOException {
  dir=dir.getAbsoluteFile();
  if (!dir.isDirectory()) {
    dir.delete();
    if (!dir.mkdirs())     throw new IOException("String_Node_Str" + dir);
  }
  if (!dir.canWrite())   throw new IOException("String_Node_Str" + dir);
  if (!dir.canRead())   throw new IOException("String_Node_Str" + dir);
  return dir;
}
Program: 4202
Project: 4202
Buggy source:
/** 
 * Saves the data iff it was written exactly as we wanted.
 */
public static boolean verySafeSave(File dir,String name,byte[] data){
  File tmp;
  try {
    tmp=File.createTempFile(name,"String_Node_Str",dir);
  }
 catch (  IOException hrorible) {
    return false;
  }
  File out=new File(dir,name);
  OutputStream os=null;
  try {
    os=new BufferedOutputStream(new FileOutputStream(tmp));
    os.write(data);
    os.flush();
  }
 catch (  IOException bad) {
    return false;
  }
 finally {
    close(os);
  }
  byte[] read=readFileFully(tmp);
  if (read == null || !Arrays.equals(read,data))   return false;
  return forceRename(tmp,out);
}

Fixed version (ground truth):
/** 
 * Saves the data iff it was written exactly as we wanted.
 */
public static boolean verySafeSave(File dir,String name,byte[] data){
  File tmp;
  try {
    tmp=FileUtils.createTempFile(name,"String_Node_Str",dir);
  }
 catch (  IOException hrorible) {
    return false;
  }
  File out=new File(dir,name);
  OutputStream os=null;
  try {
    os=new BufferedOutputStream(new FileOutputStream(tmp));
    os.write(data);
    os.flush();
  }
 catch (  IOException bad) {
    return false;
  }
 finally {
    close(os);
  }
  byte[] read=readFileFully(tmp);
  if (read == null || !Arrays.equals(read,data))   return false;
  return forceRename(tmp,out);
}
Program: 4203
Project: 4203
Buggy source:
/** 
 * Wires initial pieces together that are required for nearly everything. 
 */
public static void preinstall(){
  if (!preinstalled.compareAndSet(false,true))   return;
  try {
    CommonUtils.setUserSettingsDir(LimeWireUtils.getRequestedUserSettingsLocation());
  }
 catch (  IOException iox) {
    try {
      File temporaryDir;
      try {
        temporaryDir=LimeWireUtils.getTemporarySettingsDirectory();
      }
 catch (      IOException tempFull) {
        tempFull.printStackTrace();
        tempFull.initCause(iox);
        LimeWireUtils.clearTemporarySettingsDirectories();
        try {
          temporaryDir=LimeWireUtils.getTemporarySettingsDirectory();
        }
 catch (        IOException stillBad) {
          stillBad.initCause(tempFull);
          throw stillBad;
        }
      }
      temporaryDir.deleteOnExit();
      try {
        CommonUtils.setUserSettingsDir(temporaryDir);
      }
 catch (      IOException cannotSet) {
        cannotSet.initCause(iox);
        throw cannotSet;
      }
      LimeWireUtils.setTemporaryDirectoryInUse(true);
    }
 catch (    IOException reallyBad) {
      throw new RuntimeException(reallyBad);
    }
  }
}

Fixed version (ground truth):
/** 
 * Wires initial pieces together that are required for nearly everything. 
 */
public static void preinstall() throws InstallFailedException {
  if (!preinstalled.compareAndSet(false,true))   return;
  try {
    CommonUtils.setUserSettingsDir(LimeWireUtils.getRequestedUserSettingsLocation());
  }
 catch (  IOException requestedFailed) {
    try {
      LimeWireUtils.clearTemporarySettingsDirectories();
      File temporaryDir;
      try {
        temporaryDir=LimeWireUtils.getTemporarySettingsDirectory();
      }
 catch (      IOException tempFailed) {
        tempFailed.initCause(requestedFailed);
        throw tempFailed;
      }
      temporaryDir.deleteOnExit();
      try {
        CommonUtils.setUserSettingsDir(temporaryDir);
      }
 catch (      IOException cannotSet) {
        cannotSet.initCause(requestedFailed);
        throw cannotSet;
      }
      LimeWireUtils.setTemporaryDirectoryInUse(true);
    }
 catch (    IOException totalFailure) {
      throw new InstallFailedException("String_Node_Str",totalFailure);
    }
  }
}
Program: 4204
Project: 4204
Buggy source:
private String getRawNameForSaving(){
  String tempFileName=getDisplayName();
  if (tempFileName != null && tempFileName.length() > 0) {
    return tempFileName;
  }
  tempFileName=getKeywordTopic();
  if (tempFileName != null && tempFileName.length() > 0) {
    return tempFileName;
  }
  URN urn=getSHA1Urn();
  if (urn != null) {
    tempFileName=urn.toString();
    return tempFileName;
  }
  String[] urls=getDefaultURLs();
  if (urls.length > 0) {
    try {
      URI uri=new URI(urls[0].toCharArray());
      tempFileName=extractFileName(uri);
      if (tempFileName != null && tempFileName.length() > 0) {
        return tempFileName;
      }
    }
 catch (    URIException e) {
    }
  }
  try {
    File file=File.createTempFile("String_Node_Str","String_Node_Str");
    file.deleteOnExit();
    tempFileName=file.getName();
    return tempFileName;
  }
 catch (  IOException ie) {
  }
  tempFileName=DOWNLOAD_PREFIX;
  return tempFileName;
}

Fixed version (ground truth):
private String getRawNameForSaving(){
  String tempFileName=getDisplayName();
  if (tempFileName != null && tempFileName.length() > 0) {
    return tempFileName;
  }
  tempFileName=getKeywordTopic();
  if (tempFileName != null && tempFileName.length() > 0) {
    return tempFileName;
  }
  URN urn=getSHA1Urn();
  if (urn != null) {
    tempFileName=urn.toString();
    return tempFileName;
  }
  String[] urls=getDefaultURLs();
  if (urls.length > 0) {
    try {
      URI uri=new URI(urls[0].toCharArray());
      tempFileName=extractFileName(uri);
      if (tempFileName != null && tempFileName.length() > 0) {
        return tempFileName;
      }
    }
 catch (    URIException e) {
    }
  }
  try {
    File file=FileUtils.createTempFile("String_Node_Str","String_Node_Str");
    file.deleteOnExit();
    tempFileName=file.getName();
    return tempFileName;
  }
 catch (  IOException ie) {
  }
  tempFileName=DOWNLOAD_PREFIX;
  return tempFileName;
}
Program: 4205
Project: 4205
Buggy source:
/** 
 * updates the given ogg file with the new Comment field
 * @param comment the <tt>com.jcraft.jorbis.Comment</tt> object to put in the file
 * @param file the .ogg file to be updated
 */
public void update(Comment comment,File file) throws IOException {
  InputStream in=null;
  OutputStream out=null;
  File tempFile=null;
  try {
    state=new State();
    in=new BufferedInputStream(new FileInputStream(file));
    read(in);
    state.vc=comment;
    tempFile=null;
    try {
      tempFile=File.createTempFile(file.getName(),"String_Node_Str");
    }
 catch (    IOException e) {
      LOG.debug("String_Node_Str");
      tempFile=new File(file.getAbsolutePath(),file.getName() + "String_Node_Str");
    }
    out=new BufferedOutputStream(new FileOutputStream(tempFile));
    LOG.debug("String_Node_Str");
    write(out);
    out.flush();
  }
  finally {
    if (out != null)     try {
      out.close();
    }
 catch (    IOException ignored) {
    }
    if (in != null)     try {
      in.close();
    }
 catch (    IOException ignored) {
    }
  }
  if (tempFile.length() == 0)   throw new IOException("String_Node_Str");
  if (!FileUtils.forceRename(tempFile,file))   throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * updates the given ogg file with the new Comment field
 * @param comment the <tt>com.jcraft.jorbis.Comment</tt> object to put in the file
 * @param file the .ogg file to be updated
 */
public void update(Comment comment,File file) throws IOException {
  InputStream in=null;
  OutputStream out=null;
  File tempFile=null;
  try {
    state=new State();
    in=new BufferedInputStream(new FileInputStream(file));
    read(in);
    state.vc=comment;
    tempFile=null;
    try {
      tempFile=FileUtils.createTempFile(file.getName(),"String_Node_Str");
    }
 catch (    IOException e) {
      LOG.debug("String_Node_Str");
      tempFile=new File(file.getAbsolutePath(),file.getName() + "String_Node_Str");
    }
    out=new BufferedOutputStream(new FileOutputStream(tempFile));
    LOG.debug("String_Node_Str");
    write(out);
    out.flush();
  }
  finally {
    if (out != null)     try {
      out.close();
    }
 catch (    IOException ignored) {
    }
    if (in != null)     try {
      in.close();
    }
 catch (    IOException ignored) {
    }
  }
  if (tempFile.length() == 0)   throw new IOException("String_Node_Str");
  if (!FileUtils.forceRename(tempFile,file))   throw new IOException("String_Node_Str");
}
Program: 4206
Project: 4206
Buggy source:
/** 
 * Clears all potential temporary LW directories. 
 */
public static void clearTemporarySettingsDirectories(){
  File tempDir;
  try {
    tempDir=File.createTempFile("String_Node_Str","String_Node_Str").getAbsoluteFile();
  }
 catch (  IOException failure) {
    return;
  }
  File tempDirParent=tempDir.getParentFile();
  tempDir.delete();
  for (int i=0; i < 1000; i++) {
    File dir=new File(tempDirParent,"String_Node_Str" + i);
    if (!dir.delete())     FileUtils.deleteRecursive(dir);
  }
}

Fixed version (ground truth):
/** 
 * Clears all potential temporary LW directories. 
 */
public static void clearTemporarySettingsDirectories(){
  File tempDir;
  try {
    tempDir=FileUtils.createTempFile("String_Node_Str","String_Node_Str").getAbsoluteFile();
  }
 catch (  IOException failure) {
    return;
  }
  File tempDirParent=tempDir.getParentFile();
  tempDir.delete();
  for (int i=0; i < 1000; i++) {
    File dir=new File(tempDirParent,"String_Node_Str" + i);
    if (!dir.delete())     FileUtils.deleteRecursive(dir);
  }
}
Program: 4207
Project: 4207
Buggy source:
/** 
 * Returns a temporary directory that can be used for settings. 
 */
public static File getTemporarySettingsDirectory() throws IOException {
  File tempDir=File.createTempFile("String_Node_Str","String_Node_Str").getAbsoluteFile();
  File tempDirParent=tempDir.getParentFile();
  tempDir.delete();
  if (!tempDir.exists()) {
    if (tempDir.mkdir()) {
      if (tempDir.exists() && tempDir.isDirectory()) {
        return tempDir;
      }
    }
  }
  for (int i=0; i < 1000; i++) {
    tempDir=new File(tempDirParent,"String_Node_Str" + i);
    if (!tempDir.exists()) {
      if (tempDir.mkdir()) {
        if (tempDir.exists() && tempDir.isDirectory()) {
          return tempDir;
        }
      }
    }
  }
  throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns a temporary directory that can be used for settings. 
 */
public static File getTemporarySettingsDirectory() throws IOException {
  File tempDir=FileUtils.createTempFile("String_Node_Str","String_Node_Str").getAbsoluteFile();
  File tempDirParent=tempDir.getParentFile();
  tempDir.delete();
  if (!tempDir.exists()) {
    if (tempDir.mkdir()) {
      if (tempDir.exists() && tempDir.isDirectory()) {
        return tempDir;
      }
    }
  }
  for (int i=0; i < 1000; i++) {
    tempDir=new File(tempDirParent,"String_Node_Str" + i);
    if (!tempDir.exists()) {
      if (tempDir.mkdir()) {
        if (tempDir.exists() && tempDir.isDirectory()) {
          return tempDir;
        }
      }
    }
  }
  throw new IOException("String_Node_Str" + tempDirParent + "String_Node_Str");
}
Program: 4209
Project: 4209
Buggy source:
/** 
 * @return the number, average, variance, min, median and max of alist of Integers
 */
public static DoubleStats quickStatsDouble(List<Double> l){
  DoubleStats ret=new DoubleStats();
  ret.number=l.size();
  if (ret.number < 2)   return ret;
  Collections.sort(l);
  ret.min=l.get(0);
  ret.max=l.get(l.size() - 1);
  ret.med=getQuartile(Quartile.MED,l);
  if (ret.number > 6) {
    ret.q1=getQuartile(Quartile.Q1,l);
    ret.q3=getQuartile(Quartile.Q3,l);
  }
  double mode=l.get(0);
  double current=l.get(0);
  int occurences=0;
  int currentOccurences=0;
  for (int i=1; i < l.size(); i++) {
    if (l.get(i) == current)     currentOccurences++;
    current=l.get(i);
    if (currentOccurences > occurences) {
      occurences=currentOccurences;
      mode=current;
    }
  }
  ret.mode=mode;
  double sum=0;
  for (  double i : l)   sum+=i;
  ret.avg=sum / l.size();
  sum=0;
  double sum3=0;
  double sum4=0;
  for (  double i : l) {
    if (i > ret.avg)     ret.st++;
    double dist=i - ret.avg;
    double dist2=dist * dist;
    double dist3=dist2 * dist;
    sum+=dist2;
    sum3+=dist3;
    sum4+=(dist2 * dist2);
  }
  int div=l.size() - 1;
  ret.m2=sum / div;
  ret.m3=sum3 / div;
  ret.m4=sum4 / div;
  double[] swilk=swilk(l);
  if (swilk != null) {
    ret.swilkW=swilk[0];
    ret.swilkPW=swilk[1];
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @return the number, average, variance, min, median and max of alist of Integers
 */
public static DoubleStats quickStatsDouble(List<Double> l){
  DoubleStats ret=new DoubleStats();
  ret.number=l.size();
  if (ret.number < 2)   return ret;
  Collections.sort(l);
  ret.min=l.get(0);
  ret.max=l.get(l.size() - 1);
  ret.med=getQuartile(Quartile.MED,l);
  if (ret.number > 6) {
    ret.q1=getQuartile(Quartile.Q1,l);
    ret.q3=getQuartile(Quartile.Q3,l);
  }
  double mode=l.get(0);
  double current=l.get(0);
  int occurences=0;
  int currentOccurences=0;
  for (int i=1; i < l.size(); i++) {
    if (l.get(i) == current)     currentOccurences++;
 else {
      current=l.get(i);
      currentOccurences=0;
    }
    if (currentOccurences > occurences) {
      occurences=currentOccurences;
      mode=current;
    }
  }
  ret.mode=mode;
  double sum=0;
  for (  double i : l)   sum+=i;
  ret.avg=sum / l.size();
  sum=0;
  double sum3=0;
  double sum4=0;
  for (  double i : l) {
    if (i > ret.avg)     ret.st++;
    double dist=i - ret.avg;
    double dist2=dist * dist;
    double dist3=dist2 * dist;
    sum+=dist2;
    sum3+=dist3;
    sum4+=(dist2 * dist2);
  }
  int div=l.size() - 1;
  ret.m2=sum / div;
  ret.m3=sum3 / div;
  ret.m4=sum4 / div;
  double[] swilk=swilk(l);
  if (swilk != null) {
    ret.swilkW=swilk[0];
    ret.swilkPW=swilk[1];
  }
  return ret;
}
Program: 4210
Project: 4210
Buggy source:
public void testQuickStats() throws Exception {
  List<Double> l=new ArrayList<Double>();
  for (int i=0; i < 100; i++)   l.add((double)i);
  DoubleStats s=StatsUtils.quickStatsDouble(l);
  assertEquals(100,s.getNumber());
  assertEquals(0.0,s.min);
  assertEquals(99.0,s.max);
  assertEquals(49.5,s.med);
  assertEquals(49.5,s.avg);
  assertEquals(24.25,s.q1);
  assertEquals(74.75,s.q3);
  assertEquals(841.6666666,s.m2,0.00001);
  assertEquals(0.0,s.mode);
  l.add((double)55);
  s=StatsUtils.quickStatsDouble(l);
  assertEquals(55.0,s.mode);
}

Fixed version (ground truth):
public void testQuickStats() throws Exception {
  List<Double> l=new ArrayList<Double>();
  for (int i=0; i < 100; i++)   l.add((double)i);
  DoubleStats s=StatsUtils.quickStatsDouble(l);
  assertEquals(100,s.getNumber());
  assertEquals(0.0,s.min);
  assertEquals(99.0,s.max);
  assertEquals(49.5,s.med);
  assertEquals(49.5,s.avg);
  assertEquals(24.25,s.q1);
  assertEquals(74.75,s.q3);
  assertEquals(841.6666666,s.m2,0.00001);
  assertEquals(0.0,s.mode);
  l.clear();
  l.add(2.0);
  l.add(2.0);
  l.add(1.0);
  l.add(1.0);
  l.add(0.5);
  l.add(0.5);
  l.add(0.5);
  s=StatsUtils.quickStatsDouble(l);
  assertEquals(0.5,s.mode);
}
Program: 4211
Project: 4211
Buggy source:
/** 
 * Gets copies of the current RouteTable, clears the current RouteTable and re-adds the Contacts from the copies.
 */
private void rebuild(boolean isTrueRebuild,long lastContactTime){
  Collection<Contact> activeNodes=getActiveContacts();
  activeNodes=ContactUtils.sortAliveToFailed(activeNodes);
  Collection<Contact> cachedNodes=null;
  if (isTrueRebuild) {
    cachedNodes=getCachedContacts();
    cachedNodes=ContactUtils.sort(cachedNodes);
  }
  clear();
  boolean removed=activeNodes.remove(localNode);
  assert(removed);
  long currentTime=System.currentTimeMillis();
  for (  Contact node : activeNodes) {
    if (lastContactTime >= 0L && (currentTime - node.getTimeStamp()) < lastContactTime) {
      continue;
    }
    if (isTrueRebuild) {
      node.unknown();
    }
    add(node);
  }
  if (isTrueRebuild) {
    for (    Contact node : cachedNodes) {
      if (lastContactTime >= 0L && (currentTime - node.getTimeStamp()) < lastContactTime) {
        continue;
      }
      node.unknown();
      add(node);
    }
  }
}

Fixed version (ground truth):
/** 
 * Gets copies of the current RouteTable, clears the current RouteTable and re-adds the Contacts from the copies.
 */
private void rebuild(boolean isTrueRebuild,long lastContactTime){
  Collection<Contact> activeNodes=getActiveContacts();
  activeNodes=ContactUtils.sortAliveToFailed(activeNodes);
  Collection<Contact> cachedNodes=null;
  if (isTrueRebuild) {
    cachedNodes=getCachedContacts();
    cachedNodes=ContactUtils.sort(cachedNodes);
  }
  clear();
  boolean removed=activeNodes.remove(localNode);
  assert(removed);
  long currentTime=System.currentTimeMillis();
  for (  Contact node : activeNodes) {
    if (lastContactTime >= 0L && (currentTime - node.getTimeStamp()) >= lastContactTime) {
      continue;
    }
    if (isTrueRebuild) {
      node.unknown();
    }
    add(node);
  }
  if (isTrueRebuild) {
    for (    Contact node : cachedNodes) {
      if (lastContactTime >= 0L && (currentTime - node.getTimeStamp()) >= lastContactTime) {
        continue;
      }
      node.unknown();
      add(node);
    }
  }
}
Program: 4212
Project: 4212
Buggy source:
/** 
 * Shuts down this NIOServerSocket 
 */
public void close() throws IOException {
  IOException exception=null;
  try {
    socket.close();
  }
 catch (  IOException iox) {
    exception=iox;
  }
  observer.shutdown();
  if (exception != null)   throw exception;
}

Fixed version (ground truth):
/** 
 * Shuts down this NIOServerSocket 
 */
public void close() throws IOException {
  IOException exception;
  if (VersionUtils.isJavaVersionOrAbove("String_Node_Str") || NIODispatcher.instance().isDispatchThread()) {
    exception=shutdownSocketAndChannels();
  }
 else {
    final AtomicReference<IOException> exRef=new AtomicReference<IOException>();
    try {
      NIODispatcher.instance().invokeAndWait(new Runnable(){
        public void run(){
          exRef.set(shutdownSocketAndChannels());
        }
      }
);
    }
 catch (    InterruptedException e) {
      throw new IllegalStateException(e);
    }
    exception=exRef.get();
  }
  observer.shutdown();
  if (exception != null)   throw exception;
}
Program: 4213
Project: 4213
Buggy source:
void writeDone(){
  doingWrite=false;
}

Fixed version (ground truth):
void writeDone(){
  doingWrite=false;
  _stateMachine.handleRead();
}
Program: 4214
Project: 4214
Buggy source:
public void writeScheduled(){
  LOG.debug("String_Node_Str");
  buffer.clear();
  downloader.writeDone();
  irc.interestRead(true);
}

Fixed version (ground truth):
public void writeScheduled(){
  LOG.debug("String_Node_Str");
  NIODispatcher.instance().invokeLater(this);
}
Program: 4215
Project: 4215
Buggy source:
public boolean get(int i){
  boolean ret=fields[0].get(i);
  for (int j=1; i < fields.length; j++)   ret^=fields[j].get(i);
  return ret;
}

Fixed version (ground truth):
public boolean get(int i){
  boolean ret=fields[0].get(i);
  for (int j=1; j < fields.length; j++) {
    ret^=fields[j].get(i);
  }
  return ret;
}
Program: 4217
Project: 4217
Buggy source:
private boolean add(Contact node){
  InetAddress addr=((InetSocketAddress)node.getContactAddress()).getAddress();
  if (addr instanceof Inet6Address) {
    if (!((Inet6Address)addr).isIPv4CompatibleAddress() && !NetworkUtils.isIPv4MappedAddress(addr)) {
      return true;
    }
  }
  int key=NetworkUtils.getMaskedIP(addr,NetworkUtils.CLASS_C_NETMASK);
  return filter.put(key,node) == null;
}

Fixed version (ground truth):
private boolean add(Contact node){
  InetAddress addr=((InetSocketAddress)node.getContactAddress()).getAddress();
  int key=NetworkUtils.getMaskedIP(addr,NetworkUtils.CLASS_C_NETMASK);
  return filter.put(key,node) == null;
}
Program: 4218
Project: 4218
Buggy source:
/** 
 * Handles a node response message.  This type of message is handled in the same way regardless of the type of lookup.
 */
protected final boolean handleNodeResponse(FindNodeResponse response){
  Contact sender=response.getContact();
  Collection<? extends Contact> nodes=response.getNodes();
  if (!nodes.isEmpty()) {
    ContactFilter filter=new ContactFilter(context,sender);
    for (    Contact node : nodes) {
      if (!filter.isValidContact(node)) {
        if (LOG.isInfoEnabled()) {
          LOG.info("String_Node_Str" + node + "String_Node_Str"+ sender);
        }
        continue;
      }
      if (!isQueried(node) && !isYetToBeQueried(node)) {
        if (LOG.isTraceEnabled()) {
          LOG.trace("String_Node_Str" + node + "String_Node_Str");
        }
        addYetToBeQueried(node,currentHop + 1);
        assert(node.isAlive() == false);
        context.getRouteTable().add(node);
      }
    }
    collisions.addAll(filter.getCollisions());
    addToResponsePath(response);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Handles a node response message.  This type of message is handled in the same way regardless of the type of lookup.
 */
protected final boolean handleNodeResponse(FindNodeResponse response){
  Contact sender=response.getContact();
  Collection<? extends Contact> nodes=response.getNodes();
  if (!nodes.isEmpty()) {
    ContactFilter filter=new ContactFilter(context,sender);
    for (    Contact node : nodes) {
      if (!filter.isValidContact(node)) {
        if (LOG.isInfoEnabled()) {
          LOG.info("String_Node_Str" + node + "String_Node_Str"+ sender);
        }
        continue;
      }
      if (!isQueried(node) && !isYetToBeQueried(node)) {
        if (LOG.isTraceEnabled()) {
          LOG.trace("String_Node_Str" + node + "String_Node_Str");
        }
        addYetToBeQueried(node,currentHop + 1);
        assert(node.isAlive() == false);
        context.getRouteTable().add(node);
      }
    }
    collisions.addAll(filter.getCollisions());
  }
  addToResponsePath(response);
  return true;
}
Program: 4219
Project: 4219
Buggy source:
/** 
 * Tests that the progress is not 0% when resume button is hit while requerying.  This was caused by the call to cleanup() from tryAllDownloads3() and was reported by Sam Berlin.  Changed after requeries have been shut off (requery-expunge-branch).
 */
public void testRequeryProgress() throws Exception {
  LOG.info("String_Node_Str");
  TestUploader uploader=null;
  ManagedDownloader downloader=null;
  try {
    uploader=new TestUploader("String_Node_Str",PORT);
    uploader.stopAfter(500);
    uploader.setSendThexTreeHeader(false);
    uploader.setSendThexTree(false);
    downloader=new ManagedDownloader(new RemoteFileDesc[]{newRFD("String_Node_Str",FileDescStub.DEFAULT_URN.toString())},new IncompleteFileManager(),null);
    downloader.initialize(manager,fileman,callback);
    requestStart(downloader);
    Thread.sleep(140000);
    assertEquals("String_Node_Str",500,downloader.getAmountRead());
    assertEquals("String_Node_Str",Downloader.WAITING_FOR_USER,downloader.getState());
    downloader.resume();
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
    }
    assertEquals(Downloader.WAITING_FOR_CONNECTIONS,downloader.getState());
    assertEquals(500,downloader.getAmountRead());
  }
  finally {
    if (uploader != null)     uploader.stopThread();
    if (downloader != null)     downloader.stop();
  }
}

Fixed version (ground truth):
/** 
 * Tests that the progress is not 0% when resume button is hit while requerying.  This was caused by the call to cleanup() from tryAllDownloads3() and was reported by Sam Berlin.  Changed after requeries have been shut off (requery-expunge-branch).
 */
public void testRequeryProgress() throws Exception {
  LOG.info("String_Node_Str");
  TestUploader uploader=null;
  ManagedDownloader downloader=null;
  try {
    uploader=new TestUploader("String_Node_Str",PORT);
    uploader.stopAfter(500);
    uploader.setSendThexTreeHeader(false);
    uploader.setSendThexTree(false);
    downloader=new ManagedDownloader(new RemoteFileDesc[]{newRFD("String_Node_Str",FileDescStub.DEFAULT_URN.toString())},new IncompleteFileManager(),null);
    downloader.initialize(manager,fileman,callback);
    requestStart(downloader);
    uploader.waitForUploaderToStop();
    try {
      Thread.sleep(5 * 1000);
    }
 catch (    InterruptedException ie) {
    }
    assertEquals("String_Node_Str",500,downloader.getAmountRead());
    try {
      Thread.sleep(60 * 1000);
    }
 catch (    InterruptedException ie) {
    }
    assertEquals("String_Node_Str",Downloader.WAITING_FOR_USER,downloader.getState());
    downloader.resume();
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
    }
    assertEquals(Downloader.WAITING_FOR_CONNECTIONS,downloader.getState());
    assertEquals(500,downloader.getAmountRead());
  }
  finally {
    if (uploader != null)     uploader.stopThread();
    if (downloader != null)     downloader.stop();
  }
}
Program: 4220
Project: 4220
Buggy source:
/** 
 * Repeatedly accepts connections and handles them.
 */
private void loop(int port){
  Socket socket=null;
  while (true) {
    try {
      socket=server.accept();
      connects++;
      if (connects > maxConnects) {
        LOG.debug("String_Node_Str");
        socket.close();
        continue;
      }
      InetAddress address=socket.getInetAddress();
      if (isBannedIP(address.getHostAddress())) {
        LOG.debug("String_Node_Str");
        server.close();
        continue;
      }
      LOG.debug("String_Node_Str");
      final Socket mySocket=socket;
      Thread runner=new Thread(new SocketHandler(mySocket),name);
      runner.start();
    }
 catch (    IOException e) {
      LOG.debug("String_Node_Str",e);
      try {
        server.close();
      }
 catch (      IOException ignore) {
      }
      return;
    }
  }
}

Fixed version (ground truth):
/** 
 * Repeatedly accepts connections and handles them.
 */
private void loop(int port){
  Socket socket=null;
  while (true) {
    try {
      socket=server.accept();
      connects++;
      if (connects > maxConnects) {
        LOG.debug("String_Node_Str");
        socket.close();
        continue;
      }
      InetAddress address=socket.getInetAddress();
      if (isBannedIP(address.getHostAddress())) {
        LOG.debug("String_Node_Str");
        socket.close();
        continue;
      }
      LOG.debug("String_Node_Str");
      final Socket mySocket=socket;
      Thread runner=new Thread(new SocketHandler(mySocket),name);
      runner.start();
    }
 catch (    IOException e) {
      LOG.debug("String_Node_Str",e);
      try {
        server.close();
      }
 catch (      IOException ignore) {
      }
      return;
    }
  }
}
Program: 4222
Project: 4222
Buggy source:
/** 
 * Notification that a read can happen on the SocketChannel.
 */
public void handleRead() throws IOException {
synchronized (bufferLock) {
    int read=0;
    while (buffer.hasRemaining() && (read=channel.read(buffer)) > 0)     ;
    if (read == -1)     source.finished();
    if (buffer.position() > 0 || read == -1)     bufferLock.notify();
    if (!buffer.hasRemaining() || read == -1)     channel.interestRead(false);
  }
}

Fixed version (ground truth):
/** 
 * Notification that a read can happen on the SocketChannel.
 */
public void handleRead() throws IOException {
  if (bufferLock == null) {
    channel.read(BufferUtils.getEmptyBuffer());
  }
 else {
synchronized (bufferLock) {
      int read=0;
      while (buffer.hasRemaining() && (read=channel.read(buffer)) > 0)       ;
      if (read == -1)       source.finished();
      if (buffer.position() > 0 || read == -1)       bufferLock.notify();
      if (!buffer.hasRemaining() || read == -1)       channel.interestRead(false);
    }
  }
}
Program: 4224
Project: 4224
Buggy source:
/** 
 * Initializes this TLSLayer, using the given address and enabling the given cipherSuites. If clientMode is disabled, client authentication can be turned on/off.
 * @param addr
 * @param cipherSuites
 */
void initialize(SocketAddress addr,String[] cipherSuites,boolean clientMode,boolean needClientAuth){
  if (!(addr instanceof InetSocketAddress))   throw new IllegalArgumentException("String_Node_Str");
  InetSocketAddress iaddr=(InetSocketAddress)addr;
  String host=iaddr.getAddress().getHostAddress();
  int port=iaddr.getPort();
  engine=context.createSSLEngine(host,port);
  engine.setEnabledCipherSuites(cipherSuites);
  engine.setUseClientMode(clientMode);
  if (!clientMode) {
    engine.setWantClientAuth(needClientAuth);
    engine.setNeedClientAuth(needClientAuth);
  }
  SSLSession session=engine.getSession();
  readIncoming=ByteBuffer.allocate(session.getApplicationBufferSize());
  writeOutgoing=ByteBuffer.allocate(session.getPacketBufferSize());
  if (LOG.isTraceEnabled())   LOG.trace("String_Node_Str" + engine + "String_Node_Str"+ session);
}

Fixed version (ground truth):
/** 
 * Initializes this TLSLayer, using the given address and enabling the given cipherSuites. If clientMode is disabled, client authentication can be turned on/off.
 * @param addr
 * @param cipherSuites
 */
void initialize(SocketAddress addr,String[] cipherSuites,boolean clientMode,boolean needClientAuth){
  if (addr != null) {
    if (!(addr instanceof InetSocketAddress))     throw new IllegalArgumentException("String_Node_Str");
    InetSocketAddress iaddr=(InetSocketAddress)addr;
    String host=iaddr.getAddress().getHostAddress();
    int port=iaddr.getPort();
    engine=context.createSSLEngine(host,port);
  }
 else {
    engine=context.createSSLEngine();
  }
  engine.setEnabledCipherSuites(cipherSuites);
  engine.setUseClientMode(clientMode);
  if (!clientMode) {
    engine.setWantClientAuth(needClientAuth);
    engine.setNeedClientAuth(needClientAuth);
  }
  SSLSession session=engine.getSession();
  readIncoming=ByteBuffer.allocate(session.getApplicationBufferSize());
  writeOutgoing=ByteBuffer.allocate(session.getPacketBufferSize());
  if (LOG.isTraceEnabled())   LOG.trace("String_Node_Str" + engine + "String_Node_Str"+ session);
}
Program: 4225
Project: 4225
Buggy source:
private void proxyLoop(){
  try {
    while (true) {
      Socket incomingProxy=null;
      incomingProxy=_proxyServer.accept();
      if (!_proxyOn)       fail("String_Node_Str");
      InputStream is=incomingProxy.getInputStream();
      OutputStream os=incomingProxy.getOutputStream();
      if (_proxyVersion == ProxyTest.SOCKS4)       checkSOCKS4(is,os);
 else       if (_proxyVersion == ProxyTest.SOCKS5)       checkSOCKS5(is,os);
 else       if (_proxyVersion == ProxyTest.HTTP)       checkHTTP(is,os);
 else       assertTrue("String_Node_Str",_isHTTPRequest);
      int a=0;
      try {
        if (_isHTTPRequest) {
          consumeHttpHeaders(is);
          writeHTTPBack(os);
          try {
            Thread.sleep(1000);
          }
 catch (          InterruptedException x) {
          }
        }
 else {
          while (a != -1)           a=is.read();
        }
      }
 catch (      SocketException se) {
        if (!_makeError) {
          throw se;
        }
      }
      if (!incomingProxy.isClosed())       incomingProxy.close();
    }
  }
 catch (  IOException iox) {
    ErrorService.error(iox);
  }
}

Fixed version (ground truth):
private void proxyLoop(){
  try {
    while (true) {
      Socket incomingProxy=null;
      incomingProxy=_proxyServer.accept();
      boolean savedMakeError=_makeError;
      if (!_proxyOn)       fail("String_Node_Str");
      InputStream is=incomingProxy.getInputStream();
      OutputStream os=incomingProxy.getOutputStream();
      if (_proxyVersion == ProxyTest.SOCKS4)       checkSOCKS4(is,os);
 else       if (_proxyVersion == ProxyTest.SOCKS5)       checkSOCKS5(is,os);
 else       if (_proxyVersion == ProxyTest.HTTP)       checkHTTP(is,os);
 else       assertTrue("String_Node_Str",_isHTTPRequest);
      int a=0;
      try {
        if (_isHTTPRequest) {
          consumeHttpHeaders(is);
          writeHTTPBack(os);
          try {
            Thread.sleep(1000);
          }
 catch (          InterruptedException x) {
          }
        }
 else {
          while (a != -1)           a=is.read();
        }
      }
 catch (      SocketException se) {
        if (!savedMakeError) {
          throw se;
        }
      }
      if (!incomingProxy.isClosed())       incomingProxy.close();
    }
  }
 catch (  IOException iox) {
    ErrorService.error(iox);
  }
}
Program: 4226
Project: 4226
Buggy source:
/** 
 * Adds a certain IP to the IPList.
 * @param ipStr a String containing the IP, see IP.java for formatting
 */
public void add(String ipStr){
  IP ip;
  try {
    ip=new IP(ipStr);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  AddFilter filter=new AddFilter(ip);
  Map.Entry<IP,IP> entry=ips.select(ip,filter);
  if (entry != null) {
    if (!entry.getKey().contains(ip)) {
      for (      IP obsolete : filter.getContained()) {
        ips.remove(obsolete);
      }
      ips.put(ip,ip);
    }
  }
 else {
    ips.put(ip,ip);
  }
}

Fixed version (ground truth):
/** 
 * Adds a certain IP to the IPList.
 * @param ipStr a String containing the IP, see IP.java for formatting
 */
public void add(String ipStr){
  IP ip;
  try {
    ip=new IP(ipStr);
  }
 catch (  IllegalArgumentException e) {
    return;
  }
  if (ip.equals(NULL_IP)) {
    ips.clear();
    ips.put(ip,ip);
    return;
  }
  AddFilter filter=new AddFilter(ip);
  Map.Entry<IP,IP> entry=ips.select(ip,filter);
  if (entry != null) {
    if (!entry.getKey().contains(ip)) {
      for (      IP obsolete : filter.getContained()) {
        ips.remove(obsolete);
      }
      ips.put(ip,ip);
    }
  }
 else {
    ips.put(ip,ip);
  }
}
Program: 4228
Project: 4228
Buggy source:
@Override public void setReadOnly(RandomAccessFile raf,String path) throws IOException {
  MappedByteBuffer buf;
synchronized (this) {
    buf=bufMap.remove(raf);
  }
  try {
    safeForce(buf);
  }
  finally {
    if (!clean(buf)) {
      buf=null;
      System.gc();
    }
  }
  super.setReadOnly(raf,path);
  buf=raf.getChannel().map(MapMode.READ_ONLY,0,raf.length());
synchronized (this) {
    bufMap.put(raf,buf);
  }
}

Fixed version (ground truth):
@Override public RandomAccessFile setReadOnly(RandomAccessFile raf,String path) throws IOException {
  MappedByteBuffer buf;
synchronized (this) {
    buf=bufMap.remove(raf);
  }
  try {
    safeForce(buf);
  }
  finally {
    if (!clean(buf)) {
      buf=null;
      System.gc();
    }
  }
  raf=super.setReadOnly(raf,path);
  buf=raf.getChannel().map(MapMode.READ_ONLY,0,raf.length());
synchronized (this) {
    bufMap.put(raf,buf);
  }
  return raf;
}
Program: 4229
Project: 4229
Buggy source:
protected void setReadOnly(RandomAccessFile f,String path) throws IOException {
  f.close();
  f=new RandomAccessFile(path,"String_Node_Str");
}

Fixed version (ground truth):
protected RandomAccessFile setReadOnly(RandomAccessFile f,String path) throws IOException {
  f.close();
  return new RandomAccessFile(path,"String_Node_Str");
}
Program: 4232
Project: 4232
Buggy source:
public boolean add(Object o){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
public boolean add(T o){
  throw new UnsupportedOperationException();
}