Program: 160370
Project: 160370
Buggy source:
protected HashMapVirtualObject convertByteArrayToObject(EClass eClass,long oid,ByteBuffer buffer,int rid) throws BimserverDatabaseException {
  try {
    HashMapVirtualObject idEObject=new HashMapVirtualObject(reusable,eClass);
    idEObject.setOid(oid);
    int unsettedLength=getPackageMetaData().getUnsettedLength(eClass);
    byte[] unsetted=new byte[unsettedLength];
    buffer.get(unsetted);
    int fieldCounter=0;
    for (    EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
      try {
        if (getPackageMetaData().useForDatabaseStorage(eClass,feature)) {
          boolean isUnsetted=(unsetted[fieldCounter / 8] & (1 << (fieldCounter % 8))) != 0;
          if (isUnsetted) {
            if (feature.isUnsettable()) {
              idEObject.eUnset(feature);
            }
 else             if (feature.isMany()) {
            }
 else             if (feature.getDefaultValue() != null) {
              idEObject.setAttribute(feature,feature.getDefaultValue());
            }
          }
 else {
            Object newValue=null;
            if (feature.isMany()) {
              newValue=readList(idEObject,buffer,feature);
            }
 else {
              if (feature.getEType() instanceof EEnum) {
                int enumOrdinal=buffer.getInt();
                if (enumOrdinal == -1) {
                  newValue=null;
                }
 else {
                  EClassifier eType=feature.getEType();
                  EEnumLiteral enumLiteral=((EEnumImpl)eType).getEEnumLiteral(enumOrdinal);
                  if (enumLiteral != null) {
                    newValue=enumLiteral.getInstance();
                  }
                }
              }
 else               if (feature.getEType() instanceof EClass) {
                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 (feature.getEAnnotation("String_Node_Str") != null) {
                    newValue=readEmbeddedValue(feature,buffer,referenceClass);
                  }
 else {
                    newValue=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);
                  newValue=readReference(buffer,feature,referenceClass);
                  if ((Long)newValue != -1) {
                    if (queryObjectProvider.hasReadOrIsGoingToRead(((Long)newValue)) || queryObjectProvider.hasReadOrIsGoingToRead(referenceClass)) {
                      idEObject.addUseForSerialization(feature);
                    }
                  }
                }
              }
 else               if (feature.getEType() instanceof EDataType) {
                newValue=readPrimitiveValue(feature.getEType(),buffer);
              }
              if (newValue != null) {
                idEObject.setAttribute(feature,newValue);
              }
            }
          }
          fieldCounter++;
        }
      }
 catch (      StringIndexOutOfBoundsException e) {
        throw new BimserverDatabaseException("String_Node_Str" + eClass.getName() + "String_Node_Str"+ feature.getName(),e);
      }
catch (      BufferUnderflowException e) {
        throw new BimserverDatabaseException("String_Node_Str" + eClass.getName() + "String_Node_Str"+ feature.getName(),e);
      }
catch (      BufferOverflowException e) {
        throw new BimserverDatabaseException("String_Node_Str" + eClass.getName() + "String_Node_Str"+ feature.getName(),e);
      }
    }
    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);
  }
}

Fixed version (ground truth):
protected HashMapVirtualObject convertByteArrayToObject(EClass eClass,long oid,ByteBuffer buffer,int rid) throws BimserverDatabaseException {
  try {
    HashMapVirtualObject idEObject=new HashMapVirtualObject(reusable,eClass);
    idEObject.setOid(oid);
    int unsettedLength=getPackageMetaData().getUnsettedLength(eClass);
    byte[] unsetted=new byte[unsettedLength];
    buffer.get(unsetted);
    int fieldCounter=0;
    if (eClass.getName().equals("String_Node_Str") && buffer.capacity() == 27) {
      System.out.println();
    }
    for (    EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
      try {
        if (getPackageMetaData().useForDatabaseStorage(eClass,feature)) {
          boolean isUnsetted=(unsetted[fieldCounter / 8] & (1 << (fieldCounter % 8))) != 0;
          if (isUnsetted) {
            if (feature.isUnsettable()) {
              idEObject.eUnset(feature);
            }
 else             if (feature.isMany()) {
            }
 else             if (feature.getDefaultValue() != null) {
              idEObject.setAttribute(feature,feature.getDefaultValue());
            }
          }
 else {
            Object newValue=null;
            if (feature.isMany()) {
              newValue=readList(idEObject,buffer,feature);
            }
 else {
              if (feature.getEType() instanceof EEnum) {
                int enumOrdinal=buffer.getInt();
                if (enumOrdinal == -1) {
                  newValue=null;
                }
 else {
                  EClassifier eType=feature.getEType();
                  EEnumLiteral enumLiteral=((EEnumImpl)eType).getEEnumLiteral(enumOrdinal);
                  if (enumLiteral != null) {
                    newValue=enumLiteral.getInstance();
                  }
                }
              }
 else               if (feature.getEType() instanceof EClass) {
                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 (feature.getEAnnotation("String_Node_Str") != null) {
                    newValue=readEmbeddedValue(feature,buffer,referenceClass);
                  }
 else {
                    newValue=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);
                  newValue=readReference(buffer,feature,referenceClass);
                  if ((Long)newValue != -1) {
                    if (queryObjectProvider.hasReadOrIsGoingToRead(((Long)newValue)) || queryObjectProvider.hasReadOrIsGoingToRead(referenceClass)) {
                      idEObject.addUseForSerialization(feature);
                    }
                  }
                }
              }
 else               if (feature.getEType() instanceof EDataType) {
                newValue=readPrimitiveValue(feature.getEType(),buffer);
              }
              if (newValue != null) {
                idEObject.setAttribute(feature,newValue);
              }
            }
          }
          fieldCounter++;
        }
      }
 catch (      StringIndexOutOfBoundsException e) {
        throw new BimserverDatabaseException("String_Node_Str" + eClass.getName() + "String_Node_Str"+ feature.getName(),e);
      }
catch (      BufferUnderflowException e) {
        throw new BimserverDatabaseException("String_Node_Str" + eClass.getName() + "String_Node_Str"+ feature.getName()+ "String_Node_Str"+ buffer.capacity(),e);
      }
catch (      BufferOverflowException e) {
        throw new BimserverDatabaseException("String_Node_Str" + eClass.getName() + "String_Node_Str"+ feature.getName(),e);
      }
    }
    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);
  }
}