You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid endless Class Parameter Argument scanning, if the parameter Object contains a circular reference (e.g. bi directional relation within a bean)
#177
Open
Syntobe opened this issue
Aug 30, 2021
· 0 comments
If a bean contains a circular reference, the DefaultModelDependencyProvider will never end with a scan of the parameter, due to endless looping over the entity.
i can submit a feature / bug fix for that if i get the rights. the additions for DefaultModelDependencyProvider are very easy.
you can simply avoid endless scans by adding a check, if the complex type has been processed within the current context:
// TODO: one should mark not only base types, but rather complex types as well, since you will benefit from the recursion break with back referenced objects.
if (isComplexType(ModelContext.fromParent(modelContext, resolvedType))) {
if(modelContext.hasSeenBefore(resolvedType)){
return new HashSet<>();
}
LOG.debug("Marking complex type {} as seen", resolvedType.getSignature());
modelContext.seen(resolvedType);
}
since i am not very familiar with all the rest that is involved, i could imagine this fix may break certain things. thus, it would be nice if you could have a quick look at it.
The text was updated successfully, but these errors were encountered:
If a bean contains a circular reference, the DefaultModelDependencyProvider will never end with a scan of the parameter, due to endless looping over the entity.
i can submit a feature / bug fix for that if i get the rights. the additions for DefaultModelDependencyProvider are very easy.
once you track complex types as well,
private boolean isComplexType(ModelContext modelContext) {
return !isBaseType(modelContext);
}
you can simply avoid endless scans by adding a check, if the complex type has been processed within the current context:
// TODO: one should mark not only base types, but rather complex types as well, since you will benefit from the recursion break with back referenced objects.
if (isComplexType(ModelContext.fromParent(modelContext, resolvedType))) {
if(modelContext.hasSeenBefore(resolvedType)){
return new HashSet<>();
}
LOG.debug("Marking complex type {} as seen", resolvedType.getSignature());
modelContext.seen(resolvedType);
}
since i am not very familiar with all the rest that is involved, i could imagine this fix may break certain things. thus, it would be nice if you could have a quick look at it.
The text was updated successfully, but these errors were encountered: