Program: 160371
Project: 160371
Buggy source:
private Object readList(HashMapVirtualObject idEObject,ByteBuffer buffer,EStructuralFeature feature) throws BimserverDatabaseException {
  if (feature.getEType() instanceof EEnum) {
  }
 else   if (feature.getEType() instanceof EClass) {
    if (buffer.capacity() == 1 && buffer.get(0) == -1) {
      buffer.position(buffer.position() + 1);
    }
 else {
      int listSize=buffer.getInt();
      for (int i=0; i < listSize; i++) {
        if (feature.getEAnnotation("String_Node_Str") != null) {
          HashMapVirtualObject newObject=new HashMapVirtualObject(reusable,(EClass)feature.getEType());
          Object result=readList(newObject,buffer,newObject.eClass().getEStructuralFeature("String_Node_Str"));
          if (result != null) {
            newObject.setAttribute(newObject.eClass().getEStructuralFeature("String_Node_Str"),result);
          }
          idEObject.setListItem(feature,i,newObject);
        }
 else {
          buffer.order(ByteOrder.LITTLE_ENDIAN);
          short cid=buffer.getShort();
          buffer.order(ByteOrder.BIG_ENDIAN);
          if (cid == -1) {
          }
 else           if (cid < 0) {
            EClass referenceClass=queryObjectProvider.getDatabaseSession().getEClass((short)(-cid));
            if (referenceClass == null) {
              throw new BimserverDatabaseException("String_Node_Str" + (-cid));
            }
            idEObject.setListItem(feature,i,readWrappedValue(feature,buffer,referenceClass));
          }
 else           if (cid > 0) {
            EClass referenceClass=queryObjectProvider.getDatabaseSession().getEClass(cid);
            if (referenceClass == null) {
              throw new BimserverDatabaseException("String_Node_Str" + cid);
            }
            buffer.position(buffer.position() - 2);
            long rf=readReference(buffer,feature,referenceClass);
            idEObject.setListItemReference(feature,i,referenceClass,rf,-1);
            if (rf != -1) {
              if (queryObjectProvider.hasReadOrIsGoingToRead((rf)) || queryObjectProvider.hasReadOrIsGoingToRead(referenceClass)) {
                idEObject.addUseForSerialization(feature,i);
              }
            }
          }
        }
      }
    }
  }
 else   if (feature.getEType() instanceof EDataType) {
    int listSize=buffer.getInt();
    for (int i=0; i < listSize; i++) {
      Object reference=readPrimitiveValue(feature.getEType(),buffer);
      if (reference != null) {
        idEObject.setListItem(feature,i,reference);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private Object readList(HashMapVirtualObject idEObject,ByteBuffer buffer,EStructuralFeature feature) throws BimserverDatabaseException {
  if (feature.getEType() instanceof EEnum) {
  }
 else   if (feature.getEType() instanceof EClass) {
    if (buffer.capacity() == 1 && buffer.get(0) == -1) {
      buffer.position(buffer.position() + 1);
    }
 else {
      if (buffer.position() + 4 > buffer.capacity()) {
        System.out.println();
      }
      int listSize=buffer.getInt();
      for (int i=0; i < listSize; i++) {
        if (feature.getEAnnotation("String_Node_Str") != null) {
          HashMapVirtualObject newObject=new HashMapVirtualObject(reusable,(EClass)feature.getEType());
          Object result=readList(newObject,buffer,newObject.eClass().getEStructuralFeature("String_Node_Str"));
          if (result != null) {
            newObject.setAttribute(newObject.eClass().getEStructuralFeature("String_Node_Str"),result);
          }
          idEObject.setListItem(feature,i,newObject);
        }
 else {
          buffer.order(ByteOrder.LITTLE_ENDIAN);
          short cid=buffer.getShort();
          buffer.order(ByteOrder.BIG_ENDIAN);
          if (cid == -1) {
          }
 else           if (cid < 0) {
            EClass referenceClass=queryObjectProvider.getDatabaseSession().getEClass((short)(-cid));
            if (referenceClass == null) {
              throw new BimserverDatabaseException("String_Node_Str" + (-cid));
            }
            idEObject.setListItem(feature,i,readWrappedValue(feature,buffer,referenceClass));
          }
 else           if (cid > 0) {
            EClass referenceClass=queryObjectProvider.getDatabaseSession().getEClass(cid);
            if (referenceClass == null) {
              throw new BimserverDatabaseException("String_Node_Str" + cid);
            }
            buffer.position(buffer.position() - 2);
            long rf=readReference(buffer,feature,referenceClass);
            idEObject.setListItemReference(feature,i,referenceClass,rf,-1);
            if (rf != -1) {
              if (queryObjectProvider.hasReadOrIsGoingToRead((rf)) || queryObjectProvider.hasReadOrIsGoingToRead(referenceClass)) {
                idEObject.addUseForSerialization(feature,i);
              }
            }
          }
        }
      }
    }
  }
 else   if (feature.getEType() instanceof EDataType) {
    int listSize=buffer.getInt();
    for (int i=0; i < listSize; i++) {
      Object reference=readPrimitiveValue(feature.getEType(),buffer);
      if (reference != null) {
        idEObject.setListItem(feature,i,reference);
      }
    }
  }
  return null;
}