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

EventQueue with Group scope throws NPE if publish without subscribe

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 5.0.10
    • Fix Version/s: 5.0.11
    • Component/s: General
    • Labels:

      Description

      EventQueue in Group scope will have NPE in the following condition.
      index.zul

      <zk>
      	<zscript>
      	EventQueue que = EventQueues.lookup("iframe", "group", true);
      	void publish() {
      		String text = tbx.getValue();
      		que.publish(new Event("onGroupTest", null, text));
      	}
      	</zscript>
      	<vlayout>
      		<iframe width="400px" height="600px" src="iframe.zul" />
      		<div>
      			Please type some words into the textbox and then you should see NPE exception.
      			<textbox id="tbx" onChange="publish()"/>
      		</div>
      	</vlayout>
      </zk>
      

      iframe.zul

      <zk>
      	<window title="Iframe" border="normal" width="300px">
      		<zscript>
      		EventQueue que = EventQueues.lookup("iframe", "group", true);
      		que.subscribe(new EventListener() {
      			public void onEvent(Event evt) {
      				lbl.setValue((String)evt.getData());
      			}
      		});
      		</zscript>
      		<textbox id="lbl" value="This is Iframe" />
      	</window>
      </zk>
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vincentjian vincentjian
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h