Github user mtaylor commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/632#discussion_r71181087 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ObjectInputStreamWithClassLoader.java --- @@ -25,23 +25,110 @@ import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; public class ObjectInputStreamWithClassLoader extends ObjectInputStream { // Constants ------------------------------------------------------------------------------------ + /** + * Value used to indicate that all classes should be white or black listed, + */ + public static final String CATCH_ALL_WILDCARD = "*"; + + public static final String WHITELIST_PROPERTY = "org.apache.activemq.artemis.jms.deserialization.whitelist"; + public static final String BLACKLIST_PROPERTY = "org.apache.activemq.artemis.jms.deserialization.blacklist"; + // Attributes ----------------------------------------------------------------------------------- + private List<String> whiteList = new ArrayList<>(); + private List<String> blackList = new ArrayList<>(); + // Static --------------------------------------------------------------------------------------- // Constructors --------------------------------------------------------------------------------- public ObjectInputStreamWithClassLoader(final InputStream in) throws IOException { super(in); + String whiteList = System.getProperty(WHITELIST_PROPERTY, null); + setWhiteList(whiteList); + + String blackList = System.getProperty(BLACKLIST_PROPERTY, null); + setBlackList(blackList); } // Public --------------------------------------------------------------------------------------- + /** + * @return the whiteList configured on this policy instance. + */ + public String getWhiteList() { + Iterator<String> entries = whiteList.iterator(); + StringBuilder builder = new StringBuilder(); + + while (entries.hasNext()) { + builder.append(entries.next()); + if (entries.hasNext()) { + builder.append(","); + } + } + return builder.toString(); + } + + /** + * @return the blackList configured on this policy instance. + */ + public String getBlackList() { + Iterator<String> entries = blackList.iterator(); + StringBuilder builder = new StringBuilder(); + + while (entries.hasNext()) { + builder.append(entries.next()); + if (entries.hasNext()) { + builder.append(","); + } + } + --- End diff -- You could either use a third part StringUtil (like ApacheCommons) to do this, or at least pull this into it's own utility method in Artemis StringUtils. e,g,
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---