nus-yam/ex-repair huggingface dataset:
Program: 4390
Project: 4390
Buggy source:
/** 
 * Sends the message with the specified, pre-calculated priority.
 * @param m the <tt>Message</tt> to send
 * @param priority the priority to send the message with
 */
private void send(Message m,int priority){
  if (!supportsGGEP())   m=m.stripExtendedPayload();
  int smh=softMaxHops;
  if ((smh > -1) && (m instanceof QueryRequest) && (m.getHops() >= smh))   return;
  repOk();
  Assert.that(_outputQueue != null,"String_Node_Str");
synchronized (_outputQueueLock) {
    _numMessagesSent++;
    _outputQueue[priority].add(m);
    int dropped=_outputQueue[priority].resetDropped();
    addSentDropped(dropped);
    _queued+=1 - dropped;
    _lastPriority=priority;
    _outputQueueLock.notify();
  }
  repOk();
}

Fixed version (ground truth):
/** 
 * Sends the message with the specified, pre-calculated priority.
 * @param m the <tt>Message</tt> to send
 * @param priority the priority to send the message with
 */
private void send(Message m,int priority){
  if (!supportsGGEP())   m=m.stripExtendedPayload();
  int smh=hopsFlowMax;
  if ((smh > -1) && (m instanceof QueryRequest) && (m.getHops() >= smh))   return;
  repOk();
  Assert.that(_outputQueue != null,"String_Node_Str");
synchronized (_outputQueueLock) {
    _numMessagesSent++;
    _outputQueue[priority].add(m);
    int dropped=_outputQueue[priority].resetDropped();
    addSentDropped(dropped);
    _queued+=1 - dropped;
    _lastPriority=priority;
    _outputQueueLock.notify();
  }
  repOk();
}
Program: 4392
Project: 4392
Buggy source:
/** 
 * Check to see how many leaves' tables would be included in the LastHop QRT
 * @return number of leaf tables which would be included in a LastHop QRT
 */
private int getTotalNumberOfLeavesQRTsIncluded(){
  int leaves=0;
  Iterator it=cm.getConnections().iterator();
  while (it.hasNext()) {
    if (((ManagedConnectionCountQRT)it.next())._qrtIncluded)     leaves++;
  }
  return leaves;
}

Fixed version (ground truth):
/** 
 * Check to see how many leaves' tables would be included in the LastHop QRT
 * @return number of leaf tables which would be included in a LastHop QRT
 */
private int getTotalNumberOfLeavesQRTsIncluded(){
  int leaves=0;
  Iterator it=cm.getInitializedClientConnections().iterator();
  while (it.hasNext()) {
    ManagedConnectionCountQRT mc=((ManagedConnectionCountQRT)it.next());
    if (mc._qrtIncluded)     leaves++;
  }
  return leaves;
}
Program: 4394
Project: 4394
Buggy source:
/** 
 * creates a PushEndpoint from a String passed in http header exchange.
 */
public PushEndpoint(String httpString) throws IOException {
  if (httpString.length() < 32 || httpString.indexOf("String_Node_Str") > 32)   throw new IOException("String_Node_Str");
  String guidS=httpString.substring(0,32);
  httpString=httpString.substring(32);
  _clientGUID=GUID.fromHexString(guidS);
  _guid=new GUID(_clientGUID);
  StringTokenizer tok=new StringTokenizer(httpString,"String_Node_Str");
  Set proxies=new HashSet();
  int fwtVersion=0;
  IpPort addr=null;
  while (tok.hasMoreTokens() && proxies.size() < 4) {
    String current=tok.nextToken().trim();
    if (current.startsWith(HTTPConstants.FW_TRANSFER)) {
      fwtVersion=(int)HTTPUtils.parseFeatureToken(current);
      continue;
    }
    try {
      proxies.add(parseIpPort(current));
      continue;
    }
 catch (    IOException ohWell) {
    }
    if (addr == null) {
      try {
        addr=parsePortIp(current);
      }
 catch (      IOException notBad) {
      }
    }
  }
  _proxies=proxies;
  _externalAddr=addr;
  _fwtVersion=fwtVersion;
  _features=proxies.size() | (_fwtVersion << 3);
}

Fixed version (ground truth):
/** 
 * creates a PushEndpoint from a String passed in http header exchange.
 */
public PushEndpoint(String httpString) throws IOException {
  if (httpString.length() < 32 || httpString.indexOf("String_Node_Str") > 32)   throw new IOException("String_Node_Str");
  String guidS=httpString.substring(0,32);
  httpString=httpString.substring(32);
  try {
    _clientGUID=GUID.fromHexString(guidS);
  }
 catch (  IllegalArgumentException iae) {
    throw new IOException(iae.getMessage());
  }
  _guid=new GUID(_clientGUID);
  StringTokenizer tok=new StringTokenizer(httpString,"String_Node_Str");
  Set proxies=new HashSet();
  int fwtVersion=0;
  IpPort addr=null;
  while (tok.hasMoreTokens() && proxies.size() < 4) {
    String current=tok.nextToken().trim();
    if (current.startsWith(HTTPConstants.FW_TRANSFER)) {
      fwtVersion=(int)HTTPUtils.parseFeatureToken(current);
      continue;
    }
    try {
      proxies.add(parseIpPort(current));
      continue;
    }
 catch (    IOException ohWell) {
    }
    if (addr == null) {
      try {
        addr=parsePortIp(current);
      }
 catch (      IOException notBad) {
      }
    }
  }
  _proxies=proxies;
  _externalAddr=addr;
  _fwtVersion=fwtVersion;
  _features=proxies.size() | (_fwtVersion << 3);
}
Program: 4395
Project: 4395
Buggy source:
public boolean sendResponses(Response[] responses,QueryRequest query,ReplyHandler handler){
  if ((responses == null) || ((responses.length < 1)))   return false;
  if (query.desiresOutOfBandReplies() && !isConnectedTo(query,handler) && RouterService.canReceiveSolicited()&& RouterService.getUploadManager().isServiceable()) {
    if (bufferResponsesForLaterDelivery(query,responses)) {
      InetAddress addr=null;
      try {
        addr=InetAddress.getByName(query.getReplyAddress());
      }
 catch (      UnknownHostException uhe) {
      }
      int port=query.getReplyPort();
      if (addr != null && NetworkUtils.isValidAddress(addr) && NetworkUtils.isValidPort(port)) {
        int resultCount=(responses.length > 255) ? 255 : responses.length;
        ReplyNumberVendorMessage vm=new ReplyNumberVendorMessage(new GUID(query.getGUID()),resultCount);
        UDPService.instance().send(vm,addr,port);
        return true;
      }
    }
 else {
      return false;
    }
  }
  Iterator iterator=responsesToQueryReplies(responses,query);
  try {
    while (iterator.hasNext()) {
      QueryReply queryReply=(QueryReply)iterator.next();
      sendQueryReply(queryReply);
    }
  }
 catch (  IOException e) {
  }
  return true;
}

