|
44 | 44 | public class AddressHierarchyServiceImpl implements AddressHierarchyService {
|
45 | 45 |
|
46 | 46 | protected static final Log log = LogFactory.getLog(AddressHierarchyServiceImpl.class);
|
47 |
| - |
| 47 | + |
| 48 | + private static final String GET_GLOBAL_PROPERTIES = "Get Global Properties"; |
48 | 49 | private AddressHierarchyDAO dao;
|
49 | 50 |
|
50 | 51 | private Map<Locale, Map<String,List<String>> > fullAddressCache;
|
@@ -705,18 +706,26 @@ else if (level.getParent() == null){
|
705 | 706 | synchronized public void initializeFullAddressCache() {
|
706 | 707 |
|
707 | 708 | // generally, this global property should be set to true; it just allows cache load to be disabled to speed startup
|
708 |
| - if (Context.getAdministrationService().getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP).equalsIgnoreCase("true")) { |
709 |
| - |
710 |
| - // only initialize if necessary (and if we have entries) |
711 |
| - if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache)) |
712 |
| - && this.getAddressHierarchyEntryCount() > 0) { |
713 |
| - |
714 |
| - this.fullAddressCache = new HashMap<Locale, Map<String,List<String>> >(); |
715 |
| - Locale locale = i18nCache.getLocaleForFullAddressCache(); |
716 |
| - getAddressesForLocale(locale); |
717 |
| - this.fullAddressCacheInitialized = true; |
| 709 | + try { |
| 710 | + Context.addProxyPrivilege(GET_GLOBAL_PROPERTIES); |
| 711 | + if (Context.getAdministrationService() |
| 712 | + .getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP) |
| 713 | + .equalsIgnoreCase("true")) { |
| 714 | + |
| 715 | + // only initialize if necessary (and if we have entries) |
| 716 | + if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache)) |
| 717 | + && this.getAddressHierarchyEntryCount() > 0) { |
| 718 | + |
| 719 | + this.fullAddressCache = new HashMap<Locale, Map<String, List<String>>>(); |
| 720 | + Locale locale = i18nCache.getLocaleForFullAddressCache(); |
| 721 | + getAddressesForLocale(locale); |
| 722 | + this.fullAddressCacheInitialized = true; |
| 723 | + } |
718 | 724 | }
|
719 | 725 | }
|
| 726 | + finally { |
| 727 | + Context.removeProxyPrivilege(GET_GLOBAL_PROPERTIES); |
| 728 | + } |
720 | 729 |
|
721 | 730 | }
|
722 | 731 |
|
|
0 commit comments