Details

      Description

      Steps to reproduce:

      1) Login to Portal
      2) Navigate to Control Panel > Server Administration > Script
      3) Select BeanShell as language
      4) Paste the script from below
      5) Execute the script and examine the result

      Expected result

      "TEST SUCCESSFULL!!!" message should be printed

      Actual result
      The following results are printed:

      [ERROR] : Cannot cast org.python.core.PyObjectDerived to java.util.HashMap
      TEST FAILED....

      The script to use:

      import java.util.Set;
      import java.util.HashSet;
      import java.util.Map;
      import java.util.HashMap;
      import java.io.Serializable;
      import com.liferay.portal.kernel.scripting.ScriptingUtil;
      
      ClassLoader[] servletContextNames = new ClassLoader[0];
      
      String script = "workflowContext.put(\"resetPhase\", \"true\")";
      
      Set outputNames = new HashSet();
      
      outputNames.add("workflowContext");
      
      Map workflowContext =	new HashMap();
      
      workflowContext.put("nice", true);
      
      Map inputObjects = new HashMap();
      
      inputObjects.put("workflowContext", workflowContext);
      
      Map outputObjects = ScriptingUtil.eval(null, inputObjects, outputNames, "python", script, servletContextNames);
      
      Object workflowContextObject = outputObjects.get("workflowContext");
      
      HashMap workflowContextHashMap = null;
      try {
      	workflowContextHashMap =(HashMap)workflowContextObject;
      }
      catch(java.lang.Exception e) {
      	out.println("[ERROR] : " + e.getMessage());
      }
      
      if (workflowContextHashMap == null) {
      	out.println("TEST FAILED....");
      }
      else {
      	out.println("TEST SUCCESSFUL!!!");
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yvonne.han Yvonne Han
              Reporter:
              vilmos.papp Vilmos Papp
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 46 weeks ago

                  Packages

                  Version Package
                  6.2.3 CE GA4
                  6.2.X EE
                  7.0.0 M5