--- On Sat, 1/30/10, Adrian Crum <adrian.c...@yahoo.com> wrote: > From: Adrian Crum <adrian.c...@yahoo.com> > Subject: Re: svn commit: r904921 - in > /ofbiz/trunk/framework/base/src/org/ofbiz/base: test/BaseUnitTests.java > util/string/UelUtil.java > To: dev@ofbiz.apache.org > Date: Saturday, January 30, 2010, 4:45 PM > --- On Sat, 1/30/10, Adam Heath > <doo...@brainfood.com> > wrote: > > Subject: Re: svn commit: r904921 - in > /ofbiz/trunk/framework/base/src/org/ofbiz/base: > test/BaseUnitTests.java util/string/UelUtil.java > > To: dev@ofbiz.apache.org > > Date: Saturday, January 30, 2010, 4:36 PM > > adri...@apache.org > > wrote: > > > Author: adrianc > > > Date: Sun Jan 31 00:08:14 2010 > > > New Revision: 904921 > > > > > > URL: http://svn.apache.org/viewvc?rev=904921&view=rev > > > Log: > > > Some changes to the UEL integration. While > attempting > > to upgrade the JUEL library, some flaws in my original > code > > were exposed. This commit fixes them. Also, I added > some > > more unit tests. > > > > I would have split this commit into several. > > > > > Modified: > > > ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java > > > URL: > > > http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java?rev=904921&r1=904920&r2=904921&view=diff > > > > > > ============================================================================== > > > --- > > > ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java > > (original) > > > +++ > > > ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java > > Sun Jan 31 00:08:14 2010 > > > @@ -120,9 +120,11 @@ > > > } > > > > > > protected static class > > BasicContext extends ELContext { > > > + protected final > > Map<String, Object> variables; > > > protected final > > VariableMapper variableMapper; > > > public > > BasicContext(Map<String, ? extends Object> > context) { > > > - > > this.variableMapper = new > BasicVariableMapper(context, > > this); > > > + > > this.variableMapper = new BasicVariableMapper(this); > > > + > > this.variables = UtilGenerics.cast(context); > > > > This is wrong. You've converted a read only map to > a > > writable one. > > The syntax on context means that BasicContext doesn't > > insert new > > items, nor replace any items in context. > > > > If you really need to modify variable, then change > the > > generics markup > > on context. > > I appreciate the review and comments, but I think you're > not understanding the integration. I can't change the method > signature because it is part of the JSR 245 specification, > and yes, I really need to write to the context because that > is the whole point of the integration.
Umm.. err.. what I meant to say was, I have to accept the read-only Map provided by the framework and write to it. The method signatures are actually my own, and I was just passing the Map along the same way I got it.