cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30250] New: - SessionPropagatorAction defaults cause exception
Date Thu, 22 Jul 2004 02:47:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30250>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30250

SessionPropagatorAction defaults cause exception

           Summary: SessionPropagatorAction defaults cause exception
           Product: Cocoon 2
           Version: 2.1.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: sitemap components
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: smangano@ureach.com


The SessionPropagatorAction allows you to provide defaults when you congigure 
it in sitemap like so:

<map:action name="session-propagator" logger="sitemap.action.session"
     src="org.apache.cocoon.acting.SessionPropagatorAction">
       <my-default1>0</my-default1>
       <my-default2>default</my-default2>
</map:action>

However, if you look at the code for SessionPropagatorAction it makes no sense 
because it will result in an exception being thrown if a default specified like 
above is NOT in the parameters and will result in simply taking the value from 
the parameters if it is! 

For example, give, the above:

          <map:act type="session-propagator">
            <map:parameter name="my-default1" value="2"/>
		<!-- ... -->
          </map:act>

Will throw an exception like:

http8080-Processor2/SessionPropagatorAction: exception: 
org.apache.avalon.framework.parameters.ParameterException: The parameter 'my-
default2' does not contain a value

SEE: PropagatorAction for the right way to handle defaults, I belive.

The offending code is:
        // defaults, that are not overridden
            for (int i = 0; i < defaults.length; i++) {
                if (!actionMap.containsKey(defaults[i])) {
                    String sessionParamName = (String) defaults[i];
                    
//This is bogus /////////////////////////////////////////////////////////////
                    String value = parameters.getParameter(sessionParamName);
////////////////////////////////////////////////////////////////////////////
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("Propagating value "
                                          + value
                                          + " to session attribute "
                                          + sessionParamName);
                    }  
                    session.setAttribute(sessionParamName, value);
                    actionMap.put(sessionParamName, value);
                }
            }

Mime
View raw message