Fixed version (ground truth):
public boolean sendResponses(Response[] responses,QueryRequest query,ReplyHandler handler){
  if ((responses == null) || ((responses.length < 1)))   return false;
  if (query.desiresOutOfBandReplies() && !isConnectedTo(query,handler) && RouterService.canReceiveSolicited()&& RouterService.getUploadManager().isServiceable()&& NetworkUtils.isValidAddressAndPort(query.getReplyAddress(),query.getReplyPort())) {
    if (bufferResponsesForLaterDelivery(query,responses)) {
      InetAddress addr=null;
      try {
        addr=InetAddress.getByName(query.getReplyAddress());
      }
 catch (      UnknownHostException uhe) {
      }
      int port=query.getReplyPort();
      if (addr != null) {
        int resultCount=(responses.length > 255) ? 255 : responses.length;
        ReplyNumberVendorMessage vm=new ReplyNumberVendorMessage(new GUID(query.getGUID()),resultCount);
        UDPService.instance().send(vm,addr,port);
        return true;
      }
    }
 else {
      return false;
    }
  }
  Iterator iterator=responsesToQueryReplies(responses,query);
  try {
    while (iterator.hasNext()) {
      QueryReply queryReply=(QueryReply)iterator.next();
      sendQueryReply(queryReply);
    }
  }
 catch (  IOException e) {
  }
  return true;
}
Program: 4397
Project: 4397
Buggy source:
/** 
 * Determines if the given addr or port is valid. Both must be valid for this to return true.
 */
public static boolean isValidAddressAndPort(byte[] addr,int port){
  return isValidAddress(addr) && isValidPort(port);
}

Fixed version (ground truth):
/** 
 * Determines if the given addr or port is valid. Both must be valid for this to return true.
 */
public static boolean isValidAddressAndPort(String addr,int port){
  return isValidAddress(addr) && isValidPort(port);
}
Program: 4398
Project: 4398
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 (    IOException iox) {
      String msg=iox.getMessage();
      if (StringUtils.indexOfIgnoreCase(msg,"String_Node_Str") < 0)       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) {
      }
    }
  }
  Iterator ii=settings.iterator();
  while (ii.hasNext()) {
    Setting set=(Setting)ii.next();
    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 (StringUtils.indexOfIgnoreCase(msg,"String_Node_Str") < 0)       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) {
      }
    }
  }
  Iterator ii=settings.iterator();
  while (ii.hasNext()) {
    Setting set=(Setting)ii.next();
    set.reload();
  }
  setExpireValue();
}
Program: 4399
Project: 4399
Buggy source:
/** 
 * Determines whether or not the partial file is valid for us to add ourselves to the mesh. Checks the following: - RFD has a SHA1. - We are allowing partial sharing - The VerifyingFile is not corrupted - We've accepted an incoming connection this session - Our port and IP address are valid and not private.
 */
private boolean isPartialFileValid(){
  return _rfd.getSHA1Urn() != null && UploadSettings.ALLOW_PARTIAL_SHARING.getValue() && !_outIsCorrupted && RouterService.acceptedIncomingConnection() && _incompleteFile.length() > MIN_PARTIAL_FILE_BYTES && NetworkUtils.isValidPort(RouterService.getPort()) && NetworkUtils.isValidAddress(RouterService.getAddress()) && !NetworkUtils.isPrivateAddress(RouterService.getAddress());
}

Fixed version (ground truth):
/** 
 * Determines whether or not the partial file is valid for us to add ourselves to the mesh. Checks the following: - RFD has a SHA1. - We are allowing partial sharing - The VerifyingFile is not corrupted - Our port and IP address are valid 
 */
private boolean isPartialFileValid(){
  return _rfd.getSHA1Urn() != null && UploadSettings.ALLOW_PARTIAL_SHARING.getValue() && !_outIsCorrupted && _incompleteFile.length() > MIN_PARTIAL_FILE_BYTES && NetworkUtils.isValidPort(RouterService.getPort()) && NetworkUtils.isValidAddress(RouterService.getAddress());
}
Program: 4400
Project: 4400
Buggy source:
public boolean sendResponses(Response[] responses,QueryRequest query,ReplyHandler handler){
  if ((responses == null) || ((responses.length < 1)))   return false;
  if (query.desiresOutOfBandReplies() && !isConnectedTo(query,handler) && RouterService.canReceiveSolicited()&& RouterService.getUploadManager().isServiceable()) {
    if (bufferResponsesForLaterDelivery(query,responses)) {
      InetAddress addr=null;
      try {
        addr=InetAddress.getByName(query.getReplyAddress());
      }
 catch (      UnknownHostException uhe) {
        return false;
      }
      int port=query.getReplyPort();
      int resultCount=(responses.length > 255) ? 255 : responses.length;
      ReplyNumberVendorMessage vm=new ReplyNumberVendorMessage(new GUID(query.getGUID()),resultCount);
      UDPService.instance().send(vm,addr,port);
      return true;
    }
    return false;
  }
  Iterator iterator=responsesToQueryReplies(responses,query);
  try {
    while (iterator.hasNext()) {
      QueryReply queryReply=(QueryReply)iterator.next();
      sendQueryReply(queryReply);
    }
  }
 catch (  IOException e) {
  }
  return true;
}

