source code - how to fix bugs?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

source code - how to fix bugs?

Istvan Nagy-2
Hi

what URL can I download the source code from? I would like to fix a minor but fatal problem.

It seems that there is a bug with the org.orbeon.oxf.externalcontext.ForwardHttpServletRequestWrapper.getParameter() method.

The behavior of the method should be as follow:
"[..]If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.[..]"
(quoted: j2ee apidoc ServletRequest.getParameter())

The implemenetation, however, is not suitable to handle a multivalued parameter (on the basis of source of the class decompiled by jad):
 public String getParameter(String s)
    {
        return (String)parameters.get(s);
    }

This implementation results in a casting exception if one used the method with an array. Using the getParameterValues() would help one to avoid the exception but the implementation above is not correct, however.

Thanks
Istvan



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: source code - how to fix bugs?

Erik Bruchez
Administrator
Istvan,

You get the source code from CVS:

   http://forge.objectweb.org/scm/?group_id=168

You are right that this is a bug. I think this should fix it:

public String getParameter(String s) {
     final String[] parameterValues = getParameterValues(s);
     if (parameterValues == null || parameterValues.length == 0)
         return null;
     else
         return parameterValues[0];
}

Right? Let me know, and I will commit that code.

-Erik

[hidden email] wrote:

> Hi
>
> what URL can I download the source code from? I would like to fix a minor but fatal problem.
>
> It seems that there is a bug with the org.orbeon.oxf.externalcontext.ForwardHttpServletRequestWrapper.getParameter() method.
>
> The behavior of the method should be as follow:
> "[..]If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.[..]"
> (quoted: j2ee apidoc ServletRequest.getParameter())
>
> The implemenetation, however, is not suitable to handle a multivalued parameter (on the basis of source of the class decompiled by jad):
>  public String getParameter(String s)
>     {
>         return (String)parameters.get(s);
>     }
>
> This implementation results in a casting exception if one used the method with an array. Using the getParameterValues() would help one to avoid the exception but the implementation above is not correct, however.
>
> Thanks
> Istvan
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: source code - how to fix bugs?

Istvan Nagy-2
Erik,
 
it looks like what i am looking for.
 
thank you for the quick response and resolution.
 
regards
Istvan
 
2006/7/12, Erik Bruchez <[hidden email]>:
Istvan,

You get the source code from CVS:

   http://forge.objectweb.org/scm/?group_id=168

You are right that this is a bug. I think this should fix it:

public String getParameter(String s) {
    final String[] parameterValues = getParameterValues(s);
    if (parameterValues == null || parameterValues.length == 0)
        return null;
    else
        return parameterValues[0];
}

Right? Let me know, and I will commit that code.

-Erik

[hidden email] wrote:

> Hi
>
> what URL can I download the source code from? I would like to fix a minor but fatal problem.
>
> It seems that there is a bug with the org.orbeon.oxf.externalcontext.ForwardHttpServletRequestWrapper.getParameter() method.
>
> The behavior of the method should be as follow:
> "[..]If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.[..]"
> (quoted: j2ee apidoc ServletRequest.getParameter())
>
> The implemenetation, however, is not suitable to handle a multivalued parameter (on the basis of source of the class decompiled by jad):
>  public String getParameter(String s)
>     {
>         return (String)parameters.get(s);
>     }
>
> This implementation results in a casting exception if one used the method with an array. Using the getParameterValues() would help one to avoid the exception but the implementation above is not correct, however.
>
> Thanks
> Istvan

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto: [hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: source code - how to fix bugs?

Erik Bruchez
Administrator
Istvan,

You're welcome, this was an easy one ;-) This is now committed. Please
give it a try from CVS or with an unstable build:

   http://forge.objectweb.org/nightlybuilds/ops/ops/

-Erik

Istvan Nagy wrote:
> Erik,
>  
> it looks like what i am looking for.
>  
> thank you for the quick response and resolution.
>  
> regards
> Istvan

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws