Program: 160556
Project: 160556
Buggy source:
@SuppressWarnings("String_Node_Str") private IdEObject convertByteArrayToObject(IdEObject idEObject,EClass originalQueryClass,EClass eClass,long oid,ByteBuffer buffer,IfcModelInterface model,int rid,QueryInterface query,TodoList todoList) throws BimserverDatabaseException {
  try {
    if (idEObject == null) {
      idEObject=createInternal(eClass,query);
      ((IdEObjectImpl)idEObject).setOid(oid);
      ((IdEObjectImpl)idEObject).setPid(query.getPid());
      if (rid == Integer.MAX_VALUE) {
        throw new BimserverDatabaseException("String_Node_Str" + Integer.MAX_VALUE);
      }
    }
    ((IdEObjectImpl)idEObject).setRid(rid);
    if (DEVELOPER_DEBUG && StorePackage.eINSTANCE == idEObject.eClass().getEPackage()) {
      LOGGER.info("String_Node_Str" + idEObject.eClass().getName() + "String_Node_Str"+ query.getPid()+ "String_Node_Str"+ oid+ "String_Node_Str"+ rid);
    }
    ((IdEObjectImpl)idEObject).setLoadingState(State.LOADING);
    objectCache.put(new RecordIdentifier(query.getPid(),oid,rid),idEObject);
    byte unsettedLength=buffer.get();
    byte[] unsetted=new byte[unsettedLength];
    buffer.get(unsetted);
    int fieldCounter=0;
    for (    EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
      if (feature.isUnsettable() && (unsetted[fieldCounter / 8] & (1 << (fieldCounter % 8))) != 0) {
        idEObject.eUnset(feature);
      }
 else {
        if (!query.shouldFollowReference(originalQueryClass,eClass,feature)) {
          fakeRead(buffer,feature);
        }
 else {
          Object newValue=null;
          if (feature.isMany()) {
            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();
                AbstractEList<Object> list=(AbstractEList<Object>)idEObject.eGet(feature);
                for (int i=0; i < listSize; i++) {
                  IdEObject referencedObject=null;
                  short cid=buffer.getShort();
                  if (cid == -1) {
                  }
 else                   if (cid < 0) {
                    EClass referenceClass=database.getEClassForCid((short)(-cid));
                    referencedObject=readWrappedValue(feature,buffer,referenceClass,query);
                  }
 else                   if (cid > 0) {
                    EClass referenceClass=database.getEClassForCid(cid);
                    referencedObject=readReference(originalQueryClass,buffer,model,idEObject,feature,referenceClass,query,todoList);
                  }
                  if (referencedObject != null) {
                    if (!feature.getEType().isInstance(referencedObject)) {
                      throw new BimserverDatabaseException(referencedObject.getClass().getSimpleName() + "String_Node_Str" + feature.getName());
                    }
                    if (feature.isUnique()) {
                      list.add(referencedObject);
                    }
 else {
                      list.addUnique(referencedObject);
                    }
                  }
                }
              }
            }
 else             if (feature.getEType() instanceof EDataType) {
              int listSize=buffer.getInt();
              BasicEList<Object> list=new BasicEList<Object>(listSize);
              for (int i=0; i < listSize; i++) {
                Object reference=readPrimitiveValue(feature.getEType(),buffer);
                if (reference != null) {
                  list.addUnique(reference);
                }
              }
              newValue=list;
            }
          }
 else {
            if (feature.getEType() instanceof EEnum) {
              int enumOrdinal=buffer.getInt();
              EClassifier eType=feature.getEType();
              EEnumLiteral enumLiteral=((EEnumImpl)eType).getEEnumLiteral(enumOrdinal);
              if (enumLiteral != null) {
                newValue=enumLiteral.getInstance();
              }
 else {
                LOGGER.error(enumOrdinal + "String_Node_Str");
              }
            }
 else             if (feature.getEType() instanceof EClass) {
              short cid=buffer.getShort();
              if (cid == -1) {
              }
 else               if (cid < 0) {
                EClass referenceClass=database.getEClassForCid((short)(-cid));
                newValue=readWrappedValue(feature,buffer,referenceClass,query);
              }
 else               if (cid > 0) {
                EClass referenceClass=database.getEClassForCid(cid);
                newValue=readReference(originalQueryClass,buffer,model,idEObject,feature,referenceClass,query,todoList);
              }
            }
 else             if (feature.getEType() instanceof EDataType) {
              newValue=readPrimitiveValue(feature.getEType(),buffer);
            }
          }
          if (newValue != null) {
            if (newValue instanceof IdEObject) {
              State oldState=((IdEObjectImpl)newValue).getLoadingState();
              if (oldState == State.TO_BE_LOADED && ((EReference)feature).getEOpposite() != null) {
                ((IdEObjectImpl)newValue).setLoadingState(State.OPPOSITE_SETTING);
                idEObject.eSet(feature,newValue);
                ((IdEObjectImpl)newValue).setLoadingState(oldState);
              }
 else {
                idEObject.eSet(feature,newValue);
              }
            }
 else {
              idEObject.eSet(feature,newValue);
            }
          }
        }
      }
      fieldCounter++;
    }
    ((IdEObjectImpl)idEObject).setLoaded();
    if (idEObject.getRid() > 100000 || idEObject.getRid() < -100000) {
      throw new RuntimeException("String_Node_Str" + idEObject.getRid() + "String_Node_Str"+ idEObject);
    }
    return idEObject;
  }
 catch (  BufferUnderflowException e) {
    throw new BimserverDatabaseException("String_Node_Str" + idEObject.eClass().getName(),e);
  }
catch (  BufferOverflowException e) {
    throw new BimserverDatabaseException("String_Node_Str" + idEObject.eClass().getName(),e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private IdEObject convertByteArrayToObject(IdEObject idEObject,EClass originalQueryClass,EClass eClass,long oid,ByteBuffer buffer,IfcModelInterface model,int rid,QueryInterface query,TodoList todoList) throws BimserverDatabaseException {
  try {
    if (idEObject == null) {
      idEObject=createInternal(eClass,query);
      ((IdEObjectImpl)idEObject).setOid(oid);
      ((IdEObjectImpl)idEObject).setPid(query.getPid());
      if (rid == Integer.MAX_VALUE) {
        throw new BimserverDatabaseException("String_Node_Str" + Integer.MAX_VALUE);
      }
    }
    ((IdEObjectImpl)idEObject).setRid(rid);
    if (DEVELOPER_DEBUG && StorePackage.eINSTANCE == idEObject.eClass().getEPackage()) {
      LOGGER.info("String_Node_Str" + idEObject.eClass().getName() + "String_Node_Str"+ query.getPid()+ "String_Node_Str"+ oid+ "String_Node_Str"+ rid);
    }
    ((IdEObjectImpl)idEObject).setLoadingState(State.LOADING);
    objectCache.put(new RecordIdentifier(query.getPid(),oid,rid),idEObject);
    byte unsettedLength=buffer.get();
    byte[] unsetted=new byte[unsettedLength];
    buffer.get(unsetted);
    int fieldCounter=0;
    for (    EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
      if (feature.isUnsettable() && (unsetted[fieldCounter / 8] & (1 << (fieldCounter % 8))) != 0) {
        idEObject.eUnset(feature);
      }
 else {
        if (!query.shouldFollowReference(originalQueryClass,eClass,feature)) {
          fakeRead(buffer,feature);
        }
 else {
          Object newValue=null;
          if (feature.isMany()) {
            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();
                AbstractEList<Object> list=(AbstractEList<Object>)idEObject.eGet(feature);
                for (int i=0; i < listSize; i++) {
                  IdEObject referencedObject=null;
                  short cid=buffer.getShort();
                  if (cid == -1) {
                  }
 else                   if (cid < 0) {
                    EClass referenceClass=database.getEClassForCid((short)(-cid));
                    referencedObject=readWrappedValue(feature,buffer,referenceClass,query);
                  }
 else                   if (cid > 0) {
                    EClass referenceClass=database.getEClassForCid(cid);
                    referencedObject=readReference(originalQueryClass,buffer,model,idEObject,feature,referenceClass,query,todoList);
                  }
                  if (referencedObject != null) {
                    if (!feature.getEType().isInstance(referencedObject)) {
                      throw new BimserverDatabaseException(referencedObject.getClass().getSimpleName() + "String_Node_Str" + feature.getName());
                    }
                    if (feature.isUnique()) {
                      list.add(referencedObject);
                    }
 else {
                      list.addUnique(referencedObject);
                    }
                  }
                }
              }
            }
 else             if (feature.getEType() instanceof EDataType) {
              int listSize=buffer.getInt();
              BasicEList<Object> list=new BasicEList<Object>(listSize);
              for (int i=0; i < listSize; i++) {
                Object reference=readPrimitiveValue(feature.getEType(),buffer);
                if (reference != null) {
                  list.addUnique(reference);
                }
              }
              newValue=list;
            }
          }
 else {
            if (feature.getEType() instanceof EEnum) {
              int enumOrdinal=buffer.getInt();
              EClassifier eType=feature.getEType();
              EEnumLiteral enumLiteral=((EEnumImpl)eType).getEEnumLiteral(enumOrdinal);
              if (enumLiteral != null) {
                newValue=enumLiteral.getInstance();
              }
 else {
                LOGGER.error(enumOrdinal + "String_Node_Str");
              }
            }
 else             if (feature.getEType() instanceof EClass) {
              short cid=buffer.getShort();
              if (cid == -1) {
              }
 else               if (cid < 0) {
                EClass referenceClass=database.getEClassForCid((short)(-cid));
                newValue=readWrappedValue(feature,buffer,referenceClass,query);
              }
 else               if (cid > 0) {
                EClass referenceClass=database.getEClassForCid(cid);
                newValue=readReference(originalQueryClass,buffer,model,idEObject,feature,referenceClass,query,todoList);
              }
            }
 else             if (feature.getEType() instanceof EDataType) {
              newValue=readPrimitiveValue(feature.getEType(),buffer);
            }
          }
          if (newValue != null) {
            if (newValue instanceof IdEObject) {
              State oldState=((IdEObjectImpl)newValue).getLoadingState();
              if (oldState == State.TO_BE_LOADED && ((EReference)feature).getEOpposite() != null) {
                ((IdEObjectImpl)newValue).setLoadingState(State.OPPOSITE_SETTING);
                idEObject.eSet(feature,newValue);
                ((IdEObjectImpl)newValue).setLoadingState(oldState);
              }
 else {
                idEObject.eSet(feature,newValue);
              }
            }
 else {
              idEObject.eSet(feature,newValue);
            }
          }
        }
      }
      fieldCounter++;
    }
    ((IdEObjectImpl)idEObject).setLoaded();
    if (idEObject.getRid() > 100000 || idEObject.getRid() < -100000) {
      throw new RuntimeException("String_Node_Str" + idEObject.getRid() + "String_Node_Str"+ idEObject);
    }
    return idEObject;
  }
 catch (  BufferUnderflowException e) {
    throw new BimserverDatabaseException("String_Node_Str" + eClass.getName(),e);
  }
catch (  BufferOverflowException e) {
    throw new BimserverDatabaseException("String_Node_Str" + eClass.getName(),e);
  }
}