neilg       2002/10/09 10:39:36

  Modified:    java/src/org/apache/xerces/util ObjectFactory.java
  Log:
  as described in a post to xerces-j-dev, this change introduces a JAXP-like default 
for Xerces to examine for a properties file ($java.home/lib/xerces.properties, to be 
precise).  It also no longer prepends $java.home/lib/ to a passed-in properties 
filename.
  
  Revision  Changes    Path
  1.8       +13 -7     xml-xerces/java/src/org/apache/xerces/util/ObjectFactory.java
  
  Index: ObjectFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/ObjectFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ObjectFactory.java        10 Sep 2002 13:42:07 -0000      1.7
  +++ ObjectFactory.java        9 Oct 2002 17:39:36 -0000       1.8
  @@ -90,6 +90,9 @@
       // Constants
       //
   
  +    // name of default properties file to look for in JDK's jre/lib directory
  +    private static final String DEFAULT_PROPERTIES_FILENAME = "xerces.properties";
  +
       /** Set to true for debugging */
       private static final boolean DEBUG = false;
   
  @@ -135,7 +138,8 @@
        * @param factoryId             Name of the factory to find, same as
        *                              a property name
        * @param propertiesFilename The filename in the $java.home/lib directory
  -     *                           of the properties file.
  +     *                           of the properties file.  If none specified,
  +     *                           ${java.home}/lib/xerces.properties will be used.
        * @param fallbackClassName     Implementation class name, if nothing else
        *                              is found.  Use null to mean no fallback.
        *
  @@ -162,17 +166,19 @@
               // Ignore and continue w/ next location
           }
   
  -        // Try to read from $java.home/lib/jaxp.properties
  +        // Try to read from propertiesFilename, or $java.home/lib/xerces.properties
           try {
  +            if(propertiesFilename ==null) {
               String javah = ss.getSystemProperty("java.home");
  -            String configFile = javah + File.separator +
  -                "lib" + File.separator + "propertiesFilename";
  -            FileInputStream fis = ss.getFileInputStream(new File(configFile));
  +                propertiesFilename = javah + File.separator +
  +                    "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
  +            }
  +            FileInputStream fis = ss.getFileInputStream(new 
File(propertiesFilename));
               Properties props = new Properties();
               props.load(fis);
               String factoryClassName = props.getProperty(factoryId);
               if (factoryClassName != null) {
  -                debugPrintln("found in jaxp.properties, value=" + factoryClassName);
  +                debugPrintln("found in " + propertiesFilename + ", value=" + 
factoryClassName);
                   return newInstance(factoryClassName, cl, true);
               }
           } catch (Exception x) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to