Author: drobiazko
Date: Wed Apr 21 20:44:30 2010
New Revision: 936499
URL: http://svn.apache.org/viewvc?rev=936499&view=rev
Log:
TAP5-1077: SymbolBeanFactoryPostProcessor ignores unresolvable placeholders
Modified:
tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SymbolBeanFactoryPostProcessor.java
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestrySpringIntegrationTest.java
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/services/SymbolValueHolder.java
tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml
tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/WEB-INF/applicationContext.xml
Modified:
tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SymbolBeanFactoryPostProcessor.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SymbolBeanFactoryPostProcessor.java?rev=936499&r1=936498&r2=936499&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SymbolBeanFactoryPostProcessor.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SymbolBeanFactoryPostProcessor.java
Wed Apr 21 20:44:30 2010
@@ -27,16 +27,20 @@ public class SymbolBeanFactoryPostProces
{
super();
this.symbolSource = symbolSource;
+ setIgnoreUnresolvablePlaceholders(true);
}
@Override
protected String resolvePlaceholder(String placeholder, Properties props)
{
- String value = symbolSource.valueForSymbol(placeholder);
-
- if(value != null ) return value;
-
- return super.resolvePlaceholder(placeholder, props);
+ try
+ {
+ return symbolSource.valueForSymbol(placeholder);
+ }
+ catch(RuntimeException e)
+ {
+ return super.resolvePlaceholder(placeholder, props);
+ }
}
}
Modified:
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestrySpringIntegrationTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestrySpringIntegrationTest.java?rev=936499&r1=936498&r2=936499&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestrySpringIntegrationTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestrySpringIntegrationTest.java
Wed Apr 21 20:44:30 2010
@@ -74,6 +74,6 @@ public class TapestrySpringIntegrationTe
{
open(BASE_URL);
- assertEquals(getText("symbolValueHolder"), "Start page is 'start'");
+ assertEquals(getText("symbolValueHolder"), "Start page is 'start',
Value from Spring is 'Hello'");
}
}
Modified:
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/services/SymbolValueHolder.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/services/SymbolValueHolder.java?rev=936499&r1=936498&r2=936499&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/services/SymbolValueHolder.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/services/SymbolValueHolder.java
Wed Apr 21 20:44:30 2010
@@ -16,6 +16,8 @@ package org.example.testapp.services;
public class SymbolValueHolder
{
private String value;
+
+ private String anotherValue;
public String getValue()
{
@@ -26,4 +28,14 @@ public class SymbolValueHolder
{
this.value = value;
}
+
+ public String getAnotherValue()
+ {
+ return anotherValue;
+ }
+
+ public void setAnotherValue(String anotherValue)
+ {
+ this.anotherValue = anotherValue;
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml?rev=936499&r1=936498&r2=936499&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml
(original)
+++ tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml Wed Apr
21 20:44:30 2010
@@ -22,7 +22,7 @@
<dt>Via factory:</dt>
<dd id="viaFactory">${viaFactory.message}</dd>
<dt>Symbol Value Holder:</dt>
- <dd id="symbolValueHolder">Start page is
'${symbolValueHolder.value}'</dd>
+ <dd id="symbolValueHolder">Start page is
'${symbolValueHolder.value}', Value from Spring is 'Hello'</dd>
</dl>
</body>
Modified:
tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/WEB-INF/applicationContext.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/WEB-INF/applicationContext.xml?rev=936499&r1=936498&r2=936499&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/WEB-INF/applicationContext.xml
(original)
+++
tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/WEB-INF/applicationContext.xml
Wed Apr 21 20:44:30 2010
@@ -18,9 +18,10 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config/>
@@ -32,8 +33,16 @@
<bean id="viaFactory"
class="org.example.testapp.services.ViaFactoryFactory"/>
+ <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="properties">
+ <value>value.from.spring=Hello</value>
+ </property>
+ </bean>
+
<bean id="symbolValueHolder"
class="org.example.testapp.services.SymbolValueHolder">
<property name="value" value="${tapestry.start-page-name}"/>
+ <property name="anotherValue" value="${value.from.spring}"/>
</bean>
+
</beans>