You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Greg Katz (JIRA)" <ji...@apache.org> on 2010/07/27 00:10:18 UTC

[jira] Commented: (CXF-2908) Using a Java enum type in a JAX-RS matrix parameter results in a StackOverflowError when generating the WADL

    [ https://issues.apache.org/jira/browse/CXF-2908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892501#action_12892501 ] 

Greg Katz commented on CXF-2908:
--------------------------------

Thanks for the prompt fix!

Does CXF version 2.2.10 have a release date?

Thanks,
Greg

> Using a Java enum type in a JAX-RS matrix parameter results in a StackOverflowError when generating the WADL
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2908
>                 URL: https://issues.apache.org/jira/browse/CXF-2908
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.9
>         Environment: Windows XP, Tomcat 6.0.20, JDK 1.6.0_19
>            Reporter: Greg Katz
>            Assignee: Sergey Beryozkin
>             Fix For: 2.3, 2.2.10
>
>
> *Repro steps:*
> 1. Create a JAX-RS endpoint method that uses an object with an enum-typed property as a matrix parameter.
> 2. Hit the WADL URI for the endpoint's path (or "above" the endpoint's path). Something like {{http://host:port/rest?_wadl}}, in other words.
> *Result:*
> The {{org.apache.cxf.jaxrs.model.wadl.WadlGenerator}} throws a {{StackOverflowError}}.
> {noformat}
> ERROR 2010-07-23 09:45:09.417 http-8080-1>  Servlet.service() for servlet CXFServlet threw exception
> java.lang.StackOverflowError
>         at java.lang.Class.privateGetPublicMethods(Class.java:2536)
>         at java.lang.Class.getMethods(Class.java:1410)
>         at org.apache.cxf.jaxrs.utils.InjectionUtils.getParametersFromBeanClass(InjectionUtils.java:853)
>         at org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:447)
>         at org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:456)
>         at org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:456)
>         at org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:456)
>         at org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:456)
>         ...
> {noformat}
> *Example code:*
> {code:java}
> @Path("/whatever")
> @Produces("application/json")
> public interface WhateverEndpoint {
>     
>     @GET
>     @Path("/")
>     public Whatever[] getWhatevers(@MatrixParam("")WhateverSearchCriteria criteria);
> }
> @XmlRootElement
> public class WhateverSearchCriteria {
>     private EnumType enumValue;
>     public EnumType getEnumValue() {
>         return enumValue;
>     }
> }
> @XmlRootElement
> public enum EnumType {
>     Value1,
>     Value2;
> }
> {code}
> *Observations:*
> When I commented out the enum-typed property, the {{StackOverflowError}} went away. 
> I stepped through the {{WadlGenerator}} in the debugger and noticed something about {{getParametersFromBeanClass}} that might be the source of the problem. {{getParametersFromBeanClass}} gets all of the no-arg methods that begin with {{get}} and then discards "getClass". However, it doesn't discard the {{Enum}} class's {{getDeclaringClass}} method. This method returns an object of type {{java.lang.Class}}. In the debugger, I saw that all of the remaining {{doWriteBeanParam}} stack frames after the one whose {{type}} argument was the enum type had a {{type}} argument of {{java.lang.Class}}.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.