commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dmi...@apache.org>
Subject Re: [jxpath] setValue calling getValue
Date Fri, 08 Nov 2002 23:28:26 GMT
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: <Ext-Mike.Hogan@nokia.com>
To: <commons-dev@jakarta.apache.org>; <dmitri@apache.org>
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:dplotnik@yahoo.com]
> 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
>
> --- Ext-Mike.Hogan@nokia.com 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:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-dev-help@jakarta.apache.org>
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> U2 on LAUNCH - Exclusive greatest hits videos
> http://launch.yahoo.com/u2
>
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
>
>

--
To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>





--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message