vmassol     01/11/16 14:36:21

  Modified:    src/framework/share/org/apache/cactus/client
                        ClientConfiguration.java
  Log:
  corrected code for using -Dcactus.config parameter (I had not finished writing it 
... :))
  
  Revision  Changes    Path
  1.2       +11 -3     
jakarta-cactus/src/framework/share/org/apache/cactus/client/ClientConfiguration.java
  
  Index: ClientConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/ClientConfiguration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClientConfiguration.java  2001/11/16 19:16:26     1.1
  +++ ClientConfiguration.java  2001/11/16 22:36:21     1.2
  @@ -59,13 +59,14 @@
   
   import org.apache.cactus.*;
   import org.apache.cactus.util.log.*;
  +import org.apache.cactus.util.ChainedRuntimeException;
   
   /**
    * Provides acces to the client side Cactus configuration.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Massol</a>
    *
  - * @version $Id: ClientConfiguration.java,v 1.1 2001/11/16 19:16:26 vmassol Exp $
  + * @version $Id: ClientConfiguration.java,v 1.2 2001/11/16 22:36:21 vmassol Exp $
    */
   public class ClientConfiguration
   {
  @@ -105,11 +106,18 @@
           if (CONFIG == null) {
               // Has the user passed the location of the cactus configuration file
               // as a java property
  -            String location = System.getProperty(CONFIG_PROPERTY);
  -            if (location == null) {
  +            String configOverride = System.getProperty(CONFIG_PROPERTY);
  +            if (configOverride == null) {
                   // Try to read the default cactus configuration file from the
                   // classpath
                   CONFIG = PropertyResourceBundle.getBundle(CONFIG_DEFAULT_NAME);
  +            } else {
  +                try {
  +                    CONFIG = new PropertyResourceBundle(new 
FileInputStream(configOverride));
  +                } catch (IOException e) {
  +                    throw new ChainedRuntimeException("Cannot read cactus 
configuration file [" +
  +                        configOverride + "]", e);
  +                }
               }
           }
           return CONFIG;
  
  
  

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

Reply via email to