Skip to content

Commit 6c056c3

Browse files
committed
Fixed potential dead lock when compating two instances of WrapperList. Issue #1243. Contributed by Tim Peierls.
1 parent 0e0a2a4 commit 6c056c3

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

build/tmpl/text/changes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Changes log
1616
Reported and contributed by Colin Puy.
1717
- Fixed computation of the agent name in case Safari browser. Issue #1238.
1818
Reported by Abhishek Nandi.
19+
- Fixed potential dead lock when compating two instances of WrapperList. Issue #1243.
20+
Contributed by Tim Peierls.
1921
- Enhancements
2022
- Added overload to OAuthParameters.toReference which accepts an existing Reference.
2123
Contributed by Ryan O'Meara.

modules/org.restlet/src/org/restlet/util/WrapperList.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
package org.restlet.util;
2626

27+
import java.util.Arrays;
2728
import java.util.Collection;
2829
import java.util.Iterator;
2930
import java.util.List;
@@ -32,12 +33,10 @@
3233

3334
/**
3435
* List wrapper. Modifiable list that delegates all methods to a wrapped list.
35-
* This allows an easy sub-classing. By default, it wraps a thread-safe
36-
* {@link Vector} instance.
36+
* This allows an easy sub-classing. By default, it wraps a thread-safe {@link Vector} instance.
3737
*
3838
* @author Jerome Louvel
39-
* @see <a href="http://c2.com/cgi/wiki?DecoratorPattern">The decorator (aka
40-
* wrapper) pattern</a>
39+
* @see <a href="http://c2.com/cgi/wiki?DecoratorPattern">The decorator (aka wrapper) pattern</a>
4140
* @see java.util.Collections
4241
* @see java.util.List
4342
*/
@@ -157,7 +156,16 @@ public boolean containsAll(Collection<?> elements) {
157156
*/
158157
@Override
159158
public boolean equals(Object o) {
160-
return getDelegate().equals(o);
159+
if (this == o) {
160+
return true;
161+
}
162+
163+
if (o instanceof List) {
164+
List<?> that = (List<?>) o;
165+
return Arrays.equals(this.toArray(), that.toArray());
166+
}
167+
168+
return false;
161169
}
162170

163171
/**

0 commit comments

Comments
 (0)