systemProperties and NPE
------------------------

         Key: MSUREFIRE-80
         URL: http://jira.codehaus.org/browse/MSUREFIRE-80
     Project: Maven 2.x Surefire Plugin
        Type: Bug

    Reporter: Jason Dillon
    Priority: Blocker


I've got in my pom:

{code}
<properties>
        <jdbc.schema></jdbc.schema>
</properties>
{code}

And then configured the surefire plugin to set a system property:

{code}
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemProperties>
                        
<dbunit.connection.schema>${jdbc.schema}</dbunit.connection.schema>
                    </systemProperties>
                </configuration>
            </plugin>
{code}

Which ends up resulting in:

{noformat}
[DEBUG]   (f) systemProperties = {dbunit.connection.schema=null}
...
[DEBUG] Trace
java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:393)
        at java.util.Properties.setProperty(Properties.java:102)
        at java.lang.System.setProperty(System.java:656)
        at 
org.apache.maven.test.SurefirePlugin.processSystemProperties(SurefirePlugin.java:408)
        at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:335)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:485)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:455)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
        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:324)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)          
{noformat}

If I put any value into the property, like

{code}
<properties>
        <jdbc.schema>foo</jdbc.schema>
</properties>
{code}

Then it works as expected, no NPE and the property gets set.

But I need to set the property to an empty string... why on earth does this get 
turned into a null?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to