0 Replies Latest reply on Jan 20, 2004 9:13 PM by mgmartin

    Bug / Fix for System Properties Corruption in 3.2.3

    mgmartin Newbie

      So, lot's of debugging, but I found the problem to this post regarding applets losing system properties when posting a jms message:

      http://www.jboss.org/index.html?module=bb&op=viewtopic&t=43860

      The problem is that all the user.xx properties and others disappear from the System.getProperties() after invoking m.setStringProperty(). Internal java stuff breaks and the plugin console no longer works.

      I narrowed down the problem to org.jboss.util.property.PropertyManager.

      This class has a static init function which calls System.setProperties(props) -- passing in a JBoss-derived properties ( PropertiesMap).

      The problem happens when this class get initialized via this call:

      props.putAll(System.getProperties());

      This sets all the values at the Hashtable level, but not at the derived Properties level. The Properties class contains a Properties member called defaults which contains all the java default values such as user.xxx and others. They never get copied into the new system-wide properties.

      The difference in 3.2.2 and 3.2.3 is that in 3.2.2, the PropertyManager never gets called.

      In 3.2.3, PropertyManager is being called from this stack trace:

      at java.lang.Thread.dumpStack(Thread.java:1064)
      at org.jboss.util.property.PropertyManager.(PropertyManager.java:57)
      at org.jboss.util.property.Property.get(Property.java:87)
      at org.jboss.util.platform.Constants.(Constants.java:23)
      at org.jboss.util.Strings.(Strings.java:31)
      at org.jboss.mq.SpyMessage.checkProperty(SpyMessage.java:413)
      at org.jboss.mq.SpyMessage.setStringProperty(SpyMessage.java:516)

      The 3.2.2 thread of execution never called Strings.isValidJavaIdentifier(name) in SpyMessage.java which takes it back to the PropertyManager.

      A simple solution I found was to initialize the PropertyMap with
      props = new PropertyMap(System.getProperties()), so now PropertyMap.defaults has everything. Otherwise, a more manual means of copying all the property values could be implemented.


      Not sure where to really post this. Hopefully it finds its way to the right people.

      --Michael