cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Inefficiencies in DefaultConfiguration
Date Tue, 09 Apr 2002 17:45:44 GMT
Please look here (AbstractConfiguration)

    public String getValue( final String defaultValue )
    {
        try
        {
            return getValue();
        }
        catch( final ConfigurationException ce )
        {
            return defaultValue;
        }
    }

then look here

    public String getValue() throws ConfigurationException
    {
        if( null != m_value )
        {
            return m_value;
        }
        else
        {
            throw new ConfigurationException( "No value is associated
with the "+
                                              "configuration element \""
+ getName() +
                                              "\" at " + getLocation()
);
        }
    }

Can somebody tell me why we have to:

 1) create three strings
 2) call two methods
 3) create an exception object
 4) throw the exception
 5) and then throw everything away.

in order to resort to the default value?

I understand that getValue() doesn't return null, but this seems utterly
inefficient to me.

Considering that Cocoon calls this method "a lot" no wonder why Cocoon
startup is slow as hell.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message