Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-3592

CheckBoxFieldFactory throws null pointer if i18n is enabled in the form but disabled in the system

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 5.3.12
    • 5.3.10
    • forms

          @Override
          public Field<Boolean> createField() {
              super.createField();
              if (definition.isI18n()) {
                  if (item instanceof JcrItemAdapter) {
                      javax.jcr.Item jcrItem = ((JcrItemAdapter) item).getJcrItem();
                      if (jcrItem.isNode()) {
                          Node node = (Node) jcrItem;
                          List<Locale> locales = i18nAuthoringSupport.getAvailableLocales(node);
                          Locale defaultLocale = getDefaultLocale(node);
                          for (Locale locale : locales) {
                              if (!locale.getLanguage().equals(defaultLocale.getLanguage())) {
                                  Property<?> property = initializeLocalizedProperty(locale);
                                  setPropertyDataSourceAndDefaultValue(property);
                              }
                          }
                      }
                  }
              }
      
              return field;
          }
      

      If i18n support is enabled on the form; but not in system itself the for loop causes a null pointer as locales are null.

      There are two options to fix:

      • enable i18n support on system level
      • disable i18n inside the form

        Acceptance criteria

              sang.ngo Sang Ngo Huu
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - 0.75d
                    0.75d
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 0.75d
                    0.75d