Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-103906

IllegalAccessException when adding a fragment with item selector configuration to a content page

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: Master
    • Fix Version/s: Master
    • Component/s: WCM
    • Labels:
      None

      Description

      Steps to reproduce:

      • Go to Content & Data > Web Content
      • Click + to add a new Basic Web Content
      • Provide a title and a content, and publish it
      • Edit the web content, and check in the side bar, in Basic Information the ID for it, since we are going to use it. We'll also need the classNameId for JournalArticle, this can be done through the database or through the following script in Server administration
      number =com.liferay.portal.kernel.service.ClassNameLocalServiceUtil.getClassNameId("com.liferay.journal.model.JournalArticle");
      out.println(number);
      
      • Go to Site Builder > Page Fragments
      • Click + to add a new Fragment Collection
      • Provide a name, and save
      • Click + to add a new Fragment
      • Provide any text in the HTML field
      • Go to the configuration tab, and specify the following changing classPK with the ID of the article and classNameId with the classNameId of JournalArticle:
      {
      	"fieldSets": [
      		{
      			"fields": [
      				{
      					"defaultValue": {
      						"className": "com.liferay.journal.model.JournalArticle",
      						"classNameId": "CLASS_NAME_ID",
      						"classPK": "CLASS_PK"
      					},
      					"name": "itemSelector1",
      					"type": "itemSelector"
      				}
      			]
      		}
      	]
      }
      
      • Publish the fragment
      • Go to Site Builder > Pages
      • Click + to create a new Page
      • Choose blank, and provide a name to it
      • From the sidebar select the fragment that was created beforehand, and drag and drop it to the page (note that it's added)
      • Refresh the page

      Expected result: The fragment will be shown, and clicking on it, will show the icon to configure and select an asset for it
      Actual result: Page editor will break, and no sidebar will be shown (under others). An error is also thron in the logs

      java.lang.IllegalAccessException: Class com.liferay.portal.template.soy.internal.SoyTemplateRecord can not access a member of class org.json.JSONObject$Null with modifiers "public"
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord._toSoyValue(SoyTemplateRecord.java:324)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord.lambda$_toSoyValue$2(SoyTemplateRecord.java:261)
          at java.util.Iterator.forEachRemaining(Iterator.java:116)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord._toSoyValue(SoyTemplateRecord.java:260)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord.lambda$_toSoyValue$2(SoyTemplateRecord.java:261)
          at java.util.Iterator.forEachRemaining(Iterator.java:116)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord._toSoyValue(SoyTemplateRecord.java:260)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord.lambda$_toSoyValue$3(SoyTemplateRecord.java:278)
          at java.util.HashMap$EntrySet.forEach(HashMap.java:1044)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord._toSoyValue(SoyTemplateRecord.java:276)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord.lambda$_toSoyValue$3(SoyTemplateRecord.java:278)
          at java.util.HashMap$EntrySet.forEach(HashMap.java:1044)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord._toSoyValue(SoyTemplateRecord.java:276)
          at com.liferay.portal.template.soy.internal.SoyTemplateRecord.getFieldProvider(SoyTemplateRecord.java:135)
          at com.google.template.soy.sharedpasses.render.Environment$Impl.<init>(Environment.java:98)
          at com.google.template.soy.sharedpasses.render.Environment.create(Environment.java:56)
          at com.google.template.soy.sharedpasses.render.RenderVisitor.renderTemplate(RenderVisitor.java:258)
          at com.google.template.soy.sharedpasses.render.RenderVisitor.visitTemplateNode(RenderVisitor.java:272)
          at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitTemplateBasicNode(AbstractSoyNodeVisitor.java:231)
          at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNodeVisitor.java:65)
      

        Attachments

          Activity

            People

            • Assignee:
              yang.cao Yang Cao
              Reporter:
              jurgen.kappler Jürgen Kappler
              Participants of an Issue:
              Recent user:
              Yang Cao
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 weeks, 2 days ago

                Packages

                Version Package
                Master