You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kalle Korhonen <ka...@gmail.com> on 2007/06/27 00:25:50 UTC

OGNL 2.7 Must use #this

Hi Jesse et al,

while trying to migrate to Tap 4.1.2 we started getting lots of
OgnlExceptions with message "source is null" from OgnlRuntime.getProperty.
The workaround was to add #this to a lot of places where we used more
complex OGNL expressions. I realize this is probably much more to do with
enhanced Ognl than Tapestry, so I would have taken the discussion to ognl
list, but subscribing to ognl-interest failed with lists.ognl.org domain not
found. Anyway, an example of failing expression is:
ognl:object[linkProperty]

that now only works with:
ognl:object[#this.linkProperty]

Without knowing anything about how compiled OGNL works, just following the
ExpressionEvaluatorImpl.java source I tried to make a test case that fails:
    public String getKey() {
        return "key";
    }

    public void testEnhancedOgnl() throws Exception {
        map = new HashMap();
        map.put("key", "value");
        ClassResolver ognlResolver = new OgnlClassResolver();
        OgnlContext context = (OgnlContext)Ognl.createDefaultContext(this,
ognlResolver);
        Node expression = Ognl.compileExpression(context, map, "key");
        assertEquals(map.get("key"), Ognl.getValue(expression.getAccessor(),
context, map)) ;

        context = (OgnlContext)Ognl.createDefaultContext(this,
ognlResolver);
        expression = Ognl.compileExpression(context, this, "#this[key]");
        assertEquals("key", Ognl.getValue(expression.getAccessor(), context,
this)) ;

        context = (OgnlContext)Ognl.createDefaultContext(this,
ognlResolver);
        expression = Ognl.compileExpression(context, this, "#this.key");
        assertEquals("key", Ognl.getValue(expression.getAccessor(), context,
this)) ;

        // Fails
        context = (OgnlContext)Ognl.createDefaultContext(this,
ognlResolver);
        expression = Ognl.compileExpression(context, this, "key");
        assertEquals("key", Ognl.getValue(expression.getAccessor(), context,
this)) ;
    }


I might be way off here (like I said, I don't know anything about it :), but
the last assert fails (on CannotCompileException) even though to me the
expression is equal to the two above it (the first one's just me figuring
out how it works).

Since 2.7 is already released and I can see Jesse has even tagged Tap4.1.2 a
few hours ago, I was mostly looking for a quick explanation, maybe a better
workaround if possible. If this (pun intended) is the price to pay for
faster OGNL, here's my check and huge thanks to Jesse for all the hard work!

Kalle

Re: OGNL 2.7 Must use #this

Posted by Kalle Korhonen <ka...@gmail.com>.
Yeap, you are absolutely right Jesse, the unit test succeeds. Must have had
the wrong snapshot version in the classpath. However, a more complex case
still fails in latest 2.7.1, opened
http://jira.opensymphony.com/browse/OGNL-105 for it with a unit test to show
the problem (sorry for the trouble!).

Kalle


On 7/2/07, Kalle Korhonen <ka...@gmail.com> wrote:
>
> The unit test doesn't succeed for me (and neither does the real world
> example, which is slightly different, but I assume the unit test would cover
> for it). Well, if you say the unit test should pass now, I'll double-check I
> have the right version and get back to you.
>
> Kalle
>
>
> On 7/2/07, Jesse Kuhnert <jk...@gmail.com> wrote:
> >
> > That looks like the right one to me.   The code you provided in the test
> > case was re-produced / fixed.  You did mention something about
> > "object[linkProperty]" not working before you provided a code example
> > but
> > I'm assuming the code example was what was intended to be fixed....
> >
> > Does the same test case not work for you?
> >
> > On 7/2/07, Kalle Korhonen <kalle.o.korhonen@gmail.com > wrote:
> > >
> > > Hey Jesse - saw you had marked
> > > http://jira.opensymphony.com/browse/OGNL-97as resolved so I assumed
> > > the fix might be in the latest snapshot
> > > ognl-2.7.1-20070630.205921-4 posted later but there were no changes as
> > far
> > > as I could notice. Certainly don't want to sound impatient as you are
> > > doing
> > > superb job in fixing these, but how do I know in which snapshot the
> > fix
> > > might be?
> > >
> > > Kalle
> > >
> > >
> > > On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> > > >
> > > > Thanks. I wasn't 100% how legitimate, but filed as
> > > > http://jira.opensymphony.com/browse/OGNL-97
> > > >
> > > > Kalle
> > > >
> > > > On 6/26/07, Jesse Kuhnert < jkuhnert@gmail.com> wrote:
> > > > >
> > > > > No time to look at this right now,  but if you file a jira report
> > > here:
> > > > >
> > > > > http://jira.opensymphony.com/browse/OGNL
> > > > >
> > > > > it can be looked in to for the next 2.7.1 release.
> > > > >
> > > > > The forums are here:
> > > > >
> > > > > http://forums.opensymphony.com/category.jspa?categoryID=10
> > > > >
> > > > > (though I'm thinking of moving them to google groups as well)
> > > > >
> > > > > On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> > > > > >
> > > > > > Hi Jesse et al,
> > > > > >
> > > > > > while trying to migrate to Tap 4.1.2 we started getting lots of
> > > > > > OgnlExceptions with message "source is null" from
> > > > > OgnlRuntime.getProperty.
> > > > > > The workaround was to add #this to a lot of places where we used
> >
> > > more
> > > > > > complex OGNL expressions. I realize this is probably much more
> > to do
> > > > > with
> > > > > > enhanced Ognl than Tapestry, so I would have taken the
> > discussion to
> > > > > ognl
> > > > > > list, but subscribing to ognl-interest failed with
> > > lists.ognl.orgdomain
> > > > > > not
> > > > > > found. Anyway, an example of failing expression is:
> > > > > > ognl:object[linkProperty]
> > > > > >
> > > > > > that now only works with:
> > > > > > ognl:object[#this.linkProperty]
> > > > > >
> > > > > > Without knowing anything about how compiled OGNL works, just
> > > following
> > > > > the
> > > > > > ExpressionEvaluatorImpl.java source I tried to make a test case
> > that
> > > > > > fails:
> > > > > >     public String getKey() {
> > > > > >         return "key";
> > > > > >     }
> > > > > >
> > > > > >     public void testEnhancedOgnl() throws Exception {
> > > > > >         map = new HashMap();
> > > > > >         map.put("key", "value");
> > > > > >         ClassResolver ognlResolver = new OgnlClassResolver();
> > > > > >         OgnlContext context =
> > > > > (OgnlContext)Ognl.createDefaultContext(this,
> > > > > > ognlResolver);
> > > > > >         Node expression = Ognl.compileExpression(context, map,
> > > "key");
> > > > > >         assertEquals(map.get("key"), Ognl.getValue(
> > > > > expression.getAccessor
> > > > > > (),
> > > > > > context, map)) ;
> > > > > >
> > > > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > > > ognlResolver);
> > > > > >         expression = Ognl.compileExpression(context, this,
> > > > > "#this[key]");
> > > > > >         assertEquals("key", Ognl.getValue(expression.getAccessor
> > (),
> > > > > > context,
> > > > > > this)) ;
> > > > > >
> > > > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > > > ognlResolver);
> > > > > >         expression = Ognl.compileExpression (context, this,
> > > > > "#this.key");
> > > > > >         assertEquals("key", Ognl.getValue(expression.getAccessor
> > (),
> > > > > > context,
> > > > > > this)) ;
> > > > > >
> > > > > >         // Fails
> > > > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > > > ognlResolver);
> > > > > >         expression = Ognl.compileExpression (context, this,
> > "key");
> > > > > >         assertEquals("key", Ognl.getValue(expression.getAccessor
> > (),
> > > > > > context,
> > > > > > this)) ;
> > > > > >     }
> > > > > >
> > > > > >
> > > > > > I might be way off here (like I said, I don't know anything
> > about it
> > > > > :),
> > > > > > but
> > > > > > the last assert fails (on CannotCompileException) even though to
> > me
> > > > > the
> > > > > > expression is equal to the two above it (the first one's just me
> > > > > figuring
> > > > > > out how it works).
> > > > > >
> > > > > > Since 2.7 is already released and I can see Jesse has even
> > tagged
> > > > > Tap4.1.2a
> > > > > > few hours ago, I was mostly looking for a quick explanation,
> > maybe a
> > > > > > better
> > > > > > workaround if possible. If this (pun intended) is the price to
> > pay
> > > for
> > > > >
> > > > > > faster OGNL, here's my check and huge thanks to Jesse for all
> > the
> > > hard
> > > > > > work!
> > > > > >
> > > > > > Kalle
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jesse Kuhnert
> > > > > Tapestry/Dojo team member/developer
> > > > >
> > > > > Open source based consulting work centered around
> > > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > > >
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
>
>

Re: OGNL 2.7 Must use #this

Posted by Kalle Korhonen <ka...@gmail.com>.
The unit test doesn't succeed for me (and neither does the real world
example, which is slightly different, but I assume the unit test would cover
for it). Well, if you say the unit test should pass now, I'll double-check I
have the right version and get back to you.

Kalle


On 7/2/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> That looks like the right one to me.   The code you provided in the test
> case was re-produced / fixed.  You did mention something about
> "object[linkProperty]" not working before you provided a code example but
> I'm assuming the code example was what was intended to be fixed....
>
> Does the same test case not work for you?
>
> On 7/2/07, Kalle Korhonen <ka...@gmail.com> wrote:
> >
> > Hey Jesse - saw you had marked
> > http://jira.opensymphony.com/browse/OGNL-97as resolved so I assumed
> > the fix might be in the latest snapshot
> > ognl-2.7.1-20070630.205921-4 posted later but there were no changes as
> far
> > as I could notice. Certainly don't want to sound impatient as you are
> > doing
> > superb job in fixing these, but how do I know in which snapshot the fix
> > might be?
> >
> > Kalle
> >
> >
> > On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> > >
> > > Thanks. I wasn't 100% how legitimate, but filed as
> > > http://jira.opensymphony.com/browse/OGNL-97
> > >
> > > Kalle
> > >
> > > On 6/26/07, Jesse Kuhnert <jk...@gmail.com> wrote:
> > > >
> > > > No time to look at this right now,  but if you file a jira report
> > here:
> > > >
> > > > http://jira.opensymphony.com/browse/OGNL
> > > >
> > > > it can be looked in to for the next 2.7.1 release.
> > > >
> > > > The forums are here:
> > > >
> > > > http://forums.opensymphony.com/category.jspa?categoryID=10
> > > >
> > > > (though I'm thinking of moving them to google groups as well)
> > > >
> > > > On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> > > > >
> > > > > Hi Jesse et al,
> > > > >
> > > > > while trying to migrate to Tap 4.1.2 we started getting lots of
> > > > > OgnlExceptions with message "source is null" from
> > > > OgnlRuntime.getProperty.
> > > > > The workaround was to add #this to a lot of places where we used
> > more
> > > > > complex OGNL expressions. I realize this is probably much more to
> do
> > > > with
> > > > > enhanced Ognl than Tapestry, so I would have taken the discussion
> to
> > > > ognl
> > > > > list, but subscribing to ognl-interest failed with
> > lists.ognl.orgdomain
> > > > > not
> > > > > found. Anyway, an example of failing expression is:
> > > > > ognl:object[linkProperty]
> > > > >
> > > > > that now only works with:
> > > > > ognl:object[#this.linkProperty]
> > > > >
> > > > > Without knowing anything about how compiled OGNL works, just
> > following
> > > > the
> > > > > ExpressionEvaluatorImpl.java source I tried to make a test case
> that
> > > > > fails:
> > > > >     public String getKey() {
> > > > >         return "key";
> > > > >     }
> > > > >
> > > > >     public void testEnhancedOgnl() throws Exception {
> > > > >         map = new HashMap();
> > > > >         map.put("key", "value");
> > > > >         ClassResolver ognlResolver = new OgnlClassResolver();
> > > > >         OgnlContext context =
> > > > (OgnlContext)Ognl.createDefaultContext(this,
> > > > > ognlResolver);
> > > > >         Node expression = Ognl.compileExpression(context, map,
> > "key");
> > > > >         assertEquals(map.get("key"), Ognl.getValue(
> > > > expression.getAccessor
> > > > > (),
> > > > > context, map)) ;
> > > > >
> > > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > > ognlResolver);
> > > > >         expression = Ognl.compileExpression(context, this,
> > > > "#this[key]");
> > > > >         assertEquals("key", Ognl.getValue(expression.getAccessor
> (),
> > > > > context,
> > > > > this)) ;
> > > > >
> > > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > > ognlResolver);
> > > > >         expression = Ognl.compileExpression (context, this,
> > > > "#this.key");
> > > > >         assertEquals("key", Ognl.getValue(expression.getAccessor
> (),
> > > > > context,
> > > > > this)) ;
> > > > >
> > > > >         // Fails
> > > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > > ognlResolver);
> > > > >         expression = Ognl.compileExpression(context, this, "key");
> > > > >         assertEquals("key", Ognl.getValue(expression.getAccessor
> (),
> > > > > context,
> > > > > this)) ;
> > > > >     }
> > > > >
> > > > >
> > > > > I might be way off here (like I said, I don't know anything about
> it
> > > > :),
> > > > > but
> > > > > the last assert fails (on CannotCompileException) even though to
> me
> > > > the
> > > > > expression is equal to the two above it (the first one's just me
> > > > figuring
> > > > > out how it works).
> > > > >
> > > > > Since 2.7 is already released and I can see Jesse has even tagged
> > > > Tap4.1.2a
> > > > > few hours ago, I was mostly looking for a quick explanation, maybe
> a
> > > > > better
> > > > > workaround if possible. If this (pun intended) is the price to pay
> > for
> > > >
> > > > > faster OGNL, here's my check and huge thanks to Jesse for all the
> > hard
> > > > > work!
> > > > >
> > > > > Kalle
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Jesse Kuhnert
> > > > Tapestry/Dojo team member/developer
> > > >
> > > > Open source based consulting work centered around
> > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > >
> > >
> > >
> >
>
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>

Re: OGNL 2.7 Must use #this

Posted by Jesse Kuhnert <jk...@gmail.com>.
That looks like the right one to me.   The code you provided in the test
case was re-produced / fixed.  You did mention something about
"object[linkProperty]" not working before you provided a code example but
I'm assuming the code example was what was intended to be fixed....

Does the same test case not work for you?

On 7/2/07, Kalle Korhonen <ka...@gmail.com> wrote:
>
> Hey Jesse - saw you had marked
> http://jira.opensymphony.com/browse/OGNL-97as resolved so I assumed
> the fix might be in the latest snapshot
> ognl-2.7.1-20070630.205921-4 posted later but there were no changes as far
> as I could notice. Certainly don't want to sound impatient as you are
> doing
> superb job in fixing these, but how do I know in which snapshot the fix
> might be?
>
> Kalle
>
>
> On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> >
> > Thanks. I wasn't 100% how legitimate, but filed as
> > http://jira.opensymphony.com/browse/OGNL-97
> >
> > Kalle
> >
> > On 6/26/07, Jesse Kuhnert <jk...@gmail.com> wrote:
> > >
> > > No time to look at this right now,  but if you file a jira report
> here:
> > >
> > > http://jira.opensymphony.com/browse/OGNL
> > >
> > > it can be looked in to for the next 2.7.1 release.
> > >
> > > The forums are here:
> > >
> > > http://forums.opensymphony.com/category.jspa?categoryID=10
> > >
> > > (though I'm thinking of moving them to google groups as well)
> > >
> > > On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> > > >
> > > > Hi Jesse et al,
> > > >
> > > > while trying to migrate to Tap 4.1.2 we started getting lots of
> > > > OgnlExceptions with message "source is null" from
> > > OgnlRuntime.getProperty.
> > > > The workaround was to add #this to a lot of places where we used
> more
> > > > complex OGNL expressions. I realize this is probably much more to do
> > > with
> > > > enhanced Ognl than Tapestry, so I would have taken the discussion to
> > > ognl
> > > > list, but subscribing to ognl-interest failed with
> lists.ognl.orgdomain
> > > > not
> > > > found. Anyway, an example of failing expression is:
> > > > ognl:object[linkProperty]
> > > >
> > > > that now only works with:
> > > > ognl:object[#this.linkProperty]
> > > >
> > > > Without knowing anything about how compiled OGNL works, just
> following
> > > the
> > > > ExpressionEvaluatorImpl.java source I tried to make a test case that
> > > > fails:
> > > >     public String getKey() {
> > > >         return "key";
> > > >     }
> > > >
> > > >     public void testEnhancedOgnl() throws Exception {
> > > >         map = new HashMap();
> > > >         map.put("key", "value");
> > > >         ClassResolver ognlResolver = new OgnlClassResolver();
> > > >         OgnlContext context =
> > > (OgnlContext)Ognl.createDefaultContext(this,
> > > > ognlResolver);
> > > >         Node expression = Ognl.compileExpression(context, map,
> "key");
> > > >         assertEquals(map.get("key"), Ognl.getValue(
> > > expression.getAccessor
> > > > (),
> > > > context, map)) ;
> > > >
> > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > ognlResolver);
> > > >         expression = Ognl.compileExpression(context, this,
> > > "#this[key]");
> > > >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > > > context,
> > > > this)) ;
> > > >
> > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > ognlResolver);
> > > >         expression = Ognl.compileExpression (context, this,
> > > "#this.key");
> > > >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > > > context,
> > > > this)) ;
> > > >
> > > >         // Fails
> > > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > > ognlResolver);
> > > >         expression = Ognl.compileExpression(context, this, "key");
> > > >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > > > context,
> > > > this)) ;
> > > >     }
> > > >
> > > >
> > > > I might be way off here (like I said, I don't know anything about it
> > > :),
> > > > but
> > > > the last assert fails (on CannotCompileException) even though to me
> > > the
> > > > expression is equal to the two above it (the first one's just me
> > > figuring
> > > > out how it works).
> > > >
> > > > Since 2.7 is already released and I can see Jesse has even tagged
> > > Tap4.1.2a
> > > > few hours ago, I was mostly looking for a quick explanation, maybe a
> > > > better
> > > > workaround if possible. If this (pun intended) is the price to pay
> for
> > >
> > > > faster OGNL, here's my check and huge thanks to Jesse for all the
> hard
> > > > work!
> > > >
> > > > Kalle
> > > >
> > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > >
> >
> >
>



-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Re: OGNL 2.7 Must use #this

Posted by Kalle Korhonen <ka...@gmail.com>.
Hey Jesse - saw you had marked
http://jira.opensymphony.com/browse/OGNL-97as resolved so I assumed
the fix might be in the latest snapshot
ognl-2.7.1-20070630.205921-4 posted later but there were no changes as far
as I could notice. Certainly don't want to sound impatient as you are doing
superb job in fixing these, but how do I know in which snapshot the fix
might be?

Kalle


On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
>
> Thanks. I wasn't 100% how legitimate, but filed as
> http://jira.opensymphony.com/browse/OGNL-97
>
> Kalle
>
> On 6/26/07, Jesse Kuhnert <jk...@gmail.com> wrote:
> >
> > No time to look at this right now,  but if you file a jira report here:
> >
> > http://jira.opensymphony.com/browse/OGNL
> >
> > it can be looked in to for the next 2.7.1 release.
> >
> > The forums are here:
> >
> > http://forums.opensymphony.com/category.jspa?categoryID=10
> >
> > (though I'm thinking of moving them to google groups as well)
> >
> > On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> > >
> > > Hi Jesse et al,
> > >
> > > while trying to migrate to Tap 4.1.2 we started getting lots of
> > > OgnlExceptions with message "source is null" from
> > OgnlRuntime.getProperty.
> > > The workaround was to add #this to a lot of places where we used more
> > > complex OGNL expressions. I realize this is probably much more to do
> > with
> > > enhanced Ognl than Tapestry, so I would have taken the discussion to
> > ognl
> > > list, but subscribing to ognl-interest failed with lists.ognl.orgdomain
> > > not
> > > found. Anyway, an example of failing expression is:
> > > ognl:object[linkProperty]
> > >
> > > that now only works with:
> > > ognl:object[#this.linkProperty]
> > >
> > > Without knowing anything about how compiled OGNL works, just following
> > the
> > > ExpressionEvaluatorImpl.java source I tried to make a test case that
> > > fails:
> > >     public String getKey() {
> > >         return "key";
> > >     }
> > >
> > >     public void testEnhancedOgnl() throws Exception {
> > >         map = new HashMap();
> > >         map.put("key", "value");
> > >         ClassResolver ognlResolver = new OgnlClassResolver();
> > >         OgnlContext context =
> > (OgnlContext)Ognl.createDefaultContext(this,
> > > ognlResolver);
> > >         Node expression = Ognl.compileExpression(context, map, "key");
> > >         assertEquals(map.get("key"), Ognl.getValue(
> > expression.getAccessor
> > > (),
> > > context, map)) ;
> > >
> > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > ognlResolver);
> > >         expression = Ognl.compileExpression(context, this,
> > "#this[key]");
> > >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > > context,
> > > this)) ;
> > >
> > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > ognlResolver);
> > >         expression = Ognl.compileExpression (context, this,
> > "#this.key");
> > >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > > context,
> > > this)) ;
> > >
> > >         // Fails
> > >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > > ognlResolver);
> > >         expression = Ognl.compileExpression(context, this, "key");
> > >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > > context,
> > > this)) ;
> > >     }
> > >
> > >
> > > I might be way off here (like I said, I don't know anything about it
> > :),
> > > but
> > > the last assert fails (on CannotCompileException) even though to me
> > the
> > > expression is equal to the two above it (the first one's just me
> > figuring
> > > out how it works).
> > >
> > > Since 2.7 is already released and I can see Jesse has even tagged
> > Tap4.1.2a
> > > few hours ago, I was mostly looking for a quick explanation, maybe a
> > > better
> > > workaround if possible. If this (pun intended) is the price to pay for
> >
> > > faster OGNL, here's my check and huge thanks to Jesse for all the hard
> > > work!
> > >
> > > Kalle
> > >
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
>
>

