Program: 49871
Project: 49871
Buggy source:
/** 
 * See the general contract of the <code>readLine</code> method of <code>DataInput</code>. <p/> Bytes for this operation are read from the contained input stream.
 * @return the next line of text from this input stream.
 * @throws IOException if an I/O error occurs.
 * @see java.io.BufferedReader#readLine()
 * @see java.io.FilterInputStream#in
 * @deprecated This method does not properly convert bytes to characters. Asof JDK&nbsp;1.1, the preferred way to read lines of text is via the <code>BufferedReader.readLine()</code> method. Programs that use the <code>DataInputStream</code> class to read lines can be converted to use the <code>BufferedReader</code> class by replacing code of the form: <blockquote> <p/> <pre> DataInputStream d = new DataInputStream(in); </pre> <p/> </blockquote> with: <blockquote> <p/> <pre> BufferedReader d = new BufferedReader(new InputStreamReader(in)); </pre> <p/> </blockquote>
 */
@Deprecated public final String readLine() throws IOException {
  char buf[]=lineBuffer;
  if (buf == null) {
    buf=lineBuffer=new char[128];
  }
  int room=buf.length;
  int offset=0;
  int c;
  loop:   while (true) {
switch (c=read()) {
case -1:
case '\n':
      break loop;
case '\r':
    final int c2=read();
  if ((c2 != '\n') && (c2 != -1)) {
    new PushbackInputStream(this).unread(c2);
  }
break loop;
default :
if (--room < 0) {
buf=new char[offset + 128];
room=buf.length - offset - 1;
System.arraycopy(lineBuffer,0,buf,0,offset);
lineBuffer=buf;
}
buf[offset++]=(char)c;
break;
}
}
if ((c == -1) && (offset == 0)) {
return null;
}
return String.copyValueOf(buf,0,offset);
}

Fixed version (ground truth):
/** 
 * See the general contract of the <code>readLine</code> method of <code>DataInput</code>. <p/> Bytes for this operation are read from the contained input stream.
 * @return the next line of text from this input stream.
 * @throws IOException if an I/O error occurs.
 * @see java.io.BufferedReader#readLine()
 * @see java.io.FilterInputStream#in
 * @deprecated This method does not properly convert bytes to characters. Asof JDK&nbsp;1.1, the preferred way to read lines of text is via the <code>BufferedReader.readLine()</code> method. Programs that use the <code>DataInputStream</code> class to read lines can be converted to use the <code>BufferedReader</code> class by replacing code of the form: <blockquote> <p/> <pre> DataInputStream d = new DataInputStream(in); </pre> </blockquote> with: <blockquote> <pre> BufferedReader d = new BufferedReader(new InputStreamReader(in)); </pre> </blockquote>
 */
@Deprecated public final String readLine() throws IOException {
  char buf[]=lineBuffer;
  if (buf == null) {
    buf=lineBuffer=new char[128];
  }
  int room=buf.length;
  int offset=0;
  int c;
  loop:   while (true) {
switch (c=read()) {
case -1:
case '\n':
      break loop;
case '\r':
    final int c2=read();
  if ((c2 != '\n') && (c2 != -1)) {
    new PushbackInputStream(this).unread(c2);
  }
break loop;
default :
if (--room < 0) {
buf=new char[offset + 128];
room=buf.length - offset - 1;
System.arraycopy(lineBuffer,0,buf,0,offset);
lineBuffer=buf;
}
buf[offset++]=(char)c;
break;
}
}
if ((c == -1) && (offset == 0)) {
return null;
}
return String.copyValueOf(buf,0,offset);
}