You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Grant Smith <wo...@gmail.com> on 2006/02/18 01:50:21 UTC

Bug in selectOneMenu when disabled

**Wow. So it turns out that Myfaces suffers from a particularly nasty bug
which was also present in the Sun 1.1 RI.
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=87

So anyone who is disabling a dropdown, beware of this! Your backing bean
will become null for that property on submit.
Now, the question is will fixing this have any effect on the TCK results ?
I'm in favor of fixing it, and will do it if I get some consensus.

--
Grant Smith

Re: Bug in selectOneMenu when disabled

Posted by Martin Marinschek <ma...@gmail.com>.
Ok,

I digged a little deeper - Grant, are you talking about disabled or
readonly selectOneMenu's?

I found a bug in RendererUtils, where readonly was checked for with
readOnly instead of readonly ;)

regards,

Martin

On 2/19/06, Martin Marinschek <ma...@gmail.com> wrote:
> Ok, this is the corresponding code. Wonder why that doesn't work. Very strange.
>
>     public static void decodeUISelectOne(FacesContext facesContext,
>                                          UIComponent component) {
>         if (!(component instanceof EditableValueHolder)) {
>             throw new IllegalArgumentException("Component "
>                     + component.getClientId(facesContext)
>                     + " is not an EditableValueHolder");
>         }
>
>         if(isDisabledOrReadOnly(component))
>             return;
>
>         Map paramMap = facesContext.getExternalContext()
>                 .getRequestParameterMap();
>         String clientId = component.getClientId(facesContext);
>         if (paramMap.containsKey(clientId)) {
>             //request parameter found, set submitted value
>             ((EditableValueHolder) component).setSubmittedValue(paramMap
>                     .get(clientId));
>         } else {
>             //see reason for this action at decodeUISelectMany
>             ((EditableValueHolder) component).setSubmittedValue(
> RendererUtils.NOTHING );
>         }
>     }
>
> maybe there is an error later on?
>
> regards,
>
> Martin
>
> On 2/18/06, Grant Smith <wo...@gmail.com> wrote:
> > I haven't delved into the code yet, but the behaviour is definitely
> > exhibiting itself in an application Im working on. Perhaps someone can do an
> > independent analysis to confirm. I have some really ugly workarounds in my
> > backing bean now that try to dodge the null that I'm really keen to get rid
> > of.
> >
> >
> > On 2/18/06, Sean Schofield <se...@gmail.com> wrote:
> > > I'm ok with fixing it.  If it breaks the TCK then we could ask Sun to
> > > patch the TCK.  I believe they did this for us during the initial TCK
> > > testing.
> > >
> > > Sean
> > >
> > > On 2/18/06, Martin Marinschek < martin.marinschek@gmail.com> wrote:
> > > > Why is that?
> > > >
> > > > I thought that we checked if disabled or readonly was set to true, and
> > > > then stop decoding?
> > > >
> > > > regards,
> > > >
> > > > Martin
> > > >
> > > > On 2/18/06, Grant Smith <wo...@gmail.com> wrote:
> > > > > Wow. So it turns out that Myfaces suffers from a particularly nasty
> > bug
> > > > > which was also present in the Sun 1.1 RI.
> > > > >
> > https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=87
> > > > >
> > > > >  So anyone who is disabling a dropdown, beware of this! Your backing
> > bean
> > > > > will become null for that property on submit.
> > > > >  Now, the question is will fixing this have any effect on the TCK
> > results ?
> > > > > I'm in favor of fixing it, and will do it if I get some consensus.
> > > > >
> > > > > --
> > > > > Grant Smith
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > http://www.irian.at
> > > >
> > > > Your JSF powerhouse -
> > > > JSF Consulting, Development and
> > > > Courses in English and German
> > > >
> > > > Professional Support for Apache MyFaces
> > > >
> > >
> >
> >
> >
> > --
> > Grant Smith
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Bug in selectOneMenu when disabled

Posted by Martin Marinschek <ma...@gmail.com>.
Ok, this is the corresponding code. Wonder why that doesn't work. Very strange.

    public static void decodeUISelectOne(FacesContext facesContext,
                                         UIComponent component) {
        if (!(component instanceof EditableValueHolder)) {
            throw new IllegalArgumentException("Component "
                    + component.getClientId(facesContext)
                    + " is not an EditableValueHolder");
        }

        if(isDisabledOrReadOnly(component))
            return;

        Map paramMap = facesContext.getExternalContext()
                .getRequestParameterMap();
        String clientId = component.getClientId(facesContext);
        if (paramMap.containsKey(clientId)) {
            //request parameter found, set submitted value
            ((EditableValueHolder) component).setSubmittedValue(paramMap
                    .get(clientId));
        } else {
            //see reason for this action at decodeUISelectMany
            ((EditableValueHolder) component).setSubmittedValue(
RendererUtils.NOTHING );
        }
    }

