Program: 4301
Project: 4301
Buggy source:
private void browseExchangeInternal(Socket socket) throws IOException {
  socket.setSoTimeout(5000);
  LOG.trace("String_Node_Str");
  setState(EXCHANGING);
  final String LF="String_Node_Str";
  String str=null;
  OutputStream oStream=socket.getOutputStream();
  LOG.trace("String_Node_Str");
  str="String_Node_Str" + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + NetworkUtils.ip2string(RouterService.getAddress()) + "String_Node_Str"+ RouterService.getPort()+ LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + CommonUtils.getVendor() + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + Constants.QUERYREPLY_MIME_TYPE + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + LF;
  oStream.write(str.getBytes());
  str=LF;
  oStream.write(str.getBytes());
  oStream.flush();
  LOG.trace("String_Node_Str");
  InputStream in=socket.getInputStream();
  LOG.trace("String_Node_Str");
  ByteReader br=new ByteReader(in);
  LOG.trace("String_Node_Str");
  int code=parseHTTPCode(br.readLine());
  if ((code < 200) || (code >= 300))   throw new IOException();
  if (LOG.isDebugEnabled())   LOG.debug("String_Node_Str" + code);
  boolean readingHTTP=true;
  String currLine=null;
  while (readingHTTP) {
    currLine=br.readLine();
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str" + currLine);
    if ((currLine == null) || currLine.equals("String_Node_Str")) {
      readingHTTP=false;
    }
 else     if (indexOfIgnoreCase(currLine,"String_Node_Str") > -1) {
      if (indexOfIgnoreCase(currLine,Constants.QUERYREPLY_MIME_TYPE) < 0)       throw new IOException();
    }
 else     if (indexOfIgnoreCase(currLine,"String_Node_Str") > -1) {
      throw new IOException();
    }
 else     if (markContentLength(currLine))     ;
  }
  LOG.debug("String_Node_Str");
  in=new BufferedInputStream(in);
  Message m=null;
  while (true) {
    try {
      m=null;
      LOG.debug("String_Node_Str");
      m=MessageFactory.read(in);
      LOG.debug("String_Node_Str" + m);
    }
 catch (    BadPacketException bpe) {
      LOG.debug(bpe);
    }
catch (    IOException expected) {
    }
    if (m == null)     return;
 else {
      if (m instanceof QueryReply) {
        _currentLength+=m.getTotalLength();
        if (LOG.isTraceEnabled())         LOG.trace("String_Node_Str" + m);
        QueryReply reply=(QueryReply)m;
        reply.setGUID(_guid);
        reply.setBrowseHostReply(true);
        ForMeReplyHandler.instance().handleQueryReply(reply,null);
      }
    }
  }
}

Fixed version (ground truth):
private void browseExchangeInternal(Socket socket) throws IOException {
  socket.setSoTimeout(5000);
  LOG.trace("String_Node_Str");
  setState(EXCHANGING);
  final String LF="String_Node_Str";
  String str=null;
  OutputStream oStream=socket.getOutputStream();
  LOG.trace("String_Node_Str");
  str="String_Node_Str" + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + NetworkUtils.ip2string(RouterService.getAddress()) + "String_Node_Str"+ RouterService.getPort()+ LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + CommonUtils.getVendor() + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + Constants.QUERYREPLY_MIME_TYPE + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + LF;
  oStream.write(str.getBytes());
  str="String_Node_Str" + LF;
  oStream.write(str.getBytes());
  str=LF;
  oStream.write(str.getBytes());
  oStream.flush();
  LOG.trace("String_Node_Str");
  InputStream in=socket.getInputStream();
  LOG.trace("String_Node_Str" + in);
  ByteReader br=new ByteReader(in);
  LOG.trace("String_Node_Str");
  int code=parseHTTPCode(br.readLine());
  if ((code < 200) || (code >= 300)) {
    LOG.debug("String_Node_Str" + code);
    throw new IOException();
  }
  if (LOG.isDebugEnabled())   LOG.debug("String_Node_Str" + code);
  boolean readingHTTP=true;
  String currLine=null;
  while (readingHTTP) {
    currLine=br.readLine();
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str" + currLine);
    if ((currLine == null) || currLine.equals("String_Node_Str")) {
      readingHTTP=false;
    }
 else     if (indexOfIgnoreCase(currLine,"String_Node_Str") > -1) {
      if (indexOfIgnoreCase(currLine,Constants.QUERYREPLY_MIME_TYPE) < 0)       throw new IOException();
    }
 else     if (indexOfIgnoreCase(currLine,"String_Node_Str") > -1) {
      throw new IOException();
    }
 else     if (markContentLength(currLine))     ;
  }
  LOG.debug("String_Node_Str");
  in=new BufferedInputStream(in);
  Message m=null;
  while (true) {
    try {
      m=null;
      LOG.debug("String_Node_Str");
      m=MessageFactory.read(in);
    }
 catch (    BadPacketException bpe) {
      LOG.debug("String_Node_Str",bpe);
    }
catch (    IOException expected) {
      LOG.debug("String_Node_Str",expected);
    }
    if (m == null) {
      LOG.debug("String_Node_Str");
      return;
    }
 else {
      if (m instanceof QueryReply) {
        _currentLength+=m.getTotalLength();
        if (LOG.isTraceEnabled())         LOG.trace("String_Node_Str" + m);
        QueryReply reply=(QueryReply)m;
        reply.setGUID(_guid);
        reply.setBrowseHostReply(true);
        ForMeReplyHandler.instance().handleQueryReply(reply,null);
      }
    }
  }
}