Check for null execution environment. (FELIX-1397)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@796572 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java
index 04ca1df..f004187 100644
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/Resolver.java
@@ -58,7 +58,7 @@
public Resolver(Logger logger, String fwkExecEnvStr)
{
m_logger = logger;
- m_fwkExecEnvStr = fwkExecEnvStr.trim();
+ m_fwkExecEnvStr = (fwkExecEnvStr != null) ? fwkExecEnvStr.trim() : null;
m_fwkExecEnvSet = parseExecutionEnvironments(fwkExecEnvStr);
}
@@ -1632,14 +1632,16 @@
* system variable 'org.osgi.framework.executionenvironment'.
* @param frameworkEnvironment Comma delimited string of provided execution environments
**/
- private static Set parseExecutionEnvironments(String frameworkEnvironment)
+ private static Set parseExecutionEnvironments(String fwkExecEnvStr)
{
- StringTokenizer tokens = new StringTokenizer(frameworkEnvironment, ",");
-
- Set newSet = new HashSet(tokens.countTokens());
- while (tokens.hasMoreTokens())
+ Set newSet = new HashSet();
+ if (fwkExecEnvStr != null)
{
- newSet.add(tokens.nextToken().trim());
+ StringTokenizer tokens = new StringTokenizer(fwkExecEnvStr, ",");
+ while (tokens.hasMoreTokens())
+ {
+ newSet.add(tokens.nextToken().trim());
+ }
}
return newSet;
}