[MAGNOLIA-643] cms:publicOnly showInPreview=true throws ClassCastException Created: 17/Feb/06  Updated: 23/Jan/13  Resolved: 01/Mar/06

Status: Closed
Project: Magnolia
Component/s: taglibs
Affects Version/s: 2.1.4
Fix Version/s: 2.1.5

Type: Bug Priority: Major
Reporter: Andreas Brenk Assignee: Boris Kraft
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 5m
Time Spent: Not Specified
Original Estimate: 5m

Attachments: Text File PublicOnly.patch    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 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))) {



 Comments   
Comment by Andreas Brenk [ 17/Feb/06 ]

svn diff src/main/info/magnolia/cms/taglibs/PublicOnly.java

Comment by Philipp Bracher [ 01/Mar/06 ]

patched

Generated at Mon Feb 12 03:19:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.