Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-491

SystemProperties cannot handle default values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2.5
    • None
    • Tools
    • None

    Description

      The SystemProperties class seems to be a wrapper around System.getProperties. However, System.getProperties() returns a Properties object that has preferred methods of querying properties, e.g. getProperty() instead of simply get() inherited from Hashtable. getProperty() also queries (recursively) the defaults stored in the Properties objects, which get() doesn't. The SystemProperties wrapper incorrectly calls only get which ignores the default values.
      Suppose some class changes the system properties by wrapping them into a new Properties object (passing the old values as defaults in the constructor) and setting it via System.setProperties. Everyone using getProperty() still sees the old values, whereas calling only get only the new values are shown. This means that all standard java properties (e.g. "user.dir" used in the SchemaCompiler) are lost when they are queried via SystemProperties, essentially leading to strange NullPointerExceptions when the ant task is used.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sithmein Thorsten Meinl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: