intershop

NullPtr exception while getting country names and country codes in backoffice


After upgrading to Intershop CM 7.10.18.1, we are getting NullPtr exceptions while opening store detail page in backoffice. ISML template for store details is EditStore_52.isml, which includes ISCountrySelectBox module, which futhermore calls getCountryNamesAndCodes() method. That method fails with NullPtr exception because of underlined call which returns null. failing method

We are wondering whether this is a bug and whether the intended code was supposed to be:

countriesMap.put(country.getId(), country.getDisplayName(currentLocale));

Please advise on workaround for this situation. The following is a stack trace for exception.

exception stack trace


Solution

  • The more convenient way (because editing xml import files is tedious) would be to replace the erroneous implementation using guice module override. In a nutshell:

        @Override
        protected void configure()
        {
            bind(LocalizedCountryNamesProvider.class).to(AppSFLocalizedCountryNamesProviderImpl.class);
            bindProvider(com.intershop.component.foundation.capi.localization.LocalizedCountryNamesProvider.class)
            .to(AppSFLocalizedCountryNamesProviderImpl.class);
        }