Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-643

cms:publicOnly showInPreview=true throws ClassCastException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.1.5
    • 2.1.4
    • taglibs
    • None

    Description

      The cms:publicOnly tag does not work as documented. If showInPreview is set to true it nevertheless does not evaluate its body content on an admin instance in preview mode.

      The guilty lines are

      String prev = (String) request.getSession().getAttribute("mgnlPreview"); //$NON-NLS-1$
      if (!Server.isAdmin() || (prev != null && showInPreview)) {

      in PublicOnly#condition(). The session attribute "mgnlPreview" is a Boolean and not a String so a ClassCastException occurs.

      The corrected lines should read

      if (!Server.isAdmin() || (showInPreview && Resource.showPreview(request))) {

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              kraft Boris Kraft
              abrenk Andreas Brenk
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD

                  Time Tracking

                    Estimated:
                    Original Estimate - 5m
                    5m
                    Remaining:
                    Remaining Estimate - 5m
                    5m
                    Logged:
                    Time Spent - Not Specified
                    Not Specified