Details

      Description

      Hi!

       

      As you can read in this post: https://liferay.dev/forums/-/message_boards/message/114099952, Liferay can't create structures through the JSONWS API due to a bug in the Jodd Json library. In fact, Liferay is not able to create any object that depends on the LocalizedValue class for this reason.

       

      Upgrading Jodd to version 3.6.8 fixes this issue

       

      Steps to reproduce: 

      • Try to create a localized structure through the JSONWS --> It fails. 

       


      Steps to reproduce:

      • Obtain from database the classNameId for a JournalArticle
        SELECT classNameId FROM ClassName_ WHERE value="com.liferay.journal.model.JournalArticle"
        
      • Obtain from database the guest groupid:
        SELECT groupId FROM Group_ WHERE groupKey="Guest"
        
      • Execute the following curl command, you must replace the groupId and classNameId with the obtained codes from the previous steps, and take into account that structureKey is unique
      curl http://localhost:8080/api/jsonws/ddm.ddmstructure/add-structure \
        -u test@liferay.com:test \
        -d groupId=20124 \
        -d parentStructureKey=0 \
        -d classNameId=20401\
        -d structureKey='MY_KEY' \
        -d nameMap=%7B%22sv_SE%22%3A%22Description%20in%20Swedish%22%2C%22en_US%22%3A%22Description%20in%20English%22%7D \
        -d descriptionMap=%7B%22sv_SE%22%3A%22Description%20in%20Swedish%22%2C%22en_US%22%3A%22Description%20in%20English%22%7D \
        -d %2bddmForm:com.liferay.dynamic.data.mapping.model.DDMForm=%7B%22availableLocales%22%3A%5B%22en_US%22%2C%22sv_SE%22%5D%2C%22defaultLocale%22%3A%22en_US%22%2C%22ddmFormFields%22%3A%5B%7B%22label%22%3A%7B%22values%22%3A%7B%22en_US%22%3A%22Field%20name%201%22%2C%22sv_SE%22%3A%22Field%20name%20SE%22%7D%7D%2C%22predefinedValue%22%3A%7B%22values%22%3A%7B%22en_US%22%3A%22%22%2C%22sv_SE%22%3A%22%22%7D%7D%2C%22style%22%3A%7B%22values%22%3A%7B%22en_US%22%3A%22%22%2C%22sv_SE%22%3A%22%22%7D%7D%2C%22tip%22%3A%7B%22values%22%3A%7B%22en_US%22%3A%22Some%20field%20tip%22%2C%22sv_SE%22%3A%22Some%20field%20tip%20in%20Swedish%22%7D%7D%2C%22dataType%22%3A%22string%22%2C%22indexType%22%3A%22keyword%22%2C%22localizable%22%3Atrue%2C%22name%22%3A%22myFirstField%22%2C%22readOnly%22%3Afalse%2C%22repeatable%22%3Afalse%2C%22required%22%3Afalse%2C%22showLabel%22%3Atrue%2C%22type%22%3A%22text%22%2C%22displayStyle%22%3A%22%22%2C%22fieldNamespace%22%3A%22%22%2C%22visibilityExpression%22%3A%22%22%2C%22validation%22%3A%7B%7D%7D%5D%7D \
        -d %2bddmFormLayout:com.liferay.dynamic.data.mapping.model.DDMFormLayout=%7B%22defaultLocale%22%3A%20%22en_US%22%7D \
        -d storageType='json' \
        -d type=0 \
        -d %2bserviceContext:com.liferay.portal.kernel.service.ServiceContext
        

      Actual Result

      Error response on terminal:

        
      {"exception":"java.util.Set; <--- java.lang.NoSuchMethodException: java.util.Set.<init>()","throwable":"jodd.json.JsonException: java.util.Set; <--- java.lang.NoSuchMethodException: java.util.Set.<init>()","rootCause":{"message":"java.util.Set.<init>()","type":"java.lang.NoSuchMethodException"},"error":{"message":"java.util.Set; <--- java.lang.NoSuchMethodException: java.util.Set.<init>()","type":"jodd.json.JsonException"}}
      

      Error in logs:

        ERROR [http-nio-8080-exec-4][JSONWebServiceServiceAction:114] java.util.Set; <--- java.lang.NoSuchMethodException: java.util.Set.<init>()
      

      Expected result:
      The response in the terminal must be an error-free JSON, and the created structure must be displayed at: Content & Data -> Web Context -> Structures

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

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

                  Packages

                  Version Package
                  7.2.X
                  Master