You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dmitry Barsukov <db...@gmail.com> on 2010/06/21 17:36:45 UTC

[Trinidad] Coding error (a bug) in StampState.restoreChildStampState(StampState.java:201)

Hi All,

org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)

201:    Object[] state = (Object[]) stampState;

stampState is not an array when casted to an array. The rest of code works
with the array "state".

The line above is causing me the exception.

It seems that this line should be replaced by:

   Object state[] = new Object[1];
   if (stampState.getClass().isArray())
       state = (Object[]) stampState;
   else
       state[0] = stampState;

Please find the patch attached. Someone may have a better idea how to fix
the issue.

My apologies to Trinidad community for not being able to rectify the defect.
It just disappears for unknown reason on the way when I am trying to rectify
it.

Caused by: java.lang.ClassCastException: Class cannot be casted to array
        at
org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)
        at
org.apache.myfaces.trinidad.component.UIXTable.restoreStampState(UIXTable.java:426)
        at
org.apache.myfaces.trinidad.component.UIXCollection._restoreStampState(UIXCollection.java:1813)
        at
org.apache.myfaces.trinidad.component.UIXCollection.postRowDataChange(UIXCollection.java:809)
        at
org.apache.myfaces.trinidad.component.UIXCollection.setRowIndex(UIXCollection.java:505)
        at
org.apache.myfaces.trinidad.component.UIXTable._processStamps(UIXTable.java:517)
        at
org.apache.myfaces.trinidad.component.UIXTable.processFacetsAndChildren(UIXTable.java:374)
        at
org.apache.myfaces.trinidad.component.UIXCollection.decodeChildrenImpl(UIXCollection.java:202)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
        at
org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:196)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
        at
org.apache.myfaces.trinidad.component.UIXForm.processDecodes(UIXForm.java:75)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
        at
org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
        at
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:705)
        at javax.faces.component.UIViewRoot.access$001(UIViewRoot.java:62)
        at javax.faces.component.UIViewRoot$1.process(UIViewRoot.java:121)
        at javax.faces.component.UIViewRoot.process(UIViewRoot.java:260)
        at
javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:117)
        at
org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
        at
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
        at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:178)
        ... 22 more
---
Sincerely yours
Dmitry Barsukov

Re: [Trinidad] Coding error (a bug) in StampState.restoreChildStampState(StampState.java:201)

Posted by Dmitry Barsukov <db...@gmail.com>.
Max,

I've just removed the comment, that's it, easy.
Thanks anyway.

Regards,
Dmitry


On 23 June 2010 15:12, Max Starets <ma...@oracle.com> wrote:

