Program: 80085
Project: 80085
Buggy source:
/** 
 * test position with a byte[] argument
 */
public void testPositionBytes() throws Exception {
  insertDefaultData();
  Statement stmt=createStatement();
  ResultSet rs=stmt.executeQuery("String_Node_Str");
  int blobLength=0;
  Blob blob;
  Random random=new Random();
  byte[] searchBytes;
  int start, length, startSearchPos;
  int distance, maxStartPointDistance;
  long foundAt;
  maxStartPointDistance=CharAlphabet.MODERNLATINLOWER.length;
  while (rs.next()) {
    blob=rs.getBlob(1);
    blobLength=rs.getInt(2);
    if (blob != null && blobLength > 0) {
      println("String_Node_Str" + blobLength);
      for (int i=0; i < 10; i++) {
        start=Math.max(random.nextInt(blobLength - 1),1);
        length=random.nextInt(blobLength - start) + 1;
        println("String_Node_Str" + start + "String_Node_Str"+ length);
        searchBytes=blob.getBytes(start,length);
        String searchString=new String(searchBytes);
        distance=random.nextInt(maxStartPointDistance);
        startSearchPos=Math.max((start - distance),1);
        byte[] tmp=blob.getBytes(startSearchPos,start);
        if (new String(tmp).indexOf(searchString) != -1) {
          startSearchPos=start;
        }
        println("String_Node_Str" + startSearchPos + "String_Node_Str"+ new String(searchBytes));
        foundAt=blob.position(searchBytes,startSearchPos);
        assertEquals("String_Node_Str" + searchString + "String_Node_Str"+ startSearchPos+ "String_Node_Str"+ searchBytes.length,start,foundAt);
      }
    }
  }
  rs.close();
  stmt.close();
}

Fixed version (ground truth):
/** 
 * test position with a byte[] argument
 */
public void testPositionBytes() throws Exception {
  insertDefaultData();
  Statement stmt=createStatement();
  ResultSet rs=stmt.executeQuery("String_Node_Str");
  int blobLength=0;
  Blob blob;
  Random random=new Random();
  byte[] searchBytes;
  int start, length, startSearchPos;
  int distance, maxStartPointDistance;
  long foundAt;
  maxStartPointDistance=CharAlphabet.MODERNLATINLOWER.length;
  while (rs.next()) {
    blob=rs.getBlob(1);
    blobLength=rs.getInt(2);
    if (blob != null && blobLength > 0) {
      println("String_Node_Str" + blobLength);
      for (int i=0; i < 10; i++) {
        start=Math.max(random.nextInt(blobLength - 1),1);
        length=random.nextInt(blobLength - start) + 1;
        println("String_Node_Str" + start + "String_Node_Str"+ length);
        searchBytes=blob.getBytes(start,length);
        String searchString=new String(searchBytes,"String_Node_Str");
        distance=random.nextInt(maxStartPointDistance);
        startSearchPos=Math.max((start - distance),1);
        byte[] tmp=blob.getBytes(startSearchPos,start);
        if (new String(tmp,"String_Node_Str").indexOf(searchString) != -1) {
          startSearchPos=start;
        }
        println("String_Node_Str" + startSearchPos + "String_Node_Str"+ new String(searchBytes));
        foundAt=blob.position(searchBytes,startSearchPos);
        assertEquals("String_Node_Str" + searchString + "String_Node_Str"+ startSearchPos+ "String_Node_Str"+ searchBytes.length,start,foundAt);
      }
    }
  }
  rs.close();
  stmt.close();
}