Bob:

So when I see code such as this, I question myself and ask "is this right?"  So, I sent the forum post.  I can't be crazy.  I thought the same so I just went back to another published module Hbm2ManagerMojo and find

    /**
     * Getter for property procesing properties.
     * 
     * @return The value of procesing properties.
     */
    public Properties getProcessingProperties()
    {
 
        Properties localProcessingProperties = this.getProcessingProperties();
        if ( localProcessingProperties == null )
        {
            localProcessingProperties = new Properties();
        }

This is not right.  Anyhow, thanks for the reply.  Somethings wrong with this checked in code.  I've already fixed it.

Thanks,

David

Bob Allison writes below:

If the code that is having stack overflow problems looks like this:

    public Properties getProcessingProperties()
    {
        // TODO - fix this 
        Properties localProcessingProperties = this.getProcessingProperties();
       ...
    }
 
then a stack overflow is obvious since the first thing the "getProcessingProperties" method does is call itself.
 
The other thing to question is how you have the configuration parameter called "processingParameters" defined as a variable in your mojo.  I am assuming, based on your POM fragment, that the parameter is a reference to a properties file.  In this case, the variable should be declared as a File object and you need to open the file and load the properties into a Properties object to access the properties stored in the file.
 
Hope that helps...


---------- Forwarded message ----------
From: David Whitehurst <[EMAIL PROTECTED]>
Date: Nov 9, 2006 8:37 PM
Subject: Pom plugin configuration
To: [email protected]

I'm having problems getting my configuration properties in via the pom as such  ...

        <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>appfuse-maven-plugin</artifactId>
              <configuration>
                 <modelPackageName>org.appfuse.model</modelPackageName>
                 <processingProperties>appfuse.properties</processingProperties>
              </configuration>
            </plugin>

Note: the modelPackageName has a @parameter default-value = "org.appfuse.model"  My processingProperties uses @parameter default-value=""

Even if I set that default to "appfuse.properties" the getProcessingProperties() method below will stackOverflow (log shows null) and trace over and over ...

The method below is commented because if I try to get the configured property file (mojo this.processingProperties) I get a stackOverflowException.  I can't figure it out.  Can anyone see anything wrong with this.

    public Properties getProcessingProperties()
    {

        // TODO - fix this
        //Properties localProcessingProperties = new Properties(); // = this.getProcessingProperties();
       
        Properties localProcessingProperties = null;//this.getProcessingProperties();
        if ( localProcessingProperties == null )
        {
            localProcessingProperties = new Properties();
        }
       
        if ( localProcessingProperties == null )
        {
            localProcessingProperties = new Properties();
        }

        if ( !localProcessingProperties.containsKey( "jsfwebtemplatename" ) )
        {
            localProcessingProperties.put( "templateName", this.getJsfWebTemplateName () );
        }

        if ( !localProcessingProperties.containsKey( "jsfwebpackagename" ) )
        {
            localProcessingProperties.put( "packageName", this.getJsfWebPackageName() );
        }
       
        if ( !localProcessingProperties.containsKey( "filePattern" ) )
        {
            localProcessingProperties.put( "filePattern", this.getFilePattern());
        }
       
        return localProcessingProperties;
    }
David

Reply via email to