From: <otm...@us...> - 2009-04-24 08:35:55
|
Revision: 6260 http://jython.svn.sourceforge.net/jython/?rev=6260&view=rev Author: otmarhumbel Date: 2009-04-24 08:35:48 +0000 (Fri, 24 Apr 2009) Log Message: ----------- enable overriding registry file entries with system properties (makes test_java_visibility pass again) Modified Paths: -------------- trunk/jython/src/org/python/core/PySystemState.java trunk/jython/src/org/python/util/PythonInterpreter.java Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2009-04-24 05:16:57 UTC (rev 6259) +++ trunk/jython/src/org/python/core/PySystemState.java 2009-04-24 08:35:48 UTC (rev 6260) @@ -12,6 +12,7 @@ import java.nio.charset.Charset; import java.nio.charset.UnsupportedCharsetException; import java.security.AccessControlException; +import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.StringTokenizer; @@ -618,11 +619,20 @@ private static void addRegistryFile(File file) { if (file.exists()) { if (!file.isDirectory()) { - registry = new Properties(registry); + // pre (e.g. system) properties should override the registry, + // therefore only add missing properties from this registry file + Properties fileProperties = new Properties(); try { FileInputStream fp = new FileInputStream(file); try { - registry.load(fp); + fileProperties.load(fp); + Iterator<Object> iterator = fileProperties.keySet().iterator(); + while (iterator.hasNext()) { + Object key = iterator.next(); + if (!registry.containsKey(key)) { + registry.put(key, fileProperties.get(key)); + } + } } finally { fp.close(); } Modified: trunk/jython/src/org/python/util/PythonInterpreter.java =================================================================== --- trunk/jython/src/org/python/util/PythonInterpreter.java 2009-04-24 05:16:57 UTC (rev 6259) +++ trunk/jython/src/org/python/util/PythonInterpreter.java 2009-04-24 08:35:48 UTC (rev 6260) @@ -36,6 +36,7 @@ * * @param preProperties * A set of properties. Typically System.getProperties() is used. + * PreProperties override properties from the registry file. * @param postProperties * An other set of properties. Values like python.home, python.path and all other * values from the registry files can be added to this property set. PostProperties This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |