Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-3317

[ScriptHandler] Call a Java method with a Java array with Object signature

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.4.0, 4.3.4
    • Component/s: None
    • Labels:
      None

      Description

      Since GraalJS, I'm trying to call the ModifiableDataHolder.setValue(Object) method with a Java array of String in a script :

      var content = ametysResolver.resolveById("personContent://afa5ba8d-671d-4ce2-ab02-7d9a25028d30");
      var values = ["test1", "test2"];
      content.setValue("role", Java.to(values, "java.lang.String[]"));

      I get the following error :

      ry to set the non string value '[test1, test2]' to the string data 'role' on '/ametys:root/ametys:plugins/odf/ametys:contents/11/91/person-person1-lancelot-fr (afa5ba8d-671d-4ce2-ab02-7d9a25028d30)'
      	at org.ametys.cms.data.type.impl.StringRepositoryElementType.write(StringRepositoryElementType.java:106)
      	at org.ametys.plugins.repository.data.holder.impl.DefaultModifiableModelAwareDataHolder.setValue(DefaultModifiableModelAwareDataHolder.java:284)
      	at org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject.setValue(ModifiableModelAwareDataAwareAmetysObject.java:64)
      [...]

      With a breakpoint, I can see that the value is a PolyglotList.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bmaurel Bérénice Maurel
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: