commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henrib <hen...@apache.org>
Subject Re: [jexl] Unexpected Integer -> Byte conversion
Date Thu, 05 Jul 2012 09:33:05 GMT
Hi Tomas,
Your previous issue (JEXL-135) has been solved in the trunk (2.1.2 and 3.0).
Not sure about this one, I can't reproduce it on the trunk using the
following test:

{code}

    public void test135() throws Exception {
        JexlEngine jexl = new JexlEngine();
        JexlContext jc = new MapContext();
        Script script;
        Object result;
        Map<Integer, Object> foo = new HashMap<Integer, Object>();
        foo.put(3, 42);
        jc.set("state", foo);

        script = jexl.createScript("var y = state[3]; y");
        result = script.execute(jc, foo);
        assertEquals(42, result);

        jc.set("a", 3);
        script = jexl.createScript("var y = state[a]; y");
        result = script.execute(jc, foo);
        assertEquals(42, result);

        jc.set("a", 2);
        script = jexl.createScript("var y = state[a + 1]; y");
        result = script.execute(jc, foo);
        assertEquals(42, result);

        jc.set("a", 2);
        jc.set("b", 1);
        script = jexl.createScript("var y = state[a + b]; y");
        result = script.execute(jc, foo);
        assertEquals(42, result);

        script = jexl.createScript("var y = state[3]; y", "state");
        result = script.execute(null, foo, 3);
        assertEquals(42, result);

        script = jexl.createScript("var y = state[a]; y", "state", "a");
        result = script.execute(null, foo, 3);
        assertEquals(42, result);

        script = jexl.createScript("var y = state[a + 1]; y", "state", "a");
        result = script.execute(null, foo, 2);
        assertEquals(42, result);

        script = jexl.createScript("var y = state[a + b]; y", "state", "a",
"b");
        result = script.execute(null, foo, 2, 1);
        assertEquals(42, result);
    }
{code}
Let me know what I'm missing.
Regards
Henrib

PS: If you are starting/evaluating to use JEXL and if you can, I'd suggest
you use the 3.0 SNAPSHOT (published a new one today).


--
View this message in context: http://apache-commons.680414.n4.nabble.com/jexl-Unexpected-Integer-Byte-conversion-tp4635879p4635902.html
Sent from the Commons - User mailing list archive at Nabble.com.

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


Mime
View raw message