You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2013/03/19 02:14:08 UTC

svn commit: r1458076 - /geronimo/server/branches/3.0/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java

Author: gawor
Date: Tue Mar 19 01:14:07 2013
New Revision: 1458076

URL: http://svn.apache.org/r1458076
Log:
GERONIMO-6440: unlock keystore action appears to be broken when running server against Oracle JDK 1.7. Based on patch from xiezhi.

Modified:
    geronimo/server/branches/3.0/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java

Modified: geronimo/server/branches/3.0/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java?rev=1458076&r1=1458075&r2=1458076&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java (original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/PropertyEditors.java Tue Mar 19 01:14:07 2013
@@ -34,13 +34,14 @@ import org.osgi.framework.Bundle;
  * @version $Rev$
  */
 public class PropertyEditors {
+    private final static String GERONIMO_PROPERTYEDITORS_PACKAGE = "org.apache.geronimo.common.propertyeditor";
     /**
      * We need to register the standard register seach path and explicitly
      * register a boolean editor to make sure ours overrides.
      */
     static {
         // Append the geronimo propertyeditors package to the global search path.
-        appendEditorSearchPath("org.apache.geronimo.common.propertyeditor");
+        appendEditorSearchPath(GERONIMO_PROPERTYEDITORS_PACKAGE);
         // and explicitly register the Boolean editor.
         PropertyEditorManager.registerEditor(Boolean.class, BooleanEditor.class);
         PropertyEditorManager.registerEditor(Integer.class, IntegerEditor.class);
@@ -59,6 +60,8 @@ public class PropertyEditors {
             throw new IllegalArgumentException("type is null");
         }
 
+        // Add Geronimo propertyeditors package if necessary.
+        addGeronimoPropertyEditorsPackage();
 
         // try to locate this directly from the editor manager first.
         PropertyEditor editor = PropertyEditorManager.findEditor(type);
@@ -321,9 +324,28 @@ public class PropertyEditors {
 
         // append to the current names list, and set ammended list back as the current
         // search order.
-        List currentPath = getEditorSearchPath();
-        currentPath.add(newName);
+        String[] paths = PropertyEditorManager.getEditorSearchPath();
+        appendEditorSearchPath(paths, newName);
+    }
 
-        setEditorSearchPath(currentPath);
+    /**
+     * Add Geronimo PropertyEditor package if necessary.
+     */
+    private static void addGeronimoPropertyEditorsPackage() {
+        String[] paths = PropertyEditorManager.getEditorSearchPath();
+        for (String path : paths) {
+            if (GERONIMO_PROPERTYEDITORS_PACKAGE.equals(path)) {
+                // it's already there - we are done
+                return;
+            }
+        }
+        appendEditorSearchPath(paths, GERONIMO_PROPERTYEDITORS_PACKAGE);
+    }
+
+    private static void appendEditorSearchPath(String[] paths, String additionalPath) {
+        String[] newPaths = new String[paths.length + 1];
+        System.arraycopy(paths, 0, newPaths, 0, paths.length);
+        newPaths[paths.length] = additionalPath;
+        PropertyEditorManager.setEditorSearchPath(newPaths);
     }
 }