maybe there is an error later on?

regards,

Martin

On 2/18/06, Grant Smith <wo...@gmail.com> wrote:
> I haven't delved into the code yet, but the behaviour is definitely
> exhibiting itself in an application Im working on. Perhaps someone can do an
> independent analysis to confirm. I have some really ugly workarounds in my
> backing bean now that try to dodge the null that I'm really keen to get rid
> of.
>
>
> On 2/18/06, Sean Schofield <se...@gmail.com> wrote:
> > I'm ok with fixing it.  If it breaks the TCK then we could ask Sun to
> > patch the TCK.  I believe they did this for us during the initial TCK
> > testing.
> >
> > Sean
> >
> > On 2/18/06, Martin Marinschek < martin.marinschek@gmail.com> wrote:
> > > Why is that?
> > >
> > > I thought that we checked if disabled or readonly was set to true, and
> > > then stop decoding?
> > >
> > > regards,
> > >
> > > Martin
> > >
> > > On 2/18/06, Grant Smith <wo...@gmail.com> wrote:
> > > > Wow. So it turns out that Myfaces suffers from a particularly nasty
> bug
> > > > which was also present in the Sun 1.1 RI.
> > > >
> https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=87
> > > >
> > > >  So anyone who is disabling a dropdown, beware of this! Your backing
> bean
> > > > will become null for that property on submit.
> > > >  Now, the question is will fixing this have any effect on the TCK
> results ?
> > > > I'm in favor of fixing it, and will do it if I get some consensus.
> > > >
> > > > --
> > > > Grant Smith
> > > >
> > >
> > >
> > > --
> > >
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> >
>
>
>
> --
> Grant Smith
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Bug in selectOneMenu when disabled

Posted by Grant Smith <wo...@gmail.com>.
I haven't delved into the code yet, but the behaviour is definitely
exhibiting itself in an application Im working on. Perhaps someone can do an
independent analysis to confirm. I have some really ugly workarounds in my
backing bean now that try to dodge the null that I'm really keen to get rid
of.

On 2/18/06, Sean Schofield <se...@gmail.com> wrote:
>
> I'm ok with fixing it.  If it breaks the TCK then we could ask Sun to
> patch the TCK.  I believe they did this for us during the initial TCK
> testing.
>
> Sean
>
> On 2/18/06, Martin Marinschek <ma...@gmail.com> wrote:
> > Why is that?
> >
> > I thought that we checked if disabled or readonly was set to true, and
> > then stop decoding?
> >
> > regards,
> >
> > Martin
> >
> > On 2/18/06, Grant Smith <wo...@gmail.com> wrote:
> > > Wow. So it turns out that Myfaces suffers from a particularly nasty
> bug
> > > which was also present in the Sun 1.1 RI.
> > > https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=87
> > >
> > >  So anyone who is disabling a dropdown, beware of this! Your backing
> bean
> > > will become null for that property on submit.
> > >  Now, the question is will fixing this have any effect on the TCK
> results ?
> > > I'm in favor of fixing it, and will do it if I get some consensus.
> > >
> > > --
> > > Grant Smith
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>



--
Grant Smith

Re: Bug in selectOneMenu when disabled

Posted by Sean Schofield <se...@gmail.com>.
I'm ok with fixing it.  If it breaks the TCK then we could ask Sun to
patch the TCK.  I believe they did this for us during the initial TCK
testing.

Sean

On 2/18/06, Martin Marinschek <ma...@gmail.com> wrote:
> Why is that?
>
> I thought that we checked if disabled or readonly was set to true, and
> then stop decoding?
>
> regards,
>
> Martin
>
> On 2/18/06, Grant Smith <wo...@gmail.com> wrote:
> > Wow. So it turns out that Myfaces suffers from a particularly nasty bug
> > which was also present in the Sun 1.1 RI.
> > https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=87
> >
> >  So anyone who is disabling a dropdown, beware of this! Your backing bean
> > will become null for that property on submit.
> >  Now, the question is will fixing this have any effect on the TCK results ?
> > I'm in favor of fixing it, and will do it if I get some consensus.
> >
> > --
> > Grant Smith
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>

Re: Bug in selectOneMenu when disabled

Posted by Martin Marinschek <ma...@gmail.com>.
Why is that?

I thought that we checked if disabled or readonly was set to true, and
then stop decoding?

regards,

Martin

On 2/18/06, Grant Smith <wo...@gmail.com> wrote:
> Wow. So it turns out that Myfaces suffers from a particularly nasty bug
> which was also present in the Sun 1.1 RI.
> https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=87
>
>  So anyone who is disabling a dropdown, beware of this! Your backing bean
> will become null for that property on submit.
>  Now, the question is will fixing this have any effect on the TCK results ?
> I'm in favor of fixing it, and will do it if I get some consensus.
>
> --
> Grant Smith
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces