Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4236

leaking variable resolvers when using programmatic templates

    Details

    • gh.sprint.customfield.default.name:
      ZK 8.6.2 S1

      Description

      Steps to Reproduce

      run the attached example

      Current Result

      the each expression at the bottom resolves to the last value of the list model

      Expected Result

      each should resolved to null

      Debug Info

      Root Cause

      ForEachRenderer is adding a variable resolver to the current execution in each iteration
      https://github.com/zkoss/zkcml/blob/v8.6.1/zuti/src/org/zkoss/zuti/zul/ForEachRenderer.java#L64

      But doesn't clean it up.

      A template defined in a zul page uses TemplateImpl which does the clean up by default, but also adds the VariableResolver.

      (adds the same variable resolver again)
      https://github.com/zkoss/zk/blob/v8.6.1/zk/src/org/zkoss/zk/ui/impl/UiEngineImpl.java#L2307
      (removes it)
      https://github.com/zkoss/zk/blob/v8.6.1/zk/src/org/zkoss/zk/ui/impl/UiEngineImpl.java#L2341

      Workaround

      manually remove the variable resolver during template.create
      (commented out in the attachment)

        Attachments

          Activity

            People

            • Assignee:
              rudyhuang rudyhuang
              Reporter:
              cor3000 cor3000
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - 2 hours Remaining Estimate - 2 hours Time Not Required
                2h