> Dmitry,
>
> Thanks for researching the issue.
>
> The Facelets engine has a nasty 'feature' resulting in all comments being
> sent to the rendered
> HTML. I would try setting the following context parameter in web.xml:
>
> <context-param>
>   <param-name>facelets.SKIP_COMMENTS</param-name>
>   <param-value>true</param-value>
> </context-param>
>
> Note that the parameter name is "javax.faces.FACELETS_SKIP_COMMENTS" in JSF
> 2.0.
>
> I wonder if it's going to solve the problem...
> Calling resetStampState() should not  be necessary if you are replacing
> tables data set during the invoke_application
> phase (in an event listener, etc.)
>
>
> Regards,
> Max
>
>
>
> Dmitry Barsukov wrote:
>
>> Hi Max,
>>
>> I have spent quite a bit of a time trying to localise the root of the
>> problem...
>> The outcome is not very encouraging but interesting.
>>
>> This defect is quit nasty one. Fortunately it could be stripped down to 2
>> relatively simple forms and 2 backing beans:
>> 1/ Main web page (simplest) and its backing been - see below
>> "tblbug.view.xml" &  "TblBugBean.java"
>> 2/ The simplest dialogue page and its backing bean -
>> see below "tblbugdialog.view.xml" & "TblBugDialog.java"
>> 3/ faces-config.xml is omitted, there is nothing particularly fancy there.
>>
>> Bug reproduction scenario:
>> 1/ Open "tblbug.view.xml"
>> 2/ Click on "search" - this opens a dialogue.
>> 3/ Select "1" in the listbox
>> 3/ Click of "select" - dialogue should close itself and the result set
>> table
>> shows up.
>> 4/ Click on "search" again- this opens a dialogue again.
>> 5/ Select "2" in the listbox
>> 6/ Click on "select" - dialogue closes down and the exception is being
>> thrown.
>>
>> There are a few findings which could be important for defect resolution:
>>
>> 1. The defect appears only if there is a comment (<!-- blablabla -->)
>>  within <tr:table> tag. Without comment the bug does not show up.
>>
>> 2. Answering your question: I am replacing the underlying data set of the
>> table, but I do not change the data.
>>
>> 3. The defect seems to be somehow linked to Trinidad dialogue framework.
>> When dialogue functionality is removed the defect disappears.
>>
>> 4. Good thing is - the simplest workaround for the bug is to using binding
>> and call resetStampState() function on CoreTable before replacing
>> underling
>> data set.
>>
>> tblbug.view.xml (stripped down to bare minimum without <f:view>,
>> <trh:html>,
>> <trh:body>)
>> -------------------------
>>            <tr:form id="frm_main">
>>                <tr:commandButton id="it_search" text="search"
>>                                  immediate="true" partialSubmit="true"
>>                                  action="dialog:tblbugdialog"
>> useWindow="true"
>>
>>  returnListener="#{tblBugBacking.handleReturn}"/>
>>                <tr:table id="tbl_result"
>> value="#{tblBugBacking.resultset}"
>> var="row" partialTriggers=":it_search">
>>                    <!-- bla-bla-bla -->
>>                    <tr:column><tr:outputText value="#{row}"/></tr:column>
>>                </tr:table>
>>        </tr:form>
>>
>> TblBugBean.java (mapped to tblBugBacking)
>> -------------------------
>> public class TblBugBean {
>>    protected List resultset;
>>
>>    public List getResultset() {return resultset;}
>>
>>    public void handleReturn(ReturnEvent event) {
>>        String result = (String) event.getReturnValue();
>>
>>        if (result.equals("1")) {
>>            resultset = new ArrayList(6);
>>            for (int i=0;i<6;i++) resultset.add("FIRST: "+i+i+i+i+i);
>>            return;
>>        }
>>
>>        if (result.equals("2")) {
>>            resultset = new ArrayList(4);
>>            for (int i=0;i<4;i++) resultset.add("SECOND: "+i+i+i+i+i);
>>        }
>>   }
>>
>> }
>>
>> tblbugdialog.view.xml (mapped action: dialog:tblbugdialog, stripped down
>> to
>> bare minimum without <f:view>, <trh:html>, <trh:body>)
>> -------------------------
>>            <tr:form>
>>                <tr:selectOneListbox value="#{tblBugDialog.option}">
>>                    <f:selectItem itemLabel="1" itemValue="1"/>
>>                    <f:selectItem itemLabel="2" itemValue="2"/>
>>                </tr:selectOneListbox>
>>                <tr:commandButton id="cb_select" text="Select"
>> actionListener="#{tblBugDialog.done}"/>
>>            </tr:form>
>>
>>
>> TblBugDialog.java (mapped to tblBugDialog)
>> -------------------------
>> public class TblBugDialog {
>>    private String option;
>>
>>    public String getOption() {return option;}
>>    public void setOption(String option) {this.option = option;}
>>
>>    public void done(ActionEvent event){
>>        RequestContext.getCurrentInstance().returnFromDialog(option, null);
>>    }
>>
>> }
>>
>> ---
>> Sincerely yours
>> Dmitry Barsukov
>>
>>
>>
>
>


-- 
---
Sincerely yours
Dmitry Barsukov

Re: [Trinidad] Coding error (a bug) in StampState.restoreChildStampState(StampState.java:201)

Posted by Max Starets <ma...@oracle.com>.
Dmitry,

Thanks for researching the issue.

The Facelets engine has a nasty 'feature' resulting in all comments 
being sent to the rendered
HTML. I would try setting the following context parameter in web.xml:

<context-param>
    <param-name>facelets.SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>

Note that the parameter name is "javax.faces.FACELETS_SKIP_COMMENTS" in 
JSF 2.0.

I wonder if it's going to solve the problem...
Calling resetStampState() should not  be necessary if you are replacing 
tables data set during the invoke_application
phase (in an event listener, etc.)

Regards,
Max



Dmitry Barsukov wrote:
> Hi Max,
>
> I have spent quite a bit of a time trying to localise the root of the
> problem...
> The outcome is not very encouraging but interesting.
>
> This defect is quit nasty one. Fortunately it could be stripped down to 2
> relatively simple forms and 2 backing beans:
> 1/ Main web page (simplest) and its backing been - see below
> "tblbug.view.xml" &  "TblBugBean.java"
> 2/ The simplest dialogue page and its backing bean -
> see below "tblbugdialog.view.xml" & "TblBugDialog.java"
> 3/ faces-config.xml is omitted, there is nothing particularly fancy there.
>
> Bug reproduction scenario:
> 1/ Open "tblbug.view.xml"
> 2/ Click on "search" - this opens a dialogue.
> 3/ Select "1" in the listbox
> 3/ Click of "select" - dialogue should close itself and the result set table
> shows up.
> 4/ Click on "search" again- this opens a dialogue again.
> 5/ Select "2" in the listbox
> 6/ Click on "select" - dialogue closes down and the exception is being
> thrown.
>
> There are a few findings which could be important for defect resolution:
>
> 1. The defect appears only if there is a comment (<!-- blablabla -->)
>  within <tr:table> tag. Without comment the bug does not show up.
>
> 2. Answering your question: I am replacing the underlying data set of the
> table, but I do not change the data.
>
> 3. The defect seems to be somehow linked to Trinidad dialogue framework.
> When dialogue functionality is removed the defect disappears.
>
> 4. Good thing is - the simplest workaround for the bug is to using binding
> and call resetStampState() function on CoreTable before replacing underling
> data set.
>
> tblbug.view.xml (stripped down to bare minimum without <f:view>, <trh:html>,
> <trh:body>)
> -------------------------
>             <tr:form id="frm_main">
>                 <tr:commandButton id="it_search" text="search"
>                                   immediate="true" partialSubmit="true"
>                                   action="dialog:tblbugdialog"
> useWindow="true"
>
>  returnListener="#{tblBugBacking.handleReturn}"/>
>                 <tr:table id="tbl_result" value="#{tblBugBacking.resultset}"
> var="row" partialTriggers=":it_search">
>                     <!-- bla-bla-bla -->
>                     <tr:column><tr:outputText value="#{row}"/></tr:column>
>                 </tr:table>
>         </tr:form>
>
> TblBugBean.java (mapped to tblBugBacking)
> -------------------------
> public class TblBugBean {
>     protected List resultset;
>
>     public List getResultset() {return resultset;}
>
>     public void handleReturn(ReturnEvent event) {
>         String result = (String) event.getReturnValue();
>
>         if (result.equals("1")) {
>             resultset = new ArrayList(6);
>             for (int i=0;i<6;i++) resultset.add("FIRST: "+i+i+i+i+i);
>             return;
>         }
>
>         if (result.equals("2")) {
>             resultset = new ArrayList(4);
>             for (int i=0;i<4;i++) resultset.add("SECOND: "+i+i+i+i+i);
>         }
>    }
>
> }
>
> tblbugdialog.view.xml (mapped action: dialog:tblbugdialog, stripped down to
> bare minimum without <f:view>, <trh:html>, <trh:body>)
> -------------------------
>             <tr:form>
>                 <tr:selectOneListbox value="#{tblBugDialog.option}">
>                     <f:selectItem itemLabel="1" itemValue="1"/>
>                     <f:selectItem itemLabel="2" itemValue="2"/>
>                 </tr:selectOneListbox>
>                 <tr:commandButton id="cb_select" text="Select"
> actionListener="#{tblBugDialog.done}"/>
>             </tr:form>
>
>
> TblBugDialog.java (mapped to tblBugDialog)
> -------------------------
> public class TblBugDialog {
>     private String option;
>
>     public String getOption() {return option;}
>     public void setOption(String option) {this.option = option;}
>
>     public void done(ActionEvent event){
>         RequestContext.getCurrentInstance().returnFromDialog(option, null);
>     }
>
> }
>
> ---
> Sincerely yours
> Dmitry Barsukov
>
>   


Re: [Trinidad] Coding error (a bug) in StampState.restoreChildStampState(StampState.java:201)

Posted by Dmitry Barsukov <db...@gmail.com>.
Hi Max,

I have spent quite a bit of a time trying to localise the root of the
problem...
The outcome is not very encouraging but interesting.

This defect is quit nasty one. Fortunately it could be stripped down to 2
relatively simple forms and 2 backing beans:
1/ Main web page (simplest) and its backing been - see below
"tblbug.view.xml" &  "TblBugBean.java"
2/ The simplest dialogue page and its backing bean -
see below "tblbugdialog.view.xml" & "TblBugDialog.java"
3/ faces-config.xml is omitted, there is nothing particularly fancy there.

Bug reproduction scenario:
1/ Open "tblbug.view.xml"
2/ Click on "search" - this opens a dialogue.
3/ Select "1" in the listbox
3/ Click of "select" - dialogue should close itself and the result set table
shows up.
4/ Click on "search" again- this opens a dialogue again.
5/ Select "2" in the listbox
6/ Click on "select" - dialogue closes down and the exception is being
thrown.

There are a few findings which could be important for defect resolution:

1. The defect appears only if there is a comment (<!-- blablabla -->)
 within <tr:table> tag. Without comment the bug does not show up.

2. Answering your question: I am replacing the underlying data set of the
table, but I do not change the data.

3. The defect seems to be somehow linked to Trinidad dialogue framework.
When dialogue functionality is removed the defect disappears.

4. Good thing is - the simplest workaround for the bug is to using binding
and call resetStampState() function on CoreTable before replacing underling
data set.

tblbug.view.xml (stripped down to bare minimum without <f:view>, <trh:html>,
<trh:body>)
-------------------------
            <tr:form id="frm_main">
                <tr:commandButton id="it_search" text="search"
                                  immediate="true" partialSubmit="true"
                                  action="dialog:tblbugdialog"
useWindow="true"

 returnListener="#{tblBugBacking.handleReturn}"/>
                <tr:table id="tbl_result" value="#{tblBugBacking.resultset}"
var="row" partialTriggers=":it_search">
                    <!-- bla-bla-bla -->
                    <tr:column><tr:outputText value="#{row}"/></tr:column>
                </tr:table>
        </tr:form>

TblBugBean.java (mapped to tblBugBacking)
-------------------------
public class TblBugBean {
    protected List resultset;

    public List getResultset() {return resultset;}

    public void handleReturn(ReturnEvent event) {
        String result = (String) event.getReturnValue();

        if (result.equals("1")) {
            resultset = new ArrayList(6);
            for (int i=0;i<6;i++) resultset.add("FIRST: "+i+i+i+i+i);
            return;
        }

        if (result.equals("2")) {
            resultset = new ArrayList(4);
            for (int i=0;i<4;i++) resultset.add("SECOND: "+i+i+i+i+i);
        }
   }

}

tblbugdialog.view.xml (mapped action: dialog:tblbugdialog, stripped down to
bare minimum without <f:view>, <trh:html>, <trh:body>)
-------------------------
            <tr:form>
                <tr:selectOneListbox value="#{tblBugDialog.option}">
                    <f:selectItem itemLabel="1" itemValue="1"/>
                    <f:selectItem itemLabel="2" itemValue="2"/>
                </tr:selectOneListbox>
                <tr:commandButton id="cb_select" text="Select"
actionListener="#{tblBugDialog.done}"/>
            </tr:form>


TblBugDialog.java (mapped to tblBugDialog)
-------------------------
public class TblBugDialog {
    private String option;

    public String getOption() {return option;}
    public void setOption(String option) {this.option = option;}

    public void done(ActionEvent event){
        RequestContext.getCurrentInstance().returnFromDialog(option, null);
    }

}

---
Sincerely yours
Dmitry Barsukov

Re: [Trinidad] Coding error (a bug) in StampState.restoreChildStampState(StampState.java:201)

Posted by Max Starets <ma...@oracle.com>.
Dmitry,

It is not at all obvious to me that this is a simple coding error
because saveChildStampState() always returns null or Object[].

Regards,
Max

Dmitry Barsukov wrote:
> Max,
>
> I'm not sure if I modify anything within the table...
> The form we have here is kinda complicated and hard to rectify keeping
> the defect appearing.
> The exception is thrown when a few manual operations on the form are done,
> it's not just open web page and that's it.
>
> I agree with you that finding the root of a problem is required.
>
> But what you can easily observe is the simple coding error : an object which
> is not an array is being casted to an array type. This causes an exception.
> My patch fixes coding mistake only.
>
> Nevertheless, I will allocate some more of time onto rectification of the
> issue.
>
> Regards,
> Dmitry
>
>
>
> On 21 June 2010 18:08, Max Starets <ma...@oracle.com> wrote:
>
>   
>> Dmitry,
>>
>> We need to figure out what is going on first.
>> Are you modifying components within table dynamically?
>>
>> Since the same components are being stamped for each row, it is expected
>> that the component
>> set does not change when each row is decoded or rendered.
>>
>> Regards,
>> Max Starets
>>
>>
>> Dmitry Barsukov wrote:
>>
>>     
>>> Hi All,
>>>
>>>
>>> org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)
>>>
>>> 201:    Object[] state = (Object[]) stampState;
>>>
>>> stampState is not an array when casted to an array. The rest of code works
>>> with the array "state".
>>>
>>> The line above is causing me the exception.
>>>
>>> It seems that this line should be replaced by:
>>>
>>>   Object state[] = new Object[1];
>>>   if (stampState.getClass().isArray())
>>>       state = (Object[]) stampState;
>>>   else
>>>       state[0] = stampState;
>>>
>>> Please find the patch attached. Someone may have a better idea how to fix
>>> the issue.
>>>
>>> My apologies to Trinidad community for not being able to rectify the
>>> defect. It just disappears for unknown reason on the way when I am trying to
>>> rectify it.
>>>
>>> Caused by: java.lang.ClassCastException: Class cannot be casted to array
>>>        at
>>> org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXTable.restoreStampState(UIXTable.java:426)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXCollection._restoreStampState(UIXCollection.java:1813)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXCollection.postRowDataChange(UIXCollection.java:809)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXCollection.setRowIndex(UIXCollection.java:505)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXTable._processStamps(UIXTable.java:517)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXTable.processFacetsAndChildren(UIXTable.java:374)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXCollection.decodeChildrenImpl(UIXCollection.java:202)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:196)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXForm.processDecodes(UIXForm.java:75)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>>        at
>>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>>        at
>>> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:705)
>>>        at javax.faces.component.UIViewRoot.access$001(UIViewRoot.java:62)
>>>        at javax.faces.component.UIViewRoot$1.process(UIViewRoot.java:121)
>>>        at javax.faces.component.UIViewRoot.process(UIViewRoot.java:260)
>>>        at
>>> javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:117)
>>>        at
>>> org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
>>>        at
>>> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
>>>        at
>>> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
>>>        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:178)
>>>        ... 22 more
>>> ---
>>> Sincerely yours
>>> Dmitry Barsukov
>>>
>>>       
>>     
>
>
>   


Re: [Trinidad] Coding error (a bug) in StampState.restoreChildStampState(StampState.java:201)

Posted by Dmitry Barsukov <db...@gmail.com>.
Max,

I'm not sure if I modify anything within the table...
The form we have here is kinda complicated and hard to rectify keeping
the defect appearing.
The exception is thrown when a few manual operations on the form are done,
it's not just open web page and that's it.

I agree with you that finding the root of a problem is required.

But what you can easily observe is the simple coding error : an object which
is not an array is being casted to an array type. This causes an exception.
My patch fixes coding mistake only.

Nevertheless, I will allocate some more of time onto rectification of the
issue.

Regards,
Dmitry



On 21 June 2010 18:08, Max Starets <ma...@oracle.com> wrote:

> Dmitry,
>
> We need to figure out what is going on first.
> Are you modifying components within table dynamically?
>
> Since the same components are being stamped for each row, it is expected
> that the component
> set does not change when each row is decoded or rendered.
>
> Regards,
> Max Starets
>
>
> Dmitry Barsukov wrote:
>
>> Hi All,
>>
>>
>> org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)
>>
>> 201:    Object[] state = (Object[]) stampState;
>>
>> stampState is not an array when casted to an array. The rest of code works
>> with the array "state".
>>
>> The line above is causing me the exception.
>>
>> It seems that this line should be replaced by:
>>
>>   Object state[] = new Object[1];
>>   if (stampState.getClass().isArray())
>>       state = (Object[]) stampState;
>>   else
>>       state[0] = stampState;
>>
>> Please find the patch attached. Someone may have a better idea how to fix
>> the issue.
>>
>> My apologies to Trinidad community for not being able to rectify the
>> defect. It just disappears for unknown reason on the way when I am trying to
>> rectify it.
>>
>> Caused by: java.lang.ClassCastException: Class cannot be casted to array
>>        at
>> org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)
>>        at
>> org.apache.myfaces.trinidad.component.UIXTable.restoreStampState(UIXTable.java:426)
>>        at
>> org.apache.myfaces.trinidad.component.UIXCollection._restoreStampState(UIXCollection.java:1813)
>>        at
>> org.apache.myfaces.trinidad.component.UIXCollection.postRowDataChange(UIXCollection.java:809)
>>        at
>> org.apache.myfaces.trinidad.component.UIXCollection.setRowIndex(UIXCollection.java:505)
>>        at
>> org.apache.myfaces.trinidad.component.UIXTable._processStamps(UIXTable.java:517)
>>        at
>> org.apache.myfaces.trinidad.component.UIXTable.processFacetsAndChildren(UIXTable.java:374)
>>        at
>> org.apache.myfaces.trinidad.component.UIXCollection.decodeChildrenImpl(UIXCollection.java:202)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>        at
>> org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:196)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>        at
>> org.apache.myfaces.trinidad.component.UIXForm.processDecodes(UIXForm.java:75)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>>        at
>> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>>        at
>> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:705)
>>        at javax.faces.component.UIViewRoot.access$001(UIViewRoot.java:62)
>>        at javax.faces.component.UIViewRoot$1.process(UIViewRoot.java:121)
>>        at javax.faces.component.UIViewRoot.process(UIViewRoot.java:260)
>>        at
>> javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:117)
>>        at
>> org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
>>        at
>> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
>>        at
>> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
>>        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:178)
>>        ... 22 more
>> ---
>> Sincerely yours
>> Dmitry Barsukov
>>
>
>


-- 
---
Sincerely yours
Dmitry Barsukov

Re: [Trinidad] Coding error (a bug) in StampState.restoreChildStampState(StampState.java:201)

Posted by Max Starets <ma...@oracle.com>.
Dmitry,

We need to figure out what is going on first.
Are you modifying components within table dynamically?

Since the same components are being stamped for each row, it is expected 
that the component
set does not change when each row is decoded or rendered.

Regards,
Max Starets

Dmitry Barsukov wrote:
> Hi All,
>
> org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)
>
> 201:    Object[] state = (Object[]) stampState;
>
> stampState is not an array when casted to an array. The rest of code 
> works with the array "state".
>
> The line above is causing me the exception.
>
> It seems that this line should be replaced by:
>
>    Object state[] = new Object[1];
>    if (stampState.getClass().isArray())
>        state = (Object[]) stampState;
>    else
>        state[0] = stampState;
>
> Please find the patch attached. Someone may have a better idea how to 
> fix the issue.
>
> My apologies to Trinidad community for not being able to rectify 
> the defect. It just disappears for unknown reason on the way when I am 
> trying to rectify it.
>
> Caused by: java.lang.ClassCastException: Class cannot be casted to array
>         at 
> org.apache.myfaces.trinidad.component.StampState.restoreChildStampState(StampState.java:201)
>         at 
> org.apache.myfaces.trinidad.component.UIXTable.restoreStampState(UIXTable.java:426)
>         at 
> org.apache.myfaces.trinidad.component.UIXCollection._restoreStampState(UIXCollection.java:1813)
>         at 
> org.apache.myfaces.trinidad.component.UIXCollection.postRowDataChange(UIXCollection.java:809)
>         at 
> org.apache.myfaces.trinidad.component.UIXCollection.setRowIndex(UIXCollection.java:505)
>         at 
> org.apache.myfaces.trinidad.component.UIXTable._processStamps(UIXTable.java:517)
>         at 
> org.apache.myfaces.trinidad.component.UIXTable.processFacetsAndChildren(UIXTable.java:374)
>         at 
> org.apache.myfaces.trinidad.component.UIXCollection.decodeChildrenImpl(UIXCollection.java:202)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>         at 
> org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:196)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>         at 
> org.apache.myfaces.trinidad.component.UIXForm.processDecodes(UIXForm.java:75)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1076)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1062)
>         at 
> org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:888)
>         at 
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:705)
>         at javax.faces.component.UIViewRoot.access$001(UIViewRoot.java:62)
>         at javax.faces.component.UIViewRoot$1.process(UIViewRoot.java:121)
>         at javax.faces.component.UIViewRoot.process(UIViewRoot.java:260)
>         at 
> javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:117)
>         at 
> org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
>         at 
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
>         at 
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:178)
>         ... 22 more
> ---
> Sincerely yours
> Dmitry Barsukov