Re: OGNL 2.7 Must use #this

Posted by Kalle Korhonen <ka...@gmail.com>.
Thanks. I wasn't 100% how legitimate, but filed as
http://jira.opensymphony.com/browse/OGNL-97

Kalle

On 6/26/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> No time to look at this right now,  but if you file a jira report here:
>
> http://jira.opensymphony.com/browse/OGNL
>
> it can be looked in to for the next 2.7.1 release.
>
> The forums are here:
>
> http://forums.opensymphony.com/category.jspa?categoryID=10
>
> (though I'm thinking of moving them to google groups as well)
>
> On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
> >
> > Hi Jesse et al,
> >
> > while trying to migrate to Tap 4.1.2 we started getting lots of
> > OgnlExceptions with message "source is null" from
> OgnlRuntime.getProperty.
> > The workaround was to add #this to a lot of places where we used more
> > complex OGNL expressions. I realize this is probably much more to do
> with
> > enhanced Ognl than Tapestry, so I would have taken the discussion to
> ognl
> > list, but subscribing to ognl-interest failed with lists.ognl.org domain
> > not
> > found. Anyway, an example of failing expression is:
> > ognl:object[linkProperty]
> >
> > that now only works with:
> > ognl:object[#this.linkProperty]
> >
> > Without knowing anything about how compiled OGNL works, just following
> the
> > ExpressionEvaluatorImpl.java source I tried to make a test case that
> > fails:
> >     public String getKey() {
> >         return "key";
> >     }
> >
> >     public void testEnhancedOgnl() throws Exception {
> >         map = new HashMap();
> >         map.put("key", "value");
> >         ClassResolver ognlResolver = new OgnlClassResolver();
> >         OgnlContext context =
> (OgnlContext)Ognl.createDefaultContext(this,
> > ognlResolver);
> >         Node expression = Ognl.compileExpression(context, map, "key");
> >         assertEquals(map.get("key"), Ognl.getValue(
> expression.getAccessor
> > (),
> > context, map)) ;
> >
> >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > ognlResolver);
> >         expression = Ognl.compileExpression(context, this,
> "#this[key]");
> >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > context,
> > this)) ;
> >
> >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > ognlResolver);
> >         expression = Ognl.compileExpression(context, this, "#this.key");
> >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > context,
> > this)) ;
> >
> >         // Fails
> >         context = (OgnlContext)Ognl.createDefaultContext(this,
> > ognlResolver);
> >         expression = Ognl.compileExpression(context, this, "key");
> >         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> > context,
> > this)) ;
> >     }
> >
> >
> > I might be way off here (like I said, I don't know anything about it :),
> > but
> > the last assert fails (on CannotCompileException) even though to me the
> > expression is equal to the two above it (the first one's just me
> figuring
> > out how it works).
> >
> > Since 2.7 is already released and I can see Jesse has even tagged
> Tap4.1.2a
> > few hours ago, I was mostly looking for a quick explanation, maybe a
> > better
> > workaround if possible. If this (pun intended) is the price to pay for
> > faster OGNL, here's my check and huge thanks to Jesse for all the hard
> > work!
> >
> > Kalle
> >
>
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>

Re: OGNL 2.7 Must use #this

Posted by Jesse Kuhnert <jk...@gmail.com>.
No time to look at this right now,  but if you file a jira report here:

http://jira.opensymphony.com/browse/OGNL

it can be looked in to for the next 2.7.1 release.

The forums are here:

http://forums.opensymphony.com/category.jspa?categoryID=10

(though I'm thinking of moving them to google groups as well)

On 6/26/07, Kalle Korhonen <ka...@gmail.com> wrote:
>
> Hi Jesse et al,
>
> while trying to migrate to Tap 4.1.2 we started getting lots of
> OgnlExceptions with message "source is null" from OgnlRuntime.getProperty.
> The workaround was to add #this to a lot of places where we used more
> complex OGNL expressions. I realize this is probably much more to do with
> enhanced Ognl than Tapestry, so I would have taken the discussion to ognl
> list, but subscribing to ognl-interest failed with lists.ognl.org domain
> not
> found. Anyway, an example of failing expression is:
> ognl:object[linkProperty]
>
> that now only works with:
> ognl:object[#this.linkProperty]
>
> Without knowing anything about how compiled OGNL works, just following the
> ExpressionEvaluatorImpl.java source I tried to make a test case that
> fails:
>     public String getKey() {
>         return "key";
>     }
>
>     public void testEnhancedOgnl() throws Exception {
>         map = new HashMap();
>         map.put("key", "value");
>         ClassResolver ognlResolver = new OgnlClassResolver();
>         OgnlContext context = (OgnlContext)Ognl.createDefaultContext(this,
> ognlResolver);
>         Node expression = Ognl.compileExpression(context, map, "key");
>         assertEquals(map.get("key"), Ognl.getValue(expression.getAccessor
> (),
> context, map)) ;
>
>         context = (OgnlContext)Ognl.createDefaultContext(this,
> ognlResolver);
>         expression = Ognl.compileExpression(context, this, "#this[key]");
>         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> context,
> this)) ;
>
>         context = (OgnlContext)Ognl.createDefaultContext(this,
> ognlResolver);
>         expression = Ognl.compileExpression(context, this, "#this.key");
>         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> context,
> this)) ;
>
>         // Fails
>         context = (OgnlContext)Ognl.createDefaultContext(this,
> ognlResolver);
>         expression = Ognl.compileExpression(context, this, "key");
>         assertEquals("key", Ognl.getValue(expression.getAccessor(),
> context,
> this)) ;
>     }
>
>
> I might be way off here (like I said, I don't know anything about it :),
> but
> the last assert fails (on CannotCompileException) even though to me the
> expression is equal to the two above it (the first one's just me figuring
> out how it works).
>
> Since 2.7 is already released and I can see Jesse has even tagged Tap4.1.2a
> few hours ago, I was mostly looking for a quick explanation, maybe a
> better
> workaround if possible. If this (pun intended) is the price to pay for
> faster OGNL, here's my check and huge thanks to Jesse for all the hard
> work!
>
> Kalle
>



-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com