Program: 94395
Project: 94395
Buggy source:
final public Raster toRaster(){
  WritableRaster raster=Raster.createBandedRaster(datatype,width,height,bands,new Point(0,0));
  final ByteBuffer rasterBuffer=ByteBuffer.wrap(data);
  for (int i=0; i < HEADER_LEN; i++) {
    rasterBuffer.get();
  }
  int databytes=data.length - HEADER_LEN;
switch (datatype) {
case DataBuffer.TYPE_BYTE:
{
      final byte[] bytedata=new byte[databytes];
      rasterBuffer.get(bytedata);
      raster.setDataElements(0,0,width,height,bytedata);
      break;
    }
case DataBuffer.TYPE_FLOAT:
{
    final FloatBuffer floatbuff=rasterBuffer.asFloatBuffer();
    final float[] floatdata=new float[databytes / bytesPerPixel()];
    floatbuff.get(floatdata);
    raster.setDataElements(0,0,width,height,floatdata);
    break;
  }
case DataBuffer.TYPE_DOUBLE:
{
  final DoubleBuffer doublebuff=rasterBuffer.asDoubleBuffer();
  final double[] doubledata=new double[databytes / bytesPerPixel()];
  doublebuff.get(doubledata);
  raster.setDataElements(0,0,width,height,doubledata);
  break;
}
case DataBuffer.TYPE_INT:
{
final IntBuffer intbuff=rasterBuffer.asIntBuffer();
final int[] intdata=new int[databytes / bytesPerPixel()];
intbuff.get(intdata);
raster.setDataElements(0,0,width,height,intdata);
break;
}
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
{
final ShortBuffer shortbuff=rasterBuffer.asShortBuffer();
final short[] shortdata=new short[databytes / bytesPerPixel()];
shortbuff.get(shortdata);
raster.setDataElements(0,0,width,height,shortdata);
break;
}
default :
throw new RasterWritable.RasterWritableException("String_Node_Str");
}
return raster;
}

Fixed version (ground truth):
final public Raster toRaster(){
  WritableRaster raster=RasterUtils.createEmptyRaster(width,height,bands,datatype);
  final ByteBuffer rasterBuffer=ByteBuffer.wrap(data);
  rasterBuffer.order(ByteOrder.LITTLE_ENDIAN);
  for (int i=0; i < HEADER_LEN; i++) {
    rasterBuffer.get();
  }
  int databytes=data.length - HEADER_LEN;
switch (datatype) {
case DataBuffer.TYPE_BYTE:
{
      final byte[] bytedata=new byte[databytes];
      rasterBuffer.get(bytedata);
      raster.setDataElements(0,0,width,height,bytedata);
      break;
    }
case DataBuffer.TYPE_FLOAT:
{
    final FloatBuffer floatbuff=rasterBuffer.asFloatBuffer();
    final float[] floatdata=new float[databytes / bytesPerPixel()];
    floatbuff.get(floatdata);
    raster.setDataElements(0,0,width,height,floatdata);
    break;
  }
case DataBuffer.TYPE_DOUBLE:
{
  final DoubleBuffer doublebuff=rasterBuffer.asDoubleBuffer();
  final double[] doubledata=new double[databytes / bytesPerPixel()];
  doublebuff.get(doubledata);
  raster.setDataElements(0,0,width,height,doubledata);
  break;
}
case DataBuffer.TYPE_INT:
{
final IntBuffer intbuff=rasterBuffer.asIntBuffer();
final int[] intdata=new int[databytes / bytesPerPixel()];
intbuff.get(intdata);
raster.setDataElements(0,0,width,height,intdata);
break;
}
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
{
final ShortBuffer shortbuff=rasterBuffer.asShortBuffer();
final short[] shortdata=new short[databytes / bytesPerPixel()];
shortbuff.get(shortdata);
raster.setDataElements(0,0,width,height,shortdata);
break;
}
default :
throw new RasterWritable.RasterWritableException("String_Node_Str");
}
return raster;
}