Author: rickhall
Date: Tue Feb 15 16:01:08 2011
New Revision: 1070949
URL: http://svn.apache.org/viewvc?rev=1070949&view=rev
Log:
If a bundle is uninstalled more than once, the subsequent calls
should not attempt to cache the bundle headers for the default
locale. (FELIX-2840)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java?rev=1070949&r1=1070948&r2=1070949&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
Tue Feb 15 16:01:08 2011
@@ -964,14 +964,22 @@ class BundleImpl implements Bundle
AdminPermission.LIFECYCLE));
}
- // After a bundle is uninstalled, rhe spec says getHeaders() should
+ // After a bundle is uninstalled, the spec says getHeaders() should
// return the localized headers for the default locale at the time of
- // of uninstall. So, let's clear the existing header cache and populate
- // it with the headers for the default locale.
+ // of uninstall. So, let's clear the existing header cache to throw
+ // away any other locales and populate it with the headers for the
+ // default locale. We only do this if there are multiple cached locales
+ // and if the default locale is not cached. If this method is called
+ // more than once, then subsequent calls will do nothing here since
+ // only the default locale will be left in the header cache.
synchronized (m_cachedHeaders)
{
- m_cachedHeaders.clear();
- Map map =
getCurrentLocalizedHeader(Locale.getDefault().toString());
+ if ((m_cachedHeaders.size() > 1)
+ ||
!m_cachedHeaders.containsKey(Locale.getDefault().toString()))
+ {
+ m_cachedHeaders.clear();
+ Map map =
getCurrentLocalizedHeader(Locale.getDefault().toString());
+ }
}
// Uninstall the bundle.