Apply patch from: https://issues.apache.org/jira/browse/AMQCPP-562
diff --git a/activemq-cpp/src/main/decaf/util/ArrayList.h b/activemq-cpp/src/main/decaf/util/ArrayList.h
index c3a1878..d833d95 100644
--- a/activemq-cpp/src/main/decaf/util/ArrayList.h
+++ b/activemq-cpp/src/main/decaf/util/ArrayList.h
@@ -170,11 +170,15 @@
     public:
 
         virtual void clear() {
-            delete [] this->elements;
-            this->curSize = 0;
-            this->capacity = 10;
-            this->elements = new E[this->capacity];
-            AbstractList<E>::modCount++;
+            if (this->curSize > 0) {
+                delete [] this->elements;
+                this->curSize = 0;
+                this->capacity = 10;
+                this->elements = new E[this->capacity];
+                AbstractList<E>::modCount++;
+            } else {
+                ensureCapacity(10);
+            }
         }
 
         virtual bool isEmpty() const {