[jboss-cvs] JBossAS SVN: r100777 - trunk/main/src/main/java/org/jboss.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 9 16:44:01 EST 2010


Author: bstansberry at jboss.com
Date: 2010-02-09 16:44:00 -0500 (Tue, 09 Feb 2010)
New Revision: 100777

Modified:
   trunk/main/src/main/java/org/jboss/Main.java
Log:
[JBAS-7705] Keep 'props' and system properties in sync

Modified: trunk/main/src/main/java/org/jboss/Main.java
===================================================================
--- trunk/main/src/main/java/org/jboss/Main.java	2010-02-09 20:51:34 UTC (rev 100776)
+++ trunk/main/src/main/java/org/jboss/Main.java	2010-02-09 21:44:00 UTC (rev 100777)
@@ -141,6 +141,8 @@
       super();
 
       // Set default properties
+      // TODO for JBAS-7705 we do this again at the end of processCommandLine
+      // so this can probably be eliminated
       final Properties sysProps = System.getProperties();
       for (final Object propName : sysProps.keySet())
       {
@@ -472,15 +474,6 @@
       Getopt getopt = new Getopt(programName, args, sopts, lopts);
       int code;
       String arg;
-      final String propKeyJBossasBindAddress = JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS;
-      if (props.get(propKeyJBossasBindAddress) == null)
-      {
-         // JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS could have been defined via 
-         // run.conf and so we don't wanna override that. 
-         final String defaultBindAddress = "127.0.0.1";
-         props.put(propKeyJBossasBindAddress, defaultBindAddress);
-         System.setProperty(propKeyJBossasBindAddress, defaultBindAddress);
-      }
       while ((code = getopt.getopt()) != -1)
       {
          switch (code)
@@ -690,7 +683,26 @@
                // if it does throw an error so we know about it
                throw new Error("unhandled option code: " + code);
          }
+      }      
+
+      // JBAS-7705 -- -P or other switches above may have gotten 'props'
+      // and system properties out of sync -- fix that
+      final Properties sysProps = System.getProperties();
+      for (final Object propName : sysProps.keySet())
+      {
+         final String propNameString = (String) propName;
+         final String propValue = (String) sysProps.get(propNameString);
+         props.put(propNameString, propValue);
       }
+      
+      // Ensure we have a bind address
+      final String propKeyJBossasBindAddress = JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS;
+      if (props.get(propKeyJBossasBindAddress) == null)
+      {
+         final String defaultBindAddress = "127.0.0.1";
+         props.put(propKeyJBossasBindAddress, defaultBindAddress);
+         System.setProperty(propKeyJBossasBindAddress, defaultBindAddress);
+      }
 
       // Make sure some address properties are set and/or don't specify
       // a "any local address" value that's useless for their intended usage




More information about the jboss-cvs-commits mailing list