0

NullPointerException UiEngine.deactivate()

asked 2021-12-08 00:22:41 +0800

nsaazn gravatar image nsaazn
25 3

updated 2021-12-08 16:28:40 +0800

hawk gravatar image hawk
3048 1 5
http://hawkphoenix.blogsp... ZK Team

I'am trying to execute EL Expressions without current Execution (inside backgound job)

refer to ZK-4340 i'am create FakeExecution instance. Activates it and eval the expression. This works fine, but when i try to deactivate the execution it fails with a NullPointerException, because current session is null.

This looks like a bug. UiEngineImpl does not checks session for null.

Code example:

// Create fake exec
Execution exec = FakeExecution.getExecution(UiUtilsWebAppInit.getWebApp());
// Setup variable resolver
CtxVariableResolver resolver = null;
resolver = new CtxVariableResolver();
exec.addVariableResolver(resolver);
Evaluator ev = exec.getEvaluator((Page) null, null);
//Sets current fake execution as active
((WebAppCtrl) UiUtilsWebAppInit.getWebApp()).getUiEngine().activate(exec);
ev.evaluate((Page) null, ev.parseExpression(exp, expType));
// Deactivating desktop
((WebAppCtrl) UiUtilsWebAppInit.getWebApp()).getUiEngine().deactivate(exec);

Stack trace: java.lang.NullPointerException: null at org.zkoss.zk.ui.impl.UiEngineImpl.doDeactivate(UiEngineImpl.java:2117) ~[zk-9.6.0.1.jar:9.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.deactivate(UiEngineImpl.java:1927) ~[zk-9.6.0.1.jar:9.6.0.1] at org.sinnlabs.dbvim.objects.ExpressionEvaluator.evaluate(ExpressionEvaluator.java:80) ~[dbvim-objects-0.2-SNAPSHOT.jar:?] at org.sinnlabs.dbvim.objects.DBObject.initDefValues(DBObject.java:161) ~[dbvim-objects-0.2-SNAPSHOT.jar:?]

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-08 17:40:57 +0800

hawk gravatar image hawk
3048 1 5
http://hawkphoenix.blogsp... ZK Team

After ZK-4340 is fixed, you don't need to create your fake execution to create components in a working thread.

UiEngine.activate(exec) is called when you need to access components. It seems it's no need to call it before evaluating an EL.

Since I am not familiar with what you are doing, if you can provide a runnable example, that will help us understand better.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2021-12-08 00:22:41 +0800

Seen: 6 times

Last updated: Dec 08 '21

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More