Program: 160505
Project: 160505
Buggy source:
private void processDefine(JsonObject query,JsonObject define,IfcModelInterface model,QueryInterface queryInterface,List<IdEObject> objects) throws BimserverDatabaseException, IfcModelInterfaceException {
  for (  IdEObject object : objects) {
    if (define.has("String_Node_Str")) {
      String fieldName=define.get("String_Node_Str").getAsString();
      EStructuralFeature eStructuralFeature=object.eClass().getEStructuralFeature(fieldName);
      if (eStructuralFeature == null) {
        return;
      }
      Object value=object.eGet(eStructuralFeature);
      if (eStructuralFeature.isMany()) {
        if (eStructuralFeature instanceof EReference) {
          List<?> list=((List<?>)value);
          for (          Object o : list) {
            if (!model.contains(((IdEObject)o).getOid())) {
              model.add(((IdEObject)o).getOid(),((IdEObject)o));
            }
            ((IdEObject)o).load();
            if (define.has("String_Node_Str")) {
              if (define.get("String_Node_Str").isJsonObject()) {
                processDefine(query,define.get("String_Node_Str").getAsJsonObject(),model,queryInterface,Collections.singletonList((IdEObject)o));
              }
 else               if (define.get("String_Node_Str").isJsonArray()) {
                processInclude(query,define,model,queryInterface,Collections.singletonList(((IdEObject)o)));
              }
 else {
                processSingleInclude(query,define.get("String_Node_Str"),model,queryInterface,Collections.singletonList(((IdEObject)o)));
              }
            }
          }
        }
      }
 else {
        if (value != null && value instanceof IdEObject) {
          if (!model.contains(((IdEObject)value).getOid())) {
            model.add(((IdEObject)value).getOid(),((IdEObject)value));
          }
          ((IdEObject)value).load();
          if (define.has("String_Node_Str")) {
            processDefine(query,define,model,queryInterface,Collections.singletonList((IdEObject)value));
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void processDefine(JsonObject query,JsonObject define,IfcModelInterface model,QueryInterface queryInterface,List<IdEObject> objects) throws BimserverDatabaseException, IfcModelInterfaceException {
  for (  IdEObject object : objects) {
    if (define.has("String_Node_Str")) {
      String fieldName=define.get("String_Node_Str").getAsString();
      EStructuralFeature eStructuralFeature=object.eClass().getEStructuralFeature(fieldName);
      if (eStructuralFeature == null) {
        return;
      }
      Object value=object.eGet(eStructuralFeature);
      if (eStructuralFeature.isMany()) {
        if (eStructuralFeature instanceof EReference) {
          List<?> list=((List<?>)value);
          for (          Object o : list) {
            if (o instanceof IfcClassificationReference) {
              System.out.println();
            }
            if (!model.contains(((IdEObject)o).getOid())) {
              model.add(((IdEObject)o).getOid(),((IdEObject)o));
            }
            ((IdEObject)o).load();
            if (define.has("String_Node_Str")) {
              if (define.get("String_Node_Str").isJsonObject()) {
                processDefine(query,define.get("String_Node_Str").getAsJsonObject(),model,queryInterface,Collections.singletonList((IdEObject)o));
              }
 else               if (define.get("String_Node_Str").isJsonArray()) {
                processInclude(query,define,model,queryInterface,Collections.singletonList(((IdEObject)o)));
              }
 else {
                processSingleInclude(query,define.get("String_Node_Str"),model,queryInterface,Collections.singletonList(((IdEObject)o)));
              }
            }
          }
        }
      }
 else {
        if (value != null && value instanceof IdEObject) {
          if (!model.contains(((IdEObject)value).getOid())) {
            model.add(((IdEObject)value).getOid(),((IdEObject)value));
          }
          ((IdEObject)value).load();
          if (define.has("String_Node_Str")) {
            processDefine(query,define,model,queryInterface,Collections.singletonList((IdEObject)value));
          }
        }
      }
    }
  }
}