commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kukosa, Tomas" <tomas.kuk...@siemens-enterprise.com>
Subject [jexl] invalid script variable list for nested array/map access
Date Tue, 10 Jul 2012 15:01:41 GMT
Hi Henrib,

thanks for your previous fixes.

The next bug found during my getting familiar with jexl is following one:

If the expression contains nested array/map access then the getVariables() method does not
return the right value.
The result of test code below is:

script: A+B[C]+D[E[F]]+x[y[z]]
variables: [[A], [C], [B], [D], [x]]

E, F, y, z variables have got lost somewhere.

Best regards,
  Tomas

-----
public class Test02 {

	private final static String SCR_EXPR01 = "A+B[C]+D[E[F]]+x[y[z]]";

	public static void main(String[] args) {
		JexlEngine jexl = new JexlEngine();
		JexlContext jc = new MapContext();
		Script script;
		Expression expr;
		Object result;

		script = jexl.createScript(SCR_EXPR01);
		
		System.out.print(String.format("script: %s\n", script.getText()));
		System.out.print(String.format("variables: %s\n", script.getVariables()));
		
	}

}

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message