commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject RE: [JXPath] Accessing and setting multidimensional arrays
Date Thu, 09 Jan 2003 19:28:33 GMT
Francois,

I tried to reproduce the problem, but with no luck.  The only way I
managed to get that exception thrown was when I specified an element of
the matrix that did not actually exist.  For example if the matrix was
[1,1] and I attempted to set the element [2,2], I got that exception.
(The verbiage of the exception could use some improvement, of course).

Could it be that you too are trying to set a non-existent element of
the matrix?

- Dmitri

--- Francois Swiegers <FSwiegers@RUBICO.COM> wrote:
> I used the nightly build from the 5th (commons-jxpath-20030105.zip)
> 
> Thanks for the help.
> 
> -----Original Message-----
> From: Dmitri Plotnikov [mailto:dplotnik@yahoo.com]
> Sent: Thursday, January 09, 2003 6:18 PM
> To: Jakarta Commons Users List
> Subject: Re: [JXPath] Accessing and setting multidimensional arrays
> 
> 
> This is supposed to work.  I have a JUnit test,
> MixedModelTest.testListList(), that has almost exactly your case.  I
> should really add a test that covers multidimensional arrays
> explicitly.  Will do. 
> 
> Are you using the nightly build? Tell me exactly what build you are
> using.
> 
> - Dmitri
> 
> --- Francois Swiegers <FSwiegers@RUBICO.COM> wrote:
> > How do you access and modify properties that are multidimensional
> > arrays
> > using JXPath?
> > 
> > Here is my bean:
> > 
> > public Person {
> > public int[][] getMatrix();
> > public void setMatrix(int[][] matrix);
> > }
> > 
> > To access the value of an element [x,y] in the array, I use:
> > 
> > ctx.getValue("person/matrix[x]/.[y]");
> > 
> > This works fine, but is there a better way of doing it?
> > 
> > How can I set the value of element in the Bean?
> > 
> > ctx.setValue("person/matrix[x]/.[y]", "10");
> > 
> > causes:
> > 
> >      [java] org.apache.commons.jxpath.JXPathException: Exception
> > trying to
> > set value with xpath person/matrix[4]/.[1]; Cannot setValue of an
> > object
> > that is not some other object's property
> >      [java] 	at
> >
>
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathConte
> > xtReferenceImpl.java:318)
> >      [java] 	at
> >
>
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathConte
> > xtReferenceImpl.java:309)
> > 
> > Any help/suggestions would be greatly appreciated.
> > 
> > Francois Swiegers
> > CONFIDENTIALITY NOTICE
> > This e-mail message (and attachments) contains confidential
> > information
> > intended only for the person/s to whom it is addressed. It is
> subject
> > to
> > legal privilege and any copying or unauthorised disclosure of the
> > contents
> > other than to the addressee is prohibited. If you have received
> this
> > e-mail
> > in error please notify us by telephone and erase all copies of the
> > message
> > and attachments. Thank you for your assistance.
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:commons-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-user-help@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-user-help@jakarta.apache.org>
> CONFIDENTIALITY NOTICE
> This e-mail message (and attachments) contains confidential
> information
> intended only for the person/s to whom it is addressed. It is subject
> to
> legal privilege and any copying or unauthorised disclosure of the
> contents
> other than to the addressee is prohibited. If you have received this
> e-mail
> in error please notify us by telephone and erase all copies of the
> message
> and attachments. Thank you for your assistance.
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-user-help@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Mime
View raw message