Modified BundleCache.remove() to check for a null parameter.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@423419 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
index 330d04e..7141bdc 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
@@ -170,21 +170,24 @@
public synchronized void remove(BundleArchive ba)
throws Exception
{
- // Remove the archive.
- ba.dispose();
- // Remove the archive from the cache.
- int idx = getArchiveIndex(ba);
- if (idx >= 0)
+ if (ba != null)
{
- BundleArchive[] tmp =
- new BundleArchive[m_archives.length - 1];
- System.arraycopy(m_archives, 0, tmp, 0, idx);
- if (idx < tmp.length)
+ // Remove the archive.
+ ba.dispose();
+ // Remove the archive from the cache.
+ int idx = getArchiveIndex(ba);
+ if (idx >= 0)
{
- System.arraycopy(m_archives, idx + 1, tmp, idx,
- tmp.length - idx);
+ BundleArchive[] tmp =
+ new BundleArchive[m_archives.length - 1];
+ System.arraycopy(m_archives, 0, tmp, 0, idx);
+ if (idx < tmp.length)
+ {
+ System.arraycopy(m_archives, idx + 1, tmp, idx,
+ tmp.length - idx);
+ }
+ m_archives = tmp;
}
- m_archives = tmp;
}
}