[jboss-svn-commits] JBL Code SVN: r25586 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 11 05:00:16 EDT 2009


Author: beve
Date: 2009-03-11 05:00:16 -0400 (Wed, 11 Mar 2009)
New Revision: 25586

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2461 "XMLHelper uses a single instance of SchemaFactory which is not thread safe."


Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java	2009-03-11 08:56:05 UTC (rev 25585)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java	2009-03-11 09:00:16 UTC (rev 25586)
@@ -60,10 +60,6 @@
      * The XML output factory.
      */
     private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance() ;
-    /**
-     * The schema factory.
-     */
-    private static final SchemaFactory SCHEMA_FACTORY = SchemaFactory.newInstance( "http://www.w3.org/2001/XMLSchema" );
 
     /**
      * Get the XML stream reader.
@@ -173,7 +169,7 @@
         throws SAXException
     {
         final InputStream resourceIS = ClassUtil.getResourceAsStream(resource, XMLHelper.class) ;
-        return SCHEMA_FACTORY.newSchema(new StreamSource(resourceIS)) ;
+        return newSchemaFactory().newSchema(new StreamSource(resourceIS)) ;
     }
     
     /**
@@ -192,7 +188,7 @@
             final InputStream resourceIS = ClassUtil.getResourceAsStream(resources[count], XMLHelper.class) ;
             sources[count] = new StreamSource(resourceIS) ;
         }
-        return SCHEMA_FACTORY.newSchema(sources) ;
+        return newSchemaFactory().newSchema(sources) ;
     }
     
     /**
@@ -210,11 +206,16 @@
             return true ;
         }
         catch (final IOException ioe) {} // fall through
-        catch (final SAXException saxe) {} // fall through
+        catch (final SAXException saxe)  {} // fall through
         
         return false ;
     }
 
+    private static SchemaFactory newSchemaFactory()
+    {
+        return SchemaFactory.newInstance( "http://www.w3.org/2001/XMLSchema" );
+    }
+
     /**
      * Create the XML input factory.
      * @return The XML input factory.




More information about the jboss-svn-commits mailing list