Hi Bertrand

I think, if the osgiProp is missing, the StringBuffer should just be
initialized empty. This IMHO is not a failure situation and thus not
warrant an Exception (of course NPE is wrong either, so catching the not
(yet) existing osgiProp is quite correct).

Regards
Felix

Am Montag, den 07.01.2008, 16:26 +0000 schrieb [EMAIL PROTECTED]:
> Author: bdelacretaz
> Date: Mon Jan  7 08:26:37 2008
> New Revision: 609670
> 
> URL: http://svn.apache.org/viewvc?rev=609670&view=rev
> Log:
> For SLING-149: fail more gracefully if sling.properties is missing
> 
> Modified:
>     
> incubator/sling/trunk/launcher/app/src/main/java/org/apache/sling/launcher/app/Sling.java
> 
> Modified: 
> incubator/sling/trunk/launcher/app/src/main/java/org/apache/sling/launcher/app/Sling.java
> URL: 
> http://svn.apache.org/viewvc/incubator/sling/trunk/launcher/app/src/main/java/org/apache/sling/launcher/app/Sling.java?rev=609670&r1=609669&r2=609670&view=diff
> ==============================================================================
> --- 
> incubator/sling/trunk/launcher/app/src/main/java/org/apache/sling/launcher/app/Sling.java
>  (original)
> +++ 
> incubator/sling/trunk/launcher/app/src/main/java/org/apache/sling/launcher/app/Sling.java
>  Mon Jan  7 08:26:37 2008
> @@ -335,7 +335,7 @@
>       *         an error.
>       */
>      private Map<String, String> loadConfigProperties(
> -            Map<String, String> propOverwrite) {
> +            Map<String, String> propOverwrite) throws BundleException {
>          // The config properties file is either specified by a system
>          // property or it is in the same directory as the Felix JAR file.
>          // Try to load it from one of these places.
> @@ -511,8 +511,12 @@
>       * @param prefix The prefix of properties to handle.
>       */
>      private void resolve(Map<String, String> props, String osgiProp,
> -            String prefix) {
> -        StringBuffer prop = new StringBuffer(props.get(osgiProp));
> +            String prefix) throws BundleException {
> +        final String propVal = props.get(osgiProp);
> +        if(propVal == null) {
> +            throw new BundleException(osgiProp + " property is null, 
> Sling.resolve() fails");
> +        }
> +        StringBuffer prop = new StringBuffer(propVal);
>          boolean mod = false;
>          for (Entry<String, String> pEntry : props.entrySet()) {
>              String key = pEntry.getKey();
> 
> 

Reply via email to