Program: 160551
Project: 160551
Buggy source:
@SuppressWarnings("String_Node_Str") public <T extends IdEObject>T get(IdEObject idEObject,long oid,IfcModelInterface model,QueryInterface query,TodoList todoList) throws BimserverDatabaseException {
  checkOpen();
  if (oid == -1) {
    throw new BimserverDatabaseException("String_Node_Str" + oid);
  }
  if (objectsToCommit.containsOid(oid)) {
    return (T)objectsToCommit.getByOid(oid);
  }
  EClass eClass=getEClassForOid(oid);
  RecordIdentifier recordIdentifier=new RecordIdentifier(query.getPid(),oid,query.getRid());
  IdEObjectImpl cachedObject=(IdEObjectImpl)objectCache.get(recordIdentifier);
  if (cachedObject != null) {
    idEObject=cachedObject;
    if (cachedObject.getLoadingState() == State.LOADED && cachedObject.getRid() != Integer.MAX_VALUE) {
      cachedObject.load();
      return (T)cachedObject;
    }
  }
  ByteBuffer mustStartWith=ByteBuffer.wrap(new byte[12]);
  mustStartWith.putInt(query.getPid());
  mustStartWith.putLong(oid);
  ByteBuffer startSearchWith=ByteBuffer.wrap(new byte[16]);
  startSearchWith.putInt(query.getPid());
  startSearchWith.putLong(oid);
  startSearchWith.putInt(-query.getRid());
  SearchingRecordIterator recordIterator=database.getKeyValueStore().getRecordIterator(eClass.getEPackage().getName() + "String_Node_Str" + eClass.getName(),mustStartWith.array(),startSearchWith.array(),this);
  try {
    Record record=recordIterator.next();
    if (record == null) {
      return null;
    }
    reads++;
    ByteBuffer keyBuffer=ByteBuffer.wrap(record.getKey());
    ByteBuffer valueBuffer=ByteBuffer.wrap(record.getValue());
    keyBuffer.getInt();
    long keyOid=keyBuffer.getLong();
    int keyRid=-keyBuffer.getInt();
    if (keyRid <= query.getRid()) {
      if (idEObject != null && idEObject.getRid() == Integer.MAX_VALUE) {
        ((IdEObjectImpl)idEObject).setRid(keyRid);
      }
      if (model.contains(keyOid) && ((IdEObjectImpl)model.get(keyOid)).getLoadingState() == State.LOADED) {
        return (T)model.get(keyOid);
      }
 else {
        if (valueBuffer.capacity() == 1 && valueBuffer.get(0) == -1) {
          valueBuffer.position(valueBuffer.position() + 1);
          return null;
        }
 else {
          T convertByteArrayToObject=(T)convertByteArrayToObject(idEObject,eClass,eClass,keyOid,valueBuffer,model,keyRid,query,todoList);
          if (convertByteArrayToObject.getRid() == Integer.MAX_VALUE) {
            ((IdEObjectImpl)convertByteArrayToObject).setRid(keyRid);
          }
          objectCache.put(recordIdentifier,convertByteArrayToObject);
          return convertByteArrayToObject;
        }
      }
    }
 else {
      return null;
    }
  }
  finally {
    recordIterator.close();
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T extends IdEObject>T get(IdEObject idEObject,long oid,IfcModelInterface model,QueryInterface query,TodoList todoList) throws BimserverDatabaseException {
  checkOpen();
  if (oid == 262145) {
    System.out.println();
  }
  if (oid == -1) {
    throw new BimserverDatabaseException("String_Node_Str" + oid);
  }
  if (objectsToCommit.containsOid(oid)) {
    return (T)objectsToCommit.getByOid(oid);
  }
  EClass eClass=getEClassForOid(oid);
  if (idEObject != null) {
    if (!eClass.isSuperTypeOf(idEObject.eClass())) {
      throw new BimserverDatabaseException("String_Node_Str" + oid + "String_Node_Str"+ idEObject.eClass().getName()+ "String_Node_Str"+ eClass.getName());
    }
  }
  RecordIdentifier recordIdentifier=new RecordIdentifier(query.getPid(),oid,query.getRid());
  IdEObjectImpl cachedObject=(IdEObjectImpl)objectCache.get(recordIdentifier);
  if (cachedObject != null) {
    idEObject=cachedObject;
    if (cachedObject.getLoadingState() == State.LOADED && cachedObject.getRid() != Integer.MAX_VALUE) {
      cachedObject.load();
      return (T)cachedObject;
    }
  }
  ByteBuffer mustStartWith=ByteBuffer.wrap(new byte[12]);
  mustStartWith.putInt(query.getPid());
  mustStartWith.putLong(oid);
  ByteBuffer startSearchWith=ByteBuffer.wrap(new byte[16]);
  startSearchWith.putInt(query.getPid());
  startSearchWith.putLong(oid);
  startSearchWith.putInt(-query.getRid());
  SearchingRecordIterator recordIterator=database.getKeyValueStore().getRecordIterator(eClass.getEPackage().getName() + "String_Node_Str" + eClass.getName(),mustStartWith.array(),startSearchWith.array(),this);
  try {
    Record record=recordIterator.next();
    if (record == null) {
      return null;
    }
    reads++;
    ByteBuffer keyBuffer=ByteBuffer.wrap(record.getKey());
    ByteBuffer valueBuffer=ByteBuffer.wrap(record.getValue());
    keyBuffer.getInt();
    long keyOid=keyBuffer.getLong();
    int keyRid=-keyBuffer.getInt();
    if (keyRid <= query.getRid()) {
      if (idEObject != null && idEObject.getRid() == Integer.MAX_VALUE) {
        ((IdEObjectImpl)idEObject).setRid(keyRid);
      }
      if (model.contains(keyOid) && ((IdEObjectImpl)model.get(keyOid)).getLoadingState() == State.LOADED) {
        return (T)model.get(keyOid);
      }
 else {
        if (valueBuffer.capacity() == 1 && valueBuffer.get(0) == -1) {
          valueBuffer.position(valueBuffer.position() + 1);
          return null;
        }
 else {
          T convertByteArrayToObject=(T)convertByteArrayToObject(idEObject,eClass,eClass,keyOid,valueBuffer,model,keyRid,query,todoList);
          if (convertByteArrayToObject.getRid() == Integer.MAX_VALUE) {
            ((IdEObjectImpl)convertByteArrayToObject).setRid(keyRid);
          }
          objectCache.put(recordIdentifier,convertByteArrayToObject);
          return convertByteArrayToObject;
        }
      }
    }
 else {
      return null;
    }
  }
  finally {
    recordIterator.close();
  }
}