{"action":"closed","issue":{"url":"https://api.github.com/repos/dropwizard/dropwizard/issues/763","labels_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/763/labels{/name}","comments_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/763/comments","events_url":"https://api.github.com/repos/dropwizard/dropwizard/issues/763/events","html_url":"https://github.com/dropwizard/dropwizard/issues/763","id":47130264,"number":763,"title":"Recursive sub-resource locators gives StackOverflowError","user":{"login":"olvesh","id":220643,"avatar_url":"https://avatars.githubusercontent.com/u/220643?v=3","gravatar_id":"","url":"https://api.github.com/users/olvesh","html_url":"https://github.com/olvesh","followers_url":"https://api.github.com/users/olvesh/followers","following_url":"https://api.github.com/users/olvesh/following{/other_user}","gists_url":"https://api.github.com/users/olvesh/gists{/gist_id}","starred_url":"https://api.github.com/users/olvesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olvesh/subscriptions","organizations_url":"https://api.github.com/users/olvesh/orgs","repos_url":"https://api.github.com/users/olvesh/repos","events_url":"https://api.github.com/users/olvesh/events{/privacy}","received_events_url":"https://api.github.com/users/olvesh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-10-29T10:13:16Z","updated_at":"2015-04-16T18:55:43Z","closed_at":"2015-04-16T18:55:43Z","body":"When setting up a recursive sub-resource locator in DW 0.7 it crashes with a stack overflow error.\r\n\r\nThis is perfectly legal in Jersey and should be ok in DW 0.7. I found this while migrating a DW 0.6 service, and thus it worked earlier.\r\n\r\nThe problem comes when the startup tries to log the endpoints. In DW 0.6 the subr esource locators was not logged, I guess for just this reason.\r\n\r\nI have a naive fix, but I found no good ways to unit test it (yet). The fix is skipping all endpoints that contain a return value identical with the class that contains it - but not considering inheritance and so on. I'll create a pull request, and hopefully this can go into a maintenance of DW 0.7 as well?\r\n\r\n```java\r\npackage com.example.helloworld.resources;\r\n\r\nimport javax.ws.rs.GET;\r\nimport javax.ws.rs.Path;\r\nimport javax.ws.rs.PathParam;\r\n\r\n@Path(\"/\")\r\npublic class TestResource {\r\n    @GET\r\n    public String foo() {\r\n        return \"bar\";\r\n    }\r\n\r\n    @Path(\"/sub\")\r\n    public  SubResource subFooLocator() {\r\n        return new SubResource();\r\n    }\r\n\r\n    public static class SubResource {\r\n        @GET\r\n        public String subfoo() {\r\n            return \"subbar\";\r\n        }\r\n\r\n\r\n        @Path(\"{subPath}\")\r\n        public SubResource subfoo(@PathParam(\"subPath\") String subPath) {\r\n            return new SubResource();\r\n        }\r\n\r\n    }\r\n}\r\n```\r\n\r\n```\r\nINFO  [2014-10-29 10:03:16,868] com.sun.jersey.server.impl.application.WebApplicationImpl: Initiating Jersey application, version 'Jersey: 1.18.1 02/19/2014 03:28 AM'\r\nException in thread \"main\" java.lang.StackOverflowError\r\n\tat java.security.AccessController.doPrivileged(Native Method)\r\n\tat com.sun.jersey.core.reflection.AnnotatedMethod.findAnnotatedMethod(AnnotatedMethod.java:238)\r\n\tat com.sun.jersey.core.reflection.AnnotatedMethod.findAnnotatedMethod(AnnotatedMethod.java:230)\r\n\tat com.sun.jersey.core.reflection.AnnotatedMethod.<init>(AnnotatedMethod.java:113)\r\n\tat com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:84)\r\n\tat com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:64)\r\n\tat com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:60)\r\n\tat com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:118)\r\n\tat io.dropwizard.jersey.DropwizardResourceConfig.populateEndpoints(DropwizardResourceConfig.java:170)\r\n\tat io.dropwizard.jersey.DropwizardResourceConfig.populateEndpoints(DropwizardResourceConfig.java:190)\r\n\tat io.dropwizard.jersey.DropwizardResourceConfig.populateEndpoints(DropwizardResourceConfig.java:170)\r\n\tat io.dropwizard.jersey.DropwizardResourceConfig.populateEndpoints(DropwizardResourceConfig.java:190)\r\n```"}}