Uploaded image for project: 'GateIn Portal'
  1. GateIn Portal
  2. GTNPORTAL-2707

Call getAllPortalNames() from UIUserToolbarSitePortlet only once

    Details

      Description

      Actually method getAllPortalNames() is called like 4 times (accurately 2*countOfPortals times) during rendering of UIUserToolbarSitePortlet. See code in UIUserToolbarSitePortlet.gtmpl:

      for(int i = 0; i < uicomponent.getAllPortalNames().size(); i++) {
        String portalName = uicomponent.getAllPortalNames().get(i);
        ...
      }
      

      This could mean problems like:

      • Performance - There is overhead as method is unnecessarily called 4 (or more) times. Actually the overhead shouldn't be too big as portal names are cached thanks to PortalNamesCache class, but still it is.
      • Consistency - For example if another client removes portal concurrently in the meantime, we can potentially see consistency issues and problems like ArrayIndexOutOfBoundException could happen

      It should be improved to call getAllPortalNames only once:

      List<String> allPortalNames = uicomponent.getAllPortalNames();
      for(int i = 0; i < allPortalNames.size(); i++) {
        String portalName = allPortalNames.get(i);
        ..
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mposolda Marek Posolda
                Reporter:
                mposolda Marek Posolda
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: