[
https://issues.apache.org/jira/browse/GERONIMO-6692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16760721#comment-16760721
]
James Meen commented on GERONIMO-6692:
--------------------------------------
I've tested locally and still finding an exception.
I believe it's because in the test case, you specifically and unconditionally
call
{code:java}
final Components components = new ComponentsImpl();
{code}
before mapSchemaFromClass.
But in the case I'm seeing, the components parameter is null.
If I set your test case with a null components parameters, then it fails with a
NPE.
In AnnotationProcessor.java, it looks like api.setComponents is only ever being
set if there is a SecurityScheme annotation.
e.g...
{code:java}
Stream.of(annotatedType.getAnnotationsByType(SecurityScheme.class))
.forEach(s -> {
if (api.getComponents() == null) {
api.setComponents(new ComponentsImpl());
}
api.getComponents().addSecurityScheme(s.securitySchemeName(),
mapSecurityScheme(s));
});
{code}
Thanks
> OpenAPI SchemaProcessor causes a StackOverflowException when processing
> schema for a class field that reference's it's own class
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: GERONIMO-6692
> URL: https://issues.apache.org/jira/browse/GERONIMO-6692
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Affects Versions: OpenAPI_1.0.5
> Reporter: James Meen
> Assignee: Romain Manni-Bucau
> Priority: Major
> Fix For: OpenAPI_1.0.6
>
>
> A webapp being scanned by SchemaProcessor class of the Geronimo OpenAPI
> extension has a field that references the class it is a part of, for
> example...
> {code:java}
> public class aClass
> {
> ...
> public List<aClass> getAList() { ... }
> ...
> }
> {code}
> There is no check in OpenAPI SchemaProcessor for this and it eventually
> causes a StackOverflowException.
> I doubt this issue is limited to List and will probably also happen if the
> field type is singular of the same parent class.
> The front-end exception the user sees is completely unrelated to the real
> exception. This causes a great amount of debugging time stepping through to
> determine the root cause for a relatively large application.
> Propose to somehow either support this when mapping to an OpenAPI model.
> Also, failing the possibility of a solution as above, this case should be
> detected by the schema processor and handled accordingly either skipping the
> field and/or raising a suitable warning/exception in a way that the user
> knows what/why it is failing or excluded (ultimately to save the user having
> to debug through the schema processing). A stackoverflow should not happen.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)