You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "James Meen (JIRA)" <ji...@apache.org> on 2019/02/05 00:49:00 UTC

[jira] [Commented] (GERONIMO-6692) OpenAPI SchemaProcessor causes a StackOverflowException when processing schema for a class field that reference's it's own class

    [ https://issues.apache.org/jira/browse/GERONIMO-6692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16760358#comment-16760358 ] 

James Meen commented on GERONIMO-6692:
--------------------------------------

Hi Romain, it took me a ages staring at it, testing, trying to reproduce the same issue but with your new cyclic test case... eventually I reproduced it.

I will now add a PR showing you the specific test case that still causes the stack overflow.

The two things that I found important factors to produce it...
 # "private SomeClass child;" must appear after "private List<SomeRelatedClass> children;" in SomeClass.
 # Use of a RelatedClass is important.

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)