You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2009/12/04 21:45:35 UTC
svn commit: r887351 -
/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
Author: rickhall
Date: Fri Dec 4 20:45:35 2009
New Revision: 887351
URL: http://svn.apache.org/viewvc?rev=887351&view=rev
Log:
Check for null default property URL. (FELIX-1917)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java?rev=887351&r1=887350&r2=887351&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java Fri Dec 4 20:45:35 2009
@@ -584,40 +584,43 @@
// attempt to load resource default.properties instead.
URL propURL = ExtensionManager.class.getClassLoader()
.getResource(DEFAULT_PROPERTIES_FILE_VALUE);
- InputStream is = null;
- try
+ if (propURL != null)
{
- // Load properties from URL.
- is = propURL.openConnection().getInputStream();
- Properties props = new Properties();
- props.load(is);
- is.close();
- // Perform variable substitution for system properties.
- for (Enumeration e = props.propertyNames(); e.hasMoreElements(); )
- {
- String name = (String) e.nextElement();
- props.setProperty(name,
- Util.substVars(props.getProperty(name), name, null, props));
- }
- // Return system packages property.
- return props.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
- }
- catch (Exception ex)
- {
- // Try to close input stream if we have one.
+ InputStream is = null;
try
{
- if (is != null) is.close();
+ // Load properties from URL.
+ is = propURL.openConnection().getInputStream();
+ Properties props = new Properties();
+ props.load(is);
+ is.close();
+ // Perform variable substitution for system properties.
+ for (Enumeration e = props.propertyNames(); e.hasMoreElements(); )
+ {
+ String name = (String) e.nextElement();
+ props.setProperty(name,
+ Util.substVars(props.getProperty(name), name, null, props));
+ }
+ // Return system packages property.
+ return props.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
}
- catch (IOException ex2)
+ catch (Exception ex)
{
- // Nothing we can do.
- }
+ // Try to close input stream if we have one.
+ try
+ {
+ if (is != null) is.close();
+ }
+ catch (IOException ex2)
+ {
+ // Nothing we can do.
+ }
- logger.log(
- Logger.LOG_ERROR, "Unable to load any configuration properties.", ex);
- return "";
+ logger.log(
+ Logger.LOG_ERROR, "Unable to load any configuration properties.", ex);
+ }
}
+ return "";
}
class ExtensionManagerModule extends ModuleImpl