You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by da...@apache.org on 2012/09/02 15:48:05 UTC
svn commit: r1379967 -
/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
Author: davsclaus
Date: Sun Sep 2 13:48:04 2012
New Revision: 1379967
URL: http://svn.apache.org/viewvc?rev=1379967&view=rev
Log:
AMQ-3797: Avoid adding the same paths to property editor serach path, if for example ActiveMQ is redeployed.
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java?rev=1379967&r1=1379966&r2=1379967&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java Sun Sep 2 13:48:04 2012
@@ -18,26 +18,23 @@ package org.apache.activemq.util;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
-import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
-
+import java.util.Set;
import javax.net.ssl.SSLServerSocket;
import org.apache.activemq.command.ActiveMQDestination;
-
-
-
public final class IntrospectionSupport {
static {
@@ -46,17 +43,19 @@ public final class IntrospectionSupport
"org.springframework.beans.propertyeditors",
"org.apache.activemq.util" };
synchronized (PropertyEditorManager.class) {
- String[] existingSearchPath = PropertyEditorManager.getEditorSearchPath();
- String[] newSearchPath = (String[]) Array.newInstance(String.class,
- existingSearchPath.length + additionalPath.length);
- System.arraycopy(existingSearchPath, 0,
- newSearchPath, 0,
- existingSearchPath.length);
- System.arraycopy(additionalPath, 0,
- newSearchPath, existingSearchPath.length,
- additionalPath.length);
+ List<String> list = new ArrayList<String>();
+ list.addAll(Arrays.asList(PropertyEditorManager.getEditorSearchPath()));
+
+ if (!list.contains(additionalPath[0])) {
+ list.add(additionalPath[0]);
+ }
+ if (!list.contains(additionalPath[1])) {
+ list.add(additionalPath[1]);
+ }
+
+ String[] newSearchPath = list.toArray(new String[list.size()]);
try {
- PropertyEditorManager.setEditorSearchPath(newSearchPath);
+ PropertyEditorManager.setEditorSearchPath(newSearchPath);
PropertyEditorManager.registerEditor(String[].class, StringArrayEditor.class);
} catch(java.security.AccessControlException ignore) {
// we might be in an applet...