hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsedd...@apache.org
Subject svn commit: r1762913 - in /httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src: main/java/org/apache/http/osgi/impl/WeakList.java test/java/org/apache/http/osgi/impl/WeakListTest.java
Date Fri, 30 Sep 2016 14:08:12 GMT
Author: jsedding
Date: Fri Sep 30 14:08:12 2016
New Revision: 1762913

URL: http://svn.apache.org/viewvc?rev=1762913&view=rev
Log:
HTTPCLIENT-1772: [OSGi] WeakList needs to support "clear" method

Modified:
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/WeakList.java
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/WeakListTest.java

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/WeakList.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/WeakList.java?rev=1762913&r1=1762912&r2=1762913&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/WeakList.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/WeakList.java
Fri Sep 30 14:08:12 2016
@@ -62,6 +62,11 @@ class WeakList<T> extends AbstractList<T
         return innerList.add(new WeakReference<T>(t));
     }
 
+    @Override
+    public void clear() {
+        innerList.clear();
+    }
+
     private void checkReferences() {
         final ListIterator<WeakReference<T>> references = innerList.listIterator();
         while (references.hasNext()) {

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/WeakListTest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/WeakListTest.java?rev=1762913&r1=1762912&r2=1762913&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/WeakListTest.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/WeakListTest.java
Fri Sep 30 14:08:12 2016
@@ -59,4 +59,15 @@ public class WeakListTest {
         assertTrue(thrown);
     }
 
+    @Test
+    public void clearSupported() {
+        final WeakList<Object> list = new WeakList<Object>();
+
+        list.add("hello");
+        assertEquals(1, list.size());
+
+        list.clear();
+        assertEquals(0, list.size());
+    }
+
 }
\ No newline at end of file



Mime
View raw message