Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3033

Stack Overflow in getBeanDefinition()'s of SpringBeanLocator and AnnotProxyFieldValueFactory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.10
    • 1.4.12, 1.5-M2.1
    • wicket-spring
    • None

    Description

      The getBeanDefinition() in org.apache.wicket.spring.SpringBeanLocator and org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory will result in a Stack Overflow if a parent-context exists.

      Offending code

      private BeanDefinition getBeanDefinition(ConfigurableListableBeanFactory beanFactory,
      			String name)
      {
      	[....]
      
      	BeanFactory parent = beanFactory.getParentBeanFactory();
      	if (parent != null && parent instanceof ConfigurableListableBeanFactory)
      	{
      		return getBeanDefinition(beanFactory, name);
      	}
      
      	[....]
      }
      

      As you can see it always calls the getBeanDefinition() with the same arguments resulting in a stack overflow. That specific return statement should call the getBeanDefinition of the parent and therefore should be:

      	return getBeanDefinition((ConfigurableListableBeanFactory) parent, name);
      

      I'll include a quick start to reproduce the error for the AnnotProxyFieldValueFactory and a patch to solve it for both.

      Attachments

        1. WICKET3033_getBeanDefinition.patch
          1 kB
          Maarten van Grootel
        2. getBeanBug.tar.gz
          5 kB
          Maarten van Grootel

        Activity

          People

            ivaynberg Igor Vaynberg
            mvgrootel Maarten van Grootel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: