commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <dmi...@apache.org>
Subject Re: [JXPath] Re: JXPath and JAXB [infinite loop in // iterators]
Date Sun, 24 Aug 2003 01:28:59 GMT
I am so mad at myself.  It took me the longest time ever to get around to
solving this "mystery".  Grrr..

Sorry, Richard, and especially sorry, Jerome - I made you wait much too
long.

In the end, the fix was literally a one-liner:

  +++ JXPathIntrospector.java 24 Aug 2003 01:15:28 -0000 1.7
  @@ -78,6 +78,7 @@
       private static HashMap byInterface = new HashMap();

       static {
  +        registerAtomicClass(Class.class);
           registerAtomicClass(Boolean.TYPE);

Here's the explanation.  What we all thought was an infinite loop in JXPath
was not.  In fact it was simply a really really really long loop. Some
JAXB-generated classes have a property of type java.lang.Class.  Up until
now, JXPath would treat an object of class Class as if were a Java bean.  Of
course, Class has several properties: declaredMethods, interfaces etc.  All
of those have properties of their own, some of them of type Class.  So
JXPath would spend tremendous amounts of time traversing a significant
portion of the JVM before it even started doing something meaningful.

Anyway, with that fix your example, Richard, seems to be working fine.

Again, sorry about the delay.

- Dmitri

----- Original Message ----- 
From: <richard_barnett@mlc.com.au>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Thursday, August 21, 2003 8:19 PM
Subject: Re: [JXPath] Re: JXPath and JAXB [infinite loop in // iterators]







Dmitri --

Here's a zip of the source & class files for my test.  Let me know if it
doesn't work or if I've left anything unclear.

I've been (halfheartedly) trying to trace through the operation of the
iterator, but it's a little bit mindbending :-/

When I've broken into the "infinite loop" in the debugger, it's been
introspecting the URLs in a ClassLoader :-(

I'm not sure whether it's relevant, but the JAXB-generated classes have
methods getPrimaryInterface() & getPrimaryInterfaceClass() [both returning
Class] which look like bean properties to JXPathBasicBeanInfo.

However, since some //-based iterations on my test object work, it must be
more complex than this.

I wish there was some tracing I could turn on :-(

(See attached file: dmitri.zip)





Dmitri Plotnikov <dplotnik@yahoo.com> on 22/08/2003 00:32:04

Please respond to "Jakarta Commons Users List"
       <commons-user@jakarta.apache.org>

To:    Jakarta Commons Users List <commons-user@jakarta.apache.org>
cc:

Subject:    Re: [JXPath] Re: JXPath and JAXB [infinite loop in //
       iterators]


Richard,

Thank you very much for the offer.  I've been completely swamped
lately.
Please send me that source code. I'll try to find a couple of hours
this weekend to look into this problem.

Thanks again,

- Dmitri

--- richard_barnett@mlc.com.au wrote:
>
>
>
>
> On 2003-06-18 Dmitri Plotnikov <dplotnik () yahoo ! com> wrote:
>
> > --- Steve Pannier <Steve_Pannier.CST () jacada ! com> wrote:
> >
> > > I don't know if this will help, but I experienced a similar
> problem
> > > (OutOfMemoryError) a few months back.  I wasn't using JXPath
> > > with JAXB-generated classes, but I was using the "//" pattern.
> > > See the thread titled "[JXPath] Infinite loop in
> iterator.hasNext()"
> > > in the Commons User mailing list archives.  The problem was
> > > due to the way JXPath uses introspection.  To resolve it, I ended
> > > up creating a custom BeanInfo for the class that had an
> > > introspection problem.
> >
> > The thing is that JXPath is supposed to have some protection
> against an
> > infinite loop caused by "//". So, rather than patching it for
> > particular situations, help me fully research what's wrong and fix
> or
> > re-fix it.
> >
> > Jérôme, could you give some more details, perhaps even the
> generated
> > classes and xpaths that fail - I'll try to investigate the issue
> very
> > quickly.
>
> I've just hit what seems to be the same problem (in 1.1 & the
> 20030820 nightly build)
> & can reproduce it using a trivial JAXB object.
>
> Dmitri, if you haven't already fixed this I can send you a zip of the
> sources & classes
> which reproduce this, and/or do a bit of debugging.
>
> -- Richard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org







----------------------------------------------------------------------------
----


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


Mime
View raw message