cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Simonov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-5524) JAXBContextInitializer addType stopped handling recursive types (StackOverflow)
Date Mon, 27 Jan 2014 14:12:39 GMT

     [ https://issues.apache.org/jira/browse/CXF-5524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Denis Simonov updated CXF-5524:
-------------------------------

    Attachment: JAXBContextInitializer.java

Attached JAXBContextInitializer.java with proposed fix.

> JAXBContextInitializer addType stopped handling recursive types (StackOverflow) 
> --------------------------------------------------------------------------------
>
>                 Key: CXF-5524
>                 URL: https://issues.apache.org/jira/browse/CXF-5524
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.7.2, 3.0.0-milestone1, 2.7.8
>            Reporter: Denis Simonov
>            Priority: Blocker
>             Fix For: 3.0.0-milestone2, 2.7.9
>
>         Attachments: JAXBContextInitializer.java
>
>
> As I cannot reopen issue CXF-4711, created this one. If it is possible -delete this one
and reopen CXF-4711.
> Reproduced this bug in latest version of CXF 2.7.8 and 3.0.0-milestone1(as well as in
fix version for CXF-4711 - 2.7.2). Same situation described there appears in following case:
> {code:title=CxfRecursiveTypeTest.java|borderStyle=solid}
> public class CxfRecursiveTypeTest {
>     @Test
>     public void testRecursiveType() throws Exception {
>         Set<Class<?>> classes = new HashSet<Class<?>>();
>         Collection<Object> typeReferences = new ArrayList<Object>();
>         JAXBContextInitializer jaxbContextInitializer = new JAXBContextInitializer(null,
classes, typeReferences);
>         Method addClassMethod = JAXBContextInitializer.class.getDeclaredMethod("addClass",
Class.class);
>         addClassMethod.setAccessible(true);
>         addClassMethod.invoke(jaxbContextInitializer, Validation.class);
>         System.out.println(classes);
>     }
>     public static class ObjectGraphProcessorItem<T extends ObjectGraphProcessorItem<T>>
{
>         protected T parentItem;
>         protected List<T> childItems = new ArrayList<T>();
>         public ObjectGraphProcessorItem(Object object) {
>             super();
>         }
>         public List<T> getChildItems() {
>             return childItems;
>         }
>         public void setChildItems(List<T> childItems) {
>             this.childItems = childItems;
>         }
>         public T getParentItem() {
>             return parentItem;
>         }
>         public void setParentItem(T parentItem) {
>             this.parentItem = parentItem;
>         }
>     }
>     public static class Validation extends ObjectGraphProcessorItem<Validation>
implements Serializable {
>         public Validation() {
>             super(null);
>         }
>         public Validation(Object object) {
>             super(object);
>         }
>     }
> }
> {code}
> {code:title=Stacktrace|borderStyle=solid}
> Caused by: java.lang.StackOverflowError
> 	at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_45]
> 	at org.apache.cxf.common.util.ReflectionUtil.getDeclaredConstructor(ReflectionUtil.java:83)
[cxf-api-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.common.jaxb.JAXBUtils.getValidClass(JAXBUtils.java:516) [cxf-api-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:280)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:223)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:226)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:263)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:229)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> 	at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:213)
[cxf-rt-databinding-jaxb-2.7.8.jar:2.7.8]
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message