[kepler-dev] [Bug 3874] - ptolemy.util.StringUtilities.mergePropertiesFile() deletes properties

bugzilla-daemon at ecoinformatics.org bugzilla-daemon at ecoinformatics.org
Mon Mar 9 16:58:51 PDT 2009


http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3874


cxh at eecs.berkeley.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Target Milestone|Unspecified                 |2.0.0




------- Comment #1 from cxh at eecs.berkeley.edu  2009-03-09 16:58 -------
Hmm, I can't reproduce this.

The following Tcl Code works as expected
%     java::call ptolemy.util.StringUtilities mergePropertiesFile
%     set property [java::call ptolemy.util.StringUtilities getProperty
java.class.path]
/Users/cxh/ptII:/Users/cxh/ptII/lib/diva.jar:/Users/cxh/ptII/ptolemy/distributed/jini/jar/jini-core.jar:/Users/cxh/ptII/ptolemy/distributed/jini/jar/jini-ext.jar:/Users/cxh/ptII/ptolemy/distributed/jini/jar/sun-util.jar:/Users/cxh/ptII/lib/ptCal.jar:/Users/cxh/ptII/lib/java_cup.jar:/Users/cxh/ptII/lib/chic.jar:/Users/cxh/ptII/lib/ptcolt.jar:/Users/cxh/ptII/lib/sootclasses.jar:/Users/cxh/ptII/lib/jasminclasses.jar:/Users/cxh/ptII/lib/polyglotclasses-1.3.2.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jce.jar:/Users/cxh/ptII/lib/ptjacl.jar:/Users/cxh/ptII/vendors/misc/joystick/Joystick.jar:/Users/cxh/ptII/vendors/jython/jython.jar:/Users/cxh/ptII/vendors/sun/jxta/jxta.jar:/Users/cxh/ptII/vendors/sun/jxta/log4j.jar:/Users/cxh/ptII/vendors/sun/jxta/beepcore.jar:/Users/cxh/ptII/vendors/sun/jxta/jxtasecurity.jar:/Users/cxh/ptII/vendors/sun/jxta/cryptix-asn1.jar:/Users/cx
 h/ptII/vendors/sun/jxta/cryptix32.jar:/Users/cxh/ptII/vendors/sun/jxta/jxtaptls.jar:/Users/cxh/ptII/vendors/sun/jxta/minimalBC.jar:/gdk.jar:/Users/cxh/ptII/ptolemy/actor/lib/database/mysql-connector-java-5.1.6-bin.jar:/Users/cxh/ptII/ptolemy/actor/lib/database/ojdbc5.jar:/Users/cxh/ptII/ptolemy/actor/ptalon/antlr/antlr.jar::/Users/cxh/ptII/lib/mapss.jar:/Users/cxh/ptII/lib/saxon8.jar:/Users/cxh/ptII/lib/saxon8-dom.jar:/Users/cxh/ptII/ptolemy/domains/ptinyos/lib/jdom.jar:/Users/cxh/ptII/ptolemy/domains/ptinyos/lib/nesc.jar
%     set property [java::call ptolemy.util.StringUtilities getProperty
java.home]
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home

mergePropertiesFile() looks like:

   /** Merge the properties in lib/ptII.properties with the current
     *  properties.  lib/ptII.properties is searched for in the
     *  classpath.  The value of properties listed in
     *  lib/ptII.properties do not override properties with the same
     *  name in the current properties.
     *  @exception IOException If thrown while looking for the
     *  $CLASSPATH/lib/ptII.properties file.
     */
    public static void mergePropertiesFile() throws IOException {
        Properties systemProperties = System.getProperties();
        Properties newProperties = new Properties();
        String propertyFileName = "$CLASSPATH/lib/ptII.properties";

        // FIXME: xxxxxxCLASSPATHxxxxxx is an ugly hack
        URL propertyFileURL = FileUtilities.nameToURL(
                "xxxxxxCLASSPATHxxxxxx/lib/ptII.properties", null, null);

        if (propertyFileURL == null) {
            throw new IOException("Could not find " + propertyFileName);
        }

        newProperties.load(propertyFileURL.openStream());

        // systemProperties is a HashSet, so we merge in the new properties.
        newProperties.putAll(systemProperties);
        System.setProperties(newProperties);
        // FIXME: This should be logged, not printed.
        //System.out.println("Loaded " + propertyFileURL);
    }

What does your lib/ptII.properties file look like?


More information about the Kepler-dev mailing list