The issue I think is not that it fails multi threading environment in NodeList because the way it does the caching.
If no one is changing any value of the DOM object and only reads from it then setting the following should work in NodeList implementation.
docBuilderFactory.setAttribute(http://apache.org/xml/features/dom/defer-node-expansion, Boolean.FALSE)
But it does not work because the NullPointerException is noting to do with the multi threaded access but it is due to the way it does the caching. Now in the Node implementation when we use getFirstChild and getNextSibling, it is not doing any caching and resolved the issue. I still think that NodeList should not give a null pointer exception because that is not desirable in any enterprise architecture where multi threading and performance have no alternative.
Please let me know if I am wrong in my analysis.
Thanks,
Soumya Chatterjee
Tata Consultancy Services
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
Michael Glavassevich <[EMAIL PROTECTED]>
07/26/2007 09:51 AST |
To |
j-users@xerces.apache.org |
cc |
Soumya Chatterjee <[EMAIL PROTECTED]> | |
bcc |
||
Subject |
Re: Got the Issue | |
Prashant Reddy <[EMAIL PROTECTED]> wrote on 07/26/2007 02:19:05 AM:
> Like someone else suggested earlier have you tried turning off the
> Defered node expansion to see if you still face any problems ?
>
>
> Try :
> docBuilderFactory.setAttribute("http://apache.
> org/xml/features/dom/defer-node-expansion", Boolean.FALSE);
>
> Be adviced that turning this feature off will mean your code (even if it
> works) will have a semantic-lock in to behavior of Xerces XML parser.
If you're relying on certain DOM operations being thread-safe you've
already locked yourself in, perhaps to a specific version of Xerces. Your
code may not work with other DOM implementations and there's no guarantee
that it will work with future releases of Xerces (even the next bug fix
release).
> > http://issues.apache.org/bugzilla/show_bug.cgi?id=27687
>
> I am not sure fixing the parser to become thread-safe when it is already
> declared to be not a goal is such a good idea. Besides there may be
> other places in the xerces code where assumption of no concurrent access
> may be made.
Indeed there are. At the risk of encouraging folks to write more brittle
code I won't list them here.
> -Prashant
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
ForwardSourceID:NT00020E1A
=====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you