Hi Glenn,

Thanks, looks good. As long as there are no objects from the list, I'll
check it in.

Robert Marcano, will this work for you?

Thanks,

--Keith

Glenn Nielsen wrote:
> 
> Here is the patch to implement reording of how castor reads property
> configuration files.  As discussed on the list.
> 
> Regards,
> 
> Glenn
> 
> ----------------------------------------------------------------------
> Glenn Nielsen             [EMAIL PROTECTED] | /* Spelin donut madder    |
> MOREnet System Programming               |  * if iz ina coment.      |
> Missouri Research and Education Network  |  */                       |
> ----------------------------------------------------------------------
> 
>   ------------------------------------------------------------------------
> Index: src/main/org/exolab/castor/util/Configuration.java
> ===================================================================
> RCS file: /cvs/castor/castor/src/main/org/exolab/castor/util/Configuration.java,v
> retrieving revision 1.25
> diff -u -r1.25 Configuration.java
> --- src/main/org/exolab/castor/util/Configuration.java  26 Mar 2002 01:07:57 -0000   
>   1.25
> +++ src/main/org/exolab/castor/util/Configuration.java  28 Apr 2002 00:46:01 -0000
> @@ -602,42 +602,43 @@
>          File        file;
>          InputStream is;
> 
> -        // Get detault configuration from the Castor JAR.
> -        // Complain if not found.
>          Properties properties = new Properties();
> -        try {
> -            properties.load( Configuration.class.getResourceAsStream( resourceName 
>) );
> +
> +        // Get overriding configuration from the classpath,
> +        // ignore if not found.
> +        try {
> +            is = Configuration.class.getResourceAsStream( "/" + fileName );
> +            if ( is != null ) {
> +                properties.load( is );
> +                return properties;
> +            }
>          } catch ( Exception except ) {
> -            // This should never happen
> -            throw new RuntimeException( Messages.format( 
>"conf.noDefaultConfigurationFile",
> -                                                         fileName ) );
> +            // Do nothing
>          }
> 
>          // Get overriding configuration from the Java
>          // library directory, ignore if not found.
> -        try {
> +        try {
>              file = new File( System.getProperty( "java.home" ), "lib" );
>              file = new File( file, fileName );
>              if ( file.exists() ) {
> -                properties = new Properties( properties );
>                  properties.load( new FileInputStream( file ) );
> -            }
> +                return properties;
> +            }
>          } catch ( IOException except ) {
>              // Do nothing
>          }
> 
> -        // Get overriding configuration from the classpath,
> -        // ignore if not found.
> +        // Get detault configuration from the Castor JAR.
> +        // Complain if not found.
>          try {
> -            is = Configuration.class.getResourceAsStream( "/" + fileName );
> -            if ( is != null ) {
> -                properties = new Properties( properties );
> -                properties.load( is );
> -            }
> +            properties.load( Configuration.class.getResourceAsStream( resourceName 
>) );
>          } catch ( Exception except ) {
> -            // Do nothing
> +            // This should never happen
> +            throw new RuntimeException( Messages.format( 
>"conf.noDefaultConfigurationFile",
> +                                                         fileName ) );
>          }
> 
> -               return properties;
> +        return properties;
>         }
>  } //-- Configuration

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to