Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-32342

Provide option to enable Nashorn optimistic typing

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2023.4, 2021.46
    • Fix Version/s: 2021.52, 2023.10
    • Component/s: Automation
    • Release Notes Summary:
      nuxeo.conf now allows to enable Nashorn optimistic types.
    • Backlog priority:
      900
    • Upgrade notes:
      Hide

      A new framework property allows to toggle this behavior by adding the following to your nuxeo.conf:

      nuxeo.automation.scripting.optimistic.types.enabled=true
      

       

      Show
      A new framework property allows to toggle this behavior by adding the following to your nuxeo.conf: nuxeo.automation.scripting.optimistic.types.enabled= true  
    • Sprint:
      nxplatform #108
    • Story Points:
      3

      Description

      NXP-32134 improved script compilation speed by disabling Nashorn optimistic typing - however this introduces a regression in scripts that pass number objects as parameters to operations that expect an Integer (for example, Document.RemoveItemFromListProperty). An option to enable optimistic typing (including its downsides) should be made available such that these scripts won't have to be immediately refactored.

      Steps to Reproduce:

      1. Install the attached Studio project and ensure minimum hotfix version 2021.46 or 2023.4.
      2. Create an instance of RadioGroupDoc and populate the radiogroupdoc:items multi-valued complex property with several values.
      3. After navigating to the created document, find a button under DOCUMENT_ACTIONS slot labeled "Test Item Removal" which runs the following script to remove the last item in the array:
        function run(input, params) { 
          if(input && input['radiogroupdoc:items']) {
            var len = input['radiogroupdoc:items'].length;
            if(len > 0) {
              Document.RemoveItemFromListProperty(
                input, {
                    'xpath': 'radiogroupdoc:items',
                    'index': (len - 1),
                    'save': true
                }
              );
            }
          }
        }
        

      Expected result: the last item in the list property is removed.

      Actual result: the following error is thrown:

      Exception: OperationException
      Caught error: No type adapter found for input: class java.lang.Double and output class java.lang.Integer
      Caused by: org.nuxeo.ecm.automation.OperationException: No type adapter found for input: class java.lang.Double and output class java.lang.Integer
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: