Denis Simonov created CXF-5524:
----------------------------------

             Summary: 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.8, 3.0.0-milestone1, 2.7.2
            Reporter: Denis Simonov
            Priority: Blocker
             Fix For: 3.0.0-milestone2, 2.7.9


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}




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

Reply via email to