You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Bert_nor <ce...@mail.ru> on 2009/05/20 14:58:41 UTC
NullPointerException
MultiPoolConnectionInterceptor$SubjectCRIKey.equals
java.lang.NullPointerException
at
org.apache.geronimo.connector.outbound.MultiPoolConnectionInterceptor$SubjectCRIKey.equals(MultiPoolConnectionInterceptor.java:193)
source:
return hashcode == o.hashcode &&
(subject == null ? o.subject == null :
subject.equals(o.subject) &&
cri == null ? o.cri == null : cri.equals(o.cri));
need brackets:
return hashcode == o.hashcode &&
(subject == null ? o.subject == null :
subject.equals(o.subject) &&
( cri == null ? o.cri == null : cri.equals(o.cri))
);
--
View this message in context: http://www.nabble.com/NullPointerException-MultiPoolConnectionInterceptor%24SubjectCRIKey.equals-tp23634940s134p23634940.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: NullPointerException
MultiPoolConnectionInterceptor$SubjectCRIKey.equals
Posted by Bert_nor <ce...@mail.ru>.
Thanks David, I saw new code. Early, I wrote code from javap applied to old
code.
I am mistaken, this is not a compiler bug.
djencks wrote:
>
> I'm a little confused. What code did you apply javap to? I dont
> think I pushed a copy of the newly revised code to any repos so you'd
> have to build it yourself.
>
> The new code looks like this:
>
> public boolean equals(Object o) {
> if (this == o) return true;
> if (o == null || getClass() != o.getClass()) return false;
>
> SubjectCRIKey that = (SubjectCRIKey) o;
>
> if (hashcode != that.hashcode) return false;
> if (cri != null ? !cri.equals(that.cri) : that.cri !=
> null) return false;
> if (subject != null ? !subject.equals(that.subject) :
> that.subject != null) return false;
>
> return true;
> }
>
>
> I can believe the old code resembled your deconstruction below with
> the addition of a "return".
>
> thanks
> david jencks
>
>
--
View this message in context: http://www.nabble.com/NullPointerException-MultiPoolConnectionInterceptor%24SubjectCRIKey.equals-tp23634940s134p23649541.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: NullPointerException MultiPoolConnectionInterceptor$SubjectCRIKey.equals
Posted by David Jencks <da...@yahoo.com>.
I'm a little confused. What code did you apply javap to? I dont
think I pushed a copy of the newly revised code to any repos so you'd
have to build it yourself.
The new code looks like this:
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SubjectCRIKey that = (SubjectCRIKey) o;
if (hashcode != that.hashcode) return false;
if (cri != null ? !cri.equals(that.cri) : that.cri !=
null) return false;
if (subject != null ? !subject.equals(that.subject) :
that.subject != null) return false;
return true;
}
I can believe the old code resembled your deconstruction below with
the addition of a "return".
thanks
david jencks
On May 21, 2009, at 12:08 AM, Bert_nor wrote:
>
> I think this is a compiler bug.
> javap gives next code:
> ...........
> 26: getfield #2; //Field subject:Ljavax/security/auth/Subject;
> 29: ifnonnull 42
> 32: aload_2
> 33: getfield #2; //Field subject:Ljavax/security/auth/Subject;
> 36: ifnonnull 91
> 39: goto 87
> 42: aload_0
> 43: getfield #2; //Field subject:Ljavax/security/auth/Subject;
> 46: aload_2
> 47: getfield #2; //Field subject:Ljavax/security/auth/Subject;
> 50: invokevirtual #8; //Method
> javax/security/auth/Subject.equals:(Ljava/lang/Object;)Z
> 53: ifeq 73 <---------------------
> if(subject.equals(o.subject))
> 56: aload_0
> 57: getfield #3; //Field
> cri:Ljavax/resource/spi/ConnectionRequestInfo;
> 60: ifnonnull 73
> 63: aload_2
> 64: getfield #3; //Field
> cri:Ljavax/resource/spi/ConnectionRequestInfo;
> 67: ifnonnull 91
> 70: goto 87
> 73: aload_0 <----------------------
> 74: getfield #3; //Field
> cri:Ljavax/resource/spi/ConnectionRequestInfo;
> 77: aload_2
> 78: getfield #3; //Field
> cri:Ljavax/resource/spi/ConnectionRequestInfo;
> 81: invokevirtual #9; //Method
> java/lang/Object.equals:(Ljava/lang/Object;)Z
> 84: ifeq 91
> 87: iconst_1
> 88: goto 92
> 91: iconst_0
> 92: ireturn
>
> The result is the following construction
>
> if(subject.equals(o.subject)){
> cri.equals(o.cri);
> }
>
>
>
> djencks wrote:
>>
>> I opened GERONIMO-4639 and fixed this in trunk and branches 2.1
>>
>> I couldn't understand the nested iff statements too well so I just
>> replaced it with what idea generates for equals :-)
>>
>> This is a component, not part of geronimo itself. We'll need to push
>> a release of at least the 2.1 branch.
>>
>> thanks
>> david jencks
>>
>
>
>
> --
> View this message in context: http://www.nabble.com/NullPointerException-MultiPoolConnectionInterceptor%24SubjectCRIKey.equals-tp23634940s134p23648828.html
> Sent from the Apache Geronimo - Users mailing list archive at
> Nabble.com.
>
Re: NullPointerException
MultiPoolConnectionInterceptor$SubjectCRIKey.equals
Posted by Bert_nor <ce...@mail.ru>.
I think this is a compiler bug.
javap gives next code:
...........
26: getfield #2; //Field subject:Ljavax/security/auth/Subject;
29: ifnonnull 42
32: aload_2
33: getfield #2; //Field subject:Ljavax/security/auth/Subject;
36: ifnonnull 91
39: goto 87
42: aload_0
43: getfield #2; //Field subject:Ljavax/security/auth/Subject;
46: aload_2
47: getfield #2; //Field subject:Ljavax/security/auth/Subject;
50: invokevirtual #8; //Method
javax/security/auth/Subject.equals:(Ljava/lang/Object;)Z
53: ifeq 73 <---------------------
if(subject.equals(o.subject))
56: aload_0
57: getfield #3; //Field
cri:Ljavax/resource/spi/ConnectionRequestInfo;
60: ifnonnull 73
63: aload_2
64: getfield #3; //Field
cri:Ljavax/resource/spi/ConnectionRequestInfo;
67: ifnonnull 91
70: goto 87
73: aload_0 <----------------------
74: getfield #3; //Field
cri:Ljavax/resource/spi/ConnectionRequestInfo;
77: aload_2
78: getfield #3; //Field
cri:Ljavax/resource/spi/ConnectionRequestInfo;
81: invokevirtual #9; //Method
java/lang/Object.equals:(Ljava/lang/Object;)Z
84: ifeq 91
87: iconst_1
88: goto 92
91: iconst_0
92: ireturn
The result is the following construction
if(subject.equals(o.subject)){
cri.equals(o.cri);
}
djencks wrote:
>
> I opened GERONIMO-4639 and fixed this in trunk and branches 2.1
>
> I couldn't understand the nested iff statements too well so I just
> replaced it with what idea generates for equals :-)
>
> This is a component, not part of geronimo itself. We'll need to push
> a release of at least the 2.1 branch.
>
> thanks
> david jencks
>
--
View this message in context: http://www.nabble.com/NullPointerException-MultiPoolConnectionInterceptor%24SubjectCRIKey.equals-tp23634940s134p23648828.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: NullPointerException MultiPoolConnectionInterceptor$SubjectCRIKey.equals
Posted by David Jencks <da...@yahoo.com>.
I opened GERONIMO-4639 and fixed this in trunk and branches 2.1
I couldn't understand the nested iff statements too well so I just
replaced it with what idea generates for equals :-)
This is a component, not part of geronimo itself. We'll need to push
a release of at least the 2.1 branch.
thanks
david jencks
On May 20, 2009, at 5:58 AM, Bert_nor wrote:
>
> java.lang.NullPointerException
> at
> org.apache.geronimo.connector.outbound.MultiPoolConnectionInterceptor
> $SubjectCRIKey.equals(MultiPoolConnectionInterceptor.java:193)
>
> source:
> return hashcode == o.hashcode &&
> (subject == null ? o.subject == null :
> subject.equals(o.subject) &&
> cri == null ? o.cri == null : cri.equals(o.cri));
>
> need brackets:
> return hashcode == o.hashcode &&
> (subject == null ? o.subject == null :
> subject.equals(o.subject) &&
> ( cri == null ? o.cri == null : cri.equals(o.cri))
> );
>
> --
> View this message in context: http://www.nabble.com/NullPointerException-MultiPoolConnectionInterceptor%24SubjectCRIKey.equals-tp23634940s134p23634940.html
> Sent from the Apache Geronimo - Users mailing list archive at
> Nabble.com.
>