Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-3280

2.0.3 Regression PropertyPlaceholderConfigurer and <null/> = NPE

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.0.3
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      I'm using a PropertyPlaceholderConfigurer and I'm using <null/> in some of my bean definitions. After upgrading to 2.0.3 I get the following exception for a configuration using the PropertyPlaceholderConfigurer I don't get this error with 2.0.2 If I don't pass in a <null/> property everything works fine:

      SomeBean.java
      public class SomeBean {

      public void setSomeProperty(Object obj) {

      }
      }

      applicationContext.xml
      <bean class="SomeBean">
      <property name="testProperty"><null/></property>
      </bean>

      <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" lazy-init="false">
      <property name="locations">
      <list>
      <value>classpath:property.properties</value>
      </list>
      <property/>
      </bean>

      Exception

      java.lang.NullPointerException
      at java.lang.StringBuffer.<init>(StringBuffer.java:104)
      at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.parseStringValue(PropertyPlaceholderConfigurer.java:270)
      at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingBeanDefinitionVisitor.resolveStringValue(PropertyPlaceholderConfigurer.java:401)
      at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:143)
      at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:89)
      at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:59)
      at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:246)
      at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:422)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1185)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1147)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1110)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:431)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:221)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:111)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1047)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:843)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:254)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:251)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:683)
      at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:394)
      at org.lds.stack.spring.context.WebContextSingletonBeanFactoryLocator.useBeanFactory(WebContextSingletonBeanFactoryLocator.java:38)
      at org.lds.stack.spring.context.BootstrapContextLoader.createWebApplicationContext(BootstrapContextLoader.java:30)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:448)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

        Issue Links

          Activity

          Hide
          youngm Mike Youngstrom added a comment -

          Forgot to set the status. I think this is Critical.

          Show
          youngm Mike Youngstrom added a comment - Forgot to set the status. I think this is Critical.
          Hide
          youngm Mike Youngstrom added a comment -

          Oh shoot...forgot to check fixed bugs before I reported this one. . It's a dup SPR-3249

          Show
          youngm Mike Youngstrom added a comment - Oh shoot...forgot to check fixed bugs before I reported this one. . It's a dup SPR-3249
          Hide
          juergen.hoeller Juergen Hoeller added a comment -

          Indeed, that was an unfortunate regression that slipped into 2.0.3. We simply had no test for <null/> in combination with a PropertyPlaceholderConfigurer, and changed <null/> handling for better integration with Spring IDE... missing the check in PropertyPlaceholderConfigurer.

          Anyway, this has been fixed in 2.0.4 snapshots for about a week already. Please use a recent 2.0.4 snapshot and let us know whether it generally works for you The 2.0.4 release will happen on March 30th now, so is only 9 days away!

          Juergen

          Show
          juergen.hoeller Juergen Hoeller added a comment - Indeed, that was an unfortunate regression that slipped into 2.0.3. We simply had no test for <null/> in combination with a PropertyPlaceholderConfigurer, and changed <null/> handling for better integration with Spring IDE... missing the check in PropertyPlaceholderConfigurer. Anyway, this has been fixed in 2.0.4 snapshots for about a week already. Please use a recent 2.0.4 snapshot and let us know whether it generally works for you The 2.0.4 release will happen on March 30th now, so is only 9 days away! Juergen

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              youngm Mike Youngstrom
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                10 years, 50 weeks, 4 days ago