Mike, I recently made some changes in JXPath that at least in some cases eliminate the need for setValue to call getValue. When you have a chance, could you try and let me know if the unwanted calls disappeared? You should expect paths like "/foo/bar" to stop getting "bar" before setting it, however in the case of "//bar" will still invoke getBar() because it needs to know its length and internal contents.
Thanks, - Dmitri --- Dmitri Plotnikov <[EMAIL PROTECTED]> wrote: > You are right, I looked again and sure enough I'd forgotten that it > does > call getValue(). Actually, changing that would be quite a challenge > because > of some internal logic of the interpretSimpleLocationPath method. > The code > is written in a generic fashion to accomodate cases like > Container-valued > properties, which need to be open unconditionally. I'll see what I > can do, > but I cannot promise a quick fix. > > How critical is it that the get method throw an exception? Can it > simply > return null? > > - Dmitri > > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, November 08, 2002 4:08 PM > Subject: RE: [jxpath] setValue calling getValue > > > Hi Dmitri, > > I retried with the the version at the URL you sent. Different stack > trace, > but the field still gets read. > > java.lang.Exception > at > com.nokia.b2t.dna.graphmap.MockDomainObject.getStringField(MockDomainObject. > java:51) > at java.lang.reflect.Method.invoke(Native Method) > at > org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:287) > at > org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(Be > anPropertyPointer.java:155) > at > org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getNode(BeanPro > pertyPointer.java:179) > at > org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getValuePointer(Pro > pertyPointer.java:168) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.valuePointer(SimpleP > athInterpreter.java:675) > at > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.interpretSimpleLocat > ionPath(SimplePathInterpreter.java:114) > at > org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path > .java:172) > at > org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath > .java:137) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathConte > xtReferenceImpl.java:363) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPathAndSetValu > e(JXPathContextReferenceImpl.java:354) > at > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPathAndSetValu > e(JXPathContextReferenceImpl.java:349) > at > com.nokia.b2t.dna.graphmap.ObjectGraphMapper.performMapping(ObjectGraphMappe > r.java:92) > at > com.nokia.b2t.dna.graphmap.ObjectGraphMapper.toDomainGraph(ObjectGraphMapper > .java:57) > at > com.nokia.b2t.dna.graphmap.ObjectGraphMapperJUnitTest.main(ObjectGraphMapper > JUnitTest.java:136) > > > -----Original Message----- > > From: ext Dmitri Plotnikov [mailto:[EMAIL PROTECTED]] > > Sent: 08. November 2002 19:53 > > To: Jakarta Commons Developers List > > Subject: Re: [jxpath] setValue calling getValue > > > > > > Mike, > > > > You are right, it really should not do that. > > > > The line numbers in the stack trace indicate that you are using a > > pretty old version of jxpath. Could you upgrade to the current > version > > and let me know if the problem persists? > > > > The binary download is available at > > www.plotnix.com/jxpath/commons-jxpath.zip > > > > Thank you, > > > > - Dmitri > > > > --- [EMAIL PROTECTED] wrote: > > > Hi, > > > > > > When JXPath is setting a property, it first gets the > > properties value > > > (computeValue()). I have an throwing an exception in the getter > > > method in my class to show the stack trace, below. > > > > > > Why does JXPath read the value before setting it, and is there > any > > > way to avoid it? > > > > > > Thanks, > > > Mike. > > > > > > java.lang.Exception: Reading field > > > at > > > > > com.nokia.b2t.dna.graphmap.MockDomainObject$MockNestedDomainOb > > ject.getStringField(MockDomainObject.java:76) > > > at java.lang.reflect.Method.invoke(Native Method) > > > at > > > > > org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils. > > java:287) > > > at > > > > > org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.g > > etNodeValue(BeanPropertyPointer.java:187) > > > at > > > > > org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getVa > > luePointer(PropertyPointer.java:152) > > > at > > > > > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.single > > Step(SimplePathInterpreter.java:246) > > > at > > > > > org.apache.commons.jxpath.ri.axes.SimplePathInterpreter.interp > > retPath(SimplePathInterpreter.java:119) > > > at > > > > > org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointe > > rForSteps(Path.java:162) > > > at > > > > > org.apache.commons.jxpath.ri.compiler.LocationPath.computeValu > > e(LocationPath.java:137) > > > at > > > > > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setVal > > ue(JXPathContextReferenceImpl.java:329) > > > at > > > > > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.create > > PathAndSetValue(JXPathContextReferenceImpl.java:320) > > > at > > > > > org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.create > > PathAndSetValue(JXPathContextReferenceImpl.java:315) > > > at > > > > > com.nokia.b2t.dna.graphmap.ObjectGraphMapper.performMapping(Ob > > jectGraphMapper.java:88) > > > at > > > > > com.nokia.b2t.dna.graphmap.ObjectGraphMapper.toDomainGraph(Obj > > ectGraphMapper.java:57) > > > at > > > > > com.nokia.b2t.dna.graphmap.ObjectGraphMapperJUnitTest.main(Obj > > ectGraphMapperJUnitTest.java:122) > > > > > > -- > > > To unsubscribe, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > For additional commands, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > __________________________________________________ > > Do you Yahoo!? > > U2 on LAUNCH - Exclusive greatest hits videos > > http://launch.yahoo.com/u2 > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > === message truncated === __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>