You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/08/09 10:23:07 UTC
[4/5] activemq-artemis git commit: ARTEMIS-604 - Message
Serialization Improvement - JMS and RA fixes
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0535218c/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
index bfdeaa2..7b5ecf8 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java
@@ -390,6 +390,18 @@ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase {
" <config-property-name>ProtocolManagerFactoryStr</config-property-name>" +
" <config-property-type>java.lang.String</config-property-type>" +
" <config-property-value></config-property-value>" +
+ " </config-property>" +
+ " <config-property>" +
+ " <description>List of package/class names against which matching objects are permitted to be deserilized</description>" +
+ " <config-property-name>DeserializationWhiteList</config-property-name>" +
+ " <config-property-type>java.lang.String</config-property-type>" +
+ " <config-property-value></config-property-value>" +
+ " </config-property>" +
+ " <config-property>" +
+ " <description>List of package/classe names against which matching objects are forbidden to be deserialized</description>" +
+ " <config-property-name>DeserializationBlackList</config-property-name>" +
+ " <config-property-type>java.lang.String</config-property-type>" +
+ " <config-property-value></config-property-value>" +
" </config-property>";
private static String rootConfig = "<root>" + config + commentedOutConfigs + "</root>";
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0535218c/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java
index 3932f75..eb2bb60 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java
@@ -475,6 +475,43 @@ public class ResourceAdapterTest extends ActiveMQTestBase {
}
@Test
+ public void testActivationDeserializationParameters() throws Exception {
+ ActiveMQServer server = createServer(false);
+
+ try {
+
+ server.start();
+
+ ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
+
+ ra.setConnectorClassName(INVM_CONNECTOR_FACTORY);
+ ra.setUserName("userGlobal");
+ ra.setPassword("passwordGlobal");
+ ra.setDeserializationWhiteList("a.b.c.d.e");
+ ra.setDeserializationBlackList("f.g.h.i.j");
+ ra.start(new BootstrapContext());
+
+ ActiveMQConnectionFactory factory = ra.getDefaultActiveMQConnectionFactory();
+ assertEquals("a.b.c.d.e", factory.getDeserializationWhiteList());
+ assertEquals("f.g.h.i.j", factory.getDeserializationBlackList());
+
+ ConnectionFactoryProperties overrides = new ConnectionFactoryProperties();
+ overrides.setDeserializationWhiteList("k.l.m.n");
+ overrides.setDeserializationBlackList("o.p.q.r");
+
+ factory = ra.newConnectionFactory(overrides);
+ assertEquals("k.l.m.n", factory.getDeserializationWhiteList());
+ assertEquals("o.p.q.r", factory.getDeserializationBlackList());
+
+ ra.stop();
+
+ }
+ finally {
+ server.stop();
+ }
+ }
+
+ @Test
public void testForConnectionLeakDuringActivationWhenSessionCreationFails() throws Exception {
ActiveMQServer server = createServer(false);
ActiveMQResourceAdapter ra = null;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0535218c/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java
index 19d5586..00720cd 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java
@@ -16,12 +16,16 @@
*/
package org.apache.activemq.artemis.tests.unit.util;
+import org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.EnclosingClass;
+import org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1;
+import org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass2;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
@@ -33,12 +37,17 @@ import java.net.URLClassLoader;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import org.junit.Assert;
import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader;
+import org.junit.Test;
public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
// Constants -----------------------------------------------------
@@ -47,29 +56,33 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
// Static --------------------------------------------------------
- public static ClassLoader newClassLoader(final Class anyUserClass) throws Exception {
- ProtectionDomain protectionDomain = anyUserClass.getProtectionDomain();
- CodeSource codeSource = protectionDomain.getCodeSource();
- URL classLocation = codeSource.getLocation();
+ public static ClassLoader newClassLoader(final Class... userClasses) throws Exception {
+
+ Set<URL> userClassUrls = new HashSet<>();
+ for (Class anyUserClass : userClasses) {
+ ProtectionDomain protectionDomain = anyUserClass.getProtectionDomain();
+ CodeSource codeSource = protectionDomain.getCodeSource();
+ URL classLocation = codeSource.getLocation();
+ userClassUrls.add(classLocation);
+ }
StringTokenizer tokenString = new StringTokenizer(System.getProperty("java.class.path"), File.pathSeparator);
String pathIgnore = System.getProperty("java.home");
if (pathIgnore == null) {
- pathIgnore = classLocation.toString();
+ pathIgnore = userClassUrls.iterator().next().toString();
}
List<URL> urls = new ArrayList<>();
while (tokenString.hasMoreElements()) {
String value = tokenString.nextToken();
URL itemLocation = new File(value).toURI().toURL();
- if (!itemLocation.equals(classLocation) && itemLocation.toString().indexOf(pathIgnore) >= 0) {
+ if (!userClassUrls.contains(itemLocation) && itemLocation.toString().indexOf(pathIgnore) >= 0) {
urls.add(itemLocation);
}
}
-
URL[] urlArray = urls.toArray(new URL[urls.size()]);
ClassLoader masterClassLoader = URLClassLoader.newInstance(urlArray, null);
- ClassLoader appClassLoader = URLClassLoader.newInstance(new URL[]{classLocation}, masterClassLoader);
+ ClassLoader appClassLoader = URLClassLoader.newInstance(userClassUrls.toArray(new URL[0]), masterClassLoader);
return appClassLoader;
}
@@ -85,7 +98,11 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
AnObject obj = new AnObjectImpl();
byte[] bytes = ObjectInputStreamWithClassLoaderTest.toBytes(obj);
- ClassLoader testClassLoader = ObjectInputStreamWithClassLoaderTest.newClassLoader(obj.getClass());
+ //Class.isAnonymousClass() call used in ObjectInputStreamWithClassLoader
+ //need to access the enclosing class and its parent class of the obj
+ //i.e. ActiveMQTestBase and Assert.
+ ClassLoader testClassLoader = ObjectInputStreamWithClassLoaderTest.newClassLoader(
+ obj.getClass(), ActiveMQTestBase.class, Assert.class);
Thread.currentThread().setContextClassLoader(testClassLoader);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
@@ -113,7 +130,8 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
originalProxy.setMyInt(100);
byte[] bytes = ObjectInputStreamWithClassLoaderTest.toBytes(originalProxy);
- ClassLoader testClassLoader = ObjectInputStreamWithClassLoaderTest.newClassLoader(this.getClass());
+ ClassLoader testClassLoader = ObjectInputStreamWithClassLoaderTest.newClassLoader(this.getClass(),
+ ActiveMQTestBase.class, Assert.class);
Thread.currentThread().setContextClassLoader(testClassLoader);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(bais);
@@ -132,6 +150,349 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
}
+ @Test
+ public void testWhiteBlackList() throws Exception {
+ File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
+ ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
+ try {
+ outputStream.writeObject(new TestClass1());
+ outputStream.flush();
+ }
+ finally {
+ outputStream.close();
+ }
+
+ //default
+ assertNull(readSerializedObject(null, null, serailizeFile));
+
+ //white list
+ String whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization";
+ assertNull(readSerializedObject(whiteList, null, serailizeFile));
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1";
+ assertNull(readSerializedObject(whiteList, null, serailizeFile));
+
+ whiteList = "some.other.package";
+ Exception result = readSerializedObject(whiteList, null, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //blacklist
+ String blackList = "org.apache.activemq.artemis.tests.unit.util";
+ result = readSerializedObject(null, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1";
+ result = readSerializedObject(null, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg2";
+ result = readSerializedObject(null, blackList, serailizeFile);
+ assertNull(result);
+
+ blackList = "some.other.package";
+ whiteList = "some.other.package1";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //blacklist priority
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1, some.other.package";
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ blackList = "org.apache.activemq.artemis.tests.unit, some.other.package";
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.pkg2, some.other.package";
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+
+ blackList = "some.other.package, org.apache.activemq.artemis.tests.unit.util.deserialization.pkg2";
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+
+ //wildcard
+ blackList = "*";
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ blackList = "*";
+ whiteList = "*";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+ result = readSerializedObject(whiteList, null, serailizeFile);
+ assertNull(result);
+ }
+
+ @Test
+ public void testWhiteBlackListAgainstArrayObject() throws Exception {
+ File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
+ TestClass1[] sourceObject = new TestClass1[]{new TestClass1()};
+
+ ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
+ try {
+ outputStream.writeObject(sourceObject);
+ outputStream.flush();
+ }
+ finally {
+ outputStream.close();
+ }
+
+ //default ok
+ String blackList = null;
+ String whiteList = null;
+
+ Object result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+
+ //now blacklist TestClass1
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1";
+ whiteList = null;
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //now whitelist TestClass1, it should pass.
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1";
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+ }
+
+ @Test
+ public void testWhiteBlackListAgainstListObject() throws Exception {
+ File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
+ List<TestClass1> sourceObject = new ArrayList<>();
+ sourceObject.add(new TestClass1());
+
+ ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
+ try {
+ outputStream.writeObject(sourceObject);
+ outputStream.flush();
+ }
+ finally {
+ outputStream.close();
+ }
+
+ //default ok
+ String blackList = null;
+ String whiteList = null;
+
+ Object result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+
+ //now blacklist TestClass1
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1";
+ whiteList = null;
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //now whitelist TestClass1, should fail because the List type is not allowed
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1";
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //now add List to white list, it should pass
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1," +
+ "java.util.ArrayList";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+
+ }
+
+ @Test
+ public void testWhiteBlackListAgainstListMapObject() throws Exception {
+ File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
+ Map<TestClass1, TestClass2> sourceObject = new HashMap<>();
+ sourceObject.put(new TestClass1(), new TestClass2());
+
+ ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
+ try {
+ outputStream.writeObject(sourceObject);
+ outputStream.flush();
+ }
+ finally {
+ outputStream.close();
+ }
+
+ String blackList = null;
+ String whiteList = null;
+
+ Object result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+
+ //now blacklist the key
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1";
+ whiteList = null;
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //now blacklist the value
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass2";
+ whiteList = null;
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //now white list the key, should fail too because value is forbidden
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1";
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //now white list the value, should fail too because the key is forbidden
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass2";
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //both key and value are in the whitelist, it should fail because HashMap not permitted
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1," +
+ "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass2";
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //now add HashMap, test should pass.
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass1," +
+ "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass2," +
+ "java.util.HashMap";
+
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+
+ }
+
+ @Test
+ public void testWhiteBlackListAnonymousObject() throws Exception {
+ File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
+ ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
+ try {
+ Serializable object = EnclosingClass.anonymousObject;
+ assertTrue(object.getClass().isAnonymousClass());
+ outputStream.writeObject(object);
+ outputStream.flush();
+ }
+ finally {
+ outputStream.close();
+ }
+
+ //default
+ String blackList = null;
+ String whiteList = null;
+ assertNull(readSerializedObject(whiteList, blackList, serailizeFile));
+
+ //forbidden by specifying the enclosing class
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.EnclosingClass";
+ Object result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //do it in whiteList
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.EnclosingClass";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+ }
+
+ @Test
+ public void testWhiteBlackListLocalObject() throws Exception {
+ File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
+ ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
+ try {
+ Object object = EnclosingClass.getLocalObject();
+ assertTrue(object.getClass().isLocalClass());
+ outputStream.writeObject(object);
+ outputStream.flush();
+ }
+ finally {
+ outputStream.close();
+ }
+
+ //default
+ String blackList = null;
+ String whiteList = null;
+ assertNull(readSerializedObject(whiteList, blackList, serailizeFile));
+
+ //forbidden by specifying the enclosing class
+ blackList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.EnclosingClass";
+ Object result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertTrue(result instanceof ClassNotFoundException);
+
+ //do it in whiteList
+ blackList = null;
+ whiteList = "org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.EnclosingClass";
+ result = readSerializedObject(whiteList, blackList, serailizeFile);
+ assertNull(result);
+ }
+
+ @Test
+ public void testWhiteBlackListSystemProperty() throws Exception {
+
+ File serailizeFile = new File(temporaryFolder.getRoot(), "testclass.bin");
+ ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(serailizeFile));
+ try {
+ outputStream.writeObject(new TestClass1());
+ outputStream.flush();
+ }
+ finally {
+ outputStream.close();
+ }
+
+ System.setProperty(ObjectInputStreamWithClassLoader.BLACKLIST_PROPERTY, "system.defined.black.list");
+ System.setProperty(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY, "system.defined.white.list");
+ try {
+ ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(new FileInputStream(serailizeFile));
+ String bList = ois.getBlackList();
+ String wList = ois.getWhiteList();
+ assertEquals("wrong black list: " + bList, "system.defined.black.list", bList);
+ assertEquals("wrong white list: " + wList, "system.defined.white.list", wList);
+ ois.close();
+ }
+ finally {
+ System.clearProperty(ObjectInputStreamWithClassLoader.BLACKLIST_PROPERTY);
+ System.clearProperty(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY);
+ }
+ }
+
+ private Exception readSerializedObject(String whiteList, String blackList, File serailizeFile) {
+ Exception result = null;
+
+ ObjectInputStreamWithClassLoader ois = null;
+
+ try {
+ ois = new ObjectInputStreamWithClassLoader(new FileInputStream(serailizeFile));
+ ois.setWhiteList(whiteList);
+ ois.setBlackList(blackList);
+ ois.readObject();
+ }
+ catch (Exception e) {
+ result = e;
+ }
+ finally {
+ try {
+ ois.close();
+ }
+ catch (IOException e) {
+ result = e;
+ }
+ }
+ return result;
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0535218c/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/EnclosingClass.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/EnclosingClass.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/EnclosingClass.java
new file mode 100644
index 0000000..379da85
--- /dev/null
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/EnclosingClass.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1;
+
+import java.io.Serializable;
+
+public class EnclosingClass implements Serializable {
+
+ public static Serializable anonymousObject = new Serializable() {
+ };
+
+ public static Object getLocalObject() {
+ class LocalClass implements Serializable {
+ }
+ return new LocalClass();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0535218c/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass1.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass1.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass1.java
new file mode 100644
index 0000000..3c6cbef
--- /dev/null
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass1.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1;
+
+import java.io.Serializable;
+
+public class TestClass1 implements Serializable {
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0535218c/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass2.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass2.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass2.java
new file mode 100644
index 0000000..afc52cc
--- /dev/null
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/deserialization/pkg1/TestClass2.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1;
+
+import java.io.Serializable;
+
+public class TestClass2 implements Serializable {
+}