Clean up some code to make it more sensible.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@379424 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
index fade8a1..893d9dc 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
@@ -802,27 +802,14 @@
// Get the bundle's manifest header.
Map map = getManifestHeader(revision);
- if (map == null)
- {
- map = new HashMap();
- }
// Find class path meta-data.
- String classPathString = null;
- Iterator iter = map.entrySet().iterator();
- while ((classPathString == null) && iter.hasNext())
- {
- Map.Entry entry = (Map.Entry) iter.next();
- if (entry.getKey().toString().toLowerCase().equals(
- FelixConstants.BUNDLE_CLASSPATH.toLowerCase()))
- {
- classPathString = entry.getValue().toString();
- }
- }
+ String classPath = (map == null)
+ ? null : (String) map.get(FelixConstants.BUNDLE_CLASSPATH);
// Parse the class path into strings.
String[] classPathStrings = Util.parseDelimitedString(
- classPathString, FelixConstants.CLASS_PATH_SEPARATOR);
+ classPath, FelixConstants.CLASS_PATH_SEPARATOR);
if (classPathStrings == null)
{
@@ -835,12 +822,12 @@
{
bundleJar = openBundleJar(revisionDir);
IContent self = new JarContent(new File(revisionDir, BUNDLE_JAR_FILE));
- IContent[] classPath = new IContent[classPathStrings.length];
+ IContent[] contentPath = new IContent[classPathStrings.length];
for (int i = 0; i < classPathStrings.length; i++)
{
if (classPathStrings[i].equals(FelixConstants.CLASS_PATH_DOT))
{
- classPath[i] = self;
+ contentPath[i] = self;
}
else
{
@@ -849,23 +836,23 @@
ZipEntry entry = bundleJar.getEntry(classPathStrings[i]);
if ((entry != null) && entry.isDirectory())
{
- classPath[i] = new ContentDirectoryContent(self, classPathStrings[i]);
+ contentPath[i] = new ContentDirectoryContent(self, classPathStrings[i]);
}
else
{
- classPath[i] = new JarContent(new File(embedDir, classPathStrings[i]));
+ contentPath[i] = new JarContent(new File(embedDir, classPathStrings[i]));
}
}
}
// If there is nothing on the class path, then include
// "." by default, as per the spec.
- if (classPath.length == 0)
+ if (contentPath.length == 0)
{
- classPath = new IContent[] { self };
+ contentPath = new IContent[] { self };
}
- return classPath;
+ return contentPath;
}
finally
{