Program: 107617
Project: 107617
Buggy source:
/** 
 * Listens for incoming datagrams, stores them for reading by the <tt>read</tt> method and notifies the local <tt>transferHandler</tt> that there's data to be read.
 */
public void run(){
  DatagramPacket p=new DatagramPacket(buffer,0,PACKET_RECEIVE_BUFFER_LENGTH);
  while (!closed) {
    try {
      if (OSUtils.IS_ANDROID)       p.setLength(PACKET_RECEIVE_BUFFER_LENGTH);
      receivePacket(p);
    }
 catch (    IOException e) {
      ioError=true;
      break;
    }
    DatagramPacketFilter[] datagramPacketFilters=getDatagramPacketFilters();
    boolean accept;
    if (datagramPacketFilters == null)     accept=true;
 else {
      accept=true;
      for (int i=0; i < datagramPacketFilters.length; i++) {
        try {
          if (!datagramPacketFilters[i].accept(p)) {
            accept=false;
            break;
          }
        }
 catch (        Throwable t) {
          if (t instanceof ThreadDeath)           throw (ThreadDeath)t;
        }
      }
    }
    if (accept) {
      pkt=createRawPacket(p);
      if ((pkt != null) && (!pkt.isInvalid()) && (transferHandler != null)&& !closed)       transferHandler.transferData(this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Listens for incoming datagrams, stores them for reading by the <tt>read</tt> method and notifies the local <tt>transferHandler</tt> that there's data to be read.
 */
public void run(){
  DatagramPacket p=new DatagramPacket(buffer,0,PACKET_RECEIVE_BUFFER_LENGTH);
  while (!closed) {
    try {
      if (OSUtils.IS_ANDROID)       p.setLength(PACKET_RECEIVE_BUFFER_LENGTH);
      receivePacket(p);
    }
 catch (    IOException e) {
      ioError=true;
      break;
    }
    DatagramPacketFilter[] datagramPacketFilters=getDatagramPacketFilters();
    boolean accept;
    if (datagramPacketFilters == null)     accept=true;
 else {
      accept=true;
      for (int i=0; i < datagramPacketFilters.length; i++) {
        try {
          if (!datagramPacketFilters[i].accept(p)) {
            accept=false;
            break;
          }
        }
 catch (        Throwable t) {
          if (t instanceof ThreadDeath)           throw (ThreadDeath)t;
        }
      }
    }
    if (accept) {
      RawPacket pkt=createRawPacket(p);
      if (pkt != null) {
        if (pkt.isInvalid()) {
          pkt.setBuffer(null);
          pkt.setLength(0);
          pkt.setOffset(0);
          rawPacketPool.offer(pkt);
        }
 else {
          RawPacket oldPkt;
synchronized (pktSyncRoot) {
            oldPkt=this.pkt;
            this.pkt=pkt;
          }
          if (oldPkt != null) {
            oldPkt.setBuffer(null);
            oldPkt.setLength(0);
            oldPkt.setOffset(0);
            rawPacketPool.offer(pkt);
          }
          if ((transferHandler != null) && !closed) {
            try {
              transferHandler.transferData(this);
            }
 catch (            Throwable t) {
              if (t instanceof ThreadDeath) {
                throw (ThreadDeath)t;
              }
 else {
                logger.warn("String_Node_Str" + "String_Node_Str",t);
              }
            }
          }
        }
      }
    }
  }
}