Program: 4562
Project: 4562
Buggy source:
/** 
 * Factory method for instantiating individual responses from an <tt>InputStream</tt> instance.
 * @param is the <tt>InputStream</tt> to read from
 * @throws <tt>IOException</tt> if there are any problems reading fromor writing to the stream
 */
public static Response createFromStream(InputStream is) throws IOException {
  long index=ByteOrder.ubytes2long(ByteOrder.leb2int(is));
  long size=ByteOrder.ubytes2long(ByteOrder.leb2int(is));
  if ((index & 0xFFFFFFFF00000000L) != 0)   throw new IOException("String_Node_Str" + index);
  if (size > Integer.MAX_VALUE || size < 0)   throw new IOException("String_Node_Str" + size);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  int c;
  while ((c=is.read()) != 0) {
    baos.write(c);
  }
  String name=new String(baos.toByteArray());
  if (name.length() == 0) {
    throw new IOException("String_Node_Str");
  }
  baos.reset();
  while ((c=is.read()) != 0) {
    baos.write(c);
  }
  byte[] rawMeta=baos.toByteArray();
  String betweenNulls=new String(rawMeta);
  if (betweenNulls == null || betweenNulls.equals("String_Node_Str")) {
    if (is.available() < 16) {
      throw new IOException("String_Node_Str");
    }
    return new Response(index,size,name);
  }
 else {
    StringTokenizer stok=new StringTokenizer(betweenNulls,EXT_STRING);
    Set urns=null;
    Set endpoints=null;
    String metaString=null;
    while (stok.hasMoreTokens()) {
      final String ext=stok.nextToken();
      if (URN.isUrn(ext)) {
        try {
          URN urn=URN.createSHA1Urn(ext);
          if (urns == null)           urns=new HashSet(1);
          urns.add(urn);
          continue;
        }
 catch (        IOException e) {
        }
      }
      byte[] extBytes=ext.getBytes();
      if (extBytes != null && extBytes.length > 1 && extBytes[0] == GGEP.GGEP_PREFIX_MAGIC_NUMBER) {
        boolean readMore=false;
        if (stok.hasMoreTokens()) {
          readMore=true;
          StringBuffer sb=new StringBuffer(ext);
          while (stok.hasMoreTokens()) {
            sb.append(EXT_STRING);
            sb.append(stok.nextToken());
          }
          extBytes=sb.toString().getBytes();
        }
        GGEP[] ggepBlocks=null;
        try {
          if (!readMore)           ggepBlocks=GGEP.read(extBytes,0);
 else {
            int[] end=new int[1];
            ggepBlocks=GGEP.read(extBytes,0,end);
            if (end[0] != extBytes.length)             stok=recreateTokenizer(extBytes,end[0]);
          }
          endpoints=GGEPUtil.getLocations(ggepBlocks);
          continue;
        }
 catch (        BadGGEPBlockException be) {
        }
      }
      metaString=createXmlString(name,ext);
    }
    return new Response(index,size,name,metaString,urns,null,endpoints,rawMeta);
  }
}

Fixed version (ground truth):
/** 
 * Factory method for instantiating individual responses from an <tt>InputStream</tt> instance.
 * @param is the <tt>InputStream</tt> to read from
 * @throws <tt>IOException</tt> if there are any problems reading fromor writing to the stream
 */
public static Response createFromStream(InputStream is) throws IOException {
  long index=ByteOrder.ubytes2long(ByteOrder.leb2int(is));
  long size=ByteOrder.ubytes2long(ByteOrder.leb2int(is));
  if ((index & 0xFFFFFFFF00000000L) != 0)   throw new IOException("String_Node_Str" + index);
  if (size > Integer.MAX_VALUE || size < 0)   throw new IOException("String_Node_Str" + size);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  int c;
  while ((c=is.read()) != 0) {
    if (c == -1)     throw new IOException("String_Node_Str");
    baos.write(c);
  }
  String name=new String(baos.toByteArray());
  if (name.length() == 0) {
    throw new IOException("String_Node_Str");
  }
  baos.reset();
  while ((c=is.read()) != 0) {
    if (c == -1)     throw new IOException("String_Node_Str");
    baos.write(c);
  }
  byte[] rawMeta=baos.toByteArray();
  String betweenNulls=new String(rawMeta);
  if (betweenNulls == null || betweenNulls.equals("String_Node_Str")) {
    if (is.available() < 16) {
      throw new IOException("String_Node_Str");
    }
    return new Response(index,size,name);
  }
 else {
    StringTokenizer stok=new StringTokenizer(betweenNulls,EXT_STRING);
    Set urns=null;
    Set endpoints=null;
    String metaString=null;
    while (stok.hasMoreTokens()) {
      final String ext=stok.nextToken();
      if (URN.isUrn(ext)) {
        try {
          URN urn=URN.createSHA1Urn(ext);
          if (urns == null)           urns=new HashSet(1);
          urns.add(urn);
          continue;
        }
 catch (        IOException e) {
        }
      }
      byte[] extBytes=ext.getBytes();
      if (extBytes != null && extBytes.length > 1 && extBytes[0] == GGEP.GGEP_PREFIX_MAGIC_NUMBER) {
        boolean readMore=false;
        if (stok.hasMoreTokens()) {
          readMore=true;
          StringBuffer sb=new StringBuffer(ext);
          while (stok.hasMoreTokens()) {
            sb.append(EXT_STRING);
            sb.append(stok.nextToken());
          }
          extBytes=sb.toString().getBytes();
        }
        GGEP[] ggepBlocks=null;
        try {
          if (!readMore)           ggepBlocks=GGEP.read(extBytes,0);
 else {
            int[] end=new int[1];
            ggepBlocks=GGEP.read(extBytes,0,end);
            if (end[0] != extBytes.length)             stok=recreateTokenizer(extBytes,end[0]);
          }
          endpoints=GGEPUtil.getLocations(ggepBlocks);
          continue;
        }
 catch (        BadGGEPBlockException be) {
        }
      }
      metaString=createXmlString(name,ext);
    }
    return new Response(index,size,name,metaString,urns,null,endpoints,rawMeta);
  }
}