Program: 113092
Project: 113092
Buggy source:
@Override protected void transformRange(final SortedKeyValueIterator<Key,Value> input,final KVBuffer output) throws IOException {
  if (model != null) {
    long longDataId=0;
    while (input.hasTop()) {
      final Value val=input.getTopValue();
      final Key currentKey=input.getTopKey();
      final ArrayReader<byte[]> reader=new ArrayReader<byte[]>(new PrimitiveByteArrayReader());
      final ByteArrayId fieldId=new ByteArrayId(currentKey.getColumnQualifierData().getBackingArray());
      final boolean addEncoding=(model.getReader(fieldId) == null);
      final ByteSequence rowData=currentKey.getRowData();
      AccumuloRowId rowId=new AccumuloRowId(rowData.getBackingArray());
      final byte[][] entryBytes=reader.readField(val.get());
      for (int i=0; i < entryBytes.length; i++) {
        final byte[] dataId=new byte[4];
        ByteBuffer buf=ByteBuffer.allocate(8);
        buf.putLong(longDataId++);
        buf.position(4);
        buf.get(dataId,0,4);
        rowId=new AccumuloRowId(rowId.getInsertionId(),dataId,rowId.getAdapterId(),rowId.getNumberOfDuplicates());
        final Key outKey=IteratorUtils.replaceRow(currentKey,rowId.getRowId());
        byte[] value;
        if (addEncoding) {
          if (entryBytes[i] != null) {
            value=new byte[1 + entryBytes[i].length];
            value=ArrayUtils.add(entryBytes[i],0,val.get()[0]);
          }
 else {
            value=new byte[]{val.get()[0]};
          }
        }
 else {
          value=entryBytes[i];
        }
        output.append(outKey,new Value(value));
      }
      input.next();
    }
  }
}

Fixed version (ground truth):
@Override protected void transformRange(final SortedKeyValueIterator<Key,Value> input,final KVBuffer output) throws IOException {
  if (model != null) {
    while (input.hasTop()) {
      long longDataId=0;
      final Value val=input.getTopValue();
      final Key currentKey=input.getTopKey();
      final ArrayReader<byte[]> reader=new ArrayReader<byte[]>(new PrimitiveByteArrayReader());
      final ByteArrayId fieldId=new ByteArrayId(currentKey.getColumnQualifierData().getBackingArray());
      final boolean addEncoding=(model.getReader(fieldId) == null);
      final ByteSequence rowData=currentKey.getRowData();
      AccumuloRowId rowId=new AccumuloRowId(rowData.getBackingArray());
      final byte[][] entryBytes=reader.readField(val.get());
      for (int i=0; i < entryBytes.length; i++) {
        final byte[] dataId=new byte[4];
        ByteBuffer buf=ByteBuffer.allocate(8);
        buf.putLong(longDataId++);
        buf.position(4);
        buf.get(dataId,0,4);
        rowId=new AccumuloRowId(rowId.getInsertionId(),dataId,rowId.getAdapterId(),rowId.getNumberOfDuplicates());
        final Key outKey=IteratorUtils.replaceRow(currentKey,rowId.getRowId());
        byte[] value;
        if (addEncoding) {
          if (entryBytes[i] != null) {
            value=new byte[1 + entryBytes[i].length];
            value=ArrayUtils.add(entryBytes[i],0,val.get()[0]);
          }
 else {
            value=new byte[]{val.get()[0]};
          }
        }
 else {
          value=entryBytes[i];
        }
        output.append(outKey,new Value(value));
      }
      input.next();
    }
  }
}