You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Paul Spencer (JIRA)" <de...@myfaces.apache.org> on 2007/06/12 13:45:26 UTC

[jira] Created: (TOMAHAWK-1022) HtmlMessage and HtmlMessages fails unit test when using RI

HtmlMessage and HtmlMessages fails unit test when using RI
----------------------------------------------------------

                 Key: TOMAHAWK-1022
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1022
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Message(s)
            Reporter: Paul Spencer
             Fix For: 1.1.6


Below are output from the test failures.  The test are run using the following command:

   cd tomahawk/core
   mvn test -Djsf=ri


-------------------------------------------------------------------------------
Test set: org.apache.myfaces.component.html.ext.HtmlMessagesTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.094 sec <<< FAILURE!
testDefaultRenderer(org.apache.myfaces.component.html.ext.HtmlMessagesTest)  Time elapsed: 0.032 sec  <<< ERROR!
java.lang.IllegalStateException: Parent was not null, but this component not related
	at javax.faces.component.UIComponentBase.eraseParent(UIComponentBase.java:457)
	at javax.faces.component.UIComponentBase.access$500(UIComponentBase.java:76)
	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:1496)
	at org.apache.myfaces.component.html.ext.HtmlMessagesTest.testDefaultRenderer(HtmlMessagesTest.java:66)


-------------------------------------------------------------------------------
Test set: org.apache.myfaces.component.html.ext.HtmlMessageTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031 sec <<< FAILURE!
testDefaultRenderer(org.apache.myfaces.component.html.ext.HtmlMessageTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.IllegalStateException: Parent was not null, but this component not related
	at javax.faces.component.UIComponentBase.eraseParent(UIComponentBase.java:457)
	at javax.faces.component.UIComponentBase.access$500(UIComponentBase.java:76)
	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:1496)
	at org.apache.myfaces.component.html.ext.HtmlMessageTest.testDefaultRenderer(HtmlMessageTest.java:66)



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1022) HtmlMessage and HtmlMessages fails unit test when using RI

Posted by "Paul Spencer (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602258#action_12602258 ] 

Paul Spencer commented on TOMAHAWK-1022:
----------------------------------------

I have no objections on removing  setParent().

> HtmlMessage and HtmlMessages fails unit test when using RI
> ----------------------------------------------------------
>
>                 Key: TOMAHAWK-1022
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1022
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.6, 1.1.7-SNAPSHOT
>            Reporter: Paul Spencer
>             Fix For: 1.1.7-SNAPSHOT
>
>
> Below are output from the test failures.  The test are run using the following command:
>    cd tomahawk/core
>    mvn test -Djsf=ri
> -------------------------------------------------------------------------------
> Test set: org.apache.myfaces.component.html.ext.HtmlMessagesTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.094 sec <<< FAILURE!
> testDefaultRenderer(org.apache.myfaces.component.html.ext.HtmlMessagesTest)  Time elapsed: 0.032 sec  <<< ERROR!
> java.lang.IllegalStateException: Parent was not null, but this component not related
> 	at javax.faces.component.UIComponentBase.eraseParent(UIComponentBase.java:457)
> 	at javax.faces.component.UIComponentBase.access$500(UIComponentBase.java:76)
> 	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:1496)
> 	at org.apache.myfaces.component.html.ext.HtmlMessagesTest.testDefaultRenderer(HtmlMessagesTest.java:66)
> -------------------------------------------------------------------------------
> Test set: org.apache.myfaces.component.html.ext.HtmlMessageTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031 sec <<< FAILURE!
> testDefaultRenderer(org.apache.myfaces.component.html.ext.HtmlMessageTest)  Time elapsed: 0 sec  <<< ERROR!
> java.lang.IllegalStateException: Parent was not null, but this component not related
> 	at javax.faces.component.UIComponentBase.eraseParent(UIComponentBase.java:457)
> 	at javax.faces.component.UIComponentBase.access$500(UIComponentBase.java:76)
> 	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:1496)
> 	at org.apache.myfaces.component.html.ext.HtmlMessageTest.testDefaultRenderer(HtmlMessageTest.java:66)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1022) HtmlMessage and HtmlMessages fails unit test when using RI

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602163#action_12602163 ] 

Leonardo Uribe commented on TOMAHAWK-1022:
------------------------------------------

Checking this behavior, I have noted that this is caused by a difference in the way that jsf ri implements UIComponentBase.getChildren and myfaces.

The idea when you add a child component to some other component is that child.getParent return the component where it was added. The line:

referencedComponent.setParent(panelGroup);

this is the context:

        UIComponent referencedComponent = new HtmlInputText();
        referencedComponent.setId("referencedComponent");
        referencedComponent.setParent(panelGroup);
        panelGroup.getChildren().add(referencedComponent);
        facesContext.addMessage(referencedComponent.getId(), new FacesMessage(
                FacesMessage.SEVERITY_ERROR, "summary", "detail"));

set the parent to the base component first and then add it. But checking the implementation on myfaces, when the component is added it is also set the parent property, so this code is useless. If exists on the children list, it is removed first and added later.

I think based on the message of jsf ri:

java.lang.IllegalStateException: Parent was not null, but this component not related

when is added, the parent try to check if is on the children list (Note that this do not exists in reality, because there is no add yet). The result on jsf ri is an IllegalStateException, because it try to remove a child component that in fact does not exists.

The solution is simple: just remove or comment the line:

referencedComponent.setParent(panelGroup);

on both test.

If no objections I'll commit this change.

> HtmlMessage and HtmlMessages fails unit test when using RI
> ----------------------------------------------------------
>
>                 Key: TOMAHAWK-1022
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1022
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.6, 1.1.7-SNAPSHOT
>            Reporter: Paul Spencer
>             Fix For: 1.1.7-SNAPSHOT
>
>
> Below are output from the test failures.  The test are run using the following command:
>    cd tomahawk/core
>    mvn test -Djsf=ri
> -------------------------------------------------------------------------------
> Test set: org.apache.myfaces.component.html.ext.HtmlMessagesTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.094 sec <<< FAILURE!
> testDefaultRenderer(org.apache.myfaces.component.html.ext.HtmlMessagesTest)  Time elapsed: 0.032 sec  <<< ERROR!
> java.lang.IllegalStateException: Parent was not null, but this component not related
> 	at javax.faces.component.UIComponentBase.eraseParent(UIComponentBase.java:457)
> 	at javax.faces.component.UIComponentBase.access$500(UIComponentBase.java:76)
> 	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:1496)
> 	at org.apache.myfaces.component.html.ext.HtmlMessagesTest.testDefaultRenderer(HtmlMessagesTest.java:66)
> -------------------------------------------------------------------------------
> Test set: org.apache.myfaces.component.html.ext.HtmlMessageTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031 sec <<< FAILURE!
> testDefaultRenderer(org.apache.myfaces.component.html.ext.HtmlMessageTest)  Time elapsed: 0 sec  <<< ERROR!
> java.lang.IllegalStateException: Parent was not null, but this component not related
> 	at javax.faces.component.UIComponentBase.eraseParent(UIComponentBase.java:457)
> 	at javax.faces.component.UIComponentBase.access$500(UIComponentBase.java:76)
> 	at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:1496)
> 	at org.apache.myfaces.component.html.ext.HtmlMessageTest.testDefaultRenderer(HtmlMessageTest.java:66)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.