[jboss-user] [JBoss Seam] - default equals() doesn't behave as expected for javaBean com
matt.drees
do-not-reply at jboss.com
Thu Apr 26 11:30:45 EDT 2007
I'm not sure whether this is a bug or not, but it occupied a chunk of my time trying to debug this, and I thought others should be aware of it.
The javassist proxy for javaBeans components interferes with the default equals() method. After some interceptions, something like instance_javassist.equals(instance) is called, which fails, because they're different instances.
You can see this with something like this (which fails):
| public class PingTest extends SeamTest {
|
| @Test
| public void test() throws Exception {
| new FacesRequest() {
| @Override
| protected void invokeApplication() {
| //call action methods here
| Ping ping = (Ping) getValue("#{ping}");
| Collection<Ping> pingSet = new ArrayList<Ping>();
| pingSet.add(ping);
| assert ping.equals(ping);
| }
| }.run();
| }
| }
|
| @Name("ping")
| public class Ping {
|
| @Logger private Log log;
|
| @In FacesMessages facesMessages;
|
| public void ping()
| {
| log.info("ping.ping() action called");
| facesMessages.add("ping");
| }
|
|
| }
|
If it's a bug, I'll file it in jira.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041057#4041057
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041057
More information about the jboss-user
mailing list