Richard,

TestXMLUtils has a reference to initDOMFactory. Can you please clean it up as you 
think fit? Did
you  run "all-tests"?

Thanks,
dims

--- [EMAIL PROTECTED] wrote:
> rsitze      2002/06/13 06:33:04
> 
>   Modified:    java/src/org/apache/axis/utils XMLUtils.java
>   Log:
>   Patch supplied by Takashi Okamoto to correct thread unsafe
>   access to DocumentationBuilderFactory.
>   
>   Eliminate (redundant!) side-effect in initDOMFactory,
>   rename to getDOMFactory, and make private.
>   
>   Revision  Changes    Path
>   1.52      +12 -5     xml-axis/java/src/org/apache/axis/utils/XMLUtils.java
>   
>   Index: XMLUtils.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/XMLUtils.java,v
>   retrieving revision 1.51
>   retrieving revision 1.52
>   diff -u -r1.51 -r1.52
>   --- XMLUtils.java   12 Jun 2002 18:45:58 -0000      1.51
>   +++ XMLUtils.java   13 Jun 2002 13:33:04 -0000      1.52
>   @@ -93,7 +93,7 @@
>            
>        public static final String charEncoding = "ISO-8859-1";
>    
>   -    private static DocumentBuilderFactory dbf = initDOMFactory();
>   +    private static DocumentBuilderFactory dbf = getDOMFactory();
>        private static SAXParserFactory       saxFactory;
>        private static Stack                  saxParsers = new Stack();
>    
>   @@ -171,17 +171,19 @@
>            saxFactory.setValidating(validating);
>        }
>    
>   -    public static DocumentBuilderFactory initDOMFactory() {
>   +    private static DocumentBuilderFactory getDOMFactory() {
>   +        DocumentBuilderFactory dbf;
>            try {
>                dbf = DocumentBuilderFactory.newInstance();
>                dbf.setNamespaceAware(true);
>            }
>            catch( Exception e ) {
>                log.error(JavaUtils.getMessage("exception00"), e );
>   +            dbf = null;
>            }
>            return( dbf );
>        }
>   -
>   +    
>        private static boolean tryReset= true;
>    
>        /** Get a SAX parser instance from the JAXP factory.
>   @@ -231,7 +233,9 @@
>    
>        public static Document newDocument() {
>            try {
>   -            return dbf.newDocumentBuilder().newDocument();
>   +            synchronized (dbf) {
>   +                return dbf.newDocumentBuilder().newDocument();
>   +            }
>            } catch (Exception e) {
>                return null;
>            }
>   @@ -239,7 +243,10 @@
>    
>        public static Document newDocument(InputSource inp) {
>            try {
>   -            DocumentBuilder db = dbf.newDocumentBuilder();
>   +            DocumentBuilder db;
>   +            synchronized (dbf) {
>   +                db = dbf.newDocumentBuilder();
>   +            }
>                db.setErrorHandler( new ParserErrorHandler() );
>                return( db.parse( inp ) );
>            }
>   
>   
>   


=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Reply via email to