tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [1/2] tomee git commit: TOMEE-2013 trying to use security manager to access system properties when needed
Date Wed, 08 Feb 2017 09:08:32 GMT
Repository: tomee
Updated Branches:
  refs/heads/master 274ff56ad -> 7cf6e4fe1


http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/testing/ApplicationComposers.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/testing/ApplicationComposers.java
b/container/openejb-core/src/main/java/org/apache/openejb/testing/ApplicationComposers.java
index 30bf950..2127c7d 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/testing/ApplicationComposers.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/testing/ApplicationComposers.java
@@ -74,6 +74,7 @@ import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.rest.RESTResourceFinder;
 import org.apache.openejb.spi.ContainerSystem;
 import org.apache.openejb.testing.rest.ContextProvider;
+import org.apache.openejb.util.JavaSecurityManagers;
 import org.apache.openejb.util.Join;
 import org.apache.openejb.util.NetworkUtil;
 import org.apache.openejb.util.PropertyPlaceHolderHelper;
@@ -730,9 +731,9 @@ public class ApplicationComposers {
 
         enrich(inputTestInstance, context);
 
-        System.setProperty(Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
+        JavaSecurityManagers.setSystemProperty(Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
 
-        System.getProperties().put(OPENEJB_APPLICATION_COMPOSER_CONTEXT, appContext.getGlobalJndiContext());
+        JavaSecurityManagers.setSystemProperty(OPENEJB_APPLICATION_COMPOSER_CONTEXT, appContext.getGlobalJndiContext());
 
         final List<Field> fields = new ArrayList<>(testClassFinder.findAnnotatedFields(AppResource.class));
         fields.addAll(testClassFinder.findAnnotatedFields(org.apache.openejb.junit.AppResource.class));
@@ -1289,7 +1290,7 @@ public class ApplicationComposers {
     }
 
     public void startContainer(final Object instance) throws Exception {
-        originalProperties = (Properties) System.getProperties().clone();
+        originalProperties = (Properties) JavaSecurityManagers.getSystemProperties().clone();
         originalLoader = Thread.currentThread().getContextClassLoader();
         fixFakeClassFinder(instance);
 
@@ -1490,7 +1491,7 @@ public class ApplicationComposers {
             for (final String name : propertiesToSetAgain) {
                 final String value = PropertyPlaceHolderHelper.simpleValue(SystemInstance.get().getProperty(name));
                 configuration.put(name, value);
-                System.setProperty(name, value); // done lazily to support placeholders so
container will not do it here
+                JavaSecurityManagers.setSystemProperty(name, value); // done lazily to support
placeholders so container will not do it here
             }
             propertiesToSetAgain.clear();
         }

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/testing/SingleApplicationComposerRunner.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/testing/SingleApplicationComposerRunner.java
b/container/openejb-core/src/main/java/org/apache/openejb/testing/SingleApplicationComposerRunner.java
index b0a36fe..b35b7f5 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/testing/SingleApplicationComposerRunner.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/testing/SingleApplicationComposerRunner.java
@@ -17,6 +17,7 @@
 package org.apache.openejb.testing;
 
 import org.apache.openejb.core.ThreadContext;
+import org.apache.openejb.util.JavaSecurityManagers;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.inject.OWBInjector;
 import org.apache.xbean.finder.AnnotationFinder;
@@ -112,7 +113,7 @@ public class SingleApplicationComposerRunner extends BlockJUnit4ClassRunner
{
     private static void start(final Class<?> marker) throws Exception {
         if (APP.get() == null) {
             final Class<?> type;
-            final String typeStr = System.getProperty("tomee.application-composer.application");
+            final String typeStr = JavaSecurityManagers.getSystemProperty("tomee.application-composer.application");
             if (typeStr != null) {
                 try {
                     type = Thread.currentThread().getContextClassLoader().loadClass(typeStr);

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/JavaSecurityManagers.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/JavaSecurityManagers.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/JavaSecurityManagers.java
new file mode 100644
index 0000000..6da5d1b
--- /dev/null
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/JavaSecurityManagers.java
@@ -0,0 +1,99 @@
+/*
+ * 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.openejb.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Properties;
+
+// WARN: don't add any logger or container dependency, it should stay self contained
+public final class JavaSecurityManagers {
+    private static final PrivilegedAction<Properties> GET_SYSTEM_PROPERTIES = new PrivilegedAction<Properties>()
{
+        @Override
+        public Properties run() {
+            return System.getProperties();
+        }
+    };
+
+    private JavaSecurityManagers() {
+        // no-op
+    }
+
+    public static String getSystemProperty(final String key) {
+        return System.getSecurityManager() == null ?
+                System.getProperty(key) :
+                AccessController.doPrivileged(new PrivilegedAction<String>() {
+                    @Override
+                    public String run() {
+                        return System.getProperty(key);
+                    }
+                });
+    }
+
+    public static String getSystemProperty(final String key, final String or) {
+        return System.getSecurityManager() == null ?
+                System.getProperty(key, or) :
+                AccessController.doPrivileged(new PrivilegedAction<String>() {
+                    @Override
+                    public String run() {
+                        return System.getProperty(key, or);
+                    }
+                });
+    }
+
+    public static Properties getSystemProperties() {
+        return System.getSecurityManager() == null ?
+                System.getProperties() :
+                AccessController.doPrivileged(GET_SYSTEM_PROPERTIES);
+    }
+
+    public static void removeSystemProperty(final String key) {
+        if (System.getSecurityManager() == null) {
+            System.clearProperty(key);
+        } else {
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                @Override
+                public Void run() {
+                    System.clearProperty(key);
+                    return null;
+                }
+            });
+        }
+    }
+
+    public static void setSystemProperty(final String key, final Object value) {
+        if (System.getSecurityManager() == null) {
+            if (String.class.isInstance(value)) {
+                System.setProperty(key, String.class.cast(value));
+            } else {
+                System.getProperties().put(key, value);
+            }
+        } else {
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                @Override
+                public Void run() {
+                    if (String.class.isInstance(value)) {
+                        System.setProperty(key, String.class.cast(value));
+                    } else {
+                        System.getProperties().put(key, value);
+                    }
+                    return null;
+                }
+            });
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
index 3a4fb48..2f2b040 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
@@ -49,9 +49,9 @@ public class JuliLogStreamFactory implements LogStreamFactory {
         final boolean embedded = is("org.apache.tomee.embedded.Container");
 
         // if embedded case enhance a bit logging if not set
-        final Options options = SystemInstance.isInitialized() ? SystemInstance.get().getOptions()
: new Options(System.getProperties());
+        final Options options = SystemInstance.isInitialized() ? SystemInstance.get().getOptions()
: new Options(JavaSecurityManagers.getSystemProperties());
         final boolean forceLogs = options.get("openejb.jul.forceReload", false);
-        if ((!tomee || embedded || forceLogs) && System.getProperty("java.util.logging.manager")
== null) {
+        if ((!tomee || embedded || forceLogs) && JavaSecurityManagers.getSystemProperty("java.util.logging.manager")
== null) {
             consoleHandlerClazz = options.get("openejb.jul.consoleHandlerClazz", (String)
null);
             if (consoleHandlerClazz == null) {
                 if (options.get(OPENEJB_LOG_COLOR_PROP, false) && isNotIDE()) {
@@ -82,20 +82,20 @@ public class JuliLogStreamFactory implements LogStreamFactory {
                 }
             }
             // do it last since otherwise it can lock
-            System.setProperty("java.util.logging.manager", OpenEJBLogManager.class.getName());
+            JavaSecurityManagers.setSystemProperty("java.util.logging.manager", OpenEJBLogManager.class.getName());
         }
 
         try {
             if (options.get("openjpa.Log", (String) null) == null) {
                 JuliLogStreamFactory.class.getClassLoader().loadClass("org.apache.openjpa.lib.log.LogFactoryAdapter");
-                System.setProperty("openjpa.Log", "org.apache.openejb.openjpa.JULOpenJPALogFactory");
+                JavaSecurityManagers.setSystemProperty("openjpa.Log", "org.apache.openejb.openjpa.JULOpenJPALogFactory");
             }
         } catch (final Exception ignored) {
             // no-op: openjpa is not at the classpath so don't trigger it loading with our
logger
         }
 
         try {
-            System.setProperty(WebBeansLoggerFacade.class.getName(), "org.apache.openejb.cdi.logging.ContainerJULLoggerFactory");
+            JavaSecurityManagers.setSystemProperty(WebBeansLoggerFacade.class.getName(),
"org.apache.openejb.cdi.logging.ContainerJULLoggerFactory");
         } catch (final Throwable th) {
             // ignored, surely arquillian remote only so OWB is not here
         }
@@ -125,7 +125,7 @@ public class JuliLogStreamFactory implements LogStreamFactory {
     }
 
     public static boolean isNotIDE() {
-        return !System.getProperty("java.class.path").contains("idea_rt"); // TODO: eclipse,
netbeans
+        return !JavaSecurityManagers.getSystemProperty("java.class.path").contains("idea_rt");
// TODO: eclipse, netbeans
     }
 
     // TODO: mange conf by classloader? see tomcat log manager
@@ -167,7 +167,7 @@ public class JuliLogStreamFactory implements LogStreamFactory {
             }
 
             // if it is one of ours loggers and no value is defined let set our nice logging
style
-            if (OpenEJBLogManager.class.getName().equals(System.getProperty("java.util.logging.manager"))
// custom logging
+            if (OpenEJBLogManager.class.getName().equals(JavaSecurityManagers.getSystemProperty("java.util.logging.manager"))
// custom logging
                 && isOverridableLogger(name) // managed loggers
                 && parentValue == null) { // not already defined
                 if (name.endsWith(".handlers")) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/Log4j2LogStreamFactory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/Log4j2LogStreamFactory.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/Log4j2LogStreamFactory.java
index 6e5e134..29e846b 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/Log4j2LogStreamFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/Log4j2LogStreamFactory.java
@@ -24,7 +24,7 @@ public class Log4j2LogStreamFactory implements LogStreamFactory {
     public Log4j2LogStreamFactory() {
         // WARN: don't set all subproject loggers to log4j since API is not the same
         // and it needs log4j1 fallback module to "work" (some parts are broken like config)
-        System.setProperty("openwebbeans.logging.factory", "org.apache.openejb.cdi.logging.Log4j2LoggerFactory");
+        JavaSecurityManagers.setSystemProperty("openwebbeans.logging.factory", "org.apache.openejb.cdi.logging.Log4j2LoggerFactory");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/Log4jLogStreamFactory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/Log4jLogStreamFactory.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/Log4jLogStreamFactory.java
index 7ced9d4..47ad692 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/Log4jLogStreamFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/Log4jLogStreamFactory.java
@@ -57,14 +57,14 @@ public class Log4jLogStreamFactory implements LogStreamFactory {
             // The fall back here is that if log4j.configuration system property is set,
then that configuration file will be used.
             e.printStackTrace();
         }
-        System.setProperty("openwebbeans.logging.factory", "org.apache.openejb.cdi.logging.Log4jLoggerFactory");
+        JavaSecurityManagers.setSystemProperty("openwebbeans.logging.factory", "org.apache.openejb.cdi.logging.Log4jLoggerFactory");
     }
 
     private void configureInternal() throws IOException {
         // OpenJPA should use Log4j also
-        System.setProperty("openjpa.Log", "log4j");
-        System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Log4jLogger");
-        System.setProperty(WebBeansLoggerFacade.OPENWEBBEANS_LOGGING_FACTORY_PROP, Log4jLoggerFactory.class.getName());
+        JavaSecurityManagers.setSystemProperty("openjpa.Log", "log4j");
+        JavaSecurityManagers.setSystemProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Log4jLogger");
+        JavaSecurityManagers.setSystemProperty(WebBeansLoggerFacade.OPENWEBBEANS_LOGGING_FACTORY_PROP,
Log4jLoggerFactory.class.getName());
 
         final boolean embedded = SystemInstance.get().getOptions().get("openejb.logging.embedded",
false);
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java b/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
index edb563b..2ccc43b 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
@@ -51,7 +51,7 @@ public class Logger {
     }
 
     public static synchronized void configure() {
-        configure(System.getProperties());
+        configure(SystemInstance.isInitialized() ? SystemInstance.get().getProperties() :
JavaSecurityManagers.getSystemProperties());
     }
 
     public static synchronized void configure(final Properties config) {
@@ -93,12 +93,12 @@ public class Logger {
         final String[] specialKeys = new String[] { "openejb.jul.forceReload", "openejb.jul.consoleHandlerClazz",
"openejb.logger.external" };
         final String[] originals = new String[specialKeys.length];
         for (int i = 0; i < specialKeys.length; i++) {
-            originals[i] = System.getProperty(specialKeys[i]);
+            originals[i] = JavaSecurityManagers.getSystemProperty(specialKeys[i]);
             final String property = config.getProperty(
                     specialKeys[i],
                     SystemInstance.isInitialized() ? SystemInstance.get().getOptions().get(specialKeys[i],
(String) null) : null);
             if (property != null) {
-                System.setProperty(specialKeys[i], property);
+                JavaSecurityManagers.setSystemProperty(specialKeys[i], property);
             }
         }
 
@@ -121,9 +121,9 @@ public class Logger {
         } finally {
             for (int i = 0; i < specialKeys.length; i++) {
                 if (originals[i] == null) {
-                    System.clearProperty(specialKeys[i]);
+                    JavaSecurityManagers.removeSystemProperty(specialKeys[i]);
                 } else {
-                    System.setProperty(specialKeys[i], originals[i]);
+                    JavaSecurityManagers.setSystemProperty(specialKeys[i], originals[i]);
                 }
             }
         }
@@ -308,7 +308,7 @@ public class Logger {
         this.category = category;
         this.baseName = baseName;
         this.logStream = // tomcat is already async so abuse of it
-            ("true".equals(SystemInstance.get().getProperty("openejb.log.async", "true"))
&& System.getProperty("catalina.home") == null) ?
+            ("true".equals(SystemInstance.get().getProperty("openejb.log.async", "true"))
&& JavaSecurityManagers.getSystemProperty("catalina.home") == null) ?
                 new LogStreamAsync(logStream) : logStream;
     }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/OpenEjbVersion.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/OpenEjbVersion.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/OpenEjbVersion.java
index c5d109d..c020ef7 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/OpenEjbVersion.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/OpenEjbVersion.java
@@ -51,8 +51,8 @@ public final class OpenEjbVersion {
         date = info.getProperty("date");
         time = info.getProperty("time");
 
-        System.setProperty("openejb.version", version);
-        System.setProperty("tomee.version", version);
+        JavaSecurityManagers.setSystemProperty("openejb.version", version);
+        JavaSecurityManagers.setSystemProperty("tomee.version", version);
     }
 
     public static OpenEjbVersion get() {

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/PropertiesService.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/PropertiesService.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/PropertiesService.java
index c0ec021..46f117a 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/PropertiesService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/PropertiesService.java
@@ -53,7 +53,7 @@ public class PropertiesService {
 
     public PropertiesService() {
         if (queryEnvOnInit) {
-            props.putAll(System.getProperties());
+            props.putAll(JavaSecurityManagers.getSystemProperties());
         }
     }
 
@@ -68,7 +68,7 @@ public class PropertiesService {
      */
     public String setProperty(final String name, final String value) {
         if (passOn) {
-            System.setProperty(name, value);
+            JavaSecurityManagers.setSystemProperty(name, value);
         }
         return (String) props.setProperty(name, value);
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/PropertyPlaceHolderHelper.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/PropertyPlaceHolderHelper.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/PropertyPlaceHolderHelper.java
index 4015771..cd6ae90 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/PropertyPlaceHolderHelper.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/PropertyPlaceHolderHelper.java
@@ -38,7 +38,7 @@ public final class PropertyPlaceHolderHelper {
 
     static {
         SUBSTITUTOR.setEnableSubstitutionInVariables(true);
-        SUBSTITUTOR.setValueDelimiter(System.getProperty("openejb.placehodler.delimiter",
":-")); // default one of [lang3]
+        SUBSTITUTOR.setValueDelimiter(JavaSecurityManagers.getSystemProperty("openejb.placehodler.delimiter",
":-")); // default one of [lang3]
     }
 
     public static final String CIPHER_PREFIX = "cipher:";

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
index a96407b..3410ff6 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
@@ -28,9 +28,9 @@ public class Slf4jLogStreamFactory implements LogStreamFactory {
     }
 
     public Slf4jLogStreamFactory() {
-        System.setProperty("openjpa.Log", "slf4j");
-        System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Slf4jLogger");
-        System.setProperty("openwebbeans.logging.factory", "org.apache.openejb.cdi.logging.Slf4jLoggerFactory");
+        JavaSecurityManagers.setSystemProperty("openjpa.Log", "slf4j");
+        JavaSecurityManagers.setSystemProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Slf4jLogger");
+        JavaSecurityManagers.setSystemProperty("openwebbeans.logging.factory", "org.apache.openejb.cdi.logging.Slf4jLoggerFactory");
 
         // no need to configure internals:
         // by default we are using JUL

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/SuperProperties.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/SuperProperties.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/SuperProperties.java
index 2dacdf6..ae2049b 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/SuperProperties.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/SuperProperties.java
@@ -102,7 +102,7 @@ public class SuperProperties extends Properties {
     /**
      * The line separator to use when storing.  Defaults to system line separator.
      */
-    protected String lineSeparator = System.getProperty("line.separator");
+    protected String lineSeparator = JavaSecurityManagers.getSystemProperty("line.separator");
 
     /**
      * Number of spaces to indent each line of the properties file.

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java b/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java
index 397d058..ae0c016 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java
@@ -69,7 +69,7 @@ public final class URLs {
     }
 
     public static UrlSet cullSystemJars(final UrlSet original) throws IOException {
-        final String sunboot = System.getProperty("sun.boot.class.path", "");
+        final String sunboot = JavaSecurityManagers.getSystemProperty("sun.boot.class.path",
"");
         UrlSet urls = new UrlSet(original.getUrls());
         urls = urls.exclude(ClassLoader.getSystemClassLoader().getParent());
         urls = urls.excludeJvm();

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java
index 68e4339..fd8a35a 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/UpdateChecker.java
@@ -64,22 +64,22 @@ public class UpdateChecker {
                 final URL proxyUrl = new URL(checkerProxy);
                 proxyProtocol = proxyUrl.getProtocol();
 
-                originalProxyHost = System.getProperty(proxyProtocol + ".proxyHost");
-                originalProxyPort = System.getProperty(proxyProtocol + ".proxyPort");
-                originalProxyUser = System.getProperty(proxyProtocol + ".proxyUser");
-                originalProxyPwd = System.getProperty(proxyProtocol + ".proxyPassword");
+                originalProxyHost = JavaSecurityManagers.getSystemProperty(proxyProtocol
+ ".proxyHost");
+                originalProxyPort = JavaSecurityManagers.getSystemProperty(proxyProtocol
+ ".proxyPort");
+                originalProxyUser = JavaSecurityManagers.getSystemProperty(proxyProtocol
+ ".proxyUser");
+                originalProxyPwd = JavaSecurityManagers.getSystemProperty(proxyProtocol +
".proxyPassword");
 
-                System.setProperty(proxyProtocol + ".proxyHost", proxyUrl.getHost());
-                System.setProperty(proxyProtocol + ".proxyPort", Integer.toString(proxyUrl.getPort()));
+                JavaSecurityManagers.setSystemProperty(proxyProtocol + ".proxyHost", proxyUrl.getHost());
+                JavaSecurityManagers.setSystemProperty(proxyProtocol + ".proxyPort", Integer.toString(proxyUrl.getPort()));
 
                 final String userInfo = proxyUrl.getUserInfo();
                 if (userInfo != null) {
                     final int sep = userInfo.indexOf(":");
                     if (sep >= 0) {
-                        System.setProperty(proxyProtocol + ".proxyUser", userInfo.substring(0,
sep));
-                        System.setProperty(proxyProtocol + ".proxyPassword", userInfo.substring(sep
+ 1));
+                        JavaSecurityManagers.setSystemProperty(proxyProtocol + ".proxyUser",
userInfo.substring(0, sep));
+                        JavaSecurityManagers.setSystemProperty(proxyProtocol + ".proxyPassword",
userInfo.substring(sep + 1));
                     } else {
-                        System.setProperty(proxyProtocol + ".proxyUser", userInfo);
+                        JavaSecurityManagers.setSystemProperty(proxyProtocol + ".proxyUser",
userInfo);
                     }
                 }
             } catch (final MalformedURLException e) {
@@ -124,7 +124,7 @@ public class UpdateChecker {
         if (value == null) {
             System.clearProperty(key);
         } else {
-            System.setProperty(key, value);
+            JavaSecurityManagers.setSystemProperty(key, value);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/classloader/URLClassLoaderFirst.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/classloader/URLClassLoaderFirst.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/classloader/URLClassLoaderFirst.java
index bae1052..2bcd151 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/classloader/URLClassLoaderFirst.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/classloader/URLClassLoaderFirst.java
@@ -19,6 +19,7 @@ package org.apache.openejb.util.classloader;
 
 import org.apache.openejb.core.ParentClassLoaderFinder;
 import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.util.JavaSecurityManagers;
 
 import java.io.IOException;
 import java.net.URL;
@@ -75,7 +76,7 @@ public class URLClassLoaderFirst extends URLClassLoader {
     private static boolean skipLib(final String includedClass) {
         try {
             URLClassLoaderFirst.class.getClassLoader().loadClass(includedClass);
-            return "true".equalsIgnoreCase(System.getProperty(includedClass + ".skip", "true"));
+            return "true".equalsIgnoreCase(JavaSecurityManagers.getSystemProperty(includedClass
+ ".skip", "true"));
         } catch (final ClassNotFoundException e) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/tomee/blob/7cf6e4fe/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java
b/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java
index 4381d8a..c7a3c84 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java
@@ -23,6 +23,7 @@ import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ContainerSystem;
 import org.apache.openejb.table.Line;
 import org.apache.openejb.table.Lines;
+import org.apache.openejb.util.JavaSecurityManagers;
 
 import java.util.Arrays;
 
@@ -32,7 +33,7 @@ public final class CommandHelper {
     }
 
     public static Lines listEJBs() throws Exception {
-        return listEJBs(System.getProperty("line.separator"));
+        return listEJBs(JavaSecurityManagers.getSystemProperty("line.separator"));
     }
 
     public static Lines listEJBs(final String cr) throws Exception {


Mime
View raw message