[
https://issues.apache.org/jira/browse/ARTEMIS-604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15382543#comment-15382543
]
ASF GitHub Bot commented on ARTEMIS-604:
----------------------------------------
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,
> Message Serialization Improvement
> ---------------------------------
>
> Key: ARTEMIS-604
> URL: https://issues.apache.org/jira/browse/ARTEMIS-604
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: Broker
> Affects Versions: 1.3.0
> Reporter: Howard Gao
> Assignee: Howard Gao
> Fix For: 1.4.0
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)