[ 
https://jira.codehaus.org/browse/SUREFIRE-649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=356117#comment-356117
 ] 

Tibor Digana commented on SUREFIRE-649:
---------------------------------------

As far as I remember the Spring you can call a method of A bean in B bean.
<bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location"><value>database.properties</value></property>
</bean>
<bean id="conv" class="your.company.Converter">

<bean id="dataSource" ...
<property name="password" value="#{conv.treatEmptyAsNull(${jdbc.password})}" />
</bean>

The fix in surefire was done in the same way with environment variables and 
system properties, so that java.lang.System#getenv(String) and 
#getProperty(String) return null only for unspecified properties.
The other issue of Maven itself is that null or not existing POM properties are 
always interpreted as empty string, so yet there's no way to distinguish 
between null and empty string.

> Might be impossible to have empty strings in systemPropertyVariables element
> ----------------------------------------------------------------------------
>
>                 Key: SUREFIRE-649
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-649
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.6
>            Reporter: Laird Nelson
>            Assignee: Tibor Digana
>            Priority: Minor
>             Fix For: 2.18
>
>         Attachments: surefireEmptyStringIssue.tar.gz
>
>
> This stanza:
> <systemProperties>
>   <property>
>     <name>emptyProperty</name>
>     <value></value>
>   </property>
> </systemProperties>
> ...yields "" from System.getProperty("emptyProperty").
> This (supposedly better) stanza:
> <systemPropertyVariables>
>   <emptyProperty></emptyProperty>
> </systemPropertyVariables>
> ...yields null from System.getProperty("emptyProperty").
> A test case is attached that demonstrates the issue.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to