Fixed version (ground truth):
public boolean sendResponses(Response[] responses,QueryRequest query,ReplyHandler handler){
  if ((responses == null) || ((responses.length < 1)))   return false;
  if (query.desiresOutOfBandReplies() && !isConnectedTo(query,handler) && RouterService.canReceiveSolicited()&& RouterService.getUploadManager().isServiceable()) {
    if (bufferResponsesForLaterDelivery(query,responses)) {
      InetAddress addr=null;
      try {
        addr=InetAddress.getByName(query.getReplyAddress());
      }
 catch (      UnknownHostException uhe) {
      }
      int port=query.getReplyPort();
      if (addr != null && NetworkUtils.isValidAddress(addr) && NetworkUtils.isValidPort(port)) {
        int resultCount=(responses.length > 255) ? 255 : responses.length;
        ReplyNumberVendorMessage vm=new ReplyNumberVendorMessage(new GUID(query.getGUID()),resultCount);
        UDPService.instance().send(vm,addr,port);
        return true;
      }
    }
 else {
    }
    return false;
  }
  Iterator iterator=responsesToQueryReplies(responses,query);
  try {
    while (iterator.hasNext()) {
      QueryReply queryReply=(QueryReply)iterator.next();
      sendQueryReply(queryReply);
    }
  }
 catch (  IOException e) {
  }
  return true;
}
Program: 4402
Project: 4402
Buggy source:
public IntervalSet(){
  intervals=new TreeSet(new IntervalComparator());
}

Fixed version (ground truth):
public IntervalSet(){
  intervals=new TreeSet(IntervalComparator.INSTANCE);
}
Program: 4404
Project: 4404
Buggy source:
/** 
 * Inflates (uncompresses) the data.
 */
public static byte[] inflate(byte[] data) throws IOException {
  InputStream in=null;
  try {
    in=new InflaterInputStream(new ByteArrayInputStream(data));
    ByteArrayOutputStream out=new ByteArrayOutputStream();
    byte[] buf=new byte[64];
    while (true) {
      int read=in.read(buf,0,buf.length);
      if (read == -1)       break;
      out.write(buf,0,read);
    }
    return out.toByteArray();
  }
  finally {
    IOUtils.close(in);
  }
}

Fixed version (ground truth):
/** 
 * Inflates (uncompresses) the data.
 */
public static byte[] inflate(byte[] data) throws IOException {
  InputStream in=null;
  try {
    in=new InflaterInputStream(new ByteArrayInputStream(data));
    ByteArrayOutputStream out=new ByteArrayOutputStream();
    byte[] buf=new byte[64];
    while (true) {
      int read=in.read(buf,0,buf.length);
      if (read == -1)       break;
      out.write(buf,0,read);
    }
    return out.toByteArray();
  }
 catch (  OutOfMemoryError oome) {
    throw new IOException(oome.getMessage());
  }
 finally {
    IOUtils.close(in);
  }
}
Program: 4405
Project: 4405
Buggy source:
/** 
 * This method creates an IntervalSet that is the negative to this  IntervalSet
 * @return IntervalSet containing all ranges not contained in this
 */
public IntervalSet invert(int maxSize){
  IntervalSet ret=new IntervalSet();
  if (maxSize < 1)   return ret;
  if (intervals.size() == 0) {
    Interval block=new Interval(0,maxSize - 1);
    ret.add(block);
    return ret;
  }
  int low=-1;
  Interval interval=null;
  for (Iterator iter=intervals.iterator(); iter.hasNext(); ) {
    interval=(Interval)iter.next();
    if (interval.low != 0 && low < interval.low) {
      if (low + 1 > interval.low - 1)       throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + toString() + "String_Node_Str"+ maxSize+ "String_Node_Str"+ low+ "String_Node_Str"+ interval.low);
      ret.add(new Interval(low + 1,interval.low - 1));
    }
    low=interval.high;
  }
  Assert.that(interval != null,"String_Node_Str");
  if (interval.high < maxSize - 1)   ret.add(new Interval(interval.high + 1,maxSize - 1));
  return ret;
}

Fixed version (ground truth):
/** 
 * This method creates an IntervalSet that is the negative to this  IntervalSet
 * @return IntervalSet containing all ranges not contained in this
 */
public IntervalSet invert(int maxSize){
  IntervalSet ret=new IntervalSet();
  if (maxSize < 1)   return ret;
  if (intervals.size() == 0) {
    Interval block=new Interval(0,maxSize - 1);
    ret.add(block);
    return ret;
  }
  int low=-1;
  Interval interval=null;
  boolean fixed=false;
  for (Iterator iter=intervals.iterator(); iter.hasNext(); ) {
    interval=(Interval)iter.next();
    if (interval.low != 0 && low < interval.low) {
      if (low + 1 > interval.low - 1) {
        if (!fixed) {
          fixed=true;
          fix();
          iter=intervals.iterator();
          low=-1;
          interval=null;
          continue;
        }
 else {
          throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + toString() + "String_Node_Str"+ maxSize+ "String_Node_Str"+ low+ "String_Node_Str"+ interval.low);
        }
      }
      ret.add(new Interval(low + 1,interval.low - 1));
    }
    low=interval.high;
  }
  Assert.that(interval != null,"String_Node_Str");
  if (interval.high < maxSize - 1)   ret.add(new Interval(interval.high + 1,maxSize - 1));
  return ret;
}
Program: 4406
Project: 4406
Buggy source:
/** 
 * Cancels this.  No more tasks can be scheduled or executed.
 */
public void cancel(){
  TIMER.cancel();
}

Fixed version (ground truth):
/** 
 * Cancels this.  No more tasks can be scheduled or executed.
 */
public void cancel(){
  cancelled=true;
  TIMER.cancel();
}
Program: 4407
Project: 4407
Buggy source:
/** 
 * Schedules the given task for fixed-delay execution after the given delay, repeating every period.
 * @param task the task to run repeatedly
 * @param delay the initial delay, in milliseconds
 * @param period the delay between executions, in millisecondsor zero if it should not be rescheduled
 * @exception IllegalStateException this is cancelled
 * @exception IllegalArgumentException delay or period negative
 * @see java.util.Timer#schedule(java.util.TimerTask,long,long)
 */
public void schedule(final Runnable task,long delay,long period) throws IllegalStateException {
  if (delay < 0)   throw new IllegalArgumentException("String_Node_Str" + delay);
  if (period < 0)   throw new IllegalArgumentException("String_Node_Str" + period);
  TimerTask tt=new TimerTask(){
    public void run(){
      try {
        task.run();
      }
 catch (      Throwable t) {
        ErrorService.error(t);
      }
    }
  }
;
  if (period == 0)   TIMER.schedule(tt,delay);
 else   TIMER.schedule(tt,delay,period);
}

Fixed version (ground truth):
/** 
 * Schedules the given task for fixed-delay execution after the given delay, repeating every period.
 * @param task the task to run repeatedly
 * @param delay the initial delay, in milliseconds
 * @param period the delay between executions, in millisecondsor zero if it should not be rescheduled
 * @exception IllegalStateException this is cancelled
 * @exception IllegalArgumentException delay or period negative
 * @see java.util.Timer#schedule(java.util.TimerTask,long,long)
 */
public void schedule(final Runnable task,long delay,long period) throws IllegalStateException {
  if (delay < 0)   throw new IllegalArgumentException("String_Node_Str" + delay);
  if (period < 0)   throw new IllegalArgumentException("String_Node_Str" + period);
  TimerTask tt=new TimerTask(){
    public void run(){
      try {
        task.run();
      }
 catch (      Throwable t) {
        ErrorService.error(t);
      }
    }
  }
;
  try {
    if (period == 0)     TIMER.schedule(tt,delay);
 else     TIMER.schedule(tt,delay,period);
  }
 catch (  IllegalStateException ise) {
    if (cancelled)     throw ise;
  }
}
Program: 4408
Project: 4408
Buggy source:
public int read(byte[] b,int off,int len) throws IOException {
  try {
    return super.read(b,off,len);
  }
 catch (  NullPointerException e) {
    throw new IOException("String_Node_Str");
  }
catch (  ArrayIndexOutOfBoundsException aioobe) {
    throw new IOException(aioobe.getMessage());
  }
}

Fixed version (ground truth):
public int read(byte[] b,int off,int len) throws IOException {
  try {
    return super.read(b,off,len);
  }
 catch (  NullPointerException e) {
    throw new IOException("String_Node_Str");
  }
catch (  ArrayIndexOutOfBoundsException aioobe) {
    throw new IOException(aioobe.getMessage());
  }
catch (  OutOfMemoryError oome) {
    throw new IOException(oome.getMessage());
  }
}
Program: 4410
Project: 4410
Buggy source:
/** 
 * Creates a new <tt>URL</tt> based on the IP and port in the location The location MUST be a dotted IP address.
 */
private static IpPort createUrlFromMini(final String location,URN urn) throws IOException {
  int port=location.indexOf(':');
  final String loc=(port == -1 ? location : location.substring(0,port));
  try {
    new IP(loc);
  }
 catch (  IllegalArgumentException iae) {
    throw new IOException("String_Node_Str" + location);
  }
  if (loc.indexOf('/') != -1)   throw new IOException("String_Node_Str" + location);
  if (port == -1)   port=6346;
 else {
    if (location.length() < port + 1)     throw new IOException("String_Node_Str" + location);
    try {
      port=Short.parseShort(location.substring(port + 1));
    }
 catch (    NumberFormatException nfe) {
      throw new IOException("String_Node_Str" + location);
    }
  }
  return new Endpoint(loc,port);
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>URL</tt> based on the IP and port in the location The location MUST be a dotted IP address.
 */
private static IpPort createUrlFromMini(final String location,URN urn) throws IOException {
  int port=location.indexOf(':');
  final String loc=(port == -1 ? location : location.substring(0,port));
  try {
    new IP(loc);
  }
 catch (  IllegalArgumentException iae) {
    throw new IOException("String_Node_Str" + location);
  }
  if (loc.indexOf('/') != -1)   throw new IOException("String_Node_Str" + location);
  if (!NetworkUtils.isValidAddress(loc))   throw new IOException("String_Node_Str" + location);
  if (port == -1)   port=6346;
 else {
    if (location.length() < port + 1)     throw new IOException("String_Node_Str" + location);
    try {
      port=Short.parseShort(location.substring(port + 1));
    }
 catch (    NumberFormatException nfe) {
      throw new IOException("String_Node_Str" + location);
    }
  }
  if (!NetworkUtils.isValidPort(port))   throw new IOException("String_Node_Str" + port);
  return new Endpoint(loc,port);
}
Program: 4412
Project: 4412
Buggy source:
/** 
 * Adds all supported capabilities to the given set.
 */
private static void addSupportedMessages(Set hashSet){
  SupportedMessageBlock smp=null;
  smp=new SupportedMessageBlock(FEATURE_SEARCH_BYTES,FeatureSearchData.FEATURE_SEARCH_MAX_SELECTOR);
  hashSet.add(smp);
  smp=new SupportedMessageBlock(SIMPP_CAPABILITY_BYTES,_simppVersion);
  hashSet.add(smp);
}

Fixed version (ground truth):
/** 
 * Adds all supported capabilities to the given set.
 */
private static void addSupportedMessages(Set hashSet){
  SupportedMessageBlock smp=null;
  smp=new SupportedMessageBlock(FEATURE_SEARCH_BYTES,FeatureSearchData.FEATURE_SEARCH_MAX_SELECTOR);
  hashSet.add(smp);
  smp=new SupportedMessageBlock(SIMPP_CAPABILITY_BYTES,SimppManager.instance().getVersion());
  hashSet.add(smp);
}
Program: 4413
Project: 4413
Buggy source:
public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str"+ _capabilitiesSupported+ "String_Node_Str";
}
Program: 4414
Project: 4414
Buggy source:
/** 
 * Internal constructor for creating the sole instance of our  CapabilitiesVM.
 */
private CapabilitiesVM(){
  super(F_NULL_VENDOR_ID,F_CAPABILITIES,VERSION,derivePayload());
  _simppVersion=SimppManager.instance().getVersion();
  addSupportedMessages(_capabilitiesSupported);
}

Fixed version (ground truth):
/** 
 * Internal constructor for creating the sole instance of our  CapabilitiesVM.
 */
private CapabilitiesVM(){
  super(F_NULL_VENDOR_ID,F_CAPABILITIES,VERSION,derivePayload());
  addSupportedMessages(_capabilitiesSupported);
}
Program: 4415
Project: 4415
Buggy source:
/** 
 * Called when we receive a new SIMPPVendorMessage, 
 */
public void checkAndUpdate(final byte[] simppPayload){
  if (simppPayload == null)   return;
  final int myVersion=_latestVersion;
  Runnable simppHandler=new Runnable(){
    public void run(){
      SimppDataVerifier verifier=new SimppDataVerifier(simppPayload);
      boolean verified=false;
      verified=verifier.verifySource();
      if (!verified)       return;
      SimppParser parser=null;
      try {
        parser=new SimppParser(verifier.getVerifiedData());
      }
 catch (      SAXException sx) {
        return;
      }
catch (      IOException iox) {
        return;
      }
      int version=parser.getVersion();
      if (version <= myVersion)       return;
      SimppManager.this._latestVersion=version;
      SimppManager.this._simppBytes=simppPayload;
      SimppManager.this._propsStream=parser.getPropsData();
      String props=parser.getPropsData();
      SimppSettingsManager.instance().updateSimppSettings(props);
      CapabilitiesVM.updateSimppVersion(version);
      RouterService.getConnectionManager().sendUpdatedCapabilities();
    }
  }
;
  _processingQueue.add(simppHandler);
}

Fixed version (ground truth):
/** 
 * Called when we receive a new SIMPPVendorMessage, 
 */
public void checkAndUpdate(final byte[] simppPayload){
  if (simppPayload == null)   return;
  final int myVersion=_latestVersion;
  Runnable simppHandler=new Runnable(){
    public void run(){
      SimppDataVerifier verifier=new SimppDataVerifier(simppPayload);
      boolean verified=false;
      verified=verifier.verifySource();
      if (!verified)       return;
      SimppParser parser=null;
      try {
        parser=new SimppParser(verifier.getVerifiedData());
      }
 catch (      SAXException sx) {
        return;
      }
catch (      IOException iox) {
        return;
      }
      int version=parser.getVersion();
      if (version <= myVersion)       return;
      SimppManager.this._latestVersion=version;
      SimppManager.this._simppBytes=simppPayload;
      SimppManager.this._propsStream=parser.getPropsData();
      String props=parser.getPropsData();
      SimppSettingsManager.instance().updateSimppSettings(props);
      CapabilitiesVM.reconstructInstance();
      RouterService.getConnectionManager().sendUpdatedCapabilities();
    }
  }
;
  _processingQueue.add(simppHandler);
}
Program: 4416
Project: 4416
Buggy source:
public void run(){
  SimppDataVerifier verifier=new SimppDataVerifier(simppPayload);
  boolean verified=false;
  verified=verifier.verifySource();
  if (!verified)   return;
  SimppParser parser=null;
  try {
    parser=new SimppParser(verifier.getVerifiedData());
  }
 catch (  SAXException sx) {
    return;
  }
catch (  IOException iox) {
    return;
  }
  int version=parser.getVersion();
  if (version <= myVersion)   return;
  SimppManager.this._latestVersion=version;
  SimppManager.this._simppBytes=simppPayload;
  SimppManager.this._propsStream=parser.getPropsData();
  String props=parser.getPropsData();
  SimppSettingsManager.instance().updateSimppSettings(props);
  CapabilitiesVM.updateSimppVersion(version);
  RouterService.getConnectionManager().sendUpdatedCapabilities();
}

Fixed version (ground truth):
public void run(){
  SimppDataVerifier verifier=new SimppDataVerifier(simppPayload);
  boolean verified=false;
  verified=verifier.verifySource();
  if (!verified)   return;
  SimppParser parser=null;
  try {
    parser=new SimppParser(verifier.getVerifiedData());
  }
 catch (  SAXException sx) {
    return;
  }
catch (  IOException iox) {
    return;
  }
  int version=parser.getVersion();
  if (version <= myVersion)   return;
  SimppManager.this._latestVersion=version;
  SimppManager.this._simppBytes=simppPayload;
  SimppManager.this._propsStream=parser.getPropsData();
  String props=parser.getPropsData();
  SimppSettingsManager.instance().updateSimppSettings(props);
  CapabilitiesVM.reconstructInstance();
  RouterService.getConnectionManager().sendUpdatedCapabilities();
}
Program: 4417
Project: 4417
Buggy source:
/** 
 * Responds to a Gnutella ping with cached pongs.  This does special  handling for both "heartbeat" pings that were sent to ensure that the connection is still live as well as for pings from a crawler.
 * @param ping the <tt>PingRequest</tt> to respond to
 * @param handler the <tt>ReplyHandler</tt> to send any pongs to
 */
protected void respondToPingRequest(PingRequest ping,ReplyHandler handler){
  int hops=(int)ping.getHops();
  int ttl=(int)ping.getTTL();
  if ((hops + ttl > 2) && !_manager.allowAnyConnection())   return;
  if (NetworkUtils.isValidAddress(RouterService.getAddress()) && NetworkUtils.isValidPort(RouterService.getPort())) {
    if (hops == 1 && ttl == 1) {
      handleCrawlerPing(ping,handler);
      return;
    }
    if (ping.isHeartbeat()) {
      sendPingReply(PingReply.create(ping.getGUID(),(byte)1),handler);
      return;
    }
    int newTTL=hops + 1;
    if ((hops + ttl) <= 2)     newTTL=1;
    if (RouterService.getConnectionManager().hasFreeSlots() || Statistics.instance().calculateDailyUptime() > 60 * 30) {
      PingReply pr=PingReply.create(ping.getGUID(),(byte)newTTL);
      sendPingReply(pr,handler);
    }
  }
  List pongs=PongCacher.instance().getBestPongs(ping.getLocale());
  Iterator iter=pongs.iterator();
  byte[] guid=ping.getGUID();
  InetAddress pingerIP=handler.getInetAddress();
  while (iter.hasNext()) {
    PingReply pr=(PingReply)iter.next();
    if (pr.getInetAddress().equals(pingerIP)) {
      continue;
    }
    sendPingReply(pr.mutateGUID(guid),handler);
  }
}

Fixed version (ground truth):
/** 
 * Responds to a Gnutella ping with cached pongs.  This does special  handling for both "heartbeat" pings that were sent to ensure that the connection is still live as well as for pings from a crawler.
 * @param ping the <tt>PingRequest</tt> to respond to
 * @param handler the <tt>ReplyHandler</tt> to send any pongs to
 */
protected void respondToPingRequest(PingRequest ping,ReplyHandler handler){
  int hops=(int)ping.getHops();
  int ttl=(int)ping.getTTL();
  if ((hops + ttl > 2) && !_manager.allowAnyConnection())   return;
  if (NetworkUtils.isValidAddress(RouterService.getAddress()) && NetworkUtils.isValidPort(RouterService.getPort())) {
    if (hops == 1 && ttl == 1) {
      handleCrawlerPing(ping,handler);
      return;
    }
    if (ping.isHeartbeat()) {
      sendPingReply(PingReply.create(ping.getGUID(),(byte)1),handler);
      return;
    }
    int newTTL=hops + 1;
    if ((hops + ttl) <= 2)     newTTL=1;
    if (RouterService.getConnectionManager().hasFreeSlots() || Statistics.instance().calculateDailyUptime() > 60 * 30) {
      PingReply pr=PingReply.create(ping.getGUID(),(byte)newTTL);
      sendPingReply(pr,handler);
    }
  }
  List pongs=PongCacher.instance().getBestPongs(ping.getLocale());
  Iterator iter=pongs.iterator();
  byte[] guid=ping.getGUID();
  InetAddress pingerIP=handler.getInetAddress();
  while (iter.hasNext()) {
    PingReply pr=(PingReply)iter.next();
    if (pr.getInetAddress().equals(pingerIP))     continue;
    sendPingReply(pr.mutateGUID(guid),handler);
  }
}
Program: 4420
Project: 4420
Buggy source:
/** 
 * @return A CapabilitiesVM with the set of messages this client supports.
 */
public static CapabilitiesVM instance(){
  if (_instance == null)   _instance=new CapabilitiesVM();
  return _instance;
}

Fixed version (ground truth):
/** 
 * @return A CapabilitiesVM with the set of messages this client supports.
 */
public synchronized static CapabilitiesVM instance(){
  if (_instance == null)   _instance=new CapabilitiesVM();
  return _instance;
}
Program: 4421
Project: 4421
Buggy source:
public static void updateSimppVersion(int newSimppVersion){
  Assert.that(newSimppVersion > _simppVersion,"String_Node_Str" + newSimppVersion + "String_Node_Str"+ _simppVersion);
  _simppVersion=newSimppVersion;
  _instance=null;
}

Fixed version (ground truth):
public static void updateSimppVersion(int newSimppVersion){
  Assert.that(newSimppVersion > _simppVersion,"String_Node_Str" + newSimppVersion + "String_Node_Str"+ _simppVersion);
  _simppVersion=newSimppVersion;
synchronized (CapabilitiesVM.class) {
    _instance=null;
  }
}
Program: 4422
Project: 4422
Buggy source:
public void run(){
  boolean proceed=false;
  byte[] key=_file.getClientGUID();
synchronized (UDP_FAILOVER) {
    Set files=(Set)UDP_FAILOVER.get(key);
    if (files != null && files.contains(_file.getFileName())) {
      proceed=true;
      files.remove(_file.getFileName());
      if (files.isEmpty())       UDP_FAILOVER.remove(key);
    }
  }
  if (proceed)   if (sendPushTCP(_file,_guid)) synchronized (_toNotify) {
    _toNotify.notify();
  }
}

Fixed version (ground truth):
public void run(){
  boolean proceed=false;
  byte[] key=_file.getClientGUID();
synchronized (UDP_FAILOVER) {
    Set files=(Set)UDP_FAILOVER.get(key);
    if (files != null && files.contains(_file.getFileName())) {
      proceed=true;
      files.remove(_file.getFileName());
      if (files.isEmpty())       UDP_FAILOVER.remove(key);
    }
  }
  if (proceed)   sendPushTCP(_file,_guid);
}
Program: 4423
Project: 4423
Buggy source:
public PushFailoverRequestor(RemoteFileDesc file,byte[] guid,Object toNotify){
  _file=file;
  _guid=guid;
  _toNotify=toNotify;
}

Fixed version (ground truth):
public PushFailoverRequestor(RemoteFileDesc file,byte[] guid){
  _file=file;
  _guid=guid;
}
Program: 4424
Project: 4424
Buggy source:
/** 
 * Sends a push request for the given file.  Returns false iff no push could be sent, i.e., because no routing entry exists. That generally means you shouldn't send any more pushes for this file.
 * @param file the <tt>RemoteFileDesc</tt> constructed from the query hit, containing data about the host we're pushing to
 * @return <tt>true</tt> if the push was successfully sent, otherwise<tt>false</tt>
 */
public void sendPush(final RemoteFileDesc file,final Object toNotify){
  byte[] addr=RouterService.getAddress();
  int port=RouterService.getPort();
  if (!NetworkUtils.isValidAddress(addr) || !NetworkUtils.isValidPort(port))   return;
  final byte[] guid=GUID.makeGuid();
  if (sendPushMulticast(file,guid))   return;
  byte[] key=file.getClientGUID();
synchronized (UDP_FAILOVER) {
    Set files=(Set)UDP_FAILOVER.get(key);
    if (files == null)     files=new HashSet();
    files.add(file.getFileName());
    UDP_FAILOVER.put(key,files);
  }
  RouterService.schedule(new Runnable(){
    public void run(){
      FAILOVERS.add(new PushFailoverRequestor(file,guid,toNotify));
    }
  }
,UDP_PUSH_FAILTIME,0);
  sendPushUDP(file,guid);
}

Fixed version (ground truth):
/** 
 * Sends a push request for the given file.  Returns false iff no push could be sent, i.e., because no routing entry exists. That generally means you shouldn't send any more pushes for this file.
 * @param file the <tt>RemoteFileDesc</tt> constructed from the query hit, containing data about the host we're pushing to
 * @return <tt>true</tt> if the push was successfully sent, otherwise<tt>false</tt>
 */
public void sendPush(final RemoteFileDesc file){
  byte[] addr=RouterService.getAddress();
  int port=RouterService.getPort();
  if (!NetworkUtils.isValidAddress(addr) || !NetworkUtils.isValidPort(port))   return;
  final byte[] guid=GUID.makeGuid();
  if (sendPushMulticast(file,guid))   return;
  byte[] key=file.getClientGUID();
synchronized (UDP_FAILOVER) {
    Set files=(Set)UDP_FAILOVER.get(key);
    if (files == null)     files=new HashSet();
    files.add(file.getFileName());
    UDP_FAILOVER.put(key,files);
  }
  RouterService.schedule(new Runnable(){
    public void run(){
      FAILOVERS.add(new PushFailoverRequestor(file,guid));
    }
  }
,UDP_PUSH_FAILTIME,0);
  sendPushUDP(file,guid);
}
Program: 4425
Project: 4425
Buggy source:
/** 
 * Attempts to connect by using a push to the remote end. BLOCKING.
 */
private HTTPDownloader connectWithPush(RemoteFileDesc rfd,File incFile) throws IOException {
  LOG.trace("String_Node_Str");
  HTTPDownloader ret;
  Object threadLock=new Object();
  MiniRemoteFileDesc mrfd=new MiniRemoteFileDesc(rfd.getFileName(),rfd.getIndex(),rfd.getClientGUID());
  miniRFDToLock.put(mrfd,threadLock);
  boolean pushSent;
synchronized (threadLock) {
    manager.sendPush(rfd,threadLock);
    try {
      threadLock.wait(PUSH_CONNECT_TIME);
    }
 catch (    InterruptedException e) {
      if (RECORD_STATS)       DownloadStat.PUSH_FAILURE_INTERRUPTED.incrementStat();
      throw new IOException("String_Node_Str");
    }
  }
  Socket pushSocket=(Socket)threadLockToSocket.remove(threadLock);
  if (pushSocket == null) {
    DownloadStat.PUSH_FAILURE_NO_RESPONSE.incrementStat();
    throw new IOException("String_Node_Str");
  }
  miniRFDToLock.remove(mrfd);
  ret=new HTTPDownloader(pushSocket,rfd,incFile);
  try {
    ret.connectTCP(0);
    if (RECORD_STATS)     DownloadStat.CONNECT_PUSH_SUCCESS.incrementStat();
  }
 catch (  IOException iox) {
    if (RECORD_STATS)     DownloadStat.PUSH_FAILURE_LOST.incrementStat();
    throw iox;
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Attempts to connect by using a push to the remote end. BLOCKING.
 */
private HTTPDownloader connectWithPush(RemoteFileDesc rfd,File incFile) throws IOException {
  LOG.trace("String_Node_Str");
  HTTPDownloader ret;
  Object threadLock=new Object();
  MiniRemoteFileDesc mrfd=new MiniRemoteFileDesc(rfd.getFileName(),rfd.getIndex(),rfd.getClientGUID());
  miniRFDToLock.put(mrfd,threadLock);
  boolean pushSent;
synchronized (threadLock) {
    manager.sendPush(rfd);
    try {
      threadLock.wait(PUSH_CONNECT_TIME);
    }
 catch (    InterruptedException e) {
      if (RECORD_STATS)       DownloadStat.PUSH_FAILURE_INTERRUPTED.incrementStat();
      throw new IOException("String_Node_Str");
    }
  }
  Socket pushSocket=(Socket)threadLockToSocket.remove(threadLock);
  if (pushSocket == null) {
    DownloadStat.PUSH_FAILURE_NO_RESPONSE.incrementStat();
    throw new IOException("String_Node_Str");
  }
  miniRFDToLock.remove(mrfd);
  ret=new HTTPDownloader(pushSocket,rfd,incFile);
  try {
    ret.connectTCP(0);
    if (RECORD_STATS)     DownloadStat.CONNECT_PUSH_SUCCESS.incrementStat();
  }
 catch (  IOException iox) {
    if (RECORD_STATS)     DownloadStat.PUSH_FAILURE_LOST.incrementStat();
    throw iox;
  }
  return ret;
}
Program: 4427
Project: 4427
Buggy source:
/** 
 * Resets the map to contain all the files in the saved directory. Does nothing if this is already loading, or if FileManager is still loading.
 */
private void load(){
  LOG.trace("String_Node_Str");
  Set urns=new HashSet();
  Set names=new TreeSet(Comparators.caseInsensitiveStringComparator());
  File saveDirectory=SharingSettings.getSaveDirectory();
  String[] saved=saveDirectory.list();
  if (saved == null)   saved=new String[0];
  for (int i=0; i < saved.length; i++) {
    String name=saved[i];
    File file=new File(saveDirectory,name);
    if (!file.isFile())     continue;
    if (LOG.isTraceEnabled())     LOG.trace("String_Node_Str" + file);
    names.add(name);
    Set fileUrns;
    try {
      fileUrns=FileDesc.calculateAndCacheURN(file);
      for (Iterator j=fileUrns.iterator(); j.hasNext(); )       urns.add(j.next());
    }
 catch (    IOException ignored) {
    }
catch (    InterruptedException ignored) {
    }
  }
synchronized (this) {
    _names=names;
    _urns=urns;
  }
  LOG.trace("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Resets the map to contain all the files in the saved directory. Does nothing if this is already loading, or if FileManager is still loading.
 */
private void load(){
  LOG.trace("String_Node_Str");
  Set urns=new HashSet();
  Set names=new TreeSet(Comparators.caseInsensitiveStringComparator());
  File saveDirectory=SharingSettings.getSaveDirectory();
  String[] saved=saveDirectory.list();
  if (saved == null)   saved=new String[0];
  for (int i=0; i < saved.length; i++) {
    String name=saved[i];
    File file=new File(saveDirectory,name);
    if (!file.isFile() || !file.exists())     continue;
    if (LOG.isTraceEnabled())     LOG.trace("String_Node_Str" + file);
    names.add(name);
    Set fileUrns;
    try {
      fileUrns=FileDesc.calculateAndCacheURN(file);
      for (Iterator j=fileUrns.iterator(); j.hasNext(); )       urns.add(j.next());
    }
 catch (    IOException ignored) {
    }
catch (    InterruptedException ignored) {
    }
  }
synchronized (this) {
    _names=names;
    _urns=urns;
  }
  LOG.trace("String_Node_Str");
}
Program: 4429
Project: 4429
Buggy source:
/** 
 * Returns whether or not the http request corresponds with the standard  uri-res request
 * @param requestLine the <tt>String</tt> instance containing the http request
 * @return <tt>true</tt> if the http request includes the standard "uri-res"(case-insensitive) request, <tt>false</tt> otherwise
 */
private static final boolean isValidUriRes(final String requestLine){
  int firstSlash=requestLine.indexOf(SLASH);
  if (firstSlash == -1) {
    return false;
  }
  int secondSlash=requestLine.indexOf(SLASH,firstSlash + 1);
  if (secondSlash == -1) {
    return false;
  }
  String uriStr=requestLine.substring(firstSlash + 1,secondSlash);
  if (!uriStr.equalsIgnoreCase(HTTPConstants.URI_RES)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns whether or not the http request corresponds with the standard  uri-res request
 * @param requestLine the <tt>String</tt> instance containing the http request
 * @return <tt>true</tt> if the http request includes the standard "uri-res"(case-insensitive) request, <tt>false</tt> otherwise
 */
private static final boolean isValidUriRes(final String requestLine){
  int firstSlash=requestLine.indexOf(SLASH);
  if (firstSlash == -1 || firstSlash == requestLine.length()) {
    return false;
  }
  int secondSlash=requestLine.indexOf(SLASH,firstSlash + 1);
  if (secondSlash == -1) {
    return false;
  }
  String uriStr=requestLine.substring(firstSlash + 1,secondSlash);
  if (!uriStr.equalsIgnoreCase(HTTPConstants.URI_RES)) {
    return false;
  }
  return true;
}
Program: 4430
Project: 4430
Buggy source:
/** 
 * Initializes the uploader's state. If the file is valid for uploading, this leaves the state as connecting.
 */
private void setInitialUploadingState(HTTPUploader uploader){
switch (uploader.getIndex()) {
case BROWSE_HOST_FILE_INDEX:
    uploader.setState(Uploader.BROWSE_HOST);
  return;
case FILE_VIEW_FILE_INDEX:
uploader.setState(Uploader.FILE_VIEW);
return;
case PUSH_PROXY_FILE_INDEX:
uploader.setState(Uploader.PUSH_PROXY);
return;
case UPDATE_FILE_INDEX:
uploader.setState(Uploader.UPDATE_FILE);
return;
case BAD_URN_QUERY_INDEX:
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
case MALFORMED_REQUEST_INDEX:
uploader.setState(Uploader.MALFORMED_REQUEST);
return;
default :
FileManager fm=RouterService.getFileManager();
FileDesc fd=null;
int index=uploader.getIndex();
if (fm.isValidIndex(index)) {
fd=fm.get(index);
}
if (fd == null) {
if (LOG.isDebugEnabled()) LOG.debug(uploader + "String_Node_Str");
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
}
if (!uploader.getFileName().equals(fd.getName())) {
if (LOG.isDebugEnabled()) LOG.debug(uploader + "String_Node_Str");
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
}
try {
uploader.setFileDesc(fd);
}
 catch (IOException ioe) {
if (LOG.isDebugEnabled()) LOG.debug(uploader + "String_Node_Str");
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
}
assertAsConnecting(uploader.getState());
}
}

Fixed version (ground truth):
/** 
 * Initializes the uploader's state. If the file is valid for uploading, this leaves the state as connecting.
 */
private void setInitialUploadingState(HTTPUploader uploader){
switch (uploader.getIndex()) {
case BROWSE_HOST_FILE_INDEX:
    uploader.setState(Uploader.BROWSE_HOST);
  return;
case FILE_VIEW_FILE_INDEX:
uploader.setState(Uploader.FILE_VIEW);
return;
case PUSH_PROXY_FILE_INDEX:
uploader.setState(Uploader.PUSH_PROXY);
return;
case UPDATE_FILE_INDEX:
uploader.setState(Uploader.UPDATE_FILE);
return;
case BAD_URN_QUERY_INDEX:
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
case MALFORMED_REQUEST_INDEX:
uploader.setState(Uploader.MALFORMED_REQUEST);
return;
default :
FileManager fm=RouterService.getFileManager();
FileDesc fd=null;
int index=uploader.getIndex();
synchronized (fm) {
if (fm.isValidIndex(index)) {
fd=fm.get(index);
}
}
if (fd == null) {
if (LOG.isDebugEnabled()) LOG.debug(uploader + "String_Node_Str");
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
}
if (!uploader.getFileName().equals(fd.getName())) {
if (LOG.isDebugEnabled()) LOG.debug(uploader + "String_Node_Str");
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
}
try {
uploader.setFileDesc(fd);
}
 catch (IOException ioe) {
if (LOG.isDebugEnabled()) LOG.debug(uploader + "String_Node_Str");
uploader.setState(Uploader.FILE_NOT_FOUND);
return;
}
assertAsConnecting(uploader.getState());
}
}
Program: 4431
Project: 4431
Buggy source:
public boolean hasHashTree(){
  return (_thexUri != null && _root32 != null && !_rfd.hasTHEXFailed());
}

Fixed version (ground truth):
/** 
 * Returns TRUE if this downloader has a THEX tree that we have not yet retrieved.
 */
public boolean hasHashTree(){
  return _thexUri != null && _root32 != null && !_rfd.hasTHEXFailed() && !_thexSucceeded;
}
Program: 4434
Project: 4434
Buggy source:
/** 
 * Reloads the file from disk to read values from.
 */
public static void reload(){
  File themeFile=ThemeSettings.THEME_FILE.getValue();
  if (!ThemeSettings.isThemeFile(themeFile))   ThemeSettings.THEME_FILE.revertToDefault();
  themeFile=ThemeSettings.THEME_FILE.getValue();
  File themeDir=ThemeSettings.extractThemeDir(themeFile);
  if (!themeDir.isDirectory()) {
    if (!themeFile.exists()) {
      ThemeSettings.THEME_FILE.revertToDefault();
      themeFile=ThemeSettings.THEME_FILE.getValue();
      themeDir=ThemeSettings.extractThemeDir(themeFile);
    }
    ThemeSettings.expandTheme(themeFile,themeDir,false);
  }
  final File THEME_PROPS=new File(themeDir,"String_Node_Str");
  handleFactory(THEME_PROPS);
  ThemeSettings.THEME_DIR.setValue(themeDir);
}

Fixed version (ground truth):
/** 
 * Reloads the file from disk to read values from.
 */
public static void reload(boolean force){
  File themeFile=ThemeSettings.THEME_FILE.getValue();
  if (!ThemeSettings.isThemeFile(themeFile))   ThemeSettings.THEME_FILE.revertToDefault();
  themeFile=ThemeSettings.THEME_FILE.getValue();
  File themeDir=ThemeSettings.extractThemeDir(themeFile);
  if (force || !themeDir.isDirectory()) {
    if (!themeFile.exists()) {
      ThemeSettings.THEME_FILE.revertToDefault();
      themeFile=ThemeSettings.THEME_FILE.getValue();
      themeDir=ThemeSettings.extractThemeDir(themeFile);
    }
    ThemeSettings.expandTheme(themeFile,themeDir,force || false);
  }
  final File THEME_PROPS=new File(themeDir,"String_Node_Str");
  handleFactory(THEME_PROPS);
  ThemeSettings.THEME_DIR.setValue(themeDir);
}
Program: 4435
Project: 4435
Buggy source:
/** 
 * @return true if the DEPTH is ideal enough according to our standards.
 */
public boolean isDepthGoodEnough(){
  return DEPTH >= calculateDepth(FILE_SIZE);
}

Fixed version (ground truth):
/** 
 * @return true if the DEPTH is ideal enough according to our own standards
 */
public boolean isDepthGoodEnough(){
  return DEPTH >= calculateDepth(FILE_SIZE);
}