Program: 76247
Project: 76247
Buggy source:
/** 
 * Read a pxgraph-compatible binary or ASCII encoded file.
 * @param in The input stream.
 * @exception java.io.IOException If an I/O error occurs.
 */
public void read(InputStream inputstream) throws IOException {
  DataInputStream in=new DataInputStream(new BufferedInputStream(inputstream));
  if (binary) {
    int c;
    float x=0, y=0, pointCount=0;
    boolean byteSwapped=false;
    boolean connected=false;
    byte input[]=new byte[4];
    int currentdataset=0;
switch (_endian) {
case _NATIVE_ENDIAN:
      try {
        if (System.getProperty("String_Node_Str").equals("String_Node_Str")) {
          byteSwapped=true;
        }
      }
 catch (      SecurityException e) {
      }
    break;
case _BIG_ENDIAN:
  break;
case _LITTLE_ENDIAN:
byteSwapped=true;
break;
default :
throw new IOException("String_Node_Str" + _endian + "String_Node_Str");
}
try {
c=in.readByte();
if (c != 'd') {
int bits=c;
bits=bits << 8;
bits+=in.readByte();
bits=bits << 8;
bits+=in.readByte();
bits=bits << 8;
bits+=in.readByte();
x=Float.intBitsToFloat(bits);
y=in.readFloat();
_plot.addPoint(currentdataset,x,y,connected);
connected=true;
while (true) {
x=in.readFloat();
y=in.readFloat();
_plot.addPoint(currentdataset,x,y,connected);
connected=true;
}
}
 else {
while (true) {
switch (c) {
case 'd':
if (byteSwapped) {
  in.readFully(input);
  x=Float.intBitsToFloat(((input[3] & 0xFF) << 24) | ((input[2] & 0xFF) << 16) | ((input[1] & 0xFF) << 8)| (input[0] & 0xFF));
  in.readFully(input);
  y=Float.intBitsToFloat(((input[3] & 0xFF) << 24) | ((input[2] & 0xFF) << 16) | ((input[1] & 0xFF) << 8)| (input[0] & 0xFF));
}
 else {
  x=in.readFloat();
  y=in.readFloat();
}
pointCount++;
_plot.addPoint(currentdataset,x,y,connected);
connected=true;
break;
case 'e':
connected=false;
break;
case 'n':
StringBuffer datasetname=new StringBuffer();
currentdataset++;
while (c != '\n') datasetname.append(in.readChar());
_plot.addLegend(currentdataset,datasetname.toString());
_plot.setConnected(true);
break;
case 'm':
connected=false;
break;
default :
throw new IOException("String_Node_Str" + (char)c + "String_Node_Str"+ "String_Node_Str"+ c+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ pointCount+ "String_Node_Str");
}
c=in.readByte();
}
}
}
 catch (EOFException e) {
}
}
 else {
_plot.read(inputstream);
}
}

Fixed version (ground truth):
/** 
 * Read a pxgraph-compatible binary or ASCII encoded file.
 * @param in The input stream.
 * @exception java.io.IOException If an I/O error occurs.
 */
public void read(InputStream inputstream) throws IOException {
  DataInputStream in=new DataInputStream(new BufferedInputStream(inputstream));
  if (_binary) {
    int c;
    float x=0, y=0, pointCount=0;
    boolean byteSwapped=false;
    boolean connected=false;
    byte input[]=new byte[4];
    if (_connected)     connected=true;
switch (_endian) {
case _NATIVE_ENDIAN:
      try {
        if (System.getProperty("String_Node_Str").equals("String_Node_Str")) {
          byteSwapped=true;
        }
      }
 catch (      SecurityException e) {
      }
    break;
case _BIG_ENDIAN:
  break;
case _LITTLE_ENDIAN:
byteSwapped=true;
break;
default :
throw new IOException("String_Node_Str" + _endian + "String_Node_Str");
}
try {
_firstinset=true;
_sawfirstdataset=false;
c=in.readByte();
if (c != 'd') {
int bits=c;
bits=bits << 8;
bits+=in.readByte();
bits=bits << 8;
bits+=in.readByte();
bits=bits << 8;
bits+=in.readByte();
x=Float.intBitsToFloat(bits);
y=in.readFloat();
connected=_addLegendIfNecessary(connected);
_plot.addPoint(_currentdataset,x,y,connected);
if (_connected) connected=true;
while (true) {
x=in.readFloat();
y=in.readFloat();
connected=_addLegendIfNecessary(connected);
_plot.addPoint(_currentdataset,x,y,connected);
if (_connected) connected=true;
}
}
 else {
while (true) {
switch (c) {
case 'd':
if (byteSwapped) {
  in.readFully(input);
  x=Float.intBitsToFloat(((input[3] & 0xFF) << 24) | ((input[2] & 0xFF) << 16) | ((input[1] & 0xFF) << 8)| (input[0] & 0xFF));
  in.readFully(input);
  y=Float.intBitsToFloat(((input[3] & 0xFF) << 24) | ((input[2] & 0xFF) << 16) | ((input[1] & 0xFF) << 8)| (input[0] & 0xFF));
}
 else {
  x=in.readFloat();
  y=in.readFloat();
}
pointCount++;
connected=_addLegendIfNecessary(connected);
_plot.addPoint(_currentdataset,x,y,connected);
if (_connected) connected=true;
break;
case 'e':
connected=false;
break;
case 'n':
_firstinset=true;
_sawfirstdataset=true;
StringBuffer datasetname=new StringBuffer();
_currentdataset++;
while (c != '\n') datasetname.append(in.readChar());
_plot.addLegend(_currentdataset,datasetname.toString());
_plot.setConnected(true);
break;
case 'm':
connected=false;
break;
default :
throw new IOException("String_Node_Str" + (char)c + "String_Node_Str"+ "String_Node_Str"+ c+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ pointCount+ "String_Node_Str");
}
c=in.readByte();
}
}
}
 catch (EOFException e) {
}
}
 else {
_plot.read(inputstream);
}
}