You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2017/07/11 17:55:31 UTC
[01/50] commons-collections git commit: Add initial changes.xml with
planned backports.
Repository: commons-collections
Updated Branches:
refs/heads/COLLECTIONS_3_2_X [created] 7f0185bd3
Add initial changes.xml with planned backports.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713148 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/6e5ae530
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/6e5ae530
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/6e5ae530
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 6e5ae530b3a0478dddeb44b54ea7546093e82b02
Parents: a5740d8
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 15:55:47 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 15:55:47 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 110 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6e5ae530/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
new file mode 100644
index 0000000..b7289a9
--- /dev/null
+++ b/src/changes/changes.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<document>
+ <properties>
+ <title>Commons Collections Changes</title>
+ </properties>
+ <body>
+
+ <release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+
+ <!-- Bugfixes planned to backport from 4.0
+
+ <action issue="COLLECTIONS-447" dev="tn" type="fix" due-to="Jeffrey Barnes">
+ Tree traversal with a TreeListIterator will not be affected anymore by
+ the removal of an element directly after a call to previous().
+ </action>
+ <action issue="COLLECTIONS-444" dev="tn" type="fix" due-to="Thomas Vahrst, John Vasileff">
+ SetUniqueList.set(int, E) now works correctly if the object to be inserted
+ is already placed at the given position.
+ </action>
+ <action issue="COLLECTIONS-441" dev="tn" type="fix" due-to="Thomas Vahrst">
+ MultiKeyMap.clone() now correctly calls super.clone().
+ </action>
+ <action issue="COLLECTIONS-411" dev="tn" type="fix" due-to="Adrian Nistor">
+ Fixed possible "IndexOutOfBoundsException" in "ListOrderedMap#putAll".
+ </action>
+ <action issue="COLLECTIONS-400" dev="tn" type="fix" due-to="Shin Hwei Tan">
+ Added missing null check in "CollectionUtils#addIgnoreNull(Collection, Object)".
+ </action>
+ <action issue="COLLECTIONS-380" dev="tn" type="fix" due-to="Dave Brosius">
+ Fixed infinite loop when calling "UnmodifiableBoundedCollection#unmodifiableBoundedCollection()".
+ </action>
+ <action issue="COLLECTIONS-364" dev="sebb" type="fix">
+ "DualTreeBidiMap" now uses the correct comparator for the reverse map during de-serialization.
+ </action>
+ <action issue="COLLECTIONS-360" dev="jochen" type="fix" due-to="Sai Zhang">
+ "FilterListIterator#hasNext" does not throw a NullPointerException anymore
+ to comply to the Java iterator specification.
+ </action>
+ <action issue="COLLECTIONS-359" dev="bayard" type="fix" due-to="Mark Shead">
+ "ListUtils#intersection(List, List)" will now also work correctly if there
+ are duplicate elements in the provided lists.
+ </action>
+ <action issue="COLLECTIONS-350" dev="bayard" type="fix" due-to="Michael Akerman">
+ Removed debug output in "MapUtils#getNumber(Map)".
+ </action>
+ <action issue="COLLECTIONS-335" dev="jochen" type="fix" due-to="sebb">
+ Fixed cache assignment for "TreeBidiMap#entrySet".
+ </action>
+ <action issue="COLLECTIONS-334" dev="jochen" type="fix" due-to="sebb">
+ Synchronized access to lock in "StaticBucketMap#size()".
+ </action>
+ <action issue="COLLECTIONS-330" dev="mbenson" type="fix" due-to="Joerg Schaible">
+ "LRUMap#keySet()#remove(Object)" will not throw a "ConcurrentModificationException" anymore.
+ </action>
+ <action issue="COLLECTIONS-307" dev="bayard" type="fix" due-to="Christian Semrau">
+ "SetUniqueList#subList()#contains(Object)" will now correctly check the subList
+ rather than the parent list.
+ </action>
+ <action issue="COLLECTIONS-304" dev="bayard" type="fix" due-to="Rafał Figas,Bjorn Townsend">
+ "SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint.
+ </action>
+ <action issue="COLLECTIONS-294" dev="bayard" type="fix" due-to="Benjamin Bentmann">
+ "CaseInsensitiveMap" will now convert input strings to lower-case in a
+ locale-independant manner.
+ </action>
+ <action issue="COLLECTIONS-266" dev="bayard" type="fix" due-to="Joerg Schaible">
+ "MultiKey" will now be correctly serialized/de-serialized.
+ </action>
+ <action issue="COLLECTIONS-261" dev="bayard" type="fix" due-to="ori">
+ "Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
+ if the size of the map is less or equal 3.
+ </action>
+ <action issue="COLLECTIONS-249" dev="bayard" type="fix" due-to="Joe Kelly">
+ "SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
+ provided index.
+ </action>
+ <action issue="COLLECTIONS-228" dev="scolebourne" type="fix">
+ "MultiValueMap#put(Object, Object)" and "MultiValueMap#putAll(Object, Collection)"
+ now correctly return if the map has changed by this operation.
+ </action>
+ <action issue="COLLECTIONS-219" dev="scolebourne" type="fix" due-to="Tom Leccese">
+ "CollectionUtils#removeAll" wrongly called "ListUtils#retainAll".
+ </action>
+ <action issue="COLLECTIONS-217" dev="scolebourne" type="fix" due-to="Matt Bishop">
+ Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
+ correctly set the value for the current entry.
+ </action>
+ <action issue="COLLECTIONS-216" dev="scolebourne" type="fix" due-to="Hendrik Maryns">
+ "MultiKey#toString()" will now use "Arrays#toString(List)".
+ </action>
+ -->
+ </release>
+ </body>
+</document>
[35/50] commons-collections git commit: Add rat plugin ignores for
test data.
Posted by ch...@apache.org.
Add rat plugin ignores for test data.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713798 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/52ccd2c1
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/52ccd2c1
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/52ccd2c1
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 52ccd2c137572f5c961c1ed3213a3b24e93e930e
Parents: b6870e4
Author: Thomas Neidhart <tn...@apache.org>
Authored: Wed Nov 11 10:16:39 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Wed Nov 11 10:16:39 2015 +0000
----------------------------------------------------------------------
pom.xml | 102 ++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 59 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/52ccd2c1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 79bb2fa..7baebfb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -382,6 +382,7 @@
<maven.compile.target>1.2</maven.compile.target>
<commons.componentid>collections</commons.componentid>
<commons.release.version>3.2.1</commons.release.version>
+ <commons.rc.version>RC1</commons.rc.version>
<commons.binary.suffix>-bin</commons.binary.suffix>
<commons.jira.id>COLLECTIONS</commons.jira.id>
<commons.jira.pid>12310465</commons.jira.pid>
@@ -390,49 +391,64 @@
<build>
<sourceDirectory>src/java</sourceDirectory>
<testSourceDirectory>src/test</testSourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>org/apache/commons/collections/TestAllPackages.java</include>
- </includes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
- <tasks>
- <ant antfile="build-testframework.xml" target="jar">
- <property name="component.version" value="${project.version}"/>
- <property name="test.classes" value="${project.build.directory}/test-classes"/>
- <property name="dist.home" value="${project.build.directory}"/>
- <property name="maven.compile.source" value="${maven.compile.source}"/>
- <property name="maven.compile.target" value="${maven.compile.target}"/>
- </ant>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <descriptors>
- <descriptor>src/assembly/bin.xml</descriptor>
- <descriptor>src/assembly/src.xml</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <includes>
+ <include>org/apache/commons/collections/TestAllPackages.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <ant antfile="build-testframework.xml" target="jar">
+ <property name="component.version" value="${project.version}"/>
+ <property name="test.classes" value="${project.build.directory}/test-classes"/>
+ <property name="dist.home" value="${project.build.directory}"/>
+ <property name="maven.compile.source" value="${maven.compile.source}"/>
+ <property name="maven.compile.target" value="${maven.compile.target}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/bin.xml</descriptor>
+ <descriptor>src/assembly/src.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/test/resources/data/test/*</exclude>
+ <exclude>maven-eclipse.xml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
[03/50] commons-collections git commit: Remove some bugfixes from the
list of planned backports after a closer analysis. The fixed problems are not
really serious or were only introduced after the 3.2.1 release.
Posted by ch...@apache.org.
Remove some bugfixes from the list of planned backports after a closer analysis. The fixed problems are not really serious or were only introduced after the 3.2.1 release.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713169 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/a2ddc7cd
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/a2ddc7cd
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/a2ddc7cd
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: a2ddc7cdd306bd1d074c3cc66b6b62563fe27ae1
Parents: e709ea8
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 20:13:12 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 20:13:12 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 19 -------------------
1 file changed, 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/a2ddc7cd/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a4d1492..0ae417c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -37,25 +37,9 @@
SetUniqueList.set(int, E) now works correctly if the object to be inserted
is already placed at the given position.
</action>
- <action issue="COLLECTIONS-441" dev="tn" type="fix" due-to="Thomas Vahrst">
- MultiKeyMap.clone() now correctly calls super.clone().
- </action>
- <action issue="COLLECTIONS-411" dev="tn" type="fix" due-to="Adrian Nistor">
- Fixed possible "IndexOutOfBoundsException" in "ListOrderedMap#putAll".
- </action>
- <action issue="COLLECTIONS-400" dev="tn" type="fix" due-to="Shin Hwei Tan">
- Added missing null check in "CollectionUtils#addIgnoreNull(Collection, Object)".
- </action>
- <action issue="COLLECTIONS-380" dev="tn" type="fix" due-to="Dave Brosius">
- Fixed infinite loop when calling "UnmodifiableBoundedCollection#unmodifiableBoundedCollection()".
- </action>
<action issue="COLLECTIONS-364" dev="sebb" type="fix">
"DualTreeBidiMap" now uses the correct comparator for the reverse map during de-serialization.
</action>
- <action issue="COLLECTIONS-360" dev="jochen" type="fix" due-to="Sai Zhang">
- "FilterListIterator#hasNext" does not throw a NullPointerException anymore
- to comply to the Java iterator specification.
- </action>
<action issue="COLLECTIONS-359" dev="bayard" type="fix" due-to="Mark Shead">
"ListUtils#intersection(List, List)" will now also work correctly if there
are duplicate elements in the provided lists.
@@ -102,9 +86,6 @@
Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
correctly set the value for the current entry.
</action>
- <action issue="COLLECTIONS-216" dev="scolebourne" type="fix" due-to="Hendrik Maryns">
- "MultiKey#toString()" will now use "Arrays#toString(List)".
- </action>
-->
</release>
</body>
[17/50] commons-collections git commit: Backport COLLECTIONS-444 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-444 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713299 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/be671392
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/be671392
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/be671392
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: be67139289c7167ed393537543b29041f88ca086
Parents: 7f947f9
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 21:35:53 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 21:35:53 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 8 ++++----
.../commons/collections/list/SetUniqueList.java | 10 +++++-----
.../collections/list/TestSetUniqueList.java | 17 ++++++++++++++++-
3 files changed, 25 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/be671392/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1445d73..88e5724 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -29,6 +29,10 @@
permission to read system properties, the "File#separator" field will
be used instead.
</action>
+ <action issue="COLLECTIONS-444" dev="tn" type="fix" due-to="Thomas Vahrst, John Vasileff">
+ SetUniqueList.set(int, Object) now works correctly if the object to be inserted
+ is already placed at the given position.
+ </action>
<action issue="COLLECTIONS-350" dev="bayard" type="fix" due-to="Michael Akerman">
Removed debug output in "MapUtils#getNumber(Map)".
</action>
@@ -78,10 +82,6 @@
Tree traversal with a TreeListIterator will not be affected anymore by
the removal of an element directly after a call to previous().
</action>
- <action issue="COLLECTIONS-444" dev="tn" type="fix" due-to="Thomas Vahrst, John Vasileff">
- SetUniqueList.set(int, E) now works correctly if the object to be inserted
- is already placed at the given position.
- </action>
<action issue="COLLECTIONS-359" dev="bayard" type="fix" due-to="Mark Shead">
"ListUtils#intersection(List, List)" will now also work correctly if there
are duplicate elements in the provided lists.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/be671392/src/java/org/apache/commons/collections/list/SetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/SetUniqueList.java b/src/java/org/apache/commons/collections/list/SetUniqueList.java
index 13a870e..27ad6ee 100644
--- a/src/java/org/apache/commons/collections/list/SetUniqueList.java
+++ b/src/java/org/apache/commons/collections/list/SetUniqueList.java
@@ -216,17 +216,17 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
public Object set(int index, Object object) {
int pos = indexOf(object);
Object removed = super.set(index, object);
-
+
if (pos != -1 && pos != index) {
// the object is already in the unique list
// (and it hasn't been swapped with itself)
- super.remove(pos); // remove the duplicate by index
+ super.remove(pos); // remove the duplicate by index
}
- set.add(object); // add the new item to the unique set
- set.remove(removed); // remove the item deleted by the set
+ set.remove(removed); // remove the item deleted by the set
+ set.add(object); // add the new item to the unique set
- return removed; // return the item deleted by the set
+ return removed; // return the item deleted by the set
}
public boolean remove(Object object) {
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/be671392/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
index 086027c..b8bfdcc 100644
--- a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
+++ b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
@@ -486,7 +486,22 @@ public class TestSetUniqueList extends AbstractTestList {
decoratedList.add(1, s2);
assertEquals(4, decoratedList.size());
}
-
+
+ public void testSetCollections444() {
+ final SetUniqueList lset = new SetUniqueList(new ArrayList(), new HashSet());
+ // Duplicate element
+ final Integer obj1 = new Integer(1);
+ final Integer obj2 = new Integer(2);
+ lset.add(obj1);
+ lset.add(obj2);
+ lset.set(0, obj1);
+ assertEquals(2, lset.size());
+ assertSame(obj1, lset.get(0));
+ assertSame(obj2, lset.get(1));
+ assertTrue(lset.contains(obj1));
+ assertTrue(lset.contains(obj2));
+ }
+
//-----------------------------------------------------------------------
public String getCompatibilityVersion() {
return "3.1";
[50/50] commons-collections git commit: Update old school @exception
with new school @throws.
Posted by ch...@apache.org.
Update old school @exception with new school @throws.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1747099 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/7f0185bd
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/7f0185bd
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/7f0185bd
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 7f0185bd3d44b9e1b2439d6685a418e7a91cac7a
Parents: 876942f
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Jun 7 00:40:18 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue Jun 7 00:40:18 2016 +0000
----------------------------------------------------------------------
.../collections/CursorableLinkedList.java | 2 +-
.../commons/collections/FastArrayList.java | 22 ++++++++++----------
.../comparators/ComparatorChain.java | 4 ++--
.../collections/comparators/NullComparator.java | 4 ++--
.../iterators/EnumerationIterator.java | 4 ++--
.../commons/collections/AbstractTestObject.java | 12 +++++------
6 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f0185bd/src/java/org/apache/commons/collections/CursorableLinkedList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CursorableLinkedList.java b/src/java/org/apache/commons/collections/CursorableLinkedList.java
index bc420ca..1d3b12b 100644
--- a/src/java/org/apache/commons/collections/CursorableLinkedList.java
+++ b/src/java/org/apache/commons/collections/CursorableLinkedList.java
@@ -664,7 +664,7 @@ public class CursorableLinkedList implements List, Serializable {
* be stored, if it is big enough; otherwise, a new array of the
* same runtime type is allocated for this purpose.
* @return an array containing the elements of this list.
- * @exception ArrayStoreException
+ * @throws ArrayStoreException
* if the runtime type of the specified array
* is not a supertype of the runtime type of every element in
* this list.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f0185bd/src/java/org/apache/commons/collections/FastArrayList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/FastArrayList.java b/src/java/org/apache/commons/collections/FastArrayList.java
index 4b11bc4..2bee770 100644
--- a/src/java/org/apache/commons/collections/FastArrayList.java
+++ b/src/java/org/apache/commons/collections/FastArrayList.java
@@ -178,7 +178,7 @@ public class FastArrayList extends ArrayList {
* @param index Index at which to insert this element
* @param element The element to be inserted
*
- * @exception IndexOutOfBoundsException if the index is out of range
+ * @throws IndexOutOfBoundsException if the index is out of range
*/
public void add(int index, Object element) {
@@ -230,7 +230,7 @@ public class FastArrayList extends ArrayList {
* @param index Index at which insertion takes place
* @param collection The collection to be added
*
- * @exception IndexOutOfBoundsException if the index is out of range
+ * @throws IndexOutOfBoundsException if the index is out of range
*/
public boolean addAll(int index, Collection collection) {
@@ -254,7 +254,7 @@ public class FastArrayList extends ArrayList {
* Remove all of the elements from this list. The list will be empty
* after this call returns.
*
- * @exception UnsupportedOperationException if <code>clear()</code>
+ * @throws UnsupportedOperationException if <code>clear()</code>
* is not supported by this list
*/
public void clear() {
@@ -405,7 +405,7 @@ public class FastArrayList extends ArrayList {
*
* @param index The index of the element to return
*
- * @exception IndexOutOfBoundsException if the index is out of range
+ * @throws IndexOutOfBoundsException if the index is out of range
*/
public Object get(int index) {
@@ -576,7 +576,7 @@ public class FastArrayList extends ArrayList {
*
* @param index The starting position of the iterator to return
* @return the list iterator
- * @exception IndexOutOfBoundsException if the index is out of range
+ * @throws IndexOutOfBoundsException if the index is out of range
*/
public ListIterator listIterator(int index) {
if (fast) {
@@ -593,7 +593,7 @@ public class FastArrayList extends ArrayList {
*
* @param index Index of the element to be removed
*
- * @exception IndexOutOfBoundsException if the index is out of range
+ * @throws IndexOutOfBoundsException if the index is out of range
*/
public Object remove(int index) {
@@ -643,7 +643,7 @@ public class FastArrayList extends ArrayList {
*
* @param collection Collection containing elements to be removed
*
- * @exception UnsupportedOperationException if this optional operation
+ * @throws UnsupportedOperationException if this optional operation
* is not supported by this list
*/
public boolean removeAll(Collection collection) {
@@ -670,7 +670,7 @@ public class FastArrayList extends ArrayList {
*
* @param collection Collection containing elements to be retained
*
- * @exception UnsupportedOperationException if this optional operation
+ * @throws UnsupportedOperationException if this optional operation
* is not supported by this list
*/
public boolean retainAll(Collection collection) {
@@ -702,7 +702,7 @@ public class FastArrayList extends ArrayList {
* @param index Index of the element to replace
* @param element The new element to be stored
*
- * @exception IndexOutOfBoundsException if the index is out of range
+ * @throws IndexOutOfBoundsException if the index is out of range
*/
public Object set(int index, Object element) {
@@ -743,7 +743,7 @@ public class FastArrayList extends ArrayList {
* @param fromIndex The starting index of the sublist view
* @param toIndex The index after the end of the sublist view
*
- * @exception IndexOutOfBoundsException if an index is out of range
+ * @throws IndexOutOfBoundsException if an index is out of range
*/
public List subList(int fromIndex, int toIndex) {
if (fast) {
@@ -780,7 +780,7 @@ public class FastArrayList extends ArrayList {
*
* @param array Array defining the element type of the returned list
*
- * @exception ArrayStoreException if the runtime type of <code>array</code>
+ * @throws ArrayStoreException if the runtime type of <code>array</code>
* is not a supertype of the runtime type of every element in this list
*/
public Object[] toArray(Object array[]) {
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f0185bd/src/java/org/apache/commons/collections/comparators/ComparatorChain.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/ComparatorChain.java b/src/java/org/apache/commons/collections/comparators/ComparatorChain.java
index 93fbf2f..ddc0cce 100644
--- a/src/java/org/apache/commons/collections/comparators/ComparatorChain.java
+++ b/src/java/org/apache/commons/collections/comparators/ComparatorChain.java
@@ -168,7 +168,7 @@ public class ComparatorChain implements Comparator, Serializable {
*
* @param index index of the Comparator to replace
* @param comparator Comparator to place at the given index
- * @exception IndexOutOfBoundsException
+ * @throws IndexOutOfBoundsException
* if index < 0 or index >= size()
*/
public void setComparator(int index, Comparator comparator)
@@ -260,7 +260,7 @@ public class ComparatorChain implements Comparator, Serializable {
* @param o1 the first object to compare
* @param o2 the second object to compare
* @return -1, 0, or 1
- * @exception UnsupportedOperationException
+ * @throws UnsupportedOperationException
* if the ComparatorChain does not contain at least one
* Comparator
*/
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f0185bd/src/java/org/apache/commons/collections/comparators/NullComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/NullComparator.java b/src/java/org/apache/commons/collections/comparators/NullComparator.java
index d52c6db..c0975e1 100644
--- a/src/java/org/apache/commons/collections/comparators/NullComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/NullComparator.java
@@ -65,7 +65,7 @@ public class NullComparator implements Comparator, Serializable {
* non-<code>null</code> objects. This argument cannot be
* <code>null</code>
*
- * @exception NullPointerException if <code>nonNullComparator</code> is
+ * @throws NullPointerException if <code>nonNullComparator</code> is
* <code>null</code>
**/
public NullComparator(Comparator nonNullComparator) {
@@ -104,7 +104,7 @@ public class NullComparator implements Comparator, Serializable {
* that <code>null</code> should be compared as lower than a
* non-<code>null</code> object.
*
- * @exception NullPointerException if <code>nonNullComparator</code> is
+ * @throws NullPointerException if <code>nonNullComparator</code> is
* <code>null</code>
**/
public NullComparator(Comparator nonNullComparator, boolean nullsAreHigh) {
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f0185bd/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java b/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
index f18f978..e91a058 100644
--- a/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
+++ b/src/java/org/apache/commons/collections/iterators/EnumerationIterator.java
@@ -103,8 +103,8 @@ public class EnumerationIterator implements Iterator {
* If so, the first occurrence of the last returned object from this
* iterator will be removed from the collection.
*
- * @exception IllegalStateException <code>next()</code> not called.
- * @exception UnsupportedOperationException if no associated collection
+ * @throws IllegalStateException <code>next()</code> not called.
+ * @throws UnsupportedOperationException if no associated collection
*/
public void remove() {
if (collection != null) {
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f0185bd/src/test/org/apache/commons/collections/AbstractTestObject.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/AbstractTestObject.java b/src/test/org/apache/commons/collections/AbstractTestObject.java
index 41647af..42d81d5 100644
--- a/src/test/org/apache/commons/collections/AbstractTestObject.java
+++ b/src/test/org/apache/commons/collections/AbstractTestObject.java
@@ -259,7 +259,7 @@ public abstract class AbstractTestObject extends BulkTest {
*
* @param o Object to serialize
* @param path path to write the serialized Object
- * @exception IOException
+ * @throws IOException
*/
protected void writeExternalFormToDisk(Serializable o, String path) throws IOException {
FileOutputStream fileStream = new FileOutputStream(path);
@@ -272,7 +272,7 @@ public abstract class AbstractTestObject extends BulkTest {
*
* @param o Object to convert to bytes
* @return serialized form of the Object
- * @exception IOException
+ * @throws IOException
*/
protected byte[] writeExternalFormToBytes(Serializable o) throws IOException {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
@@ -287,8 +287,8 @@ public abstract class AbstractTestObject extends BulkTest {
*
* @param path path to the serialized Object
* @return the Object at the given path
- * @exception IOException
- * @exception ClassNotFoundException
+ * @throws IOException
+ * @throws ClassNotFoundException
*/
protected Object readExternalFormFromDisk(String path) throws IOException, ClassNotFoundException {
FileInputStream stream = new FileInputStream(path);
@@ -301,8 +301,8 @@ public abstract class AbstractTestObject extends BulkTest {
*
* @param b byte array containing a serialized Object
* @return Object contained in the bytes
- * @exception IOException
- * @exception ClassNotFoundException
+ * @throws IOException
+ * @throws ClassNotFoundException
*/
protected Object readExternalFormFromBytes(byte[] b) throws IOException, ClassNotFoundException {
ByteArrayInputStream stream = new ByteArrayInputStream(b);
[38/50] commons-collections git commit: Update Release Notes with
details about improved fix for COLLECTIONS-580.
Posted by ch...@apache.org.
Update Release Notes with details about improved fix for COLLECTIONS-580.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713850 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/75335407
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/75335407
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/75335407
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 753354073b2bcf0d134d10f18e9a34cc09343a48
Parents: d9a0013
Author: Thomas Neidhart <tn...@apache.org>
Authored: Wed Nov 11 14:29:18 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Wed Nov 11 14:29:18 2015 +0000
----------------------------------------------------------------------
RELEASE-NOTES.txt | 18 +++++++++++-------
src/changes/changes.xml | 11 +++++++----
2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/75335407/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 53df5d0..b32b03d 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -12,8 +12,9 @@ This release is JDK1.3 compatible, and does not use JDK1.5 generics.
This v3.2.2 release is a bugfix release, fixing several bugs present in the previous
releases of the 3.2 branch. Additionally, this release provides a mitigation for a
known remote code exploitation via the standard java object serialization mechanism.
-By default, de-serialization of "InvokerTransformer" instances is prohibited and
-will result in an exception. For more details, please refer to COLLECTIONS-580.
+By default, serialization support for unsafe classes in the functor package is
+disabled and will result in an exception when either trying to serialize or de-serialize
+an instance of these classes. For more details, please refer to COLLECTIONS-580.
All users are strongly encouraged to updated to this release.
@@ -23,11 +24,14 @@ Changes in this version include:
CHANGES
=======
-o COLLECTIONS-580: De-serialization of "InvokerTransformer" is disabled by default as this
- can be exploited for remote code execution attacks. To re-enable the
- feature the system property
- "org.apache.commons.collections.invokertransformer.enableDeserialization"
- needs to be set to "true".
+o COLLECTIONS-580: Serialization support for unsafe classes in the functor package is
+ disabled by default as this can be exploited for remote code execution
+ attacks. To re-enable the feature the system property
+ "org.apache.commons.collections.enableUnsafeSerialization" needs to be
+ set to "true".
+ Classes considered to be unsafe are: CloneTransformer, ForClosure,
+ InstantiateFactory, InstantiateTransformer, InvokerTransformer,
+ PrototypeCloneFactory, PrototypeSerializationFactory, WhileClosure.
BUGFIXES
========
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/75335407/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 83a0427..7981903 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -21,12 +21,15 @@
</properties>
<body>
- <release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+ <release version="3.2.2" date="2015-11-18" description="This is a bugfix release.">
<action issue="COLLECTIONS-580" dev="tn" type="update">
- De-serialization of "InvokerTransformer" is disabled by default as this
- can be exploited for remote code execution attacks. To re-enable the
- feature the system property "org.apache.commons.collections.invokertransformer.enableDeserialization"
+ Serialization support for unsafe classes in the functor package is disabled
+ by default as this can be exploited for remote code execution attacks.
+ To re-enable the feature the system property "org.apache.commons.collections.enableUnsafeSerialization"
needs to be set to "true".
+ Classes considered to be unsafe are: CloneTransformer, ForClosure, InstantiateFactory,
+ InstantiateTransformer, InvokerTransformer, PrototypeCloneFactory,
+ PrototypeSerializationFactory, WhileClosure.
</action>
<action issue="COLLECTIONS-538" dev="tn" type="fix" due-to="Trejkaz">
"ExtendedProperties" will now use a privileged action to access the
[26/50] commons-collections git commit: Remove outdated MANIFEST.MF.
Posted by ch...@apache.org.
Remove outdated MANIFEST.MF.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713548 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/b56c25a6
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/b56c25a6
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/b56c25a6
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: b56c25a619587d5fcea1aa01c5cfd7a9e11cf28f
Parents: 20655b6
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:42:42 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:42:42 2015 +0000
----------------------------------------------------------------------
src/conf/MANIFEST.MF | 12 ------------
1 file changed, 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/b56c25a6/src/conf/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF
deleted file mode 100644
index dfafcc7..0000000
--- a/src/conf/MANIFEST.MF
+++ /dev/null
@@ -1,12 +0,0 @@
-Manifest-Version: 1.0
-Package: org.apache.commons.collections
-Extension-Name: commons-collections
-Specification-Version: @version@
-Specification-Vendor: Apache Software Foundation
-Specification-Title: Commons Collections
-Implementation-Version: @version@
-Implementation-Vendor: Apache Software Foundation
-Implementation-Title: Commons Collections
-Implementation-Vendor-Id: org.apache
-X-Compile-Source-JDK: 1.2
-X-Compile-Target-JDK: 1.2
\ No newline at end of file
[18/50] commons-collections git commit: [COLLECTIONS-580] Proposed
fix for remote code exploits by disabling de-serialization of
InvokerTransformer by default.
Posted by ch...@apache.org.
[COLLECTIONS-580] Proposed fix for remote code exploits by disabling de-serialization of InvokerTransformer by default.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713307 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/1642b00d
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/1642b00d
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/1642b00d
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 1642b00d67b96de87cad44223efb9ab5b4fb7be5
Parents: be67139
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 22:19:57 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 22:19:57 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 6 ++
.../functors/InvokerTransformer.java | 34 ++++++++-
.../functors/TestInvokerTransformer.java | 77 ++++++++++++++++++++
3 files changed, 116 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/1642b00d/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 88e5724..158880f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,6 +23,12 @@
<release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+ <action issue="COLLECTIONS-580" dev="tn" type="update">
+ De-serialization of "InvokerTransformer" is disabled by default as this
+ can be exploited for remote code execution attacks. To re-enable the
+ feature the system property "org.apache.commons.collections.invokertransformer.enableDeserialization"
+ needs to be set to "true".
+ </action>
<action issue="COLLECTIONS-538" dev="tn" type="fix" due-to="Trejkaz">
"ExtendedProperties" will now use a privileged action to access the
"file.separator" system property. In case the class does not have
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/1642b00d/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
index f64cb63..2dcf09c 100644
--- a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
@@ -16,9 +16,13 @@
*/
package org.apache.commons.collections.functors;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import org.apache.commons.collections.FunctorException;
import org.apache.commons.collections.Transformer;
@@ -35,7 +39,11 @@ public class InvokerTransformer implements Transformer, Serializable {
/** The serial version */
private static final long serialVersionUID = -8653385846894047688L;
-
+
+ /** System property key to enable de-serialization */
+ public final static String DESERIALIZE
+ = "org.apache.commons.collections.invokertransformer.enableDeserialization";
+
/** The method name to call */
private final String iMethodName;
/** The array of reflection parameter types */
@@ -134,4 +142,28 @@ public class InvokerTransformer implements Transformer, Serializable {
}
}
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ String deserializeProperty;
+
+ try {
+ deserializeProperty =
+ (String) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty(DESERIALIZE);
+ }
+ });
+ } catch (SecurityException ex) {
+ deserializeProperty = null;
+ }
+
+ if (deserializeProperty == null || !deserializeProperty.equalsIgnoreCase("true")) {
+ throw new UnsupportedOperationException("Deserialization of InvokerTransformer is disabled, ");
+ }
+
+ is.defaultReadObject();
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/1642b00d/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
new file mode 100644
index 0000000..9129471
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
@@ -0,0 +1,77 @@
+package org.apache.commons.collections.functors;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.commons.collections.BulkTest;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestInvokerTransformer extends BulkTest {
+
+ // conventional
+ // ------------------------------------------------------------------------
+
+ public TestInvokerTransformer(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestInvokerTransformer.class);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public void testSerializationDisabled() throws Exception {
+ Assert.assertNull(System.getProperty(InvokerTransformer.DESERIALIZE));
+ InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
+ byte[] data = serialize(transformer);
+ Assert.assertNotNull(data);
+ try {
+ deserialize(data);
+ fail("de-serialization of InvokerTransformer should be disabled by default");
+ } catch (UnsupportedOperationException ex) {
+ // expected
+ }
+ }
+
+ public void testSerializationEnabled() throws Exception {
+ Assert.assertNull(System.getProperty(InvokerTransformer.DESERIALIZE));
+ System.setProperty(InvokerTransformer.DESERIALIZE, "true");
+
+ InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
+ byte[] data = serialize(transformer);
+ Assert.assertNotNull(data);
+ try {
+ Object obj = deserialize(data);
+ Assert.assertTrue(obj instanceof InvokerTransformer);
+ } catch (UnsupportedOperationException ex) {
+ fail("de-serialization of InvokerTransformer should be enabled");
+ }
+
+ System.clearProperty(InvokerTransformer.DESERIALIZE);
+ }
+
+ private byte[] serialize(InvokerTransformer transformer) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+
+ oos.writeObject(transformer);
+ oos.close();
+
+ return baos.toByteArray();
+ }
+
+ private Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
+ ByteArrayInputStream bais = new ByteArrayInputStream(data);
+ ObjectInputStream iis = new ObjectInputStream(bais);
+
+ return iis.readObject();
+ }
+
+}
[44/50] commons-collections git commit: Update for 3.2.2 for the Ant
build and web site.
Posted by ch...@apache.org.
Update for 3.2.2 for the Ant build and web site.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1714255 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/af8a30c2
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/af8a30c2
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/af8a30c2
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: af8a30c2087aab9e24d79d5bbda0497511c2120b
Parents: ad0f9fa
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Nov 13 19:05:56 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Nov 13 19:05:56 2015 +0000
----------------------------------------------------------------------
build.xml | 2 +-
pom.xml | 2 +-
src/site/site.xml | 2 +-
xdocs/building.xml | 2 +-
xdocs/download_collections.xml | 24 +++++++++---------
xdocs/index.xml | 6 ++---
xdocs/navigation.xml | 2 +-
xdocs/release_3_2_2.xml | 50 +++++++++++++++++++++++++++++++++++++
8 files changed, 70 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index cb3c5d6..d6282d0 100644
--- a/build.xml
+++ b/build.xml
@@ -36,7 +36,7 @@
<property name="component.title.full" value="Apache Commons Collections"/>
<!-- The current version number of this component -->
- <property name="component.version" value="3.2.1"/>
+ <property name="component.version" value="3.2.2"/>
<!-- The base directory for component configuration files -->
<property name="source.conf" value="src/conf"/>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 537ace6..1aabaee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -381,7 +381,7 @@
<maven.compile.source>1.2</maven.compile.source>
<maven.compile.target>1.2</maven.compile.target>
<commons.componentid>collections</commons.componentid>
- <commons.release.version>3.2.1</commons.release.version>
+ <commons.release.version>3.2.2</commons.release.version>
<commons.rc.version>RC1</commons.rc.version>
<commons.binary.suffix>-bin</commons.binary.suffix>
<commons.jira.id>COLLECTIONS</commons.jira.id>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index a137c53..0ec7d90 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -28,7 +28,7 @@
<item name="Download" href="http://commons.apache.org/downloads/download_collections.cgi"/>
<item name="Users guide" href="/userguide.html"/>
<item name="History" href="/history.html"/>
- <item name="Javadoc (3.2.1 release)" href="api-release/index.html"/>
+ <item name="Javadoc (3.2.2 release)" href="api-release/index.html"/>
</menu>
<menu name="Development">
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/xdocs/building.xml
----------------------------------------------------------------------
diff --git a/xdocs/building.xml b/xdocs/building.xml
index 32e28ed..6f0fd01 100644
--- a/xdocs/building.xml
+++ b/xdocs/building.xml
@@ -29,7 +29,7 @@ limitations under the License.
is used for site generation.
</p>
<p>
- You may also be interested in the <a href="release_3_2_1.html">v3.2.1 release notes</a>.
+ You may also be interested in the <a href="release_3_2_2.html">v3.2.2 release notes</a>.
</p>
</section>
<!-- ================================================== -->
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/xdocs/download_collections.xml
----------------------------------------------------------------------
diff --git a/xdocs/download_collections.xml b/xdocs/download_collections.xml
index cc67f38..bca7294 100644
--- a/xdocs/download_collections.xml
+++ b/xdocs/download_collections.xml
@@ -102,17 +102,17 @@ limitations under the License.
<ul class="downloads">
<li class="group"><div class="links"><span class="label">Binary</span></div>
<ul>
- <li class="download"><a href="[preferred]/commons/collections/binaries/commons-collections-3.2.1-bin.tar.gz">3.2.1.tar.gz</a>
+ <li class="download"><a href="[preferred]/commons/collections/binaries/commons-collections-3.2.2-bin.tar.gz">3.2.2.tar.gz</a>
<ul class="attributes">
- <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.1-bin.tar.gz.md5">md5</a>]</span>
- <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.1-bin.tar.gz.asc">pgp</a>]</span>
+ <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.2-bin.tar.gz.md5">md5</a>]</span>
+ <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.2-bin.tar.gz.asc">pgp</a>]</span>
</li>
</ul>
</li>
- <li class="download"><a href="[preferred]/commons/collections/binaries/commons-collections-3.2.1-bin.zip">3.2.1.zip</a>
+ <li class="download"><a href="[preferred]/commons/collections/binaries/commons-collections-3.2.2-bin.zip">3.2.2.zip</a>
<ul class="attributes">
- <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.1-bin.zip.md5">md5</a>]</span>
- <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.1-bin.zip.asc">pgp</a>]</span>
+ <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.2-bin.zip.md5">md5</a>]</span>
+ <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/binaries/commons-collections-3.2.2-bin.zip.asc">pgp</a>]</span>
</li>
</ul>
</li>
@@ -120,17 +120,17 @@ limitations under the License.
</li>
<li class="group"><div class="links"><span class="label">Source</span></div>
<ul>
- <li class="download"><a href="[preferred]/commons/collections/source/commons-collections-3.2.1-src.tar.gz">3.2.1.tar.gz</a>
+ <li class="download"><a href="[preferred]/commons/collections/source/commons-collections-3.2.2-src.tar.gz">3.2.2.tar.gz</a>
<ul class="attributes">
- <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.1-src.tar.gz.md5">md5</a>]</span>
- <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.1-src.tar.gz.asc">pgp</a>]</span>
+ <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.2-src.tar.gz.md5">md5</a>]</span>
+ <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.2-src.tar.gz.asc">pgp</a>]</span>
</li>
</ul>
</li>
- <li class="download"><a href="[preferred]/commons/collections/source/commons-collections-3.2.1-src.zip">3.2.1.zip</a>
+ <li class="download"><a href="[preferred]/commons/collections/source/commons-collections-3.2.2-src.zip">3.2.2.zip</a>
<ul class="attributes">
- <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.1-src.zip.md5">md5</a>]</span>
- <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.1-src.zip.asc">pgp</a>]</span>
+ <li><span class="md5">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.2-src.zip.md5">md5</a>]</span>
+ <span class="pgp">[<a href="http://www.apache.org/dist/commons/collections/source/commons-collections-3.2.2-src.zip.asc">pgp</a>]</span>
</li>
</ul>
</li>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/xdocs/index.xml
----------------------------------------------------------------------
diff --git a/xdocs/index.xml b/xdocs/index.xml
index eec03d5..dc670aa 100644
--- a/xdocs/index.xml
+++ b/xdocs/index.xml
@@ -60,7 +60,7 @@ as are various <a href="maven-reports.html">project reports</a>.
The JavaDoc API documents are available online:
</p>
<ul>
-<li>The <a href="api-release/index.html">current release 3.2.1</a></li>
+<li>The <a href="api-release/index.html">current release 3.2.2</a></li>
<li>The latest 2.x release - <a href="api-2.1.1/index.html">version 2.1.1</a></li>
<li>The <a href="apidocs/index.html">latest SVN</a></li>
</ul>
@@ -72,9 +72,9 @@ The <a href="cvs-usage.html">subversion repository</a> can be
<!-- ================================================== -->
<section name="Releases">
<p>
-The latest version is v3.2.1 -
+The latest version is v3.2.2 -
<a href="http://commons.apache.org/downloads/download_collections.cgi">Download now!</a><br />
-The <a href="release_3_2_1.html">release notes</a> are also available.
+The <a href="release_3_2_2.html">release notes</a> are also available.
</p>
<p>
For previous releases, see the <a href="http://archive.apache.org/dist/commons/collections/">Apache Archive</a>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/xdocs/navigation.xml
----------------------------------------------------------------------
diff --git a/xdocs/navigation.xml b/xdocs/navigation.xml
index 6db2b1a..52769e7 100644
--- a/xdocs/navigation.xml
+++ b/xdocs/navigation.xml
@@ -30,7 +30,7 @@
<item name="Download" href="http://commons.apache.org/downloads/download_collections.cgi"/>
<item name="User guide" href="/userguide.html"/>
<item name="History" href="/history.html"/>
- <item name="Javadoc (3.2.1 release)" href="api-release/index.html"/>
+ <item name="Javadoc (3.2.2 release)" href="api-release/index.html"/>
</menu>
<menu name="Development">
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/af8a30c2/xdocs/release_3_2_2.xml
----------------------------------------------------------------------
diff --git a/xdocs/release_3_2_2.xml b/xdocs/release_3_2_2.xml
new file mode 100644
index 0000000..da8ffff
--- /dev/null
+++ b/xdocs/release_3_2_2.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<document>
+ <properties>
+ <title>Release notes for v3.2.2</title>
+ <author email="dev@commons.apache.org">Commons Documentation Team</author>
+ </properties>
+<body>
+
+<section name="Release notes for v3.2.2">
+<p>
+These are the release notes for Commons Collections v3.2.2:
+</p>
+<hr />
+<p>
+Commons collections is a project to develop and maintain collection classes
+based on and inspired by the JDK collection framework.
+This project is JDK 1.2 compatible, and does not use JDK 1.5 generics.
+</p>
+<p>
+This v3.2.2 release is a security and bug fix release.
+</p>
+<hr />
+
+<center><h3>COMPATIBILITY</h3></center>
+<p>
+This release is fully source and binary compatible with v3.2. For changes since the
+v3.1 see the <a href="release_3_2.html">v3.2 Release Notes</a>. Note that the method
+'protected java.util.Set createSetBasedOnList(java.util.Set, java.util.List)' has been
+added
+</p>
+</section>
+
+</body>
+</document>
[39/50] commons-collections git commit: Move PrototypeFactory tests
to new TestPrototypeFactory test.
Posted by ch...@apache.org.
Move PrototypeFactory tests to new TestPrototypeFactory test.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713854 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/c2413184
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/c2413184
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/c2413184
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: c2413184717c83d0a39a93dc9b270d9172af9231
Parents: 7533540
Author: Thomas Neidhart <tn...@apache.org>
Authored: Wed Nov 11 14:40:21 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Wed Nov 11 14:40:21 2015 +0000
----------------------------------------------------------------------
.../commons/collections/TestFactoryUtils.java | 62 ----------
.../functors/TestPrototypeFactory.java | 122 +++++++++++++++++++
2 files changed, 122 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c2413184/src/test/org/apache/commons/collections/TestFactoryUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestFactoryUtils.java b/src/test/org/apache/commons/collections/TestFactoryUtils.java
index e1b8f89..51dce4a 100644
--- a/src/test/org/apache/commons/collections/TestFactoryUtils.java
+++ b/src/test/org/apache/commons/collections/TestFactoryUtils.java
@@ -129,68 +129,6 @@ public class TestFactoryUtils extends junit.framework.TestCase {
assertSame(ConstantFactory.NULL_INSTANCE, FactoryUtils.prototypeFactory(null));
}
- public void testPrototypeFactoryPublicCloneMethod() throws Exception {
- Date proto = new Date();
- Factory factory = FactoryUtils.prototypeFactory(proto);
- assertNotNull(factory);
- Object created = factory.create();
- assertTrue(proto != created);
- assertEquals(proto, created);
-
- // check serialisation works
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
- out.writeObject(factory);
- out.close();
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
- in.close();
- }
-
- public void testPrototypeFactoryPublicCopyConstructor() throws Exception {
- Mock1 proto = new Mock1(6);
- Factory factory = FactoryUtils.prototypeFactory(proto);
- assertNotNull(factory);
- Object created = factory.create();
- assertTrue(proto != created);
- assertEquals(proto, created);
-
- // check serialisation works
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
- try {
- out.writeObject(factory);
- } catch (NotSerializableException ex) {
- out.close();
- }
- factory = FactoryUtils.prototypeFactory(new Mock2("S"));
- buffer = new ByteArrayOutputStream();
- out = new ObjectOutputStream(buffer);
- out.writeObject(factory);
- out.close();
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
- in.close();
- }
-
- public void testPrototypeFactoryPublicSerialization() throws Exception {
- Integer proto = new Integer(9);
- Factory factory = FactoryUtils.prototypeFactory(proto);
- assertNotNull(factory);
- Object created = factory.create();
- assertTrue(proto != created);
- assertEquals(proto, created);
-
- // check serialisation works
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
- out.writeObject(factory);
- out.close();
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
- in.close();
- }
-
public void testPrototypeFactoryPublicSerializationError() {
Mock2 proto = new Mock2(new Object());
Factory factory = FactoryUtils.prototypeFactory(proto);
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c2413184/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
index 1ac51e4..3701b04 100644
--- a/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
+++ b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
@@ -16,9 +16,17 @@
*/
package org.apache.commons.collections.functors;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Date;
import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.FactoryUtils;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -46,4 +54,118 @@ public class TestPrototypeFactory extends AbstractTestSerialization {
return Factory.class;
}
+ // ------------------------------------------------------------------------
+
+ public void testPrototypeFactoryPublicCloneMethod() throws Exception {
+ Date proto = new Date();
+ Factory factory = PrototypeFactory.getInstance(proto);
+ assertNotNull(factory);
+ Object created = factory.create();
+ assertTrue(proto != created);
+ assertEquals(proto, created);
+
+ // check serialisation works - if enabled
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "true");
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(buffer);
+ out.writeObject(factory);
+ out.close();
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ Object dest = in.readObject();
+ in.close();
+ } finally {
+ System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ }
+ }
+
+ public void testPrototypeFactoryPublicCopyConstructor() throws Exception {
+ Mock1 proto = new Mock1(6);
+ Factory factory = PrototypeFactory.getInstance(proto);
+ assertNotNull(factory);
+ Object created = factory.create();
+ assertTrue(proto != created);
+ assertEquals(proto, created);
+
+ // check serialisation works - if enabled
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "true");
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(buffer);
+ try {
+ out.writeObject(factory);
+ } catch (NotSerializableException ex) {
+ out.close();
+ }
+ factory = FactoryUtils.prototypeFactory(new Mock2("S"));
+ buffer = new ByteArrayOutputStream();
+ out = new ObjectOutputStream(buffer);
+ out.writeObject(factory);
+ out.close();
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ Object dest = in.readObject();
+ in.close();
+ } finally {
+ System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ }
+ }
+
+ public void testPrototypeFactoryPublicSerialization() throws Exception {
+ Integer proto = new Integer(9);
+ Factory factory = FactoryUtils.prototypeFactory(proto);
+ assertNotNull(factory);
+ Object created = factory.create();
+ assertTrue(proto != created);
+ assertEquals(proto, created);
+
+ // check serialisation works - if enabled
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "true");
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(buffer);
+ out.writeObject(factory);
+ out.close();
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ Object dest = in.readObject();
+ in.close();
+ } finally {
+ System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+
+ private static class Mock1 {
+ private final int iVal;
+ public Mock1(int val) {
+ iVal = val;
+ }
+ public Mock1(Mock1 mock) {
+ iVal = mock.iVal;
+ }
+ public boolean equals(Object obj) {
+ if (obj instanceof Mock1) {
+ if (iVal == ((Mock1) obj).iVal) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ private static class Mock2 implements Serializable {
+ private final Object iVal;
+ public Mock2(Object val) {
+ iVal = val;
+ }
+ public boolean equals(Object obj) {
+ if (obj instanceof Mock2) {
+ if (iVal == ((Mock2) obj).iVal) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
}
[40/50] commons-collections git commit: Update NOTICE.txt with
currenty year.
Posted by ch...@apache.org.
Update NOTICE.txt with currenty year.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713878 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/8377f587
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/8377f587
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/8377f587
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 8377f587ed364cf7fdda8092bf43addeebaabfda
Parents: c241318
Author: Thomas Neidhart <tn...@apache.org>
Authored: Wed Nov 11 15:45:09 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Wed Nov 11 15:45:09 2015 +0000
----------------------------------------------------------------------
NOTICE.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8377f587/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index a9e0fff..ab8f9cc 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
Apache Commons Collections
-Copyright 2001-2008 The Apache Software Foundation
+Copyright 2001-2015 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
[24/50] commons-collections git commit: Add missing AL header.
Posted by ch...@apache.org.
Add missing AL header.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713540 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/78c2d678
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/78c2d678
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/78c2d678
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 78c2d67826d2231f94e941d50a2fb2bea4e8ba8c
Parents: f526e49
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:20:49 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:20:49 2015 +0000
----------------------------------------------------------------------
.../functors/TestInvokerTransformer.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/78c2d678/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
index 4b48a59..883f504 100644
--- a/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
+++ b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.commons.collections.functors;
import java.io.ByteArrayInputStream;
[07/50] commons-collections git commit: Backport COLLECTIONS-266 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-266 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713176 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/fd179052
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/fd179052
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/fd179052
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: fd1790522e7dbb407dc281eab2d79c088d43362e
Parents: 3afb3cb
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 20:53:57 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 20:53:57 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 6 +--
.../commons/collections/keyvalue/MultiKey.java | 38 ++++++++++----
.../collections/keyvalue/TestMultiKey.java | 55 +++++++++++++++++++-
3 files changed, 86 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/fd179052/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e06564d..0612b0f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -26,6 +26,9 @@
<action issue="COLLECTIONS-335" dev="jochen" type="fix" due-to="sebb">
Fixed cache assignment for "TreeBidiMap#entrySet".
</action>
+ <action issue="COLLECTIONS-266" dev="bayard" type="fix" due-to="Joerg Schaible">
+ "MultiKey" will now be correctly serialized/de-serialized.
+ </action>
<action issue="COLLECTIONS-249" dev="bayard" type="fix" due-to="Joe Kelly">
"SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
provided index.
@@ -75,9 +78,6 @@
"CaseInsensitiveMap" will now convert input strings to lower-case in a
locale-independant manner.
</action>
- <action issue="COLLECTIONS-266" dev="bayard" type="fix" due-to="Joerg Schaible">
- "MultiKey" will now be correctly serialized/de-serialized.
- </action>
<action issue="COLLECTIONS-261" dev="bayard" type="fix" due-to="ori">
"Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
if the size of the map is less or equal 3.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/fd179052/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java b/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
index 7368443..1d9ab35 100644
--- a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
+++ b/src/java/org/apache/commons/collections/keyvalue/MultiKey.java
@@ -54,7 +54,7 @@ public class MultiKey implements Serializable {
/** The individual keys */
private final Object[] keys;
/** The cached hashCode */
- private final int hashCode;
+ private transient int hashCode;
/**
* Constructor taking two keys.
@@ -163,14 +163,8 @@ public class MultiKey implements Serializable {
} else {
this.keys = keys;
}
-
- int total = 0;
- for (int i = 0; i < keys.length; i++) {
- if (keys[i] != null) {
- total ^= keys[i].hashCode();
- }
- }
- hashCode = total;
+
+ calculateHashCode(keys);
}
//-----------------------------------------------------------------------
@@ -255,4 +249,30 @@ public class MultiKey implements Serializable {
return "MultiKey" + Arrays.asList(keys).toString();
}
+ /**
+ * Calculate the hash code of the instance using the provided keys.
+ *
+ * @param keys
+ */
+ private void calculateHashCode(Object[] keys) {
+ int total = 0;
+ for (int i = 0; i < keys.length; i++) {
+ if (keys[i] != null) {
+ total ^= keys[i].hashCode();
+ }
+ }
+ hashCode = total;
+ }
+
+ /**
+ * Recalculate the hash code after deserialization.
+ * The hash code of some keys might have change (hash codes based
+ * on the system hash code are only stable for the same process).
+ *
+ * @return the instance with recalculated hash code
+ */
+ private Object readResolve() {
+ calculateHashCode(keys);
+ return this;
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/fd179052/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
index 316a784..f4704d2 100644
--- a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
+++ b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
@@ -16,7 +16,15 @@
*/
package org.apache.commons.collections.keyvalue;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import junit.framework.Assert;
import junit.framework.Test;
@@ -205,5 +213,50 @@ public class TestMultiKey extends TestCase {
Assert.assertTrue(mk1.equals("") == false);
Assert.assertTrue(mk1.equals(null) == false);
}
-
+
+ static class SystemHashCodeSimulatingKey implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private final String name;
+ private int hashCode = 1;
+
+ public SystemHashCodeSimulatingKey(String name) {
+ this.name = name;
+ }
+
+ public boolean equals(Object obj) {
+ return obj instanceof SystemHashCodeSimulatingKey
+ && name.equals(((SystemHashCodeSimulatingKey) obj).name);
+ }
+
+ public int hashCode() {
+ return hashCode;
+ }
+
+ private Object readResolve() {
+ hashCode = 2; // simulate different hashCode after deserialization in another process
+ return this;
+ }
+ }
+
+ public void testEqualsAfterSerialization() throws IOException, ClassNotFoundException {
+ SystemHashCodeSimulatingKey sysKey = new SystemHashCodeSimulatingKey("test");
+ MultiKey mk = new MultiKey(ONE, sysKey);
+ Map map = new HashMap();
+ map.put(mk, TWO);
+ // serialize
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(baos);
+ out.writeObject(sysKey);
+ out.writeObject(map);
+ out.close();
+ // deserialize
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream in = new ObjectInputStream(bais);
+ sysKey = (SystemHashCodeSimulatingKey) in.readObject(); // simulate deserialization in another process
+ Map map2 = (Map) in.readObject();
+ in.close();
+ assertEquals(2, sysKey.hashCode()); // different hashCode now
+ MultiKey mk2 = new MultiKey(ONE, sysKey);
+ assertEquals(TWO, map2.get(mk2));
+ }
}
[27/50] commons-collections git commit: Update component name:
include Apache.
Posted by ch...@apache.org.
Update component name: include Apache.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713549 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/3d997354
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/3d997354
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/3d997354
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 3d997354aeb9dc0e8a073cc3c6d51a3408358239
Parents: b56c25a
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:43:02 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:43:02 2015 +0000
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3d997354/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cef7bd0..79bb2fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2-SNAPSHOT</version>
- <name>Commons Collections</name>
+ <name>Apache Commons Collections</name>
<inceptionYear>2001</inceptionYear>
<description>Types that extend and augment the Java Collections Framework.</description>
[05/50] commons-collections git commit: Backport COLLECTIONS-335 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-335 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713173 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/98762430
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/98762430
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/98762430
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 9876243087c38d583924cab592a705967860f67b
Parents: 16b1e26
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 20:31:09 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 20:31:09 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 6 +++---
.../org/apache/commons/collections/bidimap/TreeBidiMap.java | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/98762430/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f278a9d..69031da 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,6 +23,9 @@
<release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+ <action issue="COLLECTIONS-335" dev="jochen" type="fix" due-to="sebb">
+ Fixed cache assignment for "TreeBidiMap#entrySet".
+ </action>
<action issue="COLLECTIONS-249" dev="bayard" type="fix" due-to="Joe Kelly">
"SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
provided index.
@@ -51,9 +54,6 @@
<action issue="COLLECTIONS-350" dev="bayard" type="fix" due-to="Michael Akerman">
Removed debug output in "MapUtils#getNumber(Map)".
</action>
- <action issue="COLLECTIONS-335" dev="jochen" type="fix" due-to="sebb">
- Fixed cache assignment for "TreeBidiMap#entrySet".
- </action>
<action issue="COLLECTIONS-334" dev="jochen" type="fix" due-to="sebb">
Synchronized access to lock in "StaticBucketMap#size()".
</action>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/98762430/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java b/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
index 0a630af..ee42540 100644
--- a/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
+++ b/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
@@ -392,7 +392,7 @@ public class TreeBidiMap implements OrderedBidiMap {
*/
public Set entrySet() {
if (entrySet == null) {
- return new EntryView(this, KEY, MAPENTRY);
+ entrySet = new EntryView(this, KEY, MAPENTRY);
}
return entrySet;
}
[19/50] commons-collections git commit: Remove planned fixes as they
seem to be non-critical.
Posted by ch...@apache.org.
Remove planned fixes as they seem to be non-critical.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713535 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/74037186
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/74037186
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/74037186
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 7403718668df80f5d04b789b6f16f09572159226
Parents: 1642b00
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 20:49:17 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 20:49:17 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 7 -------
1 file changed, 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/74037186/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 158880f..6656de6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -88,13 +88,6 @@
Tree traversal with a TreeListIterator will not be affected anymore by
the removal of an element directly after a call to previous().
</action>
- <action issue="COLLECTIONS-359" dev="bayard" type="fix" due-to="Mark Shead">
- "ListUtils#intersection(List, List)" will now also work correctly if there
- are duplicate elements in the provided lists.
- </action>
- <action issue="COLLECTIONS-330" dev="mbenson" type="fix" due-to="Joerg Schaible">
- "LRUMap#keySet()#remove(Object)" will not throw a "ConcurrentModificationException" anymore.
- </action>
-->
</release>
</body>
[36/50] commons-collections git commit: [COLLECTIONS-580] Improve fix
applied to InvokerTransformer and also apply it for other classes which are
considered to be unsafe, improve tests.
Posted by ch...@apache.org.
[COLLECTIONS-580] Improve fix applied to InvokerTransformer and also apply it for other classes which are considered to be unsafe, improve tests.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713845 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/bce4d022
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/bce4d022
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/bce4d022
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: bce4d022f27a723fa0e0b7484dcbf0afa2dd210a
Parents: 52ccd2c
Author: Thomas Neidhart <tn...@apache.org>
Authored: Wed Nov 11 14:02:16 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Wed Nov 11 14:02:16 2015 +0000
----------------------------------------------------------------------
.../collections/functors/CloneTransformer.java | 32 ++++-
.../collections/functors/ForClosure.java | 33 ++++-
.../collections/functors/FunctorUtils.java | 35 ++++++
.../functors/InstantiateFactory.java | 35 +++++-
.../functors/InstantiateTransformer.java | 33 ++++-
.../functors/InvokerTransformer.java | 46 +++----
.../collections/functors/WhileClosure.java | 33 ++++-
.../commons/collections/functors/package.html | 28 +++++
.../commons/collections/TestAllPackages.java | 1 +
.../functors/AbstractTestSerialization.java | 120 +++++++++++++++++++
.../commons/collections/functors/TestAll.java | 48 ++++++++
.../functors/TestCloneTransformer.java | 45 +++++++
.../collections/functors/TestForClosure.java | 45 +++++++
.../functors/TestInstantiateFactory.java | 45 +++++++
.../functors/TestInstantiateTransformer.java | 45 +++++++
.../functors/TestInvokerTransformer.java | 60 +---------
.../collections/functors/TestWhileClosure.java | 45 +++++++
17 files changed, 637 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/CloneTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/CloneTransformer.java b/src/java/org/apache/commons/collections/functors/CloneTransformer.java
index 6334911..5b4df19 100644
--- a/src/java/org/apache/commons/collections/functors/CloneTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/CloneTransformer.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.collections.functors;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.apache.commons.collections.Transformer;
@@ -24,7 +27,17 @@ import org.apache.commons.collections.Transformer;
* Transformer implementation that returns a clone of the input object.
* <p>
* Clone is performed using <code>PrototypeFactory.getInstance(input).create()</code>.
- *
+ * <p>
+ * <b>WARNING:</b> from v3.2.2 onwards this class will throw an
+ * {@link UnsupportedOperationException} when trying to serialize or
+ * de-serialize an instance to prevent potential remote code execution exploits.
+ * <p>
+ * In order to re-enable serialization support for {@code CloneTransformer}
+ * the following system property can be used (via -Dproperty=true):
+ * <pre>
+ * org.apache.commons.collections.enableUnsafeSerialization
+ * </pre>
+ *
* @since Commons Collections 3.0
* @version $Revision$ $Date$
*
@@ -68,4 +81,21 @@ public class CloneTransformer implements Transformer, Serializable {
return PrototypeFactory.getInstance(input).create();
}
+ /**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(CloneTransformer.class);
+ os.defaultWriteObject();
+ }
+
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ FunctorUtils.checkUnsafeSerialization(CloneTransformer.class);
+ is.defaultReadObject();
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/ForClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/ForClosure.java b/src/java/org/apache/commons/collections/functors/ForClosure.java
index 8e6ec14..5febf0d 100644
--- a/src/java/org/apache/commons/collections/functors/ForClosure.java
+++ b/src/java/org/apache/commons/collections/functors/ForClosure.java
@@ -16,13 +16,26 @@
*/
package org.apache.commons.collections.functors;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.apache.commons.collections.Closure;
/**
* Closure implementation that calls another closure n times, like a for loop.
- *
+ * <p>
+ * <b>WARNING:</b> from v3.2.2 onwards this class will throw an
+ * {@link UnsupportedOperationException} when trying to serialize or
+ * de-serialize an instance to prevent potential remote code execution exploits.
+ * <p>
+ * In order to re-enable serialization support for {@code ForClosure}
+ * the following system property can be used (via -Dproperty=true):
+ * <pre>
+ * org.apache.commons.collections.enableUnsafeSerialization
+ * </pre>
+ *
* @since Commons Collections 3.0
* @version $Revision$ $Date$
*
@@ -102,4 +115,22 @@ public class ForClosure implements Closure, Serializable {
return iCount;
}
+ /**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(ForClosure.class);
+ os.defaultWriteObject();
+ }
+
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ FunctorUtils.checkUnsafeSerialization(ForClosure.class);
+ is.defaultReadObject();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/FunctorUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/FunctorUtils.java b/src/java/org/apache/commons/collections/functors/FunctorUtils.java
index 78f357e..30fc800 100644
--- a/src/java/org/apache/commons/collections/functors/FunctorUtils.java
+++ b/src/java/org/apache/commons/collections/functors/FunctorUtils.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.collections.functors;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Collection;
import java.util.Iterator;
@@ -34,6 +36,10 @@ import org.apache.commons.collections.Transformer;
*/
class FunctorUtils {
+ /** System property key to enable unsafe serialization */
+ final static String UNSAFE_SERIALIZABLE_PROPERTY
+ = "org.apache.commons.collections.enableUnsafeSerialization";
+
/**
* Restricted constructor.
*/
@@ -152,4 +158,33 @@ class FunctorUtils {
}
}
+ /**
+ * Package-private helper method to check if serialization support is
+ * enabled for unsafe classes.
+ *
+ * @param clazz the clazz to check for serialization support
+ * @throws UnsupportedOperationException if unsafe serialization is disabled
+ */
+ static void checkUnsafeSerialization(Class clazz) {
+ String unsafeSerializableProperty;
+
+ try {
+ unsafeSerializableProperty =
+ (String) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty(UNSAFE_SERIALIZABLE_PROPERTY);
+ }
+ });
+ } catch (SecurityException ex) {
+ unsafeSerializableProperty = null;
+ }
+
+ if (!"true".equalsIgnoreCase(unsafeSerializableProperty)) {
+ throw new UnsupportedOperationException(
+ "Serialization support for " + clazz.getName() + " is disabled for security reasons. " +
+ "To enable it set system property '" + UNSAFE_SERIALIZABLE_PROPERTY + "' to 'true', " +
+ "but you must ensure that your application does not de-serialize objects from untrusted sources.");
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java b/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
index 5031044..4320aaa 100644
--- a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
+++ b/src/java/org/apache/commons/collections/functors/InstantiateFactory.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.collections.functors;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -25,7 +28,17 @@ import org.apache.commons.collections.FunctorException;
/**
* Factory implementation that creates a new object instance by reflection.
- *
+ * <p>
+ * <b>WARNING:</b> from v3.2.2 onwards this class will throw an
+ * {@link UnsupportedOperationException} when trying to serialize or
+ * de-serialize an instance to prevent potential remote code execution exploits.
+ * <p>
+ * In order to re-enable serialization support for {@code InstantiateTransformer}
+ * the following system property can be used (via -Dproperty=true):
+ * <pre>
+ * org.apache.commons.collections.enableUnsafeSerialization
+ * </pre>
+ *
* @since Commons Collections 3.0
* @version $Revision$ $Date$
*
@@ -136,5 +149,23 @@ public class InstantiateFactory implements Factory, Serializable {
throw new FunctorException("InstantiateFactory: Constructor threw an exception", ex);
}
}
-
+
+ /**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(InstantiateFactory.class);
+ os.defaultWriteObject();
+ }
+
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ FunctorUtils.checkUnsafeSerialization(InstantiateFactory.class);
+ is.defaultReadObject();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
index e5abc21..e809f50 100644
--- a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.collections.functors;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -25,7 +28,17 @@ import org.apache.commons.collections.Transformer;
/**
* Transformer implementation that creates a new object instance by reflection.
- *
+ * <p>
+ * <b>WARNING:</b> from v3.2.2 onwards this class will throw an
+ * {@link UnsupportedOperationException} when trying to serialize or
+ * de-serialize an instance to prevent potential remote code execution exploits.
+ * <p>
+ * In order to re-enable serialization support for {@code InstantiateTransformer}
+ * the following system property can be used (via -Dproperty=true):
+ * <pre>
+ * org.apache.commons.collections.enableUnsafeSerialization
+ * </pre>
+ *
* @since Commons Collections 3.0
* @version $Revision$ $Date$
*
@@ -116,4 +129,22 @@ public class InstantiateTransformer implements Transformer, Serializable {
}
}
+ /**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(InstantiateTransformer.class);
+ os.defaultWriteObject();
+ }
+
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ FunctorUtils.checkUnsafeSerialization(InstantiateTransformer.class);
+ is.defaultReadObject();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
index 580a229..49cc953 100644
--- a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
@@ -22,8 +22,6 @@ import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import org.apache.commons.collections.FunctorException;
import org.apache.commons.collections.Transformer;
@@ -32,14 +30,13 @@ import org.apache.commons.collections.Transformer;
* Transformer implementation that creates a new object instance by reflection.
* <p>
* <b>WARNING:</b> from v3.2.2 onwards this class will throw an
- * {@link UnsupportedOperationException} when trying to de-serialize an
- * instance from a {@link ObjectOutputStream} to prevent potential
- * remote code execution exploits.
+ * {@link UnsupportedOperationException} when trying to serialize or
+ * de-serialize an instance to prevent potential remote code execution exploits.
* <p>
- * In order to re-enable de-serialization of {@code InvokerTransformer}
- * instances, the following system property can be used (via -Dproperty=true):
+ * In order to re-enable serialization support for {@code InvokerTransformer}
+ * the following system property can be used (via -Dproperty=true):
* <pre>
- * org.apache.commons.collections.invokertransformer.enableDeserialization
+ * org.apache.commons.collections.enableUnsafeSerialization
* </pre>
*
* @since Commons Collections 3.0
@@ -52,10 +49,6 @@ public class InvokerTransformer implements Transformer, Serializable {
/** The serial version */
private static final long serialVersionUID = -8653385846894047688L;
- /** System property key to enable de-serialization */
- public final static String DESERIALIZE
- = "org.apache.commons.collections.invokertransformer.enableDeserialization";
-
/** The method name to call */
private final String iMethodName;
/** The array of reflection parameter types */
@@ -155,29 +148,20 @@ public class InvokerTransformer implements Transformer, Serializable {
}
/**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(InvokerTransformer.class);
+ os.defaultWriteObject();
+ }
+
+ /**
* Overrides the default readObject implementation to prevent
* de-serialization (see COLLECTIONS-580).
*/
private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
- String deserializeProperty;
-
- try {
- deserializeProperty =
- (String) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(DESERIALIZE);
- }
- });
- } catch (SecurityException ex) {
- deserializeProperty = null;
- }
-
- if (!"true".equalsIgnoreCase(deserializeProperty)) {
- throw new UnsupportedOperationException(
- "Deserialization of InvokerTransformer is disabled for security reasons. " +
- "To re-enable it set system property '" + DESERIALIZE + "' to 'true'");
- }
-
+ FunctorUtils.checkUnsafeSerialization(InvokerTransformer.class);
is.defaultReadObject();
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/WhileClosure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/WhileClosure.java b/src/java/org/apache/commons/collections/functors/WhileClosure.java
index 0d897dd..9e33a04 100644
--- a/src/java/org/apache/commons/collections/functors/WhileClosure.java
+++ b/src/java/org/apache/commons/collections/functors/WhileClosure.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.collections.functors;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.apache.commons.collections.Closure;
@@ -24,7 +27,17 @@ import org.apache.commons.collections.Predicate;
/**
* Closure implementation that executes a closure repeatedly until a condition is met,
* like a do-while or while loop.
- *
+ * <p>
+ * <b>WARNING:</b> from v3.2.2 onwards this class will throw an
+ * {@link UnsupportedOperationException} when trying to serialize or
+ * de-serialize an instance to prevent potential remote code execution exploits.
+ * <p>
+ * In order to re-enable serialization support for {@code WhileClosure}
+ * the following system property can be used (via -Dproperty=true):
+ * <pre>
+ * org.apache.commons.collections.enableUnsafeSerialization
+ * </pre>
+ *
* @since Commons Collections 3.0
* @version $Revision$ $Date$
*
@@ -120,4 +133,22 @@ public class WhileClosure implements Closure, Serializable {
return iDoLoop;
}
+ /**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(WhileClosure.class);
+ os.defaultWriteObject();
+ }
+
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ FunctorUtils.checkUnsafeSerialization(WhileClosure.class);
+ is.defaultReadObject();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/java/org/apache/commons/collections/functors/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/package.html b/src/java/org/apache/commons/collections/functors/package.html
index 7139fee..d73ee62 100644
--- a/src/java/org/apache/commons/collections/functors/package.html
+++ b/src/java/org/apache/commons/collections/functors/package.html
@@ -24,4 +24,32 @@ This package contains implementations of the
{@link org.apache.commons.collections.Factory Factory} interfaces.
These provide simple callbacks for processing with collections.
</p>
+<p>
+<b>WARNING:</b> from v3.2.2 onwards this several classes in this package will
+throw an {@link UnsupportedOperationException} when trying to serialize or
+de-serialize an instance to prevent potential remote code execution exploits.
+</p>
+<p>
+Classes considered to be unsafe are:
+</p>
+<ul>
+ <li>CloneTransformer</li>
+ <li>ForClosure</li>
+ <li>InstantiateFactory</li>
+ <li>InstantiateTransformer</li>
+ <li>InvokerTransformer</li>
+ <li>WhileClosure</li>
+</ul>
+<p>
+In order to re-enable serialization support for these unsafe classes, the
+following system property can be used (via -Dproperty=true):
+<pre>
+org.apache.commons.collections.enableUnsafeSerialization
+</pre>
+<p>
+Be warned though that enabling serialization support for these unsafe classes
+makes your application vulnerable to known exploits and you must ensure that
+your application does not de-serialize objects from untrusted sources.
+</p>
+
</BODY>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/TestAllPackages.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestAllPackages.java b/src/test/org/apache/commons/collections/TestAllPackages.java
index f081862..024f88f 100644
--- a/src/test/org/apache/commons/collections/TestAllPackages.java
+++ b/src/test/org/apache/commons/collections/TestAllPackages.java
@@ -40,6 +40,7 @@ public class TestAllPackages extends TestCase {
suite.addTest(org.apache.commons.collections.buffer.TestAll.suite());
suite.addTest(org.apache.commons.collections.collection.TestAll.suite());
suite.addTest(org.apache.commons.collections.comparators.TestAll.suite());
+ suite.addTest(org.apache.commons.collections.functors.TestAll.suite());
suite.addTest(org.apache.commons.collections.iterators.TestAll.suite());
suite.addTest(org.apache.commons.collections.keyvalue.TestAll.suite());
suite.addTest(org.apache.commons.collections.list.TestAll.suite());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java b/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java
new file mode 100644
index 0000000..cb41dea
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import junit.framework.Assert;
+
+import org.apache.commons.collections.BulkTest;
+
+/**
+ * Abstract test class for testing serialization support
+ * of the functor package.
+ */
+public abstract class AbstractTestSerialization extends BulkTest {
+
+ /**
+ * JUnit constructor.
+ *
+ * @param testName the test class name
+ */
+ public AbstractTestSerialization(String testName) {
+ super(testName);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implements the abstract superclass method to return the comparator.
+ *
+ * @return a full iterator
+ */
+ public abstract Object makeObject();
+
+ /**
+ * Returns the class being tested for serialization.
+ *
+ * @return the test class
+ */
+ public abstract Class getTestClass();
+
+ //-----------------------------------------------------------------------
+
+ public void testSerializationDisabled() throws Exception {
+ Assert.assertNull(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY));
+ Object object = makeObject();
+ try {
+ serialize(object);
+ fail("serialization of InvokerTransformer should be disabled by default");
+ } catch (UnsupportedOperationException ex) {
+ // expected
+ }
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "true");
+ byte[] data = serialize(object);
+ System.getProperties().remove(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ Assert.assertNull(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY));
+ Assert.assertNotNull(data);
+ try {
+ deserialize(data);
+ fail("de-serialization of " + getTestClass().getName() + " should be disabled by default");
+ } catch (UnsupportedOperationException ex) {
+ // expected
+ }
+ }
+
+ public void testSerializationEnabled() throws Exception {
+ Assert.assertNull(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY));
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "true");
+
+ try {
+ Object object = makeObject();
+ byte[] data = serialize(object);
+ Assert.assertNotNull(data);
+ try {
+ Object obj = deserialize(data);
+ Assert.assertTrue(getTestClass().isInstance(obj));
+ } catch (UnsupportedOperationException ex) {
+ fail("de-serialization of " + getTestClass().getName() + " should be enabled");
+ }
+ } finally {
+ System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ }
+ }
+
+ private byte[] serialize(Object object) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+
+ oos.writeObject(object);
+ oos.close();
+
+ return baos.toByteArray();
+ }
+
+ private Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
+ ByteArrayInputStream bais = new ByteArrayInputStream(data);
+ ObjectInputStream iis = new ObjectInputStream(bais);
+
+ return iis.readObject();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestAll.java b/src/test/org/apache/commons/collections/functors/TestAll.java
new file mode 100644
index 0000000..5337628
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestAll.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Entry point for all Functor tests.
+ */
+public class TestAll extends TestCase {
+
+ public TestAll(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.addTest(TestCloneTransformer.suite());
+ suite.addTest(TestForClosure.suite());
+ suite.addTest(TestInstantiateTransformer.suite());
+ suite.addTest(TestInstantiateFactory.suite());
+ suite.addTest(TestInvokerTransformer.suite());
+ suite.addTest(TestWhileClosure.suite());
+ return suite;
+ }
+
+ public static void main(String args[]) {
+ String[] testCaseName = { TestAll.class.getName() };
+ junit.textui.TestRunner.main(testCaseName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/TestCloneTransformer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestCloneTransformer.java b/src/test/org/apache/commons/collections/functors/TestCloneTransformer.java
new file mode 100644
index 0000000..7ba4da4
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestCloneTransformer.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestCloneTransformer extends AbstractTestSerialization {
+
+ // conventional
+ // ------------------------------------------------------------------------
+
+ public TestCloneTransformer(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestCloneTransformer.class);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public Object makeObject() {
+ return CloneTransformer.INSTANCE;
+ }
+
+ public Class getTestClass() {
+ return CloneTransformer.class;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/TestForClosure.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestForClosure.java b/src/test/org/apache/commons/collections/functors/TestForClosure.java
new file mode 100644
index 0000000..30bdf73
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestForClosure.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestForClosure extends AbstractTestSerialization {
+
+ // conventional
+ // ------------------------------------------------------------------------
+
+ public TestForClosure(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestForClosure.class);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public Object makeObject() {
+ return new ForClosure(10, NOPClosure.INSTANCE);
+ }
+
+ public Class getTestClass() {
+ return ForClosure.class;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/TestInstantiateFactory.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestInstantiateFactory.java b/src/test/org/apache/commons/collections/functors/TestInstantiateFactory.java
new file mode 100644
index 0000000..6d8476e
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestInstantiateFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestInstantiateFactory extends AbstractTestSerialization {
+
+ // conventional
+ // ------------------------------------------------------------------------
+
+ public TestInstantiateFactory(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestInstantiateFactory.class);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public Object makeObject() {
+ return new InstantiateFactory(String.class);
+ }
+
+ public Class getTestClass() {
+ return InstantiateFactory.class;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/TestInstantiateTransformer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestInstantiateTransformer.java b/src/test/org/apache/commons/collections/functors/TestInstantiateTransformer.java
new file mode 100644
index 0000000..25ee961
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestInstantiateTransformer.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestInstantiateTransformer extends AbstractTestSerialization {
+
+ // conventional
+ // ------------------------------------------------------------------------
+
+ public TestInstantiateTransformer(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestInstantiateTransformer.class);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public Object makeObject() {
+ return new InstantiateTransformer(new Class[0], new Object[0]);
+ }
+
+ public Class getTestClass() {
+ return InstantiateTransformer.class;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
index 883f504..e37e86a 100644
--- a/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
+++ b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
@@ -16,19 +16,10 @@
*/
package org.apache.commons.collections.functors;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import org.apache.commons.collections.BulkTest;
-
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
-public class TestInvokerTransformer extends BulkTest {
+public class TestInvokerTransformer extends AbstractTestSerialization {
// conventional
// ------------------------------------------------------------------------
@@ -43,53 +34,12 @@ public class TestInvokerTransformer extends BulkTest {
// ------------------------------------------------------------------------
- public void testSerializationDisabled() throws Exception {
- Assert.assertNull(System.getProperty(InvokerTransformer.DESERIALIZE));
- InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
- byte[] data = serialize(transformer);
- Assert.assertNotNull(data);
- try {
- deserialize(data);
- fail("de-serialization of InvokerTransformer should be disabled by default");
- } catch (UnsupportedOperationException ex) {
- // expected
- }
+ public Object makeObject() {
+ return new InvokerTransformer("toString", new Class[0], new Object[0]);
}
- public void testSerializationEnabled() throws Exception {
- Assert.assertNull(System.getProperty(InvokerTransformer.DESERIALIZE));
- System.setProperty(InvokerTransformer.DESERIALIZE, "true");
-
- try {
- InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
- byte[] data = serialize(transformer);
- Assert.assertNotNull(data);
- try {
- Object obj = deserialize(data);
- Assert.assertTrue(obj instanceof InvokerTransformer);
- } catch (UnsupportedOperationException ex) {
- fail("de-serialization of InvokerTransformer should be enabled");
- }
- } finally {
- System.clearProperty(InvokerTransformer.DESERIALIZE);
- }
- }
-
- private byte[] serialize(InvokerTransformer transformer) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
-
- oos.writeObject(transformer);
- oos.close();
-
- return baos.toByteArray();
- }
-
- private Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
- ByteArrayInputStream bais = new ByteArrayInputStream(data);
- ObjectInputStream iis = new ObjectInputStream(bais);
-
- return iis.readObject();
+ public Class getTestClass() {
+ return InvokerTransformer.class;
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bce4d022/src/test/org/apache/commons/collections/functors/TestWhileClosure.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestWhileClosure.java b/src/test/org/apache/commons/collections/functors/TestWhileClosure.java
new file mode 100644
index 0000000..4c6a317
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestWhileClosure.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestWhileClosure extends AbstractTestSerialization {
+
+ // conventional
+ // ------------------------------------------------------------------------
+
+ public TestWhileClosure(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestWhileClosure.class);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public Object makeObject() {
+ return new WhileClosure(FalsePredicate.INSTANCE, NOPClosure.INSTANCE, true);
+ }
+
+ public Class getTestClass() {
+ return WhileClosure.class;
+ }
+
+}
[04/50] commons-collections git commit: Backport COLLECTIONS-249 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-249 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713172 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/16b1e26b
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/16b1e26b
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/16b1e26b
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 16b1e26bd1399779a6bd7177951c0770631a6cc5
Parents: a2ddc7c
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 20:26:30 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 20:26:30 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 8 +++---
.../commons/collections/list/SetUniqueList.java | 10 ++++++--
.../collections/list/TestSetUniqueList.java | 26 +++++++++++++++++++-
3 files changed, 37 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/16b1e26b/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0ae417c..f278a9d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,6 +23,10 @@
<release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+ <action issue="COLLECTIONS-249" dev="bayard" type="fix" due-to="Joe Kelly">
+ "SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
+ provided index.
+ </action>
<action issue="COLLECTIONS-219" dev="scolebourne" type="fix" due-to="Tom Leccese">
"CollectionUtils#removeAll" wrongly called "ListUtils#retainAll".
</action>
@@ -74,10 +78,6 @@
"Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
if the size of the map is less or equal 3.
</action>
- <action issue="COLLECTIONS-249" dev="bayard" type="fix" due-to="Joe Kelly">
- "SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
- provided index.
- </action>
<action issue="COLLECTIONS-228" dev="scolebourne" type="fix">
"MultiValueMap#put(Object, Object)" and "MultiValueMap#putAll(Object, Collection)"
now correctly return if the map has changed by this operation.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/16b1e26b/src/java/org/apache/commons/collections/list/SetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/SetUniqueList.java b/src/java/org/apache/commons/collections/list/SetUniqueList.java
index b075608..3eb5f34 100644
--- a/src/java/org/apache/commons/collections/list/SetUniqueList.java
+++ b/src/java/org/apache/commons/collections/list/SetUniqueList.java
@@ -168,7 +168,8 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
}
/**
- * Adds a collection of objects to the end of the list avoiding duplicates.
+ * Adds a collection of objects a specific index in the list avoiding
+ * duplicates.
* <p>
* Only elements that are not already in this list will be added, and
* duplicates from the specified collection will be ignored.
@@ -187,7 +188,12 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
// adds all elements
for (final Iterator it = coll.iterator(); it.hasNext();) {
- add(it.next());
+ int sizeBeforeAddNext = size();
+ add(index, it.next());
+ // if it was inserted, then increase the target index
+ if (sizeBeforeAddNext != size()) {
+ index++;
+ }
}
// compares sizes to detect if collection changed
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/16b1e26b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
index 560a88b..fe08150 100644
--- a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
+++ b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
@@ -144,7 +144,31 @@ public class TestSetUniqueList extends AbstractTestList {
assertEquals("Size should increase after addAll",
size + elements.length, collection.size());
}
-
+
+ public void testIntCollectionAddAll() {
+ // make a SetUniqueList with one element
+ List list = new SetUniqueList(new ArrayList(), new HashSet());
+ final Integer existingElement = new Integer(1);
+ list.add(existingElement);
+
+ // add two new unique elements at index 0
+ final Integer firstNewElement = new Integer(2);
+ final Integer secondNewElement = new Integer(3);
+ collection = Arrays.asList(new Integer[] { firstNewElement, secondNewElement });
+ list.addAll(0, collection);
+ assertEquals("Unique elements should be added.", 3, list.size());
+ assertEquals("First new element should be at index 0", firstNewElement, list.get(0));
+ assertEquals("Second new element should be at index 1", secondNewElement, list.get(1));
+ assertEquals("Existing element should shift to index 2", existingElement, list.get(2));
+
+ // add a duplicate element and a unique element at index 0
+ final Integer thirdNewElement = new Integer(4);
+ collection = Arrays.asList(new Integer[] { existingElement, thirdNewElement });
+ list.addAll(0, collection);
+ assertEquals("Duplicate element should not be added, unique element should be added.", 4, list.size());
+ assertEquals("Third new element should be at index 0", thirdNewElement, list.get(0));
+ }
+
public void testListSetByIndex() {
// override for set behaviour
resetFull();
[42/50] commons-collections git commit: Fix test compilation and
execution errors.
Posted by ch...@apache.org.
Fix test compilation and execution errors.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1714107 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/6a3dbcdc
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/6a3dbcdc
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/6a3dbcdc
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 6a3dbcdcd73667646931bff57bc230d1d4c2a1a5
Parents: cfceeb4
Author: Thomas Neidhart <tn...@apache.org>
Authored: Thu Nov 12 19:35:51 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Thu Nov 12 19:35:51 2015 +0000
----------------------------------------------------------------------
.../collections/TestExtendedProperties.java | 5 +++--
.../functors/AbstractTestSerialization.java | 6 +++---
.../functors/TestPrototypeFactory.java | 6 +++---
.../commons/collections/map/TestFlat3Map.java | 20 ++++++++++----------
4 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/TestExtendedProperties.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestExtendedProperties.java b/src/test/org/apache/commons/collections/TestExtendedProperties.java
index 1fd2195..5323e33 100644
--- a/src/test/org/apache/commons/collections/TestExtendedProperties.java
+++ b/src/test/org/apache/commons/collections/TestExtendedProperties.java
@@ -319,7 +319,9 @@ public class TestExtendedProperties extends TestCase {
SecurityManager manager = new SecurityManager() {
public void checkPropertyAccess(String key) {
- throw new SecurityException();
+ if ("file.separator".equals(key)) {
+ throw new SecurityException();
+ }
}
public void checkPermission(Permission perm) {
@@ -333,7 +335,6 @@ public class TestExtendedProperties extends TestCase {
ExtendedProperties properties = new ExtendedProperties();
assertNotNull(properties);
} catch (Exception ex) {
- ex.printStackTrace();
fail("failed to instantiate ExtendedProperties");
} finally {
System.setSecurityManager(null);
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java b/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java
index cb41dea..1c39b18 100644
--- a/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java
+++ b/src/test/org/apache/commons/collections/functors/AbstractTestSerialization.java
@@ -60,7 +60,7 @@ public abstract class AbstractTestSerialization extends BulkTest {
//-----------------------------------------------------------------------
public void testSerializationDisabled() throws Exception {
- Assert.assertNull(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY));
+ Assert.assertFalse("true".equalsIgnoreCase(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY)));
Object object = makeObject();
try {
serialize(object);
@@ -82,7 +82,7 @@ public abstract class AbstractTestSerialization extends BulkTest {
}
public void testSerializationEnabled() throws Exception {
- Assert.assertNull(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY));
+ Assert.assertFalse("true".equalsIgnoreCase(System.getProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY)));
System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "true");
try {
@@ -96,7 +96,7 @@ public abstract class AbstractTestSerialization extends BulkTest {
fail("de-serialization of " + getTestClass().getName() + " should be enabled");
}
} finally {
- System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false");
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
index 3701b04..1110d55 100644
--- a/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
+++ b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
@@ -75,7 +75,7 @@ public class TestPrototypeFactory extends AbstractTestSerialization {
Object dest = in.readObject();
in.close();
} finally {
- System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false");
}
}
@@ -106,7 +106,7 @@ public class TestPrototypeFactory extends AbstractTestSerialization {
Object dest = in.readObject();
in.close();
} finally {
- System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false");
}
}
@@ -129,7 +129,7 @@ public class TestPrototypeFactory extends AbstractTestSerialization {
Object dest = in.readObject();
in.close();
} finally {
- System.clearProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY);
+ System.setProperty(FunctorUtils.UNSAFE_SERIALIZABLE_PROPERTY, "false");
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a3dbcdc/src/test/org/apache/commons/collections/map/TestFlat3Map.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestFlat3Map.java b/src/test/org/apache/commons/collections/map/TestFlat3Map.java
index b48a867..39c9a3c 100644
--- a/src/test/org/apache/commons/collections/map/TestFlat3Map.java
+++ b/src/test/org/apache/commons/collections/map/TestFlat3Map.java
@@ -207,17 +207,17 @@ public class TestFlat3Map extends AbstractTestIterableMap {
public void testCollections261() {
final Flat3Map m = new Flat3Map();
- m.put( Integer.valueOf(1), Integer.valueOf(1) );
- m.put( Integer.valueOf(0), Integer.valueOf(0) );
- assertEquals( Integer.valueOf(1), m.remove( Integer.valueOf(1) ) );
- assertEquals( Integer.valueOf(0), m.remove( Integer.valueOf(0) ) );
+ m.put( new Integer(1), new Integer(1) );
+ m.put( new Integer(0), new Integer(0) );
+ assertEquals( new Integer(1), m.remove( new Integer(1) ) );
+ assertEquals( new Integer(0), m.remove( new Integer(0) ) );
- m.put( Integer.valueOf(2), Integer.valueOf(2) );
- m.put( Integer.valueOf(1), Integer.valueOf(1) );
- m.put( Integer.valueOf(0), Integer.valueOf(0) );
- assertEquals( Integer.valueOf(2), m.remove( Integer.valueOf(2) ) );
- assertEquals( Integer.valueOf(1), m.remove( Integer.valueOf(1) ) );
- assertEquals( Integer.valueOf(0), m.remove( Integer.valueOf(0) ) );
+ m.put( new Integer(2), new Integer(2) );
+ m.put( new Integer(1), new Integer(1) );
+ m.put( new Integer(0), new Integer(0) );
+ assertEquals( new Integer(2), m.remove( new Integer(2) ) );
+ assertEquals( new Integer(1), m.remove( new Integer(1) ) );
+ assertEquals( new Integer(0), m.remove( new Integer(0) ) );
}
public void testSerialisation0() throws Exception {
[49/50] commons-collections git commit: Can't use a Java 1.4 API when
we are supposed to compile on Java 1.3 ; -)
Posted by ch...@apache.org.
Can't use a Java 1.4 API when we are supposed to compile on Java 1.3 ;-)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1747098 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/876942fc
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/876942fc
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/876942fc
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 876942fc660632db3e45841cfa264313697c5923
Parents: 4d46116
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Jun 7 00:39:53 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue Jun 7 00:39:53 2016 +0000
----------------------------------------------------------------------
.../org/apache/commons/collections/map/TestCaseInsensitiveMap.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/876942fc/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
index 0b7266e..647ddc7 100644
--- a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
+++ b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
@@ -113,7 +113,7 @@ public class TestCaseInsensitiveMap extends AbstractTestIterableMap {
// COLLECTIONS-294
public void testLocaleIndependence() {
Locale orig = Locale.getDefault();
- Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };
+ Locale[] locales = { Locale.ENGLISH, new Locale("tr", ""), Locale.getDefault() };
String[][] data = {
{ "i", "I" },
{ "\u03C2", "\u03C3" },
[20/50] commons-collections git commit: Backport COLLECTIONS-447 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-447 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713536 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/fd61086d
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/fd61086d
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/fd61086d
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: fd61086df2f169190db670553bfee2ebdc140533
Parents: 7403718
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 20:53:04 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 20:53:04 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 13 ++++---------
.../apache/commons/collections/list/TreeList.java | 11 +++++------
.../commons/collections/list/TestTreeList.java | 15 +++++++++++++++
3 files changed, 24 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/fd61086d/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6656de6..83a0427 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,7 +22,6 @@
<body>
<release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
-
<action issue="COLLECTIONS-580" dev="tn" type="update">
De-serialization of "InvokerTransformer" is disabled by default as this
can be exploited for remote code execution attacks. To re-enable the
@@ -35,6 +34,10 @@
permission to read system properties, the "File#separator" field will
be used instead.
</action>
+ <action issue="COLLECTIONS-447" dev="tn" type="fix" due-to="Jeffrey Barnes">
+ Tree traversal with a TreeListIterator will not be affected anymore by
+ the removal of an element directly after a call to previous().
+ </action>
<action issue="COLLECTIONS-444" dev="tn" type="fix" due-to="Thomas Vahrst, John Vasileff">
SetUniqueList.set(int, Object) now works correctly if the object to be inserted
is already placed at the given position.
@@ -81,14 +84,6 @@
Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
correctly set the value for the current entry.
</action>
-
- <!-- Bugfixes planned to backport from 4.0
-
- <action issue="COLLECTIONS-447" dev="tn" type="fix" due-to="Jeffrey Barnes">
- Tree traversal with a TreeListIterator will not be affected anymore by
- the removal of an element directly after a call to previous().
- </action>
- -->
</release>
</body>
</document>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/fd61086d/src/java/org/apache/commons/collections/list/TreeList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/TreeList.java b/src/java/org/apache/commons/collections/list/TreeList.java
index 54816ac..39b077c 100644
--- a/src/java/org/apache/commons/collections/list/TreeList.java
+++ b/src/java/org/apache/commons/collections/list/TreeList.java
@@ -881,15 +881,14 @@ public class TreeList extends AbstractList {
if (currentIndex == -1) {
throw new IllegalStateException();
}
- if (nextIndex == currentIndex) {
- // remove() following previous()
- next = next.next();
- parent.remove(currentIndex);
- } else {
+ parent.remove(currentIndex);
+ if (nextIndex != currentIndex) {
// remove() following next()
- parent.remove(currentIndex);
nextIndex--;
}
+ // the AVL node referenced by next may have become stale after a remove
+ // reset it now: will be retrieved by next call to next()/previous() via nextIndex
+ next = null;
current = null;
currentIndex = -1;
expectedModCount++;
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/fd61086d/src/test/org/apache/commons/collections/list/TestTreeList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestTreeList.java b/src/test/org/apache/commons/collections/list/TestTreeList.java
index d3ae8b9..b78b0f5 100644
--- a/src/test/org/apache/commons/collections/list/TestTreeList.java
+++ b/src/test/org/apache/commons/collections/list/TestTreeList.java
@@ -242,4 +242,19 @@ public class TestTreeList extends AbstractTestList {
assertEquals(false, li.hasNext());
}
+ public void testBugCollections447() {
+ final List treeList = new TreeList();
+ treeList.add("A");
+ treeList.add("B");
+ treeList.add("C");
+ treeList.add("D");
+ final ListIterator li = treeList.listIterator();
+ assertEquals("A", li.next());
+ assertEquals("B", li.next());
+ assertEquals("B", li.previous());
+ li.remove(); // Deletes "B"
+ // previous() after remove() should move to
+ // the element before the one just removed
+ assertEquals("A", li.previous());
+ }
}
[29/50] commons-collections git commit: Create release notes for
3.2.2, changing from html to txt format.
Posted by ch...@apache.org.
Create release notes for 3.2.2, changing from html to txt format.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713554 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/68f0be9b
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/68f0be9b
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/68f0be9b
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 68f0be9bff6e6cb3d9876b10c34f7c9389e0fd69
Parents: 1a094a4
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 22:02:29 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 22:02:29 2015 +0000
----------------------------------------------------------------------
RELEASE-NOTES.html | 40 ----------------------------
RELEASE-NOTES.txt | 67 +++++++++++++++++++++++++++++++++++++++++++++++
src/assembly/bin.xml | 2 +-
src/assembly/src.xml | 2 +-
4 files changed, 69 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/68f0be9b/RELEASE-NOTES.html
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.html b/RELEASE-NOTES.html
deleted file mode 100644
index d7fb3b0..0000000
--- a/RELEASE-NOTES.html
+++ /dev/null
@@ -1,40 +0,0 @@
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<html>
-<head>
-<title>RELEASE NOTES: COLLECTIONS 3.2.1</title>
-</head>
-<body>
-<center><h2>RELEASE NOTES: COLLECTIONS 3.2.1</h2></center>
-
-<p>
-Commons collections is a project to develop and maintain collection classes
-based on and inspired by the JDK collection framework.
-This project is JDK1.2 compatible, and does not use JDK1.5 generics.
-</p>
-<p>
-This v3.2.1 release is simply a re-packaging of the v3.2 release, with appropriate
-OSGi meta data added to the jar's manifest file.
-</p>
-<hr />
-
-<center><h3>COMPATIBILITY</h3></center>
-<p>
-This release is fully source and binary compatible with v3.2.
-</p>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/68f0be9b/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
new file mode 100644
index 0000000..53df5d0
--- /dev/null
+++ b/RELEASE-NOTES.txt
@@ -0,0 +1,67 @@
+ Apache Commons Collections
+ Version 3.2.2
+ RELEASE NOTES
+
+
+INTRODUCTION:
+
+Commons collections is a project to develop and maintain collection classes
+based on and inspired by the JDK collection framework.
+This release is JDK1.3 compatible, and does not use JDK1.5 generics.
+
+This v3.2.2 release is a bugfix release, fixing several bugs present in the previous
+releases of the 3.2 branch. Additionally, this release provides a mitigation for a
+known remote code exploitation via the standard java object serialization mechanism.
+By default, de-serialization of "InvokerTransformer" instances is prohibited and
+will result in an exception. For more details, please refer to COLLECTIONS-580.
+
+All users are strongly encouraged to updated to this release.
+
+
+Changes in this version include:
+
+CHANGES
+=======
+
+o COLLECTIONS-580: De-serialization of "InvokerTransformer" is disabled by default as this
+ can be exploited for remote code execution attacks. To re-enable the
+ feature the system property
+ "org.apache.commons.collections.invokertransformer.enableDeserialization"
+ needs to be set to "true".
+
+BUGFIXES
+========
+
+o COLLECTIONS-538: "ExtendedProperties" will now use a privileged action to access the
+ "file.separator" system property. In case the class does not have
+ permission to read system properties, the "File#separator" field will
+ be used instead. Thanks to Trejkaz.
+o COLLECTIONS-447: Tree traversal with a TreeListIterator will not be affected anymore by
+ the removal of an element directly after a call to previous(). Thanks to Jeffrey Barnes.
+o COLLECTIONS-444: SetUniqueList.set(int, Object) now works correctly if the object to be inserted
+ is already placed at the given position. Thanks to Thomas Vahrst, John Vasileff.
+o COLLECTIONS-350: Removed debug output in "MapUtils#getNumber(Map)". Thanks to Michael Akerman.
+o COLLECTIONS-335: Fixed cache assignment for "TreeBidiMap#entrySet". Thanks to sebb.
+o COLLECTIONS-334: Synchronized access to lock in "StaticBucketMap#size()". Thanks to sebb.
+o COLLECTIONS-307: "SetUniqueList#subList()#contains(Object)" will now correctly check the subList
+ rather than the parent list. Thanks to Christian Semrau.
+o COLLECTIONS-304: "SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint.
+ Thanks to Rafa? Figas,Bjorn Townsend.
+o COLLECTIONS-294: "CaseInsensitiveMap" will now convert input strings to lower-case in a
+ locale-independent manner. Thanks to Benjamin Bentmann.
+o COLLECTIONS-266: "MultiKey" will now be correctly serialized/de-serialized. Thanks to Joerg Schaible.
+o COLLECTIONS-261: "Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
+ if the size of the map is less or equal 3. Thanks to ori.
+o COLLECTIONS-249: "SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
+ provided index. Thanks to Joe Kelly.
+o COLLECTIONS-228: "MultiValueMap#put(Object, Object)" and "MultiValueMap#putAll(Object, Collection)"
+ now correctly return if the map has changed by this operation.
+o COLLECTIONS-219: "CollectionUtils#removeAll" wrongly called "ListUtils#retainAll". Thanks to Tom Leccese.
+o COLLECTIONS-217: Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
+ correctly set the value for the current entry. Thanks to Matt Bishop.
+
+
+For complete information on Apache Commons Collections, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Commons Collections website:
+
+http://commons.apache.org/collections/
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/68f0be9b/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml
index ba5c51a..a58c2e5 100644
--- a/src/assembly/bin.xml
+++ b/src/assembly/bin.xml
@@ -27,7 +27,7 @@
<include>LICENSE.txt</include>
<include>NOTICE.txt</include>
<include>README.txt</include>
- <include>RELEASE-NOTES.html</include>
+ <include>RELEASE-NOTES.txt</include>
</includes>
</fileSet>
<fileSet>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/68f0be9b/src/assembly/src.xml
----------------------------------------------------------------------
diff --git a/src/assembly/src.xml b/src/assembly/src.xml
index 3f9c664..0118360 100644
--- a/src/assembly/src.xml
+++ b/src/assembly/src.xml
@@ -36,7 +36,7 @@
<include>project.xml</include>
<include>PROPOSAL.html</include>
<include>README.txt</include>
- <include>RELEASE-NOTES.html</include>
+ <include>RELEASE-NOTES.txt</include>
</includes>
</fileSet>
<fileSet>
[34/50] commons-collections git commit: Remove obsolete style.
Posted by ch...@apache.org.
Remove obsolete style.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713796 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/b6870e41
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/b6870e41
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/b6870e41
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: b6870e41bab809632a278a13c006534e33642c94
Parents: 0342172
Author: Thomas Neidhart <tn...@apache.org>
Authored: Wed Nov 11 10:06:26 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Wed Nov 11 10:06:26 2015 +0000
----------------------------------------------------------------------
xdocs/style/project.css | 18 ------------------
1 file changed, 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/b6870e41/xdocs/style/project.css
----------------------------------------------------------------------
diff --git a/xdocs/style/project.css b/xdocs/style/project.css
deleted file mode 100644
index 3f385c1..0000000
--- a/xdocs/style/project.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-@import url("http://commons.apache.org/style/commons-maven.css");
[11/50] commons-collections git commit: [COLLECTIONS-538] Use
AccessController to read system properties in ExtendedProperties,
use File.separator in case of a security exception.
Posted by ch...@apache.org.
[COLLECTIONS-538] Use AccessController to read system properties in ExtendedProperties, use File.separator in case of a security exception.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713233 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/c0da312f
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/c0da312f
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/c0da312f
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: c0da312f34de79f90ea44de52c250e0d6d88b0b0
Parents: eb693a7
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 15:05:59 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 15:05:59 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 6 +++++
.../commons/collections/ExtendedProperties.java | 17 +++++++++++--
.../collections/TestExtendedProperties.java | 26 ++++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c0da312f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 66cee68..683723b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,6 +23,12 @@
<release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+ <action issue="COLLECTIONS-538" dev="tn" type="fix" due-to="Trejkaz">
+ "ExtendedProperties" will now use a privileged action to access the
+ "file.separator" system property. In case the class does not have
+ permission to read system properties, the "File#separator" field will
+ be used instead.
+ </action>
<action issue="COLLECTIONS-350" dev="bayard" type="fix" due-to="Michael Akerman">
Removed debug output in "MapUtils#getNumber(Map)".
</action>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c0da312f/src/java/org/apache/commons/collections/ExtendedProperties.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/ExtendedProperties.java b/src/java/org/apache/commons/collections/ExtendedProperties.java
index da420bc..194670e 100644
--- a/src/java/org/apache/commons/collections/ExtendedProperties.java
+++ b/src/java/org/apache/commons/collections/ExtendedProperties.java
@@ -26,6 +26,7 @@ import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
+import java.security.AccessController;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -165,10 +166,22 @@ public class ExtendedProperties extends Hashtable {
/**
* File separator.
*/
- protected String fileSeparator = System.getProperty("file.separator");
+ protected String fileSeparator;
+ {
+ try {
+ fileSeparator = (String) AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ return System.getProperty("file.separator");
+ }
+ });
+ } catch (SecurityException ex) {
+ fileSeparator = File.separator;
+ }
+ }
/**
- * Has this configuration been intialized.
+ * Has this configuration been initialized.
*/
protected boolean isInitialized = false;
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c0da312f/src/test/org/apache/commons/collections/TestExtendedProperties.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestExtendedProperties.java b/src/test/org/apache/commons/collections/TestExtendedProperties.java
index 856c0dd..1fd2195 100644
--- a/src/test/org/apache/commons/collections/TestExtendedProperties.java
+++ b/src/test/org/apache/commons/collections/TestExtendedProperties.java
@@ -19,6 +19,7 @@ package org.apache.commons.collections;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.security.Permission;
import java.util.Properties;
import junit.framework.Test;
@@ -314,4 +315,29 @@ public class TestExtendedProperties extends TestCase {
assertEquals("class", extended.getString("resource.loader"));
}
+ public void testActiveSecurityManager() {
+ SecurityManager manager = new SecurityManager() {
+
+ public void checkPropertyAccess(String key) {
+ throw new SecurityException();
+ }
+
+ public void checkPermission(Permission perm) {
+ }
+
+ };
+
+ System.setSecurityManager(manager);
+
+ try {
+ ExtendedProperties properties = new ExtendedProperties();
+ assertNotNull(properties);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ fail("failed to instantiate ExtendedProperties");
+ } finally {
+ System.setSecurityManager(null);
+ }
+ }
+
}
[30/50] commons-collections git commit: Add Eclipse folders to
svn:ignore.
Posted by ch...@apache.org.
Add Eclipse folders to svn:ignore.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713743 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/c68f934a
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/c68f934a
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/c68f934a
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: c68f934a1e3ea7af5896ce16838a8574ffe95ee3
Parents: 68f0be9
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Nov 10 22:44:04 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue Nov 10 22:44:04 2015 +0000
----------------------------------------------------------------------
maven-eclipse.xml | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c68f934a/maven-eclipse.xml
----------------------------------------------------------------------
diff --git a/maven-eclipse.xml b/maven-eclipse.xml
new file mode 100644
index 0000000..9a99c2b
--- /dev/null
+++ b/maven-eclipse.xml
@@ -0,0 +1,8 @@
+<project default="copy-resources">
+ <target name="init"/>
+ <target name="copy-resources" depends="init">
+ <copy todir="target/classes/META-INF" filtering="false">
+ <fileset dir="." includes="NOTICE.txt|LICENSE.txt" excludes="**/*.java"/>
+ </copy>
+ </target>
+</project>
\ No newline at end of file
[13/50] commons-collections git commit: Backport COLLECTIONS-261 to
3.2.2
Posted by ch...@apache.org.
Backport COLLECTIONS-261 to 3.2.2
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713293 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/6a7d35de
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/6a7d35de
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/6a7d35de
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 6a7d35dea2a34069335126aa7e9d54b44c91c8b0
Parents: 46e5a83
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 21:04:34 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 21:04:34 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 8 ++++----
.../org/apache/commons/collections/map/Flat3Map.java | 12 ++++++------
.../apache/commons/collections/map/TestFlat3Map.java | 15 +++++++++++++++
3 files changed, 25 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a7d35de/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bccc7e1..9d3a1b7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -42,6 +42,10 @@
<action issue="COLLECTIONS-266" dev="bayard" type="fix" due-to="Joerg Schaible">
"MultiKey" will now be correctly serialized/de-serialized.
</action>
+ <action issue="COLLECTIONS-261" dev="bayard" type="fix" due-to="ori">
+ "Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
+ if the size of the map is less or equal 3.
+ </action>
<action issue="COLLECTIONS-249" dev="bayard" type="fix" due-to="Joe Kelly">
"SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
provided index.
@@ -85,10 +89,6 @@
<action issue="COLLECTIONS-304" dev="bayard" type="fix" due-to="Rafał Figas,Bjorn Townsend">
"SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint.
</action>
- <action issue="COLLECTIONS-261" dev="bayard" type="fix" due-to="ori">
- "Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
- if the size of the map is less or equal 3.
- </action>
-->
</release>
</body>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a7d35de/src/java/org/apache/commons/collections/map/Flat3Map.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/Flat3Map.java b/src/java/org/apache/commons/collections/map/Flat3Map.java
index 19085f1..b4349ec 100644
--- a/src/java/org/apache/commons/collections/map/Flat3Map.java
+++ b/src/java/org/apache/commons/collections/map/Flat3Map.java
@@ -416,7 +416,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (key2 == null) {
- Object old = value3;
+ Object old = value2;
hash2 = hash3;
key2 = key3;
value2 = value3;
@@ -427,7 +427,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (key1 == null) {
- Object old = value3;
+ Object old = value1;
hash1 = hash3;
key1 = key3;
value1 = value3;
@@ -448,7 +448,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (key1 == null) {
- Object old = value2;
+ Object old = value1;
hash1 = hash2;
key1 = key2;
value1 = value2;
@@ -483,7 +483,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (hash2 == hashCode && key.equals(key2)) {
- Object old = value3;
+ Object old = value2;
hash2 = hash3;
key2 = key3;
value2 = value3;
@@ -494,7 +494,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (hash1 == hashCode && key.equals(key1)) {
- Object old = value3;
+ Object old = value1;
hash1 = hash3;
key1 = key3;
value1 = value3;
@@ -515,7 +515,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
return old;
}
if (hash1 == hashCode && key.equals(key1)) {
- Object old = value2;
+ Object old = value1;
hash1 = hash2;
key1 = key2;
value1 = value2;
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/6a7d35de/src/test/org/apache/commons/collections/map/TestFlat3Map.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestFlat3Map.java b/src/test/org/apache/commons/collections/map/TestFlat3Map.java
index 427b7ae..b48a867 100644
--- a/src/test/org/apache/commons/collections/map/TestFlat3Map.java
+++ b/src/test/org/apache/commons/collections/map/TestFlat3Map.java
@@ -205,6 +205,21 @@ public class TestFlat3Map extends AbstractTestIterableMap {
assertSame(TWO, cloned.get(TWENTY));
}
+ public void testCollections261() {
+ final Flat3Map m = new Flat3Map();
+ m.put( Integer.valueOf(1), Integer.valueOf(1) );
+ m.put( Integer.valueOf(0), Integer.valueOf(0) );
+ assertEquals( Integer.valueOf(1), m.remove( Integer.valueOf(1) ) );
+ assertEquals( Integer.valueOf(0), m.remove( Integer.valueOf(0) ) );
+
+ m.put( Integer.valueOf(2), Integer.valueOf(2) );
+ m.put( Integer.valueOf(1), Integer.valueOf(1) );
+ m.put( Integer.valueOf(0), Integer.valueOf(0) );
+ assertEquals( Integer.valueOf(2), m.remove( Integer.valueOf(2) ) );
+ assertEquals( Integer.valueOf(1), m.remove( Integer.valueOf(1) ) );
+ assertEquals( Integer.valueOf(0), m.remove( Integer.valueOf(0) ) );
+ }
+
public void testSerialisation0() throws Exception {
Flat3Map map = new Flat3Map();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
[08/50] commons-collections git commit: Remove fix that does not
apply to 3.2.x
Posted by ch...@apache.org.
Remove fix that does not apply to 3.2.x
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713177 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/1908baae
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/1908baae
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/1908baae
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 1908baae60e4960730f92349776b5681b1133bd6
Parents: fd17905
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 20:57:07 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 20:57:07 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/1908baae/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0612b0f..8306efb 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,9 +51,6 @@
SetUniqueList.set(int, E) now works correctly if the object to be inserted
is already placed at the given position.
</action>
- <action issue="COLLECTIONS-364" dev="sebb" type="fix">
- "DualTreeBidiMap" now uses the correct comparator for the reverse map during de-serialization.
- </action>
<action issue="COLLECTIONS-359" dev="bayard" type="fix" due-to="Mark Shead">
"ListUtils#intersection(List, List)" will now also work correctly if there
are duplicate elements in the provided lists.
[09/50] commons-collections git commit: Backport COLLECTIONS-350 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-350 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713178 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/c2748821
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/c2748821
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/c2748821
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: c2748821619691f38e447a9f180af6823671fcaf
Parents: 1908baa
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 20:59:09 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 20:59:09 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 6 +++---
src/java/org/apache/commons/collections/MapUtils.java | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c2748821/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8306efb..8695e33 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,6 +23,9 @@
<release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+ <action issue="COLLECTIONS-350" dev="bayard" type="fix" due-to="Michael Akerman">
+ Removed debug output in "MapUtils#getNumber(Map)".
+ </action>
<action issue="COLLECTIONS-335" dev="jochen" type="fix" due-to="sebb">
Fixed cache assignment for "TreeBidiMap#entrySet".
</action>
@@ -55,9 +58,6 @@
"ListUtils#intersection(List, List)" will now also work correctly if there
are duplicate elements in the provided lists.
</action>
- <action issue="COLLECTIONS-350" dev="bayard" type="fix" due-to="Michael Akerman">
- Removed debug output in "MapUtils#getNumber(Map)".
- </action>
<action issue="COLLECTIONS-334" dev="jochen" type="fix" due-to="sebb">
Synchronized access to lock in "StaticBucketMap#size()".
</action>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/c2748821/src/java/org/apache/commons/collections/MapUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/MapUtils.java b/src/java/org/apache/commons/collections/MapUtils.java
index 9d38491..578d1b2 100644
--- a/src/java/org/apache/commons/collections/MapUtils.java
+++ b/src/java/org/apache/commons/collections/MapUtils.java
@@ -204,7 +204,7 @@ public class MapUtils {
return NumberFormat.getInstance().parse(text);
} catch (ParseException e) {
- logInfo(e);
+ // failure means null is returned
}
}
}
[02/50] commons-collections git commit: Backport COLLECTIONS-219 to
3.2.2
Posted by ch...@apache.org.
Backport COLLECTIONS-219 to 3.2.2
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713167 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/e709ea82
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/e709ea82
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/e709ea82
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: e709ea82aa3ead7468e7c2ebee85cd3a51d82061
Parents: 6e5ae53
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 19:44:03 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 19:44:03 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 7 +-
.../commons/collections/CollectionUtils.java | 2 +-
.../collections/TestCollectionUtils.java | 68 +++++++++++++++++++-
3 files changed, 72 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/e709ea82/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b7289a9..a4d1492 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,6 +22,10 @@
<body>
<release version="3.2.2" date="20XX-XX-XX" description="This is a bugfix release.">
+
+ <action issue="COLLECTIONS-219" dev="scolebourne" type="fix" due-to="Tom Leccese">
+ "CollectionUtils#removeAll" wrongly called "ListUtils#retainAll".
+ </action>
<!-- Bugfixes planned to backport from 4.0
@@ -94,9 +98,6 @@
"MultiValueMap#put(Object, Object)" and "MultiValueMap#putAll(Object, Collection)"
now correctly return if the map has changed by this operation.
</action>
- <action issue="COLLECTIONS-219" dev="scolebourne" type="fix" due-to="Tom Leccese">
- "CollectionUtils#removeAll" wrongly called "ListUtils#retainAll".
- </action>
<action issue="COLLECTIONS-217" dev="scolebourne" type="fix" due-to="Matt Bishop">
Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
correctly set the value for the current entry.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/e709ea82/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index 3b736b4..3abcd3d 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.java
@@ -1119,7 +1119,7 @@ public class CollectionUtils {
* @since Commons Collections 3.2
*/
public static Collection removeAll(Collection collection, Collection remove) {
- return ListUtils.retainAll(collection, remove);
+ return ListUtils.removeAll(collection, remove);
}
//-----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/e709ea82/src/test/org/apache/commons/collections/TestCollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/TestCollectionUtils.java b/src/test/org/apache/commons/collections/TestCollectionUtils.java
index 38f992e..86478dc 100644
--- a/src/test/org/apache/commons/collections/TestCollectionUtils.java
+++ b/src/test/org/apache/commons/collections/TestCollectionUtils.java
@@ -1239,7 +1239,73 @@ public class TestCollectionUtils extends TestCase {
assertEquals(eltc,eltb);
}
- public void testTransformedCollection() {
+ // -----------------------------------------------------------------------
+
+ public void testRetainAll() {
+ final List base = new ArrayList();
+ base.add("A");
+ base.add("B");
+ base.add("C");
+ final List sub = new ArrayList();
+ sub.add("A");
+ sub.add("C");
+ sub.add("X");
+
+ final Collection result = CollectionUtils.retainAll(base, sub);
+ assertEquals(2, result.size());
+ assertEquals(true, result.contains("A"));
+ assertFalse(result.contains("B"));
+ assertEquals(true, result.contains("C"));
+ assertEquals(3, base.size());
+ assertEquals(true, base.contains("A"));
+ assertEquals(true, base.contains("B"));
+ assertEquals(true, base.contains("C"));
+ assertEquals(3, sub.size());
+ assertEquals(true, sub.contains("A"));
+ assertEquals(true, sub.contains("C"));
+ assertEquals(true, sub.contains("X"));
+
+ try {
+ CollectionUtils.retainAll(null, null);
+ fail("expecting NullPointerException");
+ } catch (final NullPointerException npe) {
+ } // this is what we want
+ }
+
+ public void testRemoveAll() {
+ final List base = new ArrayList();
+ base.add("A");
+ base.add("B");
+ base.add("C");
+ final List sub = new ArrayList();
+ sub.add("A");
+ sub.add("C");
+ sub.add("X");
+
+ final Collection result = CollectionUtils.removeAll(base, sub);
+ assertEquals(1, result.size());
+ assertFalse(result.contains("A"));
+ assertEquals(true, result.contains("B"));
+ assertFalse(result.contains("C"));
+ assertEquals(3, base.size());
+ assertEquals(true, base.contains("A"));
+ assertEquals(true, base.contains("B"));
+ assertEquals(true, base.contains("C"));
+ assertEquals(3, sub.size());
+ assertEquals(true, sub.contains("A"));
+ assertEquals(true, sub.contains("C"));
+ assertEquals(true, sub.contains("X"));
+
+ try {
+ CollectionUtils.removeAll(null, null);
+ fail("expecting NullPointerException");
+ } catch (final NullPointerException npe) {
+ } // this is what we want
+ }
+
+ // -----------------------------------------------------------------------
+
+ public void testTransformedCollection() {
Transformer transformer = TransformerUtils.nopTransformer();
Collection collection =
CollectionUtils.transformedCollection(new ArrayList(), transformer);
[25/50] commons-collections git commit: Update doaf file: add AL
header, previous 3.X releases.
Posted by ch...@apache.org.
Update doaf file: add AL header, previous 3.X releases.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713541 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/20655b67
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/20655b67
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/20655b67
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 20655b679a65f2891e5d23411311ade952e5a871
Parents: 78c2d67
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:23:02 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:23:02 2015 +0000
----------------------------------------------------------------------
doap_collections.rdf | 62 +++++++++++++++++++++++++++++++++++------------
1 file changed, 47 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/20655b67/doap_collections.rdf
----------------------------------------------------------------------
diff --git a/doap_collections.rdf b/doap_collections.rdf
index 1606231..ba623be 100644
--- a/doap_collections.rdf
+++ b/doap_collections.rdf
@@ -1,34 +1,66 @@
<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:asfext="http://projects.apache.org/ns/asfext#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:doap="http://usefulinc.com/ns/doap#" xml:lang="en">
- <Project rdf:about="http://jakarta.apache.org/commons/collections/">
- <name>Apache Jakarta Commons Collections</name>
- <homepage rdf:resource="http://jakarta.apache.org/commons/collections/"/>
+ <Project rdf:about="http://commons.apache.org/collections/">
+ <name>Apache Commons Collections</name>
+ <homepage rdf:resource="http://commons.apache.org/collections/"/>
<programming-language>Java</programming-language>
<category rdf:resource="http://projects.apache.org/category/library"/>
<license rdf:resource="http://usefulinc.com/doap/licenses/asl20"/>
- <bug-database rdf:resource="http://issues.apache.org/bugzilla/buglist.cgi?product=Commons&component=collections"/>
- <download-page rdf:resource="http://jakarta.apache.org/site/downloads/downloads_commons-collections.cgi"/>
- <asfext:pmc rdf:resource="http://jakarta.apache.org/"/>
+ <bug-database rdf:resource="http://issues.apache.org/jira/browse/COLLECTIONS"/>
+ <download-page rdf:resource="http://commons.apache.org/collections/download_collections.cgi"/>
+ <asfext:pmc rdf:resource="http://commons.apache.org/"/>
<shortdesc xml:lang="en">Commons Collections</shortdesc>
<description xml:lang="en">Types that extend and augment the Java Collections Framework.</description>
<repository>
<SVNRepository>
- <browse rdf:resource="http://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk"/>
- <location rdf:resource="http://svn.apache.org/repos/asf/jakarta/commons/proper/collections"/>
+ <browse rdf:resource="http://svn.apache.org/repos/asf/commons/proper/collections/trunk"/>
+ <location rdf:resource="http://svn.apache.org/repos/asf/commons/proper/collections"/>
</SVNRepository>
</repository>
<release>
- <revision>
+ <Version>
+ <name>commons-collections</name>
+ <created>2008-04-15</created>
+ <revision>3.2.1</revision>
+ </Version>
+ </release>
+ <release>
+ <Version>
+ <name>commons-collections</name>
+ <created>2006-05-14</created>
+ <revision>3.2</revision>
+ </Version>
+ </release>
+ <release>
+ <Version>
<name>commons-collections</name>
<created>2004-06-23</created>
- <version>3.1</version>
- </revision>
- <revision>
+ <revision>3.1</revision>
+ </Version>
+ </release>
+ <release>
+ <Version>
<name>commons-collections</name>
<created>2004-06-23</created>
- <version>2.1.1</version>
- </revision>
+ <revision>2.1.1</revision>
+ </Version>
</release>
- <mailing-list rdf:resource="http://jakarta.apache.org/site/mail2.html#Commons"/>
+ <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>
</Project>
</rdf:RDF>
[06/50] commons-collections git commit: Backport COLLECTIONS-228 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-228 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713175 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/3afb3cb3
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/3afb3cb3
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/3afb3cb3
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 3afb3cb3452fa78d629facfb2d29d5d4f5b06dd7
Parents: 9876243
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 20:47:04 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 20:47:04 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 8 ++++----
.../apache/commons/collections/map/MultiValueMap.java | 11 ++++++-----
.../commons/collections/map/TestMultiValueMap.java | 11 +++++++++++
3 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3afb3cb3/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 69031da..e06564d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -30,6 +30,10 @@
"SetUniqueList.addAll(int, Collection)" now correctly add the collection at the
provided index.
</action>
+ <action issue="COLLECTIONS-228" dev="scolebourne" type="fix">
+ "MultiValueMap#put(Object, Object)" and "MultiValueMap#putAll(Object, Collection)"
+ now correctly return if the map has changed by this operation.
+ </action>
<action issue="COLLECTIONS-219" dev="scolebourne" type="fix" due-to="Tom Leccese">
"CollectionUtils#removeAll" wrongly called "ListUtils#retainAll".
</action>
@@ -78,10 +82,6 @@
"Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
if the size of the map is less or equal 3.
</action>
- <action issue="COLLECTIONS-228" dev="scolebourne" type="fix">
- "MultiValueMap#put(Object, Object)" and "MultiValueMap#putAll(Object, Collection)"
- now correctly return if the map has changed by this operation.
- </action>
<action issue="COLLECTIONS-217" dev="scolebourne" type="fix" due-to="Matt Bishop">
Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
correctly set the value for the current entry.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3afb3cb3/src/java/org/apache/commons/collections/map/MultiValueMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/MultiValueMap.java b/src/java/org/apache/commons/collections/map/MultiValueMap.java
index cc74fd7..7b7afb5 100644
--- a/src/java/org/apache/commons/collections/map/MultiValueMap.java
+++ b/src/java/org/apache/commons/collections/map/MultiValueMap.java
@@ -211,7 +211,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
if (coll.size() > 0) {
// only add if non-zero size to maintain class state
getMap().put(key, coll);
- result = false;
+ result = true; // map definitely changed
}
} else {
result = coll.add(value);
@@ -308,19 +308,20 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
if (values == null || values.size() == 0) {
return false;
}
+ boolean result = false;
Collection coll = getCollection(key);
if (coll == null) {
coll = createCollection(values.size());
- boolean result = coll.addAll(values);
+ coll.addAll(values);
if (coll.size() > 0) {
// only add if non-zero size to maintain class state
getMap().put(key, coll);
- result = false;
+ result = true; // map definitely changed
}
- return result;
} else {
- return coll.addAll(values);
+ result = coll.addAll(values);
}
+ return result;
}
/**
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3afb3cb3/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestMultiValueMap.java b/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
index 7b322dc..b9a5ac8 100644
--- a/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
+++ b/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import junit.framework.Test;
@@ -250,6 +251,16 @@ public class TestMultiValueMap extends TestCase {
assertEquals(false, map.containsValue("A", "AB"));
}
+ public void testPut_ReturnValue() {
+ MultiValueMap test = new MultiValueMap();
+ assertNotNull(test.put("key", "object1"));
+ assertNotNull(test.put("key", "object2"));
+
+ List coll = Arrays.asList(new String[]{"uno", "un"});
+ assertTrue(test.putAll("key", coll));
+ assertFalse(test.putAll("key", new ArrayList()));
+ }
+
public void testPutAll_Map1() {
MultiMap original = new MultiValueMap();
original.put("key", "object1");
[22/50] commons-collections git commit: Update to latest parent:
hopefully this will allow us to make a release.
Posted by ch...@apache.org.
Update to latest parent: hopefully this will allow us to make a release.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713538 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/348e7063
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/348e7063
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/348e7063
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 348e7063203429070850418a453e41202bff15a7
Parents: 5ec476b
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:19:46 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:19:46 2015 +0000
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/348e7063/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4a71e6a..cef7bd0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
- <version>9</version>
+ <version>39</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>commons-collections</groupId>
[45/50] commons-collections git commit: Update pom after release in
3_2_X branch.
Posted by ch...@apache.org.
Update pom after release in 3_2_X branch.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1714324 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/3a5df071
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/3a5df071
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/3a5df071
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 3a5df0719a45ddb8b8b159bcc68f3615e856409a
Parents: af8a30c
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 14 13:44:07 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 14 13:44:07 2015 +0000
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/3a5df071/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1aabaee..0b7919b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2.2-SNAPSHOT</version>
+ <version>3.2.3-SNAPSHOT</version>
<name>Apache Commons Collections</name>
<inceptionYear>2001</inceptionYear>
[46/50] commons-collections git commit: Obsolete DOAP
Posted by ch...@apache.org.
Obsolete DOAP
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1719133 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/0af16748
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/0af16748
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/0af16748
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 0af167483520819e6c3377e92c58087838a92a43
Parents: 3a5df07
Author: Sebastian Bazley <se...@apache.org>
Authored: Thu Dec 10 18:11:11 2015 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Thu Dec 10 18:11:11 2015 +0000
----------------------------------------------------------------------
doap_collections.rdf | 66 -----------------------------------------------
1 file changed, 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/0af16748/doap_collections.rdf
----------------------------------------------------------------------
diff --git a/doap_collections.rdf b/doap_collections.rdf
deleted file mode 100644
index ba623be..0000000
--- a/doap_collections.rdf
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:asfext="http://projects.apache.org/ns/asfext#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:doap="http://usefulinc.com/ns/doap#" xml:lang="en">
- <Project rdf:about="http://commons.apache.org/collections/">
- <name>Apache Commons Collections</name>
- <homepage rdf:resource="http://commons.apache.org/collections/"/>
- <programming-language>Java</programming-language>
- <category rdf:resource="http://projects.apache.org/category/library"/>
- <license rdf:resource="http://usefulinc.com/doap/licenses/asl20"/>
- <bug-database rdf:resource="http://issues.apache.org/jira/browse/COLLECTIONS"/>
- <download-page rdf:resource="http://commons.apache.org/collections/download_collections.cgi"/>
- <asfext:pmc rdf:resource="http://commons.apache.org/"/>
- <shortdesc xml:lang="en">Commons Collections</shortdesc>
- <description xml:lang="en">Types that extend and augment the Java Collections Framework.</description>
- <repository>
- <SVNRepository>
- <browse rdf:resource="http://svn.apache.org/repos/asf/commons/proper/collections/trunk"/>
- <location rdf:resource="http://svn.apache.org/repos/asf/commons/proper/collections"/>
- </SVNRepository>
- </repository>
- <release>
- <Version>
- <name>commons-collections</name>
- <created>2008-04-15</created>
- <revision>3.2.1</revision>
- </Version>
- </release>
- <release>
- <Version>
- <name>commons-collections</name>
- <created>2006-05-14</created>
- <revision>3.2</revision>
- </Version>
- </release>
- <release>
- <Version>
- <name>commons-collections</name>
- <created>2004-06-23</created>
- <revision>3.1</revision>
- </Version>
- </release>
- <release>
- <Version>
- <name>commons-collections</name>
- <created>2004-06-23</created>
- <revision>2.1.1</revision>
- </Version>
- </release>
- <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>
- </Project>
-</rdf:RDF>
[43/50] commons-collections git commit: history.xml is missing
version 3.2.2.
Posted by ch...@apache.org.
history.xml is missing version 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1714253 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/ad0f9faf
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/ad0f9faf
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/ad0f9faf
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: ad0f9faf5e2ad4913c205ffd2db274dcd5baacaa
Parents: 6a3dbcd
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Nov 13 18:55:07 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Nov 13 18:55:07 2015 +0000
----------------------------------------------------------------------
xdocs/history.xml | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/ad0f9faf/xdocs/history.xml
----------------------------------------------------------------------
diff --git a/xdocs/history.xml b/xdocs/history.xml
index 262f623..cf9d6ec 100644
--- a/xdocs/history.xml
+++ b/xdocs/history.xml
@@ -104,6 +104,14 @@ Notably MultiValueMap is a new more flexible implementation of MultiHashMap.
<b>Collections 3.2.1</b> Re-packaged v3.2 release which is OSGi enabled.
</p>
+<p>
+<b>Collections 3.2.2</b> Serialization support for unsafe classes in the functor package is disabled by default as
+this can be exploited for remote code execution attacks. To re-enable the feature the system property
+"org.apache.commons.collections.enableUnsafeSerialization" needs to be set to "true". Classes considered to be
+unsafe are: CloneTransformer, ForClosure, InstantiateFactory, InstantiateTransformer, InvokerTransformer,
+PrototypeCloneFactory, PrototypeSerializationFactory, WhileClosure. Fixes COLLECTIONS-580. Other bug fixes as well.
+</p>
+
</section>
</body>
[21/50] commons-collections git commit: [COLLECTIONS-580] Add javadoc,
improve error message and apply review comments.
Posted by ch...@apache.org.
[COLLECTIONS-580] Add javadoc, improve error message and apply review comments.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713537 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/5ec476b0
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/5ec476b0
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/5ec476b0
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 5ec476b0b756852db865b2e442180f091f8209ee
Parents: fd61086
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:09:05 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:09:05 2015 +0000
----------------------------------------------------------------------
.../functors/InvokerTransformer.java | 18 ++++++++++++++++--
.../functors/TestInvokerTransformer.java | 20 +++++++++++---------
2 files changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/5ec476b0/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
index 2dcf09c..580a229 100644
--- a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
+++ b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java
@@ -18,6 +18,7 @@ package org.apache.commons.collections.functors;
import java.io.IOException;
import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -29,6 +30,17 @@ import org.apache.commons.collections.Transformer;
/**
* Transformer implementation that creates a new object instance by reflection.
+ * <p>
+ * <b>WARNING:</b> from v3.2.2 onwards this class will throw an
+ * {@link UnsupportedOperationException} when trying to de-serialize an
+ * instance from a {@link ObjectOutputStream} to prevent potential
+ * remote code execution exploits.
+ * <p>
+ * In order to re-enable de-serialization of {@code InvokerTransformer}
+ * instances, the following system property can be used (via -Dproperty=true):
+ * <pre>
+ * org.apache.commons.collections.invokertransformer.enableDeserialization
+ * </pre>
*
* @since Commons Collections 3.0
* @version $Revision$ $Date$
@@ -160,8 +172,10 @@ public class InvokerTransformer implements Transformer, Serializable {
deserializeProperty = null;
}
- if (deserializeProperty == null || !deserializeProperty.equalsIgnoreCase("true")) {
- throw new UnsupportedOperationException("Deserialization of InvokerTransformer is disabled, ");
+ if (!"true".equalsIgnoreCase(deserializeProperty)) {
+ throw new UnsupportedOperationException(
+ "Deserialization of InvokerTransformer is disabled for security reasons. " +
+ "To re-enable it set system property '" + DESERIALIZE + "' to 'true'");
}
is.defaultReadObject();
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/5ec476b0/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
index 9129471..4b48a59 100644
--- a/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
+++ b/src/test/org/apache/commons/collections/functors/TestInvokerTransformer.java
@@ -44,17 +44,19 @@ public class TestInvokerTransformer extends BulkTest {
Assert.assertNull(System.getProperty(InvokerTransformer.DESERIALIZE));
System.setProperty(InvokerTransformer.DESERIALIZE, "true");
- InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
- byte[] data = serialize(transformer);
- Assert.assertNotNull(data);
try {
- Object obj = deserialize(data);
- Assert.assertTrue(obj instanceof InvokerTransformer);
- } catch (UnsupportedOperationException ex) {
- fail("de-serialization of InvokerTransformer should be enabled");
+ InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
+ byte[] data = serialize(transformer);
+ Assert.assertNotNull(data);
+ try {
+ Object obj = deserialize(data);
+ Assert.assertTrue(obj instanceof InvokerTransformer);
+ } catch (UnsupportedOperationException ex) {
+ fail("de-serialization of InvokerTransformer should be enabled");
+ }
+ } finally {
+ System.clearProperty(InvokerTransformer.DESERIALIZE);
}
-
- System.clearProperty(InvokerTransformer.DESERIALIZE);
}
private byte[] serialize(InvokerTransformer transformer) throws IOException {
[48/50] commons-collections git commit: commons-parent 39 -> 40.
Posted by ch...@apache.org.
commons-parent 39 -> 40.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1744818 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/4d461167
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/4d461167
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/4d461167
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 4d4611671c85137f7fe57e149d21dbce730442a9
Parents: 7fd216b
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri May 20 23:53:02 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri May 20 23:53:02 2016 +0000
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/4d461167/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0b7919b..bbd3fa8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
- <version>39</version>
+ <version>40</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>commons-collections</groupId>
[28/50] commons-collections git commit: Add release-notes template.
Posted by ch...@apache.org.
Add release-notes template.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713553 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/1a094a45
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/1a094a45
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/1a094a45
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 1a094a45970c1b2b21b660cc8a77fb8f5cb28edf
Parents: 3d99735
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:49:12 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:49:12 2015 +0000
----------------------------------------------------------------------
src/changes/release-notes.vm | 138 ++++++++++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/1a094a45/src/changes/release-notes.vm
----------------------------------------------------------------------
diff --git a/src/changes/release-notes.vm b/src/changes/release-notes.vm
new file mode 100644
index 0000000..6137b08
--- /dev/null
+++ b/src/changes/release-notes.vm
@@ -0,0 +1,138 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+ Apache ${project.name} ${version} RELEASE NOTES
+
+$introduction.replaceAll("(?<!\015)\012", "
+")
+
+## N.B. the available variables are described here:
+## http://maven.apache.org/plugins/maven-changes-plugin/examples/using-a-custom-announcement-template.html
+## Hack to improve layout: replace all pairs of spaces with a single new-line
+$release.description.replaceAll(" ", "
+")
+
+## Fix up indentation for multi-line action descriptions
+#macro ( indent )
+#set($action=$action.replaceAll("(?m)^ +"," "))
+#end
+#if ($release.getActions().size() == 0)
+No changes defined in this version.
+#else
+Changes in this version include:
+
+#if ($release.getActions('add').size() !=0)
+New features:
+#foreach($actionItem in $release.getActions('add'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#indent()
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue: #end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('fix').size() !=0)
+Fixed Bugs:
+#foreach($actionItem in $release.getActions('fix'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#indent()
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue: #end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('update').size() !=0)
+Changes:
+#foreach($actionItem in $release.getActions('update'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#indent()
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue: #end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('remove').size() !=0)
+Removed:
+#foreach($actionItem in $release.getActions('remove'))
+## Use replaceAll to fix up LF-only line ends on Windows.
+#set($action=$actionItem.getAction().replaceAll("\n","
+"))
+#indent()
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+o#if($!issue != "") $issue. #end ${action} #if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+## End of main loop
+#end
+
+For complete information on ${project.name}, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache ${project.name} website:
+
+${project.url}
[33/50] commons-collections git commit: Add missing license header.
Posted by ch...@apache.org.
Add missing license header.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713760 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/03421726
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/03421726
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/03421726
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 034217267eb716d8666ab75aed5175a059b242e8
Parents: ee7c516
Author: Gary D. Gregory <gg...@apache.org>
Authored: Wed Nov 11 05:00:03 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Wed Nov 11 05:00:03 2015 +0000
----------------------------------------------------------------------
xdocs/style/project.css | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/03421726/xdocs/style/project.css
----------------------------------------------------------------------
diff --git a/xdocs/style/project.css b/xdocs/style/project.css
index c1d541c..3f385c1 100644
--- a/xdocs/style/project.css
+++ b/xdocs/style/project.css
@@ -1 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
@import url("http://commons.apache.org/style/commons-maven.css");
[12/50] commons-collections git commit: Backport COLLECTIONS-217 to
3.2.2
Posted by ch...@apache.org.
Backport COLLECTIONS-217 to 3.2.2
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713290 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/46e5a832
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/46e5a832
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/46e5a832
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 46e5a83207196e5ef5f97fc123b8862190429931
Parents: c0da312
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 20:21:27 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 20:21:27 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 8 +--
.../commons/collections/map/Flat3Map.java | 3 +
.../commons/collections/map/TestFlat3Map.java | 61 ++++++++++++++++++++
3 files changed, 68 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/46e5a832/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 683723b..bccc7e1 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,6 +53,10 @@
<action issue="COLLECTIONS-219" dev="scolebourne" type="fix" due-to="Tom Leccese">
"CollectionUtils#removeAll" wrongly called "ListUtils#retainAll".
</action>
+ <action issue="COLLECTIONS-217" dev="scolebourne" type="fix" due-to="Matt Bishop">
+ Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
+ correctly set the value for the current entry.
+ </action>
<!-- Bugfixes planned to backport from 4.0
@@ -85,10 +89,6 @@
"Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
if the size of the map is less or equal 3.
</action>
- <action issue="COLLECTIONS-217" dev="scolebourne" type="fix" due-to="Matt Bishop">
- Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now
- correctly set the value for the current entry.
- </action>
-->
</release>
</body>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/46e5a832/src/java/org/apache/commons/collections/map/Flat3Map.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/Flat3Map.java b/src/java/org/apache/commons/collections/map/Flat3Map.java
index 518842b..19085f1 100644
--- a/src/java/org/apache/commons/collections/map/Flat3Map.java
+++ b/src/java/org/apache/commons/collections/map/Flat3Map.java
@@ -804,10 +804,13 @@ public class Flat3Map implements IterableMap, Serializable, Cloneable {
switch (nextIndex) {
case 3:
parent.value3 = value;
+ break;
case 2:
parent.value2 = value;
+ break;
case 1:
parent.value1 = value;
+ break;
}
return old;
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/46e5a832/src/test/org/apache/commons/collections/map/TestFlat3Map.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestFlat3Map.java b/src/test/org/apache/commons/collections/map/TestFlat3Map.java
index 9359602..427b7ae 100644
--- a/src/test/org/apache/commons/collections/map/TestFlat3Map.java
+++ b/src/test/org/apache/commons/collections/map/TestFlat3Map.java
@@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.util.Iterator;
import java.util.Map;
import junit.framework.Test;
@@ -40,8 +41,10 @@ public class TestFlat3Map extends AbstractTestIterableMap {
private static final Integer ONE = new Integer(1);
private static final Integer TWO = new Integer(2);
+ private static final Integer THREE = new Integer(3);
private static final String TEN = "10";
private static final String TWENTY = "20";
+ private static final String THIRTY = "30";
public TestFlat3Map(String testName) {
super(testName);
@@ -60,6 +63,64 @@ public class TestFlat3Map extends AbstractTestIterableMap {
}
//-----------------------------------------------------------------------
+ public void testEntryIteratorSetValue1() throws Exception {
+ final Flat3Map map = new Flat3Map();
+ map.put(ONE, TEN);
+ map.put(TWO, TWENTY);
+ map.put(THREE, THIRTY);
+
+ final Iterator it = map.entrySet().iterator();
+ final Map.Entry entry = (Map.Entry) it.next();
+ entry.setValue("NewValue");
+ assertEquals(3, map.size());
+ assertEquals(true, map.containsKey(ONE));
+ assertEquals(true, map.containsKey(TWO));
+ assertEquals(true, map.containsKey(THREE));
+ assertEquals("NewValue", map.get(ONE));
+ assertEquals(TWENTY, map.get(TWO));
+ assertEquals(THIRTY, map.get(THREE));
+ }
+
+ public void testEntryIteratorSetValue2() throws Exception {
+ final Flat3Map map = new Flat3Map();
+ map.put(ONE, TEN);
+ map.put(TWO, TWENTY);
+ map.put(THREE, THIRTY);
+
+ final Iterator it = map.entrySet().iterator();
+ it.next();
+ final Map.Entry entry = (Map.Entry) it.next();
+ entry.setValue("NewValue");
+ assertEquals(3, map.size());
+ assertEquals(true, map.containsKey(ONE));
+ assertEquals(true, map.containsKey(TWO));
+ assertEquals(true, map.containsKey(THREE));
+ assertEquals(TEN, map.get(ONE));
+ assertEquals("NewValue", map.get(TWO));
+ assertEquals(THIRTY, map.get(THREE));
+ }
+
+ public void testEntryIteratorSetValue3() throws Exception {
+ final Flat3Map map = new Flat3Map();
+ map.put(ONE, TEN);
+ map.put(TWO, TWENTY);
+ map.put(THREE, THIRTY);
+
+ final Iterator it = map.entrySet().iterator();
+ it.next();
+ it.next();
+ final Map.Entry entry = (Map.Entry) it.next();
+ entry.setValue("NewValue");
+ assertEquals(3, map.size());
+ assertEquals(true, map.containsKey(ONE));
+ assertEquals(true, map.containsKey(TWO));
+ assertEquals(true, map.containsKey(THREE));
+ assertEquals(TEN, map.get(ONE));
+ assertEquals(TWENTY, map.get(TWO));
+ assertEquals("NewValue", map.get(THREE));
+ }
+
+ //-----------------------------------------------------------------------
public void testEquals1() {
Flat3Map map1 = new Flat3Map();
map1.put("a", "testA");
[10/50] commons-collections git commit: Backport COLLECTIONS-294 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-294 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713181 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/eb693a74
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/eb693a74
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/eb693a74
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: eb693a74697659d226b5e4058d3c0e0313e46d07
Parents: c274882
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sat Nov 7 21:17:00 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sat Nov 7 21:17:00 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 8 +++---
.../collections/map/CaseInsensitiveMap.java | 16 ++++++-----
.../collections/map/TestCaseInsensitiveMap.java | 28 +++++++++++++++++++-
3 files changed, 41 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/eb693a74/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8695e33..66cee68 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -29,6 +29,10 @@
<action issue="COLLECTIONS-335" dev="jochen" type="fix" due-to="sebb">
Fixed cache assignment for "TreeBidiMap#entrySet".
</action>
+ <action issue="COLLECTIONS-294" dev="bayard" type="fix" due-to="Benjamin Bentmann">
+ "CaseInsensitiveMap" will now convert input strings to lower-case in a
+ locale-independent manner.
+ </action>
<action issue="COLLECTIONS-266" dev="bayard" type="fix" due-to="Joerg Schaible">
"MultiKey" will now be correctly serialized/de-serialized.
</action>
@@ -71,10 +75,6 @@
<action issue="COLLECTIONS-304" dev="bayard" type="fix" due-to="Rafał Figas,Bjorn Townsend">
"SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint.
</action>
- <action issue="COLLECTIONS-294" dev="bayard" type="fix" due-to="Benjamin Bentmann">
- "CaseInsensitiveMap" will now convert input strings to lower-case in a
- locale-independant manner.
- </action>
<action issue="COLLECTIONS-261" dev="bayard" type="fix" due-to="ori">
"Flat3Map#remove(Object)" will now return the correct value mapped to the removed key
if the size of the map is less or equal 3.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/eb693a74/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java b/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
index ba9650d..237c05a 100644
--- a/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
+++ b/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java
@@ -25,9 +25,9 @@ import java.util.Map;
/**
* A case-insensitive <code>Map</code>.
* <p>
- * As entries are added to the map, keys are converted to all lowercase. A new
- * key is compared to existing keys by comparing <code>newKey.toString().toLower()</code>
- * to the lowercase values in the current <code>KeySet.</code>
+ * Before keys are added to the map or compared to other existing keys, they are converted
+ * to all lowercase in a locale-independent fashion by using information from the Unicode
+ * data file.
* <p>
* Null keys are supported.
* <p>
@@ -111,14 +111,18 @@ public class CaseInsensitiveMap extends AbstractHashedMap implements Serializabl
* Overrides convertKey() from {@link AbstractHashedMap} to convert keys to
* lower case.
* <p>
- * Returns null if key is null.
- *
+ * Returns {@link AbstractHashedMap#NULL} if key is null.
+ *
* @param key the key convert
* @return the converted key
*/
protected Object convertKey(Object key) {
if (key != null) {
- return key.toString().toLowerCase();
+ char[] chars = key.toString().toCharArray();
+ for (int i = chars.length - 1; i >= 0; i--) {
+ chars[i] = Character.toLowerCase(Character.toUpperCase(chars[i]));
+ }
+ return new String(chars);
} else {
return AbstractHashedMap.NULL;
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/eb693a74/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
index b3f27a5..0b7266e 100644
--- a/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
+++ b/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java
@@ -17,6 +17,7 @@
package org.apache.commons.collections.map;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -108,7 +109,32 @@ public class TestCaseInsensitiveMap extends AbstractTestIterableMap {
assertEquals(map.size(), cloned.size());
assertSame(map.get("1"), cloned.get("1"));
}
-
+
+ // COLLECTIONS-294
+ public void testLocaleIndependence() {
+ Locale orig = Locale.getDefault();
+ Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };
+ String[][] data = {
+ { "i", "I" },
+ { "\u03C2", "\u03C3" },
+ { "\u03A3", "\u03C2" },
+ { "\u03A3", "\u03C3" },
+ };
+ try {
+ for (int i = 0; i < locales.length; i++) {
+ Locale.setDefault(locales[i]);
+ for (int j = 0; j < data.length; j++) {
+ assertTrue("Test data corrupt: " + j, data[j][0].equalsIgnoreCase(data[j][1]));
+ CaseInsensitiveMap map = new CaseInsensitiveMap();
+ map.put(data[j][0], "value");
+ assertEquals(Locale.getDefault() + ": " + j, "value", map.get(data[j][1]));
+ }
+ }
+ } finally {
+ Locale.setDefault(orig);
+ }
+ }
+
/*
public void testCreate() throws Exception {
resetEmpty();
[15/50] commons-collections git commit: Backport COLLECTIONS-307 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-307 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713295 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/81af3aaa
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/81af3aaa
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/81af3aaa
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 81af3aaa9a03e503e29799b9c3de9f3ddb3e875b
Parents: d75768a
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 21:12:28 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 21:12:28 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 8 ++---
.../commons/collections/list/SetUniqueList.java | 30 +++++++++++++++-
.../collections/list/TestSetUniqueList.java | 38 ++++++++++++++++++++
3 files changed, 71 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/81af3aaa/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 053ccc5..a415a91 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -38,6 +38,10 @@
<action issue="COLLECTIONS-334" dev="jochen" type="fix" due-to="sebb">
Synchronized access to lock in "StaticBucketMap#size()".
</action>
+ <action issue="COLLECTIONS-307" dev="bayard" type="fix" due-to="Christian Semrau">
+ "SetUniqueList#subList()#contains(Object)" will now correctly check the subList
+ rather than the parent list.
+ </action>
<action issue="COLLECTIONS-294" dev="bayard" type="fix" due-to="Benjamin Bentmann">
"CaseInsensitiveMap" will now convert input strings to lower-case in a
locale-independent manner.
@@ -82,10 +86,6 @@
<action issue="COLLECTIONS-330" dev="mbenson" type="fix" due-to="Joerg Schaible">
"LRUMap#keySet()#remove(Object)" will not throw a "ConcurrentModificationException" anymore.
</action>
- <action issue="COLLECTIONS-307" dev="bayard" type="fix" due-to="Christian Semrau">
- "SetUniqueList#subList()#contains(Object)" will now correctly check the subList
- rather than the parent list.
- </action>
<action issue="COLLECTIONS-304" dev="bayard" type="fix" due-to="Rafał Figas,Bjorn Townsend">
"SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint.
</action>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/81af3aaa/src/java/org/apache/commons/collections/list/SetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/SetUniqueList.java b/src/java/org/apache/commons/collections/list/SetUniqueList.java
index 3eb5f34..c9f0148 100644
--- a/src/java/org/apache/commons/collections/list/SetUniqueList.java
+++ b/src/java/org/apache/commons/collections/list/SetUniqueList.java
@@ -277,7 +277,35 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
}
public List subList(int fromIndex, int toIndex) {
- return new SetUniqueList(super.subList(fromIndex, toIndex), set);
+ List superSubList = super.subList(fromIndex, toIndex);
+ Set subSet = createSetBasedOnList(set, superSubList);
+ return new SetUniqueList(superSubList, subSet);
+ }
+
+ /**
+ * Create a new {@link Set} with the same type as the provided {@code set}
+ * and populate it with all elements of {@code list}.
+ *
+ * @param set the {@link Set} to be used as return type, must not be null
+ * @param list the {@link List} to populate the {@link Set}
+ * @return a new {@link Set} populated with all elements of the provided
+ * {@link List}
+ */
+ protected Set createSetBasedOnList(Set set, List list) {
+ Set subSet = null;
+ if(set.getClass().equals(HashSet.class)) {
+ subSet = new HashSet();
+ } else {
+ try {
+ subSet = (Set) set.getClass().newInstance();
+ } catch(InstantiationException ie) {
+ subSet = new HashSet();
+ } catch(IllegalAccessException iae) {
+ subSet = new HashSet();
+ }
+ }
+ subSet.addAll(list);
+ return subSet;
}
//-----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/81af3aaa/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
index fe08150..519cd59 100644
--- a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
+++ b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
+import java.util.Set;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -430,6 +431,43 @@ public class TestSetUniqueList extends AbstractTestList {
assertTrue(s.contains(c));
}
+ public void testCollections307() {
+ List list = new ArrayList();
+ List uniqueList = SetUniqueList.decorate(list);
+ String hello = "Hello";
+ String world = "World";
+ uniqueList.add(hello);
+ uniqueList.add(world);
+ List subList = list.subList(0, 0);
+ List subUniqueList = uniqueList.subList(0, 0);
+ assertFalse(subList.contains(world)); // passes
+ assertFalse(subUniqueList.contains(world)); // fails
+ List worldList = new ArrayList();
+ worldList.add(world);
+ assertFalse(subList.contains("World")); // passes
+ assertFalse(subUniqueList.contains("World")); // fails
+ // repeat the test with a different class than HashSet;
+ // which means subclassing SetUniqueList below
+ list = new ArrayList();
+ uniqueList = new SetUniqueList307(list, new java.util.TreeSet());
+ uniqueList.add(hello);
+ uniqueList.add(world);
+ subList = list.subList(0, 0);
+ subUniqueList = uniqueList.subList(0, 0);
+ assertFalse(subList.contains(world)); // passes
+ assertFalse(subUniqueList.contains(world)); // fails
+ worldList = new ArrayList();
+ worldList.add(world);
+ assertFalse(subList.contains("World")); // passes
+ assertFalse(subUniqueList.contains("World")); // fails
+ }
+
+ class SetUniqueList307 extends SetUniqueList {
+ public SetUniqueList307(List list, Set set) {
+ super(list, set);
+ }
+ }
+
//-----------------------------------------------------------------------
public String getCompatibilityVersion() {
return "3.1";
[32/50] commons-collections git commit: Add Eclipse file to
svn:ignore.
Posted by ch...@apache.org.
Add Eclipse file to svn:ignore.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713745 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/ee7c5166
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/ee7c5166
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/ee7c5166
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: ee7c5166899523d5df90853e154a98bfb13d5eeb
Parents: 5dacd2e
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Nov 10 22:46:43 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue Nov 10 22:46:43 2015 +0000
----------------------------------------------------------------------
----------------------------------------------------------------------
[41/50] commons-collections git commit: Fix RAT check.
Posted by ch...@apache.org.
Fix RAT check.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713914 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/cfceeb47
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/cfceeb47
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/cfceeb47
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: cfceeb47e124052cdc747b92e0025533641dae70
Parents: 8377f58
Author: Gary D. Gregory <gg...@apache.org>
Authored: Wed Nov 11 19:04:55 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Wed Nov 11 19:04:55 2015 +0000
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/cfceeb47/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7baebfb..537ace6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -443,7 +443,7 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
- <exclude>src/test/resources/data/test/*</exclude>
+ <exclude>data/test/*</exclude>
<exclude>maven-eclipse.xml</exclude>
</excludes>
</configuration>
[23/50] commons-collections git commit: Disable animal-sniffer as
there are not signatures for Java 1.2.
Posted by ch...@apache.org.
Disable animal-sniffer as there are not signatures for Java 1.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713539 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/f526e49e
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/f526e49e
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/f526e49e
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: f526e49ec226ea46c3fdbd90215b52b6d9b51434
Parents: 348e706
Author: Thomas Neidhart <tn...@apache.org>
Authored: Mon Nov 9 21:20:16 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Mon Nov 9 21:20:16 2015 +0000
----------------------------------------------------------------------
src/site/resources/profile.noanimal | 0
1 file changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/f526e49e/src/site/resources/profile.noanimal
----------------------------------------------------------------------
diff --git a/src/site/resources/profile.noanimal b/src/site/resources/profile.noanimal
new file mode 100644
index 0000000..e69de29
[16/50] commons-collections git commit: Backport COLLECTIONS-304 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-304 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713298 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/7f947f93
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/7f947f93
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/7f947f93
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 7f947f938d92eced2988d971e38810e74608467d
Parents: 81af3aa
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 21:27:35 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 21:27:35 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 6 +++---
.../commons/collections/list/SetUniqueList.java | 14 ++++++++------
.../collections/list/TestSetUniqueList.java | 19 +++++++++++++++++++
3 files changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f947f93/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a415a91..1445d73 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -42,6 +42,9 @@
"SetUniqueList#subList()#contains(Object)" will now correctly check the subList
rather than the parent list.
</action>
+ <action issue="COLLECTIONS-304" dev="bayard" type="fix" due-to="Rafał Figas,Bjorn Townsend">
+ "SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint.
+ </action>
<action issue="COLLECTIONS-294" dev="bayard" type="fix" due-to="Benjamin Bentmann">
"CaseInsensitiveMap" will now convert input strings to lower-case in a
locale-independent manner.
@@ -86,9 +89,6 @@
<action issue="COLLECTIONS-330" dev="mbenson" type="fix" due-to="Joerg Schaible">
"LRUMap#keySet()#remove(Object)" will not throw a "ConcurrentModificationException" anymore.
</action>
- <action issue="COLLECTIONS-304" dev="bayard" type="fix" due-to="Rafał Figas,Bjorn Townsend">
- "SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint.
- </action>
-->
</release>
</body>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f947f93/src/java/org/apache/commons/collections/list/SetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/list/SetUniqueList.java b/src/java/org/apache/commons/collections/list/SetUniqueList.java
index c9f0148..13a870e 100644
--- a/src/java/org/apache/commons/collections/list/SetUniqueList.java
+++ b/src/java/org/apache/commons/collections/list/SetUniqueList.java
@@ -216,14 +216,16 @@ public class SetUniqueList extends AbstractSerializableListDecorator {
public Object set(int index, Object object) {
int pos = indexOf(object);
Object removed = super.set(index, object);
- if (pos == -1 || pos == index) {
- return removed;
+
+ if (pos != -1 && pos != index) {
+ // the object is already in the unique list
+ // (and it hasn't been swapped with itself)
+ super.remove(pos); // remove the duplicate by index
}
-
- // the object is already in the uniq list
- // (and it hasn't been swapped with itself)
- super.remove(pos); // remove the duplicate by index
+
+ set.add(object); // add the new item to the unique set
set.remove(removed); // remove the item deleted by the set
+
return removed; // return the item deleted by the set
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7f947f93/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
index 519cd59..086027c 100644
--- a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
+++ b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java
@@ -468,6 +468,25 @@ public class TestSetUniqueList extends AbstractTestList {
}
}
+ public void testCollections304() {
+ List list = new LinkedList();
+ SetUniqueList decoratedList = SetUniqueList.decorate(list);
+ String s1 = "Apple";
+ String s2 = "Lemon";
+ String s3 = "Orange";
+ String s4 = "Strawberry";
+ decoratedList.add(s1);
+ decoratedList.add(s2);
+ decoratedList.add(s3);
+ assertEquals(3, decoratedList.size());
+ decoratedList.set(1, s4);
+ assertEquals(3, decoratedList.size());
+ decoratedList.add(1, s4);
+ assertEquals(3, decoratedList.size());
+ decoratedList.add(1, s2);
+ assertEquals(4, decoratedList.size());
+ }
+
//-----------------------------------------------------------------------
public String getCompatibilityVersion() {
return "3.1";
[31/50] commons-collections git commit: Oops, remove Eclipse file.
Posted by ch...@apache.org.
Oops, remove Eclipse file.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713744 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/5dacd2e7
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/5dacd2e7
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/5dacd2e7
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 5dacd2e7e6b827d15281467249b199832510b60e
Parents: c68f934
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Nov 10 22:45:16 2015 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue Nov 10 22:45:16 2015 +0000
----------------------------------------------------------------------
maven-eclipse.xml | 8 --------
1 file changed, 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/5dacd2e7/maven-eclipse.xml
----------------------------------------------------------------------
diff --git a/maven-eclipse.xml b/maven-eclipse.xml
deleted file mode 100644
index 9a99c2b..0000000
--- a/maven-eclipse.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<project default="copy-resources">
- <target name="init"/>
- <target name="copy-resources" depends="init">
- <copy todir="target/classes/META-INF" filtering="false">
- <fileset dir="." includes="NOTICE.txt|LICENSE.txt" excludes="**/*.java"/>
- </copy>
- </target>
-</project>
\ No newline at end of file
[37/50] commons-collections git commit: [COLLECTIONS-580] Add fix for
PrototypeFactory as well.
Posted by ch...@apache.org.
[COLLECTIONS-580] Add fix for PrototypeFactory as well.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713849 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/d9a00134
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/d9a00134
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/d9a00134
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: d9a00134f16d685bea11b2b12de824845e6473e3
Parents: bce4d02
Author: Thomas Neidhart <tn...@apache.org>
Authored: Wed Nov 11 14:21:37 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Wed Nov 11 14:21:37 2015 +0000
----------------------------------------------------------------------
.../collections/functors/PrototypeFactory.java | 46 ++++++++++++++++++
.../commons/collections/functors/package.html | 2 +
.../commons/collections/functors/TestAll.java | 1 +
.../functors/TestPrototypeFactory.java | 49 ++++++++++++++++++++
4 files changed, 98 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/d9a00134/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java b/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
index 5ba69eb..e28efb2 100644
--- a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
+++ b/src/java/org/apache/commons/collections/functors/PrototypeFactory.java
@@ -49,6 +49,16 @@ public class PrototypeFactory {
* <li>public copy constructor
* <li>serialization clone
* <ul>
+ * <p>
+ * <b>WARNING:</b> from v3.2.2 onwards this method will return a {@code Factory}
+ * that will throw an {@link UnsupportedOperationException} when trying to serialize
+ * or de-serialize it to prevent potential remote code execution exploits.
+ * <p>
+ * In order to re-enable serialization support the following system property
+ * can be used (via -Dproperty=true):
+ * <pre>
+ * org.apache.commons.collections.enableUnsafeSerialization
+ * </pre>
*
* @param prototype the object to clone each time in the factory
* @return the <code>prototype</code> factory
@@ -144,6 +154,24 @@ public class PrototypeFactory {
throw new FunctorException("PrototypeCloneFactory: Clone method threw an exception", ex);
}
}
+
+ /**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(PrototypeCloneFactory.class);
+ os.defaultWriteObject();
+ }
+
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ FunctorUtils.checkUnsafeSerialization(PrototypeCloneFactory.class);
+ is.defaultReadObject();
+ }
}
// PrototypeSerializationFactory
@@ -204,6 +232,24 @@ public class PrototypeFactory {
}
}
}
+
+ /**
+ * Overrides the default writeObject implementation to prevent
+ * serialization (see COLLECTIONS-580).
+ */
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ FunctorUtils.checkUnsafeSerialization(PrototypeSerializationFactory.class);
+ os.defaultWriteObject();
+ }
+
+ /**
+ * Overrides the default readObject implementation to prevent
+ * de-serialization (see COLLECTIONS-580).
+ */
+ private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
+ FunctorUtils.checkUnsafeSerialization(PrototypeSerializationFactory.class);
+ is.defaultReadObject();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/d9a00134/src/java/org/apache/commons/collections/functors/package.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/functors/package.html b/src/java/org/apache/commons/collections/functors/package.html
index d73ee62..d678ddd 100644
--- a/src/java/org/apache/commons/collections/functors/package.html
+++ b/src/java/org/apache/commons/collections/functors/package.html
@@ -38,6 +38,8 @@ Classes considered to be unsafe are:
<li>InstantiateFactory</li>
<li>InstantiateTransformer</li>
<li>InvokerTransformer</li>
+ <li>PrototypeFactory$PrototypeCloneFactory</li>
+ <li>PrototypeFactory$PrototypeSerializationFactory</li>
<li>WhileClosure</li>
</ul>
<p>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/d9a00134/src/test/org/apache/commons/collections/functors/TestAll.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestAll.java b/src/test/org/apache/commons/collections/functors/TestAll.java
index 5337628..14bcf7a 100644
--- a/src/test/org/apache/commons/collections/functors/TestAll.java
+++ b/src/test/org/apache/commons/collections/functors/TestAll.java
@@ -36,6 +36,7 @@ public class TestAll extends TestCase {
suite.addTest(TestInstantiateTransformer.suite());
suite.addTest(TestInstantiateFactory.suite());
suite.addTest(TestInvokerTransformer.suite());
+ suite.addTest(TestPrototypeFactory.suite());
suite.addTest(TestWhileClosure.suite());
return suite;
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/d9a00134/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
new file mode 100644
index 0000000..1ac51e4
--- /dev/null
+++ b/src/test/org/apache/commons/collections/functors/TestPrototypeFactory.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.functors;
+
+import java.util.ArrayList;
+
+import org.apache.commons.collections.Factory;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestPrototypeFactory extends AbstractTestSerialization {
+
+ // conventional
+ // ------------------------------------------------------------------------
+
+ public TestPrototypeFactory(String testName) {
+ super(testName);
+ }
+
+ public static Test suite() {
+ return new TestSuite(TestPrototypeFactory.class);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public Object makeObject() {
+ return PrototypeFactory.getInstance(new ArrayList());
+ }
+
+ public Class getTestClass() {
+ return Factory.class;
+ }
+
+}
[47/50] commons-collections git commit: Standardize on US English
spelling (recognised -> recognized.)
Posted by ch...@apache.org.
Standardize on US English spelling (recognised -> recognized.)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1744817 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/7fd216b4
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/7fd216b4
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/7fd216b4
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: 7fd216b4729f0cdddbe9e704f14f98462bbf1092
Parents: 0af1674
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri May 20 23:52:06 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri May 20 23:52:06 2016 +0000
----------------------------------------------------------------------
src/java/org/apache/commons/collections/CollectionUtils.java | 4 ++--
.../commons/collections/comparators/FixedOrderComparator.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7fd216b4/src/java/org/apache/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java
index 3abcd3d..23b1682 100644
--- a/src/java/org/apache/commons/collections/CollectionUtils.java
+++ b/src/java/org/apache/commons/collections/CollectionUtils.java
@@ -888,7 +888,7 @@ public class CollectionUtils {
*
* @param object the object to get the size of
* @return the size of the specified collection
- * @throws IllegalArgumentException thrown if object is not recognised or null
+ * @throws IllegalArgumentException thrown if object is not recognized or null
* @since Commons Collections 3.1
*/
public static int size(Object object) {
@@ -940,7 +940,7 @@ public class CollectionUtils {
*
* @param object the object to get the size of, not null
* @return true if empty
- * @throws IllegalArgumentException thrown if object is not recognised or null
+ * @throws IllegalArgumentException thrown if object is not recognized or null
* @since Commons Collections 3.2
*/
public static boolean sizeIsEmpty(Object object) {
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/7fd216b4/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java b/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
index a891486..59b0284 100644
--- a/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
+++ b/src/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
@@ -172,7 +172,7 @@ public class FixedOrderComparator implements Comparator {
if (unknownObjectBehavior != UNKNOWN_AFTER
&& unknownObjectBehavior != UNKNOWN_BEFORE
&& unknownObjectBehavior != UNKNOWN_THROW_EXCEPTION) {
- throw new IllegalArgumentException("Unrecognised value for unknown behaviour flag");
+ throw new IllegalArgumentException("Unrecognized value for unknown behaviour flag");
}
this.unknownObjectBehavior = unknownObjectBehavior;
}
@@ -224,7 +224,7 @@ public class FixedOrderComparator implements Comparator {
* Compares two objects according to the order of this Comparator.
* <p>
* It is important to note that this class will throw an IllegalArgumentException
- * in the case of an unrecognised object. This is not specified in the
+ * in the case of an unrecognized object. This is not specified in the
* Comparator interface, but is the most appropriate exception.
*
* @param obj1 the first object to compare
[14/50] commons-collections git commit: Backport COLLECTIONS-334 to
3.2.2.
Posted by ch...@apache.org.
Backport COLLECTIONS-334 to 3.2.2.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/COLLECTIONS_3_2_X@1713294 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/d75768a4
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/d75768a4
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/d75768a4
Branch: refs/heads/COLLECTIONS_3_2_X
Commit: d75768a4b2e71f88bf47ee45163fd671bebbd7e3
Parents: 6a7d35d
Author: Thomas Neidhart <tn...@apache.org>
Authored: Sun Nov 8 21:07:13 2015 +0000
Committer: Thomas Neidhart <tn...@apache.org>
Committed: Sun Nov 8 21:07:13 2015 +0000
----------------------------------------------------------------------
src/changes/changes.xml | 6 +++---
.../org/apache/commons/collections/map/StaticBucketMap.java | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/d75768a4/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9d3a1b7..053ccc5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -35,6 +35,9 @@
<action issue="COLLECTIONS-335" dev="jochen" type="fix" due-to="sebb">
Fixed cache assignment for "TreeBidiMap#entrySet".
</action>
+ <action issue="COLLECTIONS-334" dev="jochen" type="fix" due-to="sebb">
+ Synchronized access to lock in "StaticBucketMap#size()".
+ </action>
<action issue="COLLECTIONS-294" dev="bayard" type="fix" due-to="Benjamin Bentmann">
"CaseInsensitiveMap" will now convert input strings to lower-case in a
locale-independent manner.
@@ -76,9 +79,6 @@
"ListUtils#intersection(List, List)" will now also work correctly if there
are duplicate elements in the provided lists.
</action>
- <action issue="COLLECTIONS-334" dev="jochen" type="fix" due-to="sebb">
- Synchronized access to lock in "StaticBucketMap#size()".
- </action>
<action issue="COLLECTIONS-330" dev="mbenson" type="fix" due-to="Joerg Schaible">
"LRUMap#keySet()#remove(Object)" will not throw a "ConcurrentModificationException" anymore.
</action>
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/d75768a4/src/java/org/apache/commons/collections/map/StaticBucketMap.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/map/StaticBucketMap.java b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
index 4a130c3..1a0d379 100644
--- a/src/java/org/apache/commons/collections/map/StaticBucketMap.java
+++ b/src/java/org/apache/commons/collections/map/StaticBucketMap.java
@@ -182,7 +182,9 @@ public final class StaticBucketMap implements Map {
int cnt = 0;
for (int i = 0; i < buckets.length; i++) {
- cnt += locks[i].size;
+ synchronized(locks[i]) {
+ cnt += locks[i].size;
+ }
}
return cnt;
}