You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Roman Hrivik <hr...@isdd.sk> on 2003/11/27 15:31:50 UTC

RequestParameterModule

This can be reported as bug, I think.

When I try to access for parameter from request in sitemap and in
request is not such parameter I'll get null-exception.

I think that RequestParameterModule should return always not null value.


The method getAttribute from RequestParameterModule shoul be like this.




   public Object getAttribute( 
		String name,
		Configuration modeConf, 
		Map objectModel )
		 throws ConfigurationException {

        String pname = (String) this.settings.get("parameter", name);

        if ( modeConf != null ) {
            pname = modeConf.getChild("parameter").getValue(pname);
        }

        String value =
ObjectModelHelper.getRequest(objectModel).getParameter( pname );

        if (value == null) {
			return "";
		} 
	  else {
            	return value;
		} 

    }








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


RE: RequestParameterModule

Posted by Roman Hrivik <hr...@isdd.sk>.
I think that some of web containers implement the
request.getPatameter("myparam");
to return an empty string if parameter is not in request.

I tested it on Oracle OC4J and it returns null.
I think that this is not good.
Imagine you have a pipeline and you want to pass
A request parameter to transformation.
But this parameter is optional and not required.

When I do request-param:myparam
and there is no such parameter in querystring - than I've got an
NullPointerException

I did my own request-param input module which solve this
and it will return an empty string.

Roman



-----Původní zpráva-----
Od: Christian Haul [mailto:haul@informatik.tu-darmstadt.de] 
Odesláno: 27. novembra 2003 20:20
Komu: users@cocoon.apache.org
Předmět: Re: RequestParameterModule

Roman Hrivik wrote:
> This can be reported as bug, I think.
> 
> When I try to access for parameter from request in sitemap and in
> request is not such parameter I'll get null-exception.
> 
> I think that RequestParameterModule should return always not null
value.

Nope since "" is different from null eg on database updates. If there is
a null pointer exception inside the sitemap engine, this is an error
since it should expect null values from an input module and replace it
with "". Could you provide a test case for this that shows the error?
(A short test of mine didn't reveal any problems.)

	Chris.


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




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


Re: RequestParameterModule

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
Roman Hrivik wrote:
> This can be reported as bug, I think.
> 
> When I try to access for parameter from request in sitemap and in
> request is not such parameter I'll get null-exception.
> 
> I think that RequestParameterModule should return always not null value.

Nope since "" is different from null eg on database updates. If there is
a null pointer exception inside the sitemap engine, this is an error
since it should expect null values from an input module and replace it
with "". Could you provide a test case for this that shows the error?
(A short test of mine didn't reveal any problems.)

	Chris.


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