[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-commit] r2457 - jetty-wtp/trunk/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml

Author: jmcconnell
Date: 2010-10-29 18:48:35 -0400 (Fri, 29 Oct 2010)
New Revision: 2457

Modified:
   jetty-wtp/trunk/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java
Log:
couple of minor cleanups

Modified: jetty-wtp/trunk/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java
===================================================================
--- jetty-wtp/trunk/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java	2010-10-29 22:41:07 UTC (rev 2456)
+++ jetty-wtp/trunk/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java	2010-10-29 22:48:35 UTC (rev 2457)
@@ -55,39 +55,37 @@
 
     public static DocumentBuilder getDocumentBuilder()
     {
-        synchronized (documentBuilder)
-        {
-            if (documentBuilder == null)
+        if (documentBuilder == null)
+            try
+            {
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setValidating(false);
+                factory.setNamespaceAware(false);
+                factory.setExpandEntityReferences(false);
+                // In case we happen to have a Xerces parser, try to set the feature that allows Java encodings to be used
                 try
                 {
-                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-                    factory.setValidating(false);
-                    factory.setNamespaceAware(false);
-                    factory.setExpandEntityReferences(false);
-                    // In case we happen to have a Xerces parser, try to set the feature that allows Java encodings to be used
-                    try
-                    {
-                        factory.setFeature("http://apache.org/xml/features/allow-java-encodings",true);
-                    }
-                    catch (ParserConfigurationException e)
-                    {
-                        // Ignore if feature isn't supported
-                    }
-                    // factory.setAttribute("http://apache.org/xml/features/nonvalidating/load-external-dtd";, new Boolean(false));
-                    documentBuilder = factory.newDocumentBuilder();
-                    documentBuilder.setEntityResolver(new EntityResolver()
-                    {
-                        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
-                        {
-                            return new InputSource(new ByteArrayInputStream(new byte[0]));
-                        }
-                    });
+                    factory.setFeature("http://apache.org/xml/features/allow-java-encodings",true);
                 }
-                catch (Exception e)
+                catch (ParserConfigurationException e)
                 {
-                    Trace.trace(Trace.SEVERE,"Error creating document builder");
+                    // Ignore if feature isn't supported
                 }
-        }
+                // factory.setAttribute("http://apache.org/xml/features/nonvalidating/load-external-dtd";, new Boolean(false));
+                documentBuilder = factory.newDocumentBuilder();
+                documentBuilder.setEntityResolver(new EntityResolver()
+                {
+                    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
+                    {
+                        return new InputSource(new ByteArrayInputStream(new byte[0]));
+                    }
+                });
+            }
+            catch (Exception e)
+            {
+                Trace.trace(Trace.SEVERE,"Error creating document builder");
+            }
+
         return documentBuilder;
     }