[jira] [Commented] (OWB-1233) WrappedValueExpression.equals(Object arg0) always false if arg0 is an instance of WrappedValueExpression

2018-04-12 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-1233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16435264#comment-16435264
 ] 

Mark Struberg commented on OWB-1233:


committed the fix and our side and did report the ValueExpressionImpl#equals to 
Tomcat
https://bz.apache.org/bugzilla/show_bug.cgi?id=62287

> WrappedValueExpression.equals(Object arg0) always false if arg0 is an 
> instance of WrappedValueExpression
> 
>
> Key: OWB-1233
> URL: https://issues.apache.org/jira/browse/OWB-1233
> Project: OpenWebBeans
>  Issue Type: Bug
>  Components: Enterprise Web Beans
>Affects Versions: 2.0.3
>Reporter: Holger Sunke
>Priority: Major
>
> Hello,
>  
> I found that _org.apache.webbeans.el22.WrappedValueExpression.equals(Object 
> arg0)_ does not consider that arg0 might also bee an instance of 
> WrappedValueExpression always returns _false_ in this case.
>  
> Reproduce:
>  # Create two equal org.apache.el.ValueExpressionImpl instances _ve1_ and 
> _ve2_ such that ve1.equals(ve2) is true.
>  # Wrap _ve1_ with _we1_ = new WrappedValueExpression(_ve1_);
>  # Wrap _ve2_ with _we2_ = new WrappedValueExpression(_ve2_);
>  # assertTrue(we1.equals(we2)); -> fails
>  # assertTrue(we1.equals(ve2)); -> succeeds
>  # assertTrue(we1.equals(we1)); -> fails
>  # assertTrue(we1.equals(ve1)); -> succeeds
>  # assertTrue(ve2.equals(we1)); -> fails, breaking symmetry rule with (5.)
>  # assertTrue(ve1.equals(we1)); -> fails, breaking symmetry rule with (7.)
> I'd expect all assertions to succeed in accordance to the contract as 
> described in documentation of java.lang.Object.equals(Object).
>  
> Btw: isn't it quite dangerous to rely on the hashCode() only in 
> ValueExpressionImpl.equals(Object)?
> public boolean equals(Object obj) {
> return (obj instanceof ValueExpressionImpl && obj.hashCode() == this
> .hashCode());
>  }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OWB-1233) WrappedValueExpression.equals(Object arg0) always false if arg0 is an instance of WrappedValueExpression

2018-03-02 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/OWB-1233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16383363#comment-16383363
 ] 

Mark Struberg commented on OWB-1233:


Yes, we should fix that - thanks for reporting!

 

Do you want to ship a patch?

> WrappedValueExpression.equals(Object arg0) always false if arg0 is an 
> instance of WrappedValueExpression
> 
>
> Key: OWB-1233
> URL: https://issues.apache.org/jira/browse/OWB-1233
> Project: OpenWebBeans
>  Issue Type: Bug
>  Components: Enterprise Web Beans
>Affects Versions: 2.0.3
>Reporter: Holger Sunke
>Priority: Major
>
> Hello,
>  
> I found that _org.apache.webbeans.el22.WrappedValueExpression.equals(Object 
> arg0)_ does not consider that arg0 might also bee an instance of 
> WrappedValueExpression always returns _false_ in this case.
>  
> Reproduce:
>  # Create two equal org.apache.el.ValueExpressionImpl instances _ve1_ and 
> _ve2_ such that ve1.equals(ve2) is true.
>  # Wrap _ve1_ with _we1_ = new WrappedValueExpression(_ve1_);
>  # Wrap _ve2_ with _we2_ = new WrappedValueExpression(_ve2_);
>  # assertTrue(we1.equals(we2)); -> fails
>  # assertTrue(we1.equals(ve2)); -> succeeds
>  # assertTrue(we1.equals(we1)); -> fails
>  # assertTrue(we1.equals(ve1)); -> succeeds
>  # assertTrue(ve2.equals(we1)); -> fails, breaking symmetry rule with (5.)
>  # assertTrue(ve1.equals(we1)); -> fails, breaking symmetry rule with (7.)
> I'd expect all assertions to succeed in accordance to the contract as 
> described in documentation of java.lang.Object.equals(Object).
>  
> Btw: isn't it quite dangerous to rely on the hashCode() only in 
> ValueExpressionImpl.equals(Object)?
> public boolean equals(Object obj) {
> return (obj instanceof ValueExpressionImpl && obj.hashCode() == this
> .hashCode());
